From 4851c742ab4b99eac6d6f9ed48e32081c51cb48e Mon Sep 17 00:00:00 2001 From: skosito Date: Fri, 7 Jun 2024 16:54:23 +0200 Subject: [PATCH] fix tests --- rpc/backend/account_info_test.go | 7 +++++-- rpc/backend/client_test.go | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/rpc/backend/account_info_test.go b/rpc/backend/account_info_test.go index f54b743d5f..cebf650c7e 100644 --- a/rpc/backend/account_info_test.go +++ b/rpc/backend/account_info_test.go @@ -82,6 +82,7 @@ func (suite *BackendTestSuite) TestGetProof() { blockNrInvalid := rpctypes.NewBlockNumber(big.NewInt(1)) blockNr := rpctypes.NewBlockNumber(big.NewInt(4)) address1 := tests.GenerateAddress() + expProofValue := big.NewInt(2) testCases := []struct { name string @@ -93,7 +94,7 @@ func (suite *BackendTestSuite) TestGetProof() { expAccRes *rpctypes.AccountResult }{ { - "fail - BlockNumeber = 1 (invalidBlockNumber)", + "fail - BlockNumber = 1 (invalidBlockNumber)", address1, []string{}, rpctypes.BlockNumberOrHash{BlockNumber: &blockNrInvalid}, @@ -139,6 +140,7 @@ func (suite *BackendTestSuite) TestGetProof() { "store/evm/key", evmtypes.StateKey(address1, common.HexToHash("0x0").Bytes()), tmrpcclient.ABCIQueryOptions{Height: iavlHeight, Prove: true}, + expProofValue.Bytes(), ) RegisterABCIQueryWithOptions( client, @@ -146,6 +148,7 @@ func (suite *BackendTestSuite) TestGetProof() { "store/acc/key", authtypes.AddressStoreKey(sdk.AccAddress(address1.Bytes())), tmrpcclient.ABCIQueryOptions{Height: iavlHeight, Prove: true}, + expProofValue.Bytes(), ) }, true, @@ -159,7 +162,7 @@ func (suite *BackendTestSuite) TestGetProof() { StorageProof: []rpctypes.StorageResult{ { Key: "0x0", - Value: (*hexutil.Big)(big.NewInt(2)), + Value: (*hexutil.Big)(expProofValue), Proof: []string{""}, }, }, diff --git a/rpc/backend/client_test.go b/rpc/backend/client_test.go index a94716e2fe..640fd7e896 100644 --- a/rpc/backend/client_test.go +++ b/rpc/backend/client_test.go @@ -281,11 +281,12 @@ func RegisterABCIQueryWithOptions( path string, data bytes.HexBytes, opts tmrpcclient.ABCIQueryOptions, + respValue []byte, ) { client.On("ABCIQueryWithOptions", context.Background(), path, data, opts). Return(&tmrpctypes.ResultABCIQuery{ Response: abci.ResponseQuery{ - Value: data.Bytes(), + Value: respValue, Height: height, }, }, nil)