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

Commit

Permalink
Make GetStorageAt return 32 bytes data
Browse files Browse the repository at this point in the history
  • Loading branch information
Kourin1996 committed Sep 21, 2022
1 parent f982111 commit 6e22ed2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions jsonrpc/eth_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,21 +411,22 @@ func (e *Eth) GetStorageAt(

return nil, err
}

// Parse the RLP value
p := &fastrlp.Parser{}
v, err := p.Parse(result)

v, err := p.Parse(result)
if err != nil {
return argBytesPtr(types.ZeroHash[:]), nil
}

data, err := v.Bytes()

if err != nil {
return argBytesPtr(types.ZeroHash[:]), nil
}

return argBytesPtr(data), nil
// Pad to return 32 bytes data
return argBytesPtr(types.BytesToHash(data).Bytes()), nil
}

// GasPrice returns the average gas price based on the last x blocks
Expand Down

0 comments on commit 6e22ed2

Please sign in to comment.