From d22101ad44e62de3ff74c136d14695382f8637d8 Mon Sep 17 00:00:00 2001 From: skosito Date: Fri, 31 May 2024 12:47:44 +0200 Subject: [PATCH] make generate --- rpc/backend/account_info_test.go | 43 +++++++++++++++++++++++++--- rpc/backend/backend_suite_test.go | 16 +++++++---- rpc/backend/blocks_test.go | 4 +-- rpc/backend/call_tx_test.go | 13 +++++++-- rpc/backend/chain_info_test.go | 22 ++++++++------ rpc/backend/client_test.go | 40 +++++++++++++++++++------- rpc/backend/evm_query_client_test.go | 24 ++++++++++++---- rpc/backend/filters_test.go | 6 +++- rpc/backend/sign_tx_test.go | 10 +++++-- rpc/backend/tracing_test.go | 11 +++++-- rpc/backend/tx_info_test.go | 42 +++++++++++++++++++++++---- 11 files changed, 181 insertions(+), 50 deletions(-) diff --git a/rpc/backend/account_info_test.go b/rpc/backend/account_info_test.go index ab690bfe42..c72bf8e18f 100644 --- a/rpc/backend/account_info_test.go +++ b/rpc/backend/account_info_test.go @@ -9,17 +9,19 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "google.golang.org/grpc/metadata" - "github.com/evmos/ethermint/rpc/backend/mocks" "github.com/evmos/ethermint/tests" evmtypes "github.com/evmos/ethermint/x/evm/types" + "google.golang.org/grpc/metadata" + rpctypes "github.com/zeta-chain/zetacore/rpc/types" ) func (suite *BackendTestSuite) TestGetCode() { blockNr := rpctypes.NewBlockNumber(big.NewInt(1)) - contractCode := []byte("0xef616c92f3cfc9e92dc270d6acff9cea213cecc7020a76ee4395af09bdceb4837a1ebdb5735e11e7d3adb6104e0c3ac55180b4ddf5e54d022cc5e8837f6a4f971b") + contractCode := []byte( + "0xef616c92f3cfc9e92dc270d6acff9cea213cecc7020a76ee4395af09bdceb4837a1ebdb5735e11e7d3adb6104e0c3ac55180b4ddf5e54d022cc5e8837f6a4f971b", + ) testCases := []struct { name string @@ -224,7 +226,40 @@ func (suite *BackendTestSuite) TestGetStorageAt() { RegisterStorageAt(queryClient, addr, key, storage) }, true, - hexutil.Bytes{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + hexutil.Bytes{ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, }, } for _, tc := range testCases { diff --git a/rpc/backend/backend_suite_test.go b/rpc/backend/backend_suite_test.go index c363c0a0d5..5196800432 100644 --- a/rpc/backend/backend_suite_test.go +++ b/rpc/backend/backend_suite_test.go @@ -8,7 +8,6 @@ import ( "testing" dbm "github.com/cometbft/cometbft-db" - tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -16,18 +15,17 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/stretchr/testify/suite" - "github.com/evmos/ethermint/app" "github.com/evmos/ethermint/crypto/ethsecp256k1" "github.com/evmos/ethermint/crypto/hd" "github.com/evmos/ethermint/encoding" "github.com/evmos/ethermint/indexer" "github.com/evmos/ethermint/rpc/backend/mocks" - rpctypes "github.com/zeta-chain/zetacore/rpc/types" - "github.com/evmos/ethermint/tests" evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/stretchr/testify/suite" + + rpctypes "github.com/zeta-chain/zetacore/rpc/types" ) type BackendTestSuite struct { @@ -169,7 +167,13 @@ func (suite *BackendTestSuite) buildFormattedBlock( func (suite *BackendTestSuite) generateTestKeyring(clientDir string) (keyring.Keyring, error) { buf := bufio.NewReader(os.Stdin) encCfg := encoding.MakeConfig(app.ModuleBasics) - return keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, clientDir, buf, encCfg.Codec, []keyring.Option{hd.EthSecp256k1Option()}...) + return keyring.New( + sdk.KeyringServiceName(), + keyring.BackendTest, + clientDir, + buf, + encCfg.Codec, + []keyring.Option{hd.EthSecp256k1Option()}...) } func (suite *BackendTestSuite) signAndEncodeEthTx(msgEthereumTx *evmtypes.MsgEthereumTx) []byte { diff --git a/rpc/backend/blocks_test.go b/rpc/backend/blocks_test.go index 917ba99d63..5afb163f1e 100644 --- a/rpc/backend/blocks_test.go +++ b/rpc/backend/blocks_test.go @@ -13,11 +13,11 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/trie" - "google.golang.org/grpc/metadata" - "github.com/evmos/ethermint/rpc/backend/mocks" "github.com/evmos/ethermint/tests" evmtypes "github.com/evmos/ethermint/x/evm/types" + "google.golang.org/grpc/metadata" + ethrpc "github.com/zeta-chain/zetacore/rpc/types" ) diff --git a/rpc/backend/call_tx_test.go b/rpc/backend/call_tx_test.go index d38b2c6635..03544c4c7a 100644 --- a/rpc/backend/call_tx_test.go +++ b/rpc/backend/call_tx_test.go @@ -12,8 +12,9 @@ import ( "github.com/evmos/ethermint/rpc/backend/mocks" "github.com/evmos/ethermint/tests" evmtypes "github.com/evmos/ethermint/x/evm/types" - rpctypes "github.com/zeta-chain/zetacore/rpc/types" "google.golang.org/grpc/metadata" + + rpctypes "github.com/zeta-chain/zetacore/rpc/types" ) func (suite *BackendTestSuite) TestResend() { @@ -400,7 +401,10 @@ func (suite *BackendTestSuite) TestDoCall() { client := suite.backend.clientCtx.Client.(*mocks.Client) queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) RegisterBlock(client, 1, bz) - RegisterEthCallError(queryClient, &evmtypes.EthCallRequest{Args: argsBz, ChainId: suite.backend.chainID.Int64()}) + RegisterEthCallError( + queryClient, + &evmtypes.EthCallRequest{Args: argsBz, ChainId: suite.backend.chainID.Int64()}, + ) }, rpctypes.BlockNumber(1), callArgs, @@ -413,7 +417,10 @@ func (suite *BackendTestSuite) TestDoCall() { client := suite.backend.clientCtx.Client.(*mocks.Client) queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) RegisterBlock(client, 1, bz) - RegisterEthCall(queryClient, &evmtypes.EthCallRequest{Args: argsBz, ChainId: suite.backend.chainID.Int64()}) + RegisterEthCall( + queryClient, + &evmtypes.EthCallRequest{Args: argsBz, ChainId: suite.backend.chainID.Int64()}, + ) }, rpctypes.BlockNumber(1), callArgs, diff --git a/rpc/backend/chain_info_test.go b/rpc/backend/chain_info_test.go index e1ef761e51..cbc3a2ead2 100644 --- a/rpc/backend/chain_info_test.go +++ b/rpc/backend/chain_info_test.go @@ -4,19 +4,18 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common/hexutil" - ethrpc "github.com/ethereum/go-ethereum/rpc" - "github.com/evmos/ethermint/tests" - rpc "github.com/zeta-chain/zetacore/rpc/types" - "google.golang.org/grpc/metadata" - "github.com/cometbft/cometbft/abci/types" tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" sdk "github.com/cosmos/cosmos-sdk/types" - + "github.com/ethereum/go-ethereum/common/hexutil" + ethrpc "github.com/ethereum/go-ethereum/rpc" "github.com/evmos/ethermint/rpc/backend/mocks" + "github.com/evmos/ethermint/tests" evmtypes "github.com/evmos/ethermint/x/evm/types" feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" + "google.golang.org/grpc/metadata" + + rpc "github.com/zeta-chain/zetacore/rpc/types" ) func (suite *BackendTestSuite) TestBaseFee() { @@ -424,7 +423,14 @@ func (suite *BackendTestSuite) TestFeeHistory() { OldestBlock: (*hexutil.Big)(big.NewInt(1)), BaseFee: []*hexutil.Big{(*hexutil.Big)(big.NewInt(1)), (*hexutil.Big)(big.NewInt(1))}, GasUsedRatio: []float64{0}, - Reward: [][]*hexutil.Big{{(*hexutil.Big)(big.NewInt(0)), (*hexutil.Big)(big.NewInt(0)), (*hexutil.Big)(big.NewInt(0)), (*hexutil.Big)(big.NewInt(0))}}, + Reward: [][]*hexutil.Big{ + { + (*hexutil.Big)(big.NewInt(0)), + (*hexutil.Big)(big.NewInt(0)), + (*hexutil.Big)(big.NewInt(0)), + (*hexutil.Big)(big.NewInt(0)), + }, + }, }, sdk.AccAddress(tests.GenerateAddress().Bytes()), true, diff --git a/rpc/backend/client_test.go b/rpc/backend/client_test.go index 92158ded45..9954bca0d1 100644 --- a/rpc/backend/client_test.go +++ b/rpc/backend/client_test.go @@ -4,23 +4,22 @@ import ( "context" "testing" - "github.com/cosmos/cosmos-sdk/client" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - errortypes "github.com/cosmos/cosmos-sdk/types/errors" - abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/bytes" tmrpcclient "github.com/cometbft/cometbft/rpc/client" tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" "github.com/cometbft/cometbft/types" + "github.com/cosmos/cosmos-sdk/client" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + errortypes "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" "github.com/evmos/ethermint/rpc/backend/mocks" - rpc "github.com/zeta-chain/zetacore/rpc/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" mock "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + + rpc "github.com/zeta-chain/zetacore/rpc/types" ) // Client defines a mocked object that implements the Tendermint JSON-RPC Client @@ -269,7 +268,13 @@ func RegisterBlockByHashNotFound(client *mocks.Client, hash common.Hash, tx []by Return(nil, nil) } -func RegisterABCIQueryWithOptions(client *mocks.Client, height int64, path string, data bytes.HexBytes, opts tmrpcclient.ABCIQueryOptions) { +func RegisterABCIQueryWithOptions( + client *mocks.Client, + height int64, + path string, + data bytes.HexBytes, + opts tmrpcclient.ABCIQueryOptions, +) { client.On("ABCIQueryWithOptions", context.Background(), path, data, opts). Return(&tmrpctypes.ResultABCIQuery{ Response: abci.ResponseQuery{ @@ -279,13 +284,28 @@ func RegisterABCIQueryWithOptions(client *mocks.Client, height int64, path strin }, nil) } -func RegisterABCIQueryWithOptionsError(clients *mocks.Client, path string, data bytes.HexBytes, opts tmrpcclient.ABCIQueryOptions) { +func RegisterABCIQueryWithOptionsError( + clients *mocks.Client, + path string, + data bytes.HexBytes, + opts tmrpcclient.ABCIQueryOptions, +) { clients.On("ABCIQueryWithOptions", context.Background(), path, data, opts). Return(nil, errortypes.ErrInvalidRequest) } -func RegisterABCIQueryAccount(clients *mocks.Client, data bytes.HexBytes, opts tmrpcclient.ABCIQueryOptions, acc client.Account) { - baseAccount := authtypes.NewBaseAccount(acc.GetAddress(), acc.GetPubKey(), acc.GetAccountNumber(), acc.GetSequence()) +func RegisterABCIQueryAccount( + clients *mocks.Client, + data bytes.HexBytes, + opts tmrpcclient.ABCIQueryOptions, + acc client.Account, +) { + baseAccount := authtypes.NewBaseAccount( + acc.GetAddress(), + acc.GetPubKey(), + acc.GetAccountNumber(), + acc.GetSequence(), + ) accAny, _ := codectypes.NewAnyWithValue(baseAccount) accResponse := authtypes.QueryAccountResponse{Account: accAny} respBz, _ := accResponse.Marshal() diff --git a/rpc/backend/evm_query_client_test.go b/rpc/backend/evm_query_client_test.go index b6ec884846..2af8048a33 100644 --- a/rpc/backend/evm_query_client_test.go +++ b/rpc/backend/evm_query_client_test.go @@ -7,14 +7,12 @@ import ( "strconv" "testing" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" errortypes "github.com/cosmos/cosmos-sdk/types/errors" grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" "github.com/ethereum/go-ethereum/common" "github.com/evmos/ethermint/rpc/backend/mocks" - rpc "github.com/zeta-chain/zetacore/rpc/types" - - sdkmath "cosmossdk.io/math" "github.com/evmos/ethermint/tests" evmtypes "github.com/evmos/ethermint/x/evm/types" mock "github.com/stretchr/testify/mock" @@ -23,6 +21,8 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + + rpc "github.com/zeta-chain/zetacore/rpc/types" ) // QueryClient defines a mocked object that implements the ethermint GRPC @@ -33,7 +33,11 @@ import ( var _ evmtypes.QueryClient = &mocks.EVMQueryClient{} // TraceTransaction -func RegisterTraceTransactionWithPredecessors(queryClient *mocks.EVMQueryClient, msgEthTx *evmtypes.MsgEthereumTx, predecessors []*evmtypes.MsgEthereumTx) { +func RegisterTraceTransactionWithPredecessors( + queryClient *mocks.EVMQueryClient, + msgEthTx *evmtypes.MsgEthereumTx, + predecessors []*evmtypes.MsgEthereumTx, +) { data := []byte{0x7b, 0x22, 0x74, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x22, 0x7d} queryClient.On("TraceTx", rpc.ContextWithHeight(1), &evmtypes.QueryTraceTxRequest{Msg: msgEthTx, BlockNumber: 1, Predecessors: predecessors, ChainId: 9000}). @@ -54,8 +58,16 @@ func RegisterTraceTransactionError(queryClient *mocks.EVMQueryClient, msgEthTx * // TraceBlock func RegisterTraceBlock(queryClient *mocks.EVMQueryClient, txs []*evmtypes.MsgEthereumTx) { data := []byte{0x7b, 0x22, 0x74, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x22, 0x7d} - queryClient.On("TraceBlock", rpc.ContextWithHeight(1), - &evmtypes.QueryTraceBlockRequest{Txs: txs, BlockNumber: 1, TraceConfig: &evmtypes.TraceConfig{}, ChainId: 9000}). + queryClient.On( + "TraceBlock", + rpc.ContextWithHeight(1), + &evmtypes.QueryTraceBlockRequest{ + Txs: txs, + BlockNumber: 1, + TraceConfig: &evmtypes.TraceConfig{}, + ChainId: 9000, + }, + ). Return(&evmtypes.QueryTraceBlockResponse{Data: data}, nil) } diff --git a/rpc/backend/filters_test.go b/rpc/backend/filters_test.go index a36713d65c..99f2a2f955 100644 --- a/rpc/backend/filters_test.go +++ b/rpc/backend/filters_test.go @@ -8,6 +8,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/evmos/ethermint/rpc/backend/mocks" evmtypes "github.com/evmos/ethermint/x/evm/types" + ethrpc "github.com/zeta-chain/zetacore/rpc/types" ) @@ -16,7 +17,10 @@ func (suite *BackendTestSuite) TestGetLogs() { block := tmtypes.MakeBlock(1, []tmtypes.Tx{bz}, nil, nil) logs := make([]*evmtypes.Log, 0, 1) var log evmtypes.Log - json.Unmarshal([]byte{0x7b, 0x22, 0x74, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x22, 0x7d}, &log) + json.Unmarshal( + []byte{0x7b, 0x22, 0x74, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x22, 0x7d}, + &log, + ) logs = append(logs, &log) testCases := []struct { diff --git a/rpc/backend/sign_tx_test.go b/rpc/backend/sign_tx_test.go index e746a3d781..f51e5a2de8 100644 --- a/rpc/backend/sign_tx_test.go +++ b/rpc/backend/sign_tx_test.go @@ -205,7 +205,10 @@ func (suite *BackendTestSuite) TestSign() { responseBz, err := suite.backend.Sign(tc.fromAddr, tc.inputBz) if tc.expPass { - signature, _, err := suite.backend.clientCtx.Keyring.SignByAddress((sdk.AccAddress)(from.Bytes()), tc.inputBz) + signature, _, err := suite.backend.clientCtx.Keyring.SignByAddress( + (sdk.AccAddress)(from.Bytes()), + tc.inputBz, + ) signature[goethcrypto.RecoveryIDOffset] += 27 suite.Require().NoError(err) suite.Require().Equal((hexutil.Bytes)(signature), responseBz) @@ -255,7 +258,10 @@ func (suite *BackendTestSuite) TestSignTypedData() { if tc.expPass { sigHash, _, err := apitypes.TypedDataAndHash(tc.inputTypedData) suite.Require().NoError(err) - signature, _, err := suite.backend.clientCtx.Keyring.SignByAddress((sdk.AccAddress)(from.Bytes()), sigHash) + signature, _, err := suite.backend.clientCtx.Keyring.SignByAddress( + (sdk.AccAddress)(from.Bytes()), + sigHash, + ) signature[goethcrypto.RecoveryIDOffset] += 27 suite.Require().NoError(err) suite.Require().Equal((hexutil.Bytes)(signature), responseBz) diff --git a/rpc/backend/tracing_test.go b/rpc/backend/tracing_test.go index 0c27e980e6..3a5a702823 100644 --- a/rpc/backend/tracing_test.go +++ b/rpc/backend/tracing_test.go @@ -117,7 +117,11 @@ func (suite *BackendTestSuite) TestTraceTransaction() { queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient) client := suite.backend.clientCtx.Client.(*mocks.Client) RegisterBlockMultipleTxs(client, 1, []types.Tx{txBz, txBz2}) - RegisterTraceTransactionWithPredecessors(queryClient, msgEthereumTx2, []*evmtypes.MsgEthereumTx{msgEthereumTx}) + RegisterTraceTransactionWithPredecessors( + queryClient, + msgEthereumTx2, + []*evmtypes.MsgEthereumTx{msgEthereumTx}, + ) txResults := []*abci.ResponseDeliverTx{ { Code: 0, @@ -149,7 +153,10 @@ func (suite *BackendTestSuite) TestTraceTransaction() { RegisterBlockResultsWithTxResults(client, 1, txResults) }, - &types.Block{Header: types.Header{Height: 1, ChainID: ChainID}, Data: types.Data{Txs: []types.Tx{txBz, txBz2}}}, + &types.Block{ + Header: types.Header{Height: 1, ChainID: ChainID}, + Data: types.Data{Txs: []types.Tx{txBz, txBz2}}, + }, []*abci.ResponseDeliverTx{ { Code: 0, diff --git a/rpc/backend/tx_info_test.go b/rpc/backend/tx_info_test.go index ac33651e2b..37f4964b7d 100644 --- a/rpc/backend/tx_info_test.go +++ b/rpc/backend/tx_info_test.go @@ -16,8 +16,9 @@ import ( "github.com/evmos/ethermint/rpc/backend/mocks" ethermint "github.com/evmos/ethermint/types" evmtypes "github.com/evmos/ethermint/x/evm/types" - rpctypes "github.com/zeta-chain/zetacore/rpc/types" "google.golang.org/grpc/metadata" + + rpctypes "github.com/zeta-chain/zetacore/rpc/types" ) func (suite *BackendTestSuite) TestGetTransactionByHash() { @@ -42,7 +43,14 @@ func (suite *BackendTestSuite) TestGetTransactionByHash() { }, } - rpcTransaction, err := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, big.NewInt(1), suite.backend.chainID) + rpcTransaction, err := rpctypes.NewRPCTransaction( + msgEthereumTx.AsTransaction(), + common.Hash{}, + 0, + 0, + big.NewInt(1), + suite.backend.chainID, + ) suite.Require().NoError(err) testCases := []struct { @@ -125,7 +133,14 @@ func (suite *BackendTestSuite) TestGetTransactionByHash() { func (suite *BackendTestSuite) TestGetTransactionsByHashPending() { msgEthereumTx, bz := suite.buildEthereumTx() - rpcTransaction, err := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, big.NewInt(1), suite.backend.chainID) + rpcTransaction, err := rpctypes.NewRPCTransaction( + msgEthereumTx.AsTransaction(), + common.Hash{}, + 0, + 0, + big.NewInt(1), + suite.backend.chainID, + ) suite.Require().NoError(err) testCases := []struct { @@ -186,7 +201,14 @@ func (suite *BackendTestSuite) TestGetTransactionsByHashPending() { func (suite *BackendTestSuite) TestGetTxByEthHash() { msgEthereumTx, bz := suite.buildEthereumTx() - rpcTransaction, err := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, big.NewInt(1), suite.backend.chainID) + rpcTransaction, err := rpctypes.NewRPCTransaction( + msgEthereumTx.AsTransaction(), + common.Hash{}, + 0, + 0, + big.NewInt(1), + suite.backend.chainID, + ) suite.Require().NoError(err) testCases := []struct { @@ -201,7 +223,12 @@ func (suite *BackendTestSuite) TestGetTxByEthHash() { func() { suite.backend.indexer = nil client := suite.backend.clientCtx.Client.(*mocks.Client) - query := fmt.Sprintf("%s.%s='%s'", evmtypes.TypeMsgEthereumTx, evmtypes.AttributeKeyEthereumTxHash, common.HexToHash(msgEthereumTx.Hash).Hex()) + query := fmt.Sprintf( + "%s.%s='%s'", + evmtypes.TypeMsgEthereumTx, + evmtypes.AttributeKeyEthereumTxHash, + common.HexToHash(msgEthereumTx.Hash).Hex(), + ) RegisterTxSearch(client, query, bz) }, msgEthereumTx, @@ -348,7 +375,10 @@ func (suite *BackendTestSuite) TestGetTransactionByBlockAndIndex() { db := dbm.NewMemDB() suite.backend.indexer = indexer.NewKVIndexer(db, tmlog.NewNopLogger(), suite.backend.clientCtx) txBz := suite.signAndEncodeEthTx(msgEthTx) - block := &types.Block{Header: types.Header{Height: 1, ChainID: "test"}, Data: types.Data{Txs: []types.Tx{txBz}}} + block := &types.Block{ + Header: types.Header{Height: 1, ChainID: "test"}, + Data: types.Data{Txs: []types.Tx{txBz}}, + } err := suite.backend.indexer.IndexBlock(block, defaultResponseDeliverTx) suite.Require().NoError(err) RegisterBlockResults(client, 1)