evm: fix get storage (#375)
This commit is contained in:
parent
8491ae3c64
commit
bc2a2eb8f3
@ -154,13 +154,6 @@ func (k Keeper) Storage(c context.Context, req *types.QueryStorageRequest) (*typ
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ethermint.IsEmptyHash(req.Key) {
|
|
||||||
return nil, status.Errorf(
|
|
||||||
codes.InvalidArgument,
|
|
||||||
types.ErrEmptyHash.Error(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(c)
|
ctx := sdk.UnwrapSDKContext(c)
|
||||||
k.WithContext(ctx)
|
k.WithContext(ctx)
|
||||||
|
|
||||||
@ -170,12 +163,6 @@ func (k Keeper) Storage(c context.Context, req *types.QueryStorageRequest) (*typ
|
|||||||
state := k.GetState(address, key)
|
state := k.GetState(address, key)
|
||||||
stateHex := state.Hex()
|
stateHex := state.Hex()
|
||||||
|
|
||||||
if ethermint.IsEmptyHash(stateHex) {
|
|
||||||
return nil, status.Error(
|
|
||||||
codes.NotFound, "contract code not found for given address",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return &types.QueryStorageResponse{
|
return &types.QueryStorageResponse{
|
||||||
Value: stateHex,
|
Value: stateHex,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -271,15 +271,6 @@ func (suite *KeeperTestSuite) TestQueryStorage() {
|
|||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
{"empty hash",
|
|
||||||
func() {
|
|
||||||
req = &types.QueryStorageRequest{
|
|
||||||
Address: suite.address.String(),
|
|
||||||
Key: ethcmn.Hash{}.String(),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
false,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"success",
|
"success",
|
||||||
func() {
|
func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user