From e99d6cfa9f0c74855cfc747ee9fa3321092fa017 Mon Sep 17 00:00:00 2001 From: Freddy Caceres Date: Wed, 16 Nov 2022 20:19:17 -0500 Subject: [PATCH] fix tests --- rpc/backend/sign_tx_test.go | 3 +-- rpc/backend/tx_info_test.go | 11 +++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/rpc/backend/sign_tx_test.go b/rpc/backend/sign_tx_test.go index 385ce641fd..d97dde9da1 100644 --- a/rpc/backend/sign_tx_test.go +++ b/rpc/backend/sign_tx_test.go @@ -10,7 +10,6 @@ import ( goethcrypto "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/signer/core/apitypes" "github.com/evmos/ethermint/crypto/ethsecp256k1" - "github.com/evmos/ethermint/ethereum/eip712" "github.com/evmos/ethermint/rpc/backend/mocks" "github.com/evmos/ethermint/tests" evmtypes "github.com/evmos/ethermint/x/evm/types" @@ -248,7 +247,7 @@ func (suite *BackendTestSuite) TestSignTypedData() { responseBz, err := suite.backend.SignTypedData(tc.fromAddr, tc.inputTypedData) if tc.expPass { - sigHash, err := eip712.ComputeTypedDataHash(tc.inputTypedData) + sigHash, _, err := apitypes.TypedDataAndHash(tc.inputTypedData) signature, _, err := suite.backend.clientCtx.Keyring.SignByAddress((sdk.AccAddress)(from.Bytes()), sigHash) signature[goethcrypto.RecoveryIDOffset] += 27 suite.Require().NoError(err) diff --git a/rpc/backend/tx_info_test.go b/rpc/backend/tx_info_test.go index b34cef435e..86d73bc33a 100644 --- a/rpc/backend/tx_info_test.go +++ b/rpc/backend/tx_info_test.go @@ -41,7 +41,7 @@ func (suite *BackendTestSuite) TestGetTransactionByHash() { }, } - rpcTransaction, _ := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, big.NewInt(1)) + rpcTransaction, _ := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, big.NewInt(1), suite.backend.chainID) testCases := []struct { name string @@ -123,7 +123,7 @@ func (suite *BackendTestSuite) TestGetTransactionByHash() { func (suite *BackendTestSuite) TestGetTransactionsByHashPending() { msgEthereumTx, bz := suite.buildEthereumTx() - rpcTransaction, _ := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, big.NewInt(1)) + rpcTransaction, _ := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, big.NewInt(1), suite.backend.chainID) testCases := []struct { name string @@ -183,7 +183,7 @@ func (suite *BackendTestSuite) TestGetTransactionsByHashPending() { func (suite *BackendTestSuite) TestGetTxByEthHash() { msgEthereumTx, bz := suite.buildEthereumTx() - rpcTransaction, _ := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, big.NewInt(1)) + rpcTransaction, _ := rpctypes.NewRPCTransaction(msgEthereumTx.AsTransaction(), common.Hash{}, 0, 0, big.NewInt(1), suite.backend.chainID) testCases := []struct { name string @@ -299,6 +299,7 @@ func (suite *BackendTestSuite) TestGetTransactionByBlockAndIndex() { 1, 0, big.NewInt(1), + suite.backend.chainID, ) testCases := []struct { name string @@ -392,6 +393,7 @@ func (suite *BackendTestSuite) TestGetTransactionByBlockNumberAndIndex() { 1, 0, big.NewInt(1), + suite.backend.chainID, ) testCases := []struct { name string @@ -583,7 +585,8 @@ func (suite *BackendTestSuite) TestGetTransactionReceipt() { db := dbm.NewMemDB() suite.backend.indexer = indexer.NewKVIndexer(db, tmlog.NewNopLogger(), suite.backend.clientCtx) - err := suite.backend.indexer.IndexBlock(tc.block, tc.blockResult) + err := suite.backend.indexer.IndexBlock(tc.block, tc.blockResult) + suite.Require().NoError(err) txReceipt, err := suite.backend.GetTransactionReceipt(common.HexToHash(tc.tx.Hash)) if tc.expPass {