Skip to content

Commit

Permalink
chore: fix get proof and signmode
Browse files Browse the repository at this point in the history
  • Loading branch information
dudong2 committed Jan 15, 2024
1 parent aa20167 commit f7059a0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion rpc/backend/account_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ func (b *Backend) GetProof(address common.Address, storageKeys []string, blockNr
}

// query account proofs
_, proof, err := b.queryClient.GetProof(clientCtx, authtypes.StoreKey, address.Bytes())
accountKey := append(authtypes.AddressStoreKeyPrefix.Bytes(), address.Bytes()...)
_, proof, err := b.queryClient.GetProof(clientCtx, authtypes.StoreKey, accountKey)
if err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion rpc/backend/account_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"math/big"

tmrpcclient "github.com/cometbft/cometbft/rpc/client"
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"
Expand Down Expand Up @@ -140,7 +141,7 @@ func (suite *BackendTestSuite) TestGetProof() {
client,
bn.Int64(),
"store/acc/key",
address1.Bytes(),
append(authtypes.AddressStoreKeyPrefix.Bytes(), address1.Bytes()...),
tmrpcclient.ABCIQueryOptions{Height: iavlHeight, Prove: true},
)
},
Expand Down
4 changes: 2 additions & 2 deletions rpc/backend/sign_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ 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, signing.SignMode_SIGN_MODE_DIRECT)
signature, _, err := suite.backend.clientCtx.Keyring.SignByAddress((sdk.AccAddress)(from.Bytes()), tc.inputBz, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
signature[goethcrypto.RecoveryIDOffset] += 27
suite.Require().NoError(err)
suite.Require().Equal((hexutil.Bytes)(signature), responseBz)
Expand Down Expand Up @@ -251,7 +251,7 @@ func (suite *BackendTestSuite) TestSignTypedData() {

if tc.expPass {
sigHash, _, err := apitypes.TypedDataAndHash(tc.inputTypedData)
signature, _, err := suite.backend.clientCtx.Keyring.SignByAddress((sdk.AccAddress)(from.Bytes()), sigHash, signing.SignMode_SIGN_MODE_DIRECT)
signature, _, err := suite.backend.clientCtx.Keyring.SignByAddress((sdk.AccAddress)(from.Bytes()), sigHash, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
signature[goethcrypto.RecoveryIDOffset] += 27
suite.Require().NoError(err)
suite.Require().Equal((hexutil.Bytes)(signature), responseBz)
Expand Down

0 comments on commit f7059a0

Please sign in to comment.