From ab8dda8b3b6aa022226f8793161061f329accc42 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Tue, 22 Oct 2024 15:35:25 -0700 Subject: [PATCH] lint fix --- contrib/rpcimportable/go.mod | 5 +++++ pkg/proofs/ethereum/proof.go | 6 +++--- rpc/backend/backend.go | 2 +- rpc/backend/chain_info.go | 2 +- rpc/namespaces/ethereum/eth/api.go | 2 +- server/json_rpc.go | 7 +++---- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/contrib/rpcimportable/go.mod b/contrib/rpcimportable/go.mod index 32fe6d9e3d..044f51ae8a 100644 --- a/contrib/rpcimportable/go.mod +++ b/contrib/rpcimportable/go.mod @@ -11,5 +11,10 @@ replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) +// go-ethereum fork must be used as it removes incompatible pebbledb version +replace ( + github.com/ethereum/go-ethereum => github.com/zeta-chain/go-ethereum v1.13.16-0.20241022183758-422c6ef93ccc +) + // uncomment this for local development/testing/debugging // replace github.com/zeta-chain/node => ../.. \ No newline at end of file diff --git a/pkg/proofs/ethereum/proof.go b/pkg/proofs/ethereum/proof.go index 4f90a0984b..96a31a1957 100644 --- a/pkg/proofs/ethereum/proof.go +++ b/pkg/proofs/ethereum/proof.go @@ -159,18 +159,18 @@ func NewTrie(list types.DerivableList) Trie { // #nosec G115 iterator indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(i)) value := encodeForDerive(list, i, valueBuf) - hasher.Update(indexBuf, value) + _ = hasher.Update(indexBuf, value) } if list.Len() > 0 { indexBuf = rlp.AppendUint64(indexBuf[:0], 0) value := encodeForDerive(list, 0, valueBuf) - hasher.Update(indexBuf, value) + _ = hasher.Update(indexBuf, value) } for i := 0x80; i < list.Len(); i++ { // #nosec G115 iterator indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(i)) value := encodeForDerive(list, i, valueBuf) - hasher.Update(indexBuf, value) + _ = hasher.Update(indexBuf, value) } return Trie{hasher} } diff --git a/rpc/backend/backend.go b/rpc/backend/backend.go index 2d619944ce..06252a90c8 100644 --- a/rpc/backend/backend.go +++ b/rpc/backend/backend.go @@ -28,6 +28,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/common/math" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" @@ -35,7 +36,6 @@ import ( ethermint "github.com/zeta-chain/ethermint/types" evmtypes "github.com/zeta-chain/ethermint/x/evm/types" - "github.com/ethereum/go-ethereum/common/math" rpctypes "github.com/zeta-chain/node/rpc/types" "github.com/zeta-chain/node/server/config" ) diff --git a/rpc/backend/chain_info.go b/rpc/backend/chain_info.go index 97b1ae5538..6945cf0e28 100644 --- a/rpc/backend/chain_info.go +++ b/rpc/backend/chain_info.go @@ -25,6 +25,7 @@ import ( tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common/hexutil" + ethmath "github.com/ethereum/go-ethereum/common/math" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" @@ -33,7 +34,6 @@ import ( evmtypes "github.com/zeta-chain/ethermint/x/evm/types" feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types" - ethmath "github.com/ethereum/go-ethereum/common/math" rpctypes "github.com/zeta-chain/node/rpc/types" ) diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index 7c424ed73a..1bd68e5bed 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -21,12 +21,12 @@ import ( "github.com/cometbft/cometbft/libs/log" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + ethmath "github.com/ethereum/go-ethereum/common/math" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rpc" ethermint "github.com/zeta-chain/ethermint/types" evmtypes "github.com/zeta-chain/ethermint/x/evm/types" - ethmath "github.com/ethereum/go-ethereum/common/math" "github.com/zeta-chain/node/rpc/backend" rpctypes "github.com/zeta-chain/node/rpc/types" ) diff --git a/server/json_rpc.go b/server/json_rpc.go index 2f39ad15e2..9b780017b2 100644 --- a/server/json_rpc.go +++ b/server/json_rpc.go @@ -20,8 +20,6 @@ import ( "net/http" "time" - "golang.org/x/exp/slog" - tmlog "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" @@ -31,6 +29,7 @@ import ( "github.com/gorilla/mux" "github.com/rs/cors" ethermint "github.com/zeta-chain/ethermint/types" + "golang.org/x/exp/slog" "github.com/zeta-chain/node/rpc" "github.com/zeta-chain/node/server/config" @@ -45,7 +44,7 @@ func (g *gethLogsToTm) Enabled(_ context.Context, _ slog.Level) bool { return true } -func (g *gethLogsToTm) Handle(ctx context.Context, record slog.Record) error { +func (g *gethLogsToTm) Handle(_ context.Context, record slog.Record) error { attrs := g.attrs record.Attrs(func(attr slog.Attr) bool { attrs = append(attrs, attr) @@ -71,7 +70,7 @@ func (g *gethLogsToTm) WithAttrs(attrs []slog.Attr) slog.Handler { } } -func (g *gethLogsToTm) WithGroup(name string) slog.Handler { +func (g *gethLogsToTm) WithGroup(_ string) slog.Handler { return g }