Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
facs95 committed Nov 17, 2022
1 parent 21c63f0 commit e99d6cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions rpc/backend/sign_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 7 additions & 4 deletions rpc/backend/tx_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -299,6 +299,7 @@ func (suite *BackendTestSuite) TestGetTransactionByBlockAndIndex() {
1,
0,
big.NewInt(1),
suite.backend.chainID,
)
testCases := []struct {
name string
Expand Down Expand Up @@ -392,6 +393,7 @@ func (suite *BackendTestSuite) TestGetTransactionByBlockNumberAndIndex() {
1,
0,
big.NewInt(1),
suite.backend.chainID,
)
testCases := []struct {
name string
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e99d6cf

Please sign in to comment.