From e31af8068fa2251b4bb3ab40995687c91b3d16af Mon Sep 17 00:00:00 2001 From: skosito Date: Sat, 26 Oct 2024 01:17:11 +0200 Subject: [PATCH] fix unit tests missing mocks --- rpc/backend/call_tx_test.go | 11 +++++++++++ rpc/backend/sign_tx_test.go | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/rpc/backend/call_tx_test.go b/rpc/backend/call_tx_test.go index ec92db089b..7d8d95275e 100644 --- a/rpc/backend/call_tx_test.go +++ b/rpc/backend/call_tx_test.go @@ -24,6 +24,7 @@ func (suite *BackendTestSuite) TestResend() { gasPrice := new(hexutil.Big) toAddr := tests.GenerateAddress() chainID := (*hexutil.Big)(suite.backend.chainID) + validator := sdk.AccAddress(tests.GenerateAddress().Bytes()) callArgs := evmtypes.TransactionArgs{ From: nil, To: &toAddr, @@ -69,6 +70,7 @@ func (suite *BackendTestSuite) TestResend() { RegisterBlock(client, 1, nil) RegisterBlockResults(client, 1) RegisterBaseFeeDisabled(queryClient) + RegisterValidatorAccount(queryClient, validator) }, evmtypes.TransactionArgs{ Nonce: &txNonce, @@ -91,6 +93,7 @@ func (suite *BackendTestSuite) TestResend() { RegisterBlock(client, 1, nil) RegisterBlockResults(client, 1) RegisterBaseFee(queryClient, baseFee) + RegisterValidatorAccount(queryClient, validator) }, evmtypes.TransactionArgs{ Nonce: &txNonce, @@ -110,6 +113,7 @@ func (suite *BackendTestSuite) TestResend() { RegisterBlock(client, 1, nil) RegisterBlockResults(client, 1) RegisterBaseFeeDisabled(queryClient) + RegisterValidatorAccount(queryClient, validator) }, evmtypes.TransactionArgs{ Nonce: &txNonce, @@ -163,6 +167,7 @@ func (suite *BackendTestSuite) TestResend() { RegisterBlock(client, 1, nil) RegisterBlockResults(client, 1) RegisterBaseFee(queryClient, baseFee) + RegisterValidatorAccount(queryClient, validator) }, evmtypes.TransactionArgs{ Nonce: &txNonce, @@ -186,6 +191,7 @@ func (suite *BackendTestSuite) TestResend() { RegisterBlock(client, 1, nil) RegisterBlockResults(client, 1) RegisterBaseFee(queryClient, baseFee) + RegisterValidatorAccount(queryClient, validator) }, evmtypes.TransactionArgs{ Nonce: &txNonce, @@ -210,6 +216,7 @@ func (suite *BackendTestSuite) TestResend() { RegisterParams(queryClient, &header, 1) RegisterParamsWithoutHeader(queryClient, 1) RegisterUnconfirmedTxsError(client, nil) + RegisterValidatorAccount(queryClient, validator) }, evmtypes.TransactionArgs{ Nonce: &txNonce, @@ -238,6 +245,7 @@ func (suite *BackendTestSuite) TestResend() { RegisterParams(queryClient, &header, 1) RegisterParamsWithoutHeader(queryClient, 1) RegisterUnconfirmedTxsEmpty(client, nil) + RegisterValidatorAccount(queryClient, validator) }, evmtypes.TransactionArgs{ Nonce: &txNonce, @@ -448,6 +456,7 @@ func (suite *BackendTestSuite) TestDoCall() { func (suite *BackendTestSuite) TestGasPrice() { defaultGasPrice := (*hexutil.Big)(big.NewInt(1)) + validator := sdk.AccAddress(tests.GenerateAddress().Bytes()) testCases := []struct { name string @@ -467,6 +476,7 @@ func (suite *BackendTestSuite) TestGasPrice() { RegisterBlock(client, 1, nil) RegisterBlockResults(client, 1) RegisterBaseFee(queryClient, sdk.NewInt(1)) + RegisterValidatorAccount(queryClient, validator) }, defaultGasPrice, true, @@ -483,6 +493,7 @@ func (suite *BackendTestSuite) TestGasPrice() { RegisterBlock(client, 1, nil) RegisterBlockResults(client, 1) RegisterBaseFee(queryClient, sdk.NewInt(1)) + RegisterValidatorAccount(queryClient, validator) }, defaultGasPrice, false, diff --git a/rpc/backend/sign_tx_test.go b/rpc/backend/sign_tx_test.go index 1483b0b5e0..ee82303b0e 100644 --- a/rpc/backend/sign_tx_test.go +++ b/rpc/backend/sign_tx_test.go @@ -31,6 +31,7 @@ func (suite *BackendTestSuite) TestSendTransaction() { from := common.BytesToAddress(priv.PubKey().Address().Bytes()) nonce := hexutil.Uint64(1) baseFee := sdk.NewInt(1) + validator := sdk.AccAddress(tests.GenerateAddress().Bytes()) callArgsDefault := evmtypes.TransactionArgs{ From: &from, To: &toAddr, @@ -82,6 +83,7 @@ func (suite *BackendTestSuite) TestSendTransaction() { RegisterBlock(client, 1, nil) RegisterBlockResults(client, 1) RegisterBaseFee(queryClient, baseFee) + RegisterValidatorAccount(queryClient, validator) }, evmtypes.TransactionArgs{ From: &from, @@ -115,6 +117,7 @@ func (suite *BackendTestSuite) TestSendTransaction() { txBytes, err := txEncoder(tx) suite.Require().NoError(err) RegisterBroadcastTxError(client, txBytes) + RegisterValidatorAccount(queryClient, validator) }, callArgsDefault, common.Hash{}, @@ -142,6 +145,7 @@ func (suite *BackendTestSuite) TestSendTransaction() { txBytes, err := txEncoder(tx) suite.Require().NoError(err) RegisterBroadcastTx(client, txBytes) + RegisterValidatorAccount(queryClient, validator) }, callArgsDefault, hash,