From fcb1e119e7db76fda32694ec4f71baaf000c08f3 Mon Sep 17 00:00:00 2001 From: maskpp Date: Mon, 25 Nov 2024 12:28:28 +0800 Subject: [PATCH 1/4] fix ci --- go.mod | 2 +- packages/eventindexer/pkg/repo/containers_test.go | 9 ++++----- packages/eventindexer/pkg/repo/erc20_balance_test.go | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index ab4e68d6a34..e1184230d4e 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,7 @@ require ( github.com/go-resty/resty/v2 v2.16.2 github.com/gomarkdown/markdown v0.0.0-20231222211730-1d6d20845b47 github.com/google/uuid v1.6.0 + github.com/gorilla/websocket v1.5.3 github.com/joho/godotenv v1.5.1 github.com/labstack/echo-contrib v0.17.1 github.com/labstack/echo/v4 v4.12.0 @@ -119,7 +120,6 @@ require ( github.com/google/gofuzz v1.2.1-0.20220503160820-4a35382e8fc8 // indirect github.com/gorilla/css v1.0.0 // indirect github.com/gorilla/mux v1.8.1 // indirect - github.com/gorilla/websocket v1.5.3 // indirect github.com/hashicorp/go-bexpr v0.1.11 // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/yamux v0.1.1 // indirect diff --git a/packages/eventindexer/pkg/repo/containers_test.go b/packages/eventindexer/pkg/repo/containers_test.go index 616148e7eee..7fd28bf6f77 100644 --- a/packages/eventindexer/pkg/repo/containers_test.go +++ b/packages/eventindexer/pkg/repo/containers_test.go @@ -23,8 +23,8 @@ var ( func testMysql(t *testing.T) (db.DB, func(), error) { req := testcontainers.ContainerRequest{ - Image: "mysql:8.0.33", - ExposedPorts: []string{"3306/tcp", "33060/tcp"}, + Image: "mysql:latest", + ExposedPorts: []string{"3306/tcp"}, Env: map[string]string{ "MYSQL_ROOT_PASSWORD": dbPassword, "MYSQL_DATABASE": dbName, @@ -51,11 +51,10 @@ func testMysql(t *testing.T) (db.DB, func(), error) { } host, _ := mysqlC.Host(ctx) - p, _ := mysqlC.MappedPort(ctx, "3306/tcp") - port := p.Int() + port, _ := mysqlC.MappedPort(ctx, "3306/tcp") dsn := fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?tls=skip-verify&parseTime=true&multiStatements=true", - dbUsername, dbPassword, host, port, dbName) + dbUsername, dbPassword, host, port.Int(), dbName) gormDB, err := gorm.Open(mysql.Open(dsn), &gorm.Config{ Logger: logger.Default.LogMode(logger.Silent), diff --git a/packages/eventindexer/pkg/repo/erc20_balance_test.go b/packages/eventindexer/pkg/repo/erc20_balance_test.go index dd07a8a95e2..4a41f291dea 100644 --- a/packages/eventindexer/pkg/repo/erc20_balance_test.go +++ b/packages/eventindexer/pkg/repo/erc20_balance_test.go @@ -2,6 +2,7 @@ package repo import ( "context" + "errors" "net/http" "testing" @@ -31,7 +32,7 @@ func Test_NewERC20BalanceRepo(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { _, err := NewERC20BalanceRepository(tt.db) - if err != tt.wantErr { + if !errors.Is(err, tt.wantErr) { t.Errorf("NewERC20BalanceRepository() error = %v, wantErr %v", err, tt.wantErr) return } From 730303f383fc817211b62a69521f84b4043379ab Mon Sep 17 00:00:00 2001 From: maskpp Date: Mon, 25 Nov 2024 12:28:28 +0800 Subject: [PATCH 2/4] fix ci --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e27049140ef..106561266b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG PACKAGE=eventindexer -FROM golang:1.23.0 as builder +FROM golang:1.23.0 AS builder ARG PACKAGE From a19a6e5d01fa8f61a331c2fbc3ac9a82a8e095c2 Mon Sep 17 00:00:00 2001 From: maskpp Date: Mon, 25 Nov 2024 13:29:52 +0800 Subject: [PATCH 3/4] fix integration test --- packages/taiko-client/pkg/rpc/methods.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/taiko-client/pkg/rpc/methods.go b/packages/taiko-client/pkg/rpc/methods.go index 35a96b6f2ba..914bc3cd44d 100644 --- a/packages/taiko-client/pkg/rpc/methods.go +++ b/packages/taiko-client/pkg/rpc/methods.go @@ -323,6 +323,9 @@ func (c *Client) CalculateBaseFee( return nil, fmt.Errorf("failed to fetch parent gas excess: %w", err) } } + if currentTimestamp < l2Head.Time { + currentTimestamp = l2Head.Time + 1 + } baseFeeInfo, err = c.TaikoL2.CalculateBaseFee( &bind.CallOpts{BlockNumber: l2Head.Number, Context: ctx}, *baseFeeConfig, From 7af58ae3ccd3331dc9c2aaf4e04af2992fbdcd99 Mon Sep 17 00:00:00 2001 From: maskpp Date: Mon, 25 Nov 2024 15:00:33 +0800 Subject: [PATCH 4/4] fix integration test --- packages/taiko-client/pkg/rpc/methods.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/taiko-client/pkg/rpc/methods.go b/packages/taiko-client/pkg/rpc/methods.go index 914bc3cd44d..e605a320006 100644 --- a/packages/taiko-client/pkg/rpc/methods.go +++ b/packages/taiko-client/pkg/rpc/methods.go @@ -323,6 +323,8 @@ func (c *Client) CalculateBaseFee( return nil, fmt.Errorf("failed to fetch parent gas excess: %w", err) } } + // The time of l1Head should always be greater than that of l2Head. + // Since the block.Time after anvil rollback is smaller than the original one, the timestamp has to be modified here. if currentTimestamp < l2Head.Time { currentTimestamp = l2Head.Time + 1 }