@@ -58,7 +58,7 @@ type API interface {
5858 // GetBlockTransactionCountByNumber returns the number of transactions in the block.
5959 GetBlockTransactionCountByNumber (ctx context.Context , blockNum ethrpc.BlockNumber ) (hexutil.Uint , error )
6060 // GetStorageAt returns the storage value at the provided position.
61- GetStorageAt (ctx context.Context , address common.Address , position hexutil. Big , blockNrOrHash ethrpc.BlockNumberOrHash ) (hexutil.Big , error )
61+ GetStorageAt (ctx context.Context , address common.Address , position common. Hash , blockNrOrHash ethrpc.BlockNumberOrHash ) (hexutil.Bytes , error )
6262 // GetBalance returns the provided account's balance up to the provided block number.
6363 GetBalance (ctx context.Context , address common.Address , blockNrOrHash ethrpc.BlockNumberOrHash ) (* hexutil.Big , error )
6464 // ChainId return the EIP-155 chain id for the current network.
@@ -232,33 +232,25 @@ func (api *publicAPI) GetBlockTransactionCountByNumber(ctx context.Context, bloc
232232 return hexutil .Uint (n ), nil
233233}
234234
235- func (api * publicAPI ) GetStorageAt (ctx context.Context , address common.Address , position hexutil. Big , blockNrOrHash ethrpc.BlockNumberOrHash ) (hexutil.Big , error ) {
236- logger := api .Logger .With ("method" , "eth_getStorageAt" , "address" , address , "position " , position , "block_or_hash" , blockNrOrHash )
235+ func (api * publicAPI ) GetStorageAt (ctx context.Context , address common.Address , slot common. Hash , blockNrOrHash ethrpc.BlockNumberOrHash ) (hexutil.Bytes , error ) {
236+ logger := api .Logger .With ("method" , "eth_getStorageAt" , "address" , address , "slot " , slot , "block_or_hash" , blockNrOrHash )
237237 logger .Debug ("request" )
238238
239239 round , err := api .getBlockRound (ctx , logger , blockNrOrHash )
240240 if err != nil {
241- return hexutil.Big {}, err
241+ return hexutil.Bytes {}, err
242242 }
243243 if api .shouldQueryArchive (round ) {
244- return api .archiveClient .GetStorageAt (ctx , address , position , round )
244+ return api .archiveClient .GetStorageAt (ctx , address , slot , round )
245245 }
246246
247- // EVM module takes index as H256, which needs leading zeros.
248- position256 := make ([]byte , 32 )
249- // Unmarshalling to hexutil.Big rejects overlong inputs. Verify in `TestRejectOverlong`.
250- position .ToInt ().FillBytes (position256 )
251-
252247 ethmod := evm .NewV1 (api .client )
253- res , err := ethmod .Storage (ctx , round , address [:], position256 )
248+ res , err := ethmod .Storage (ctx , round , address [:], slot [:] )
254249 if err != nil {
255250 logger .Error ("failed to query storage" , "err" , err )
256- return hexutil. Big {} , ErrInternalError
251+ return nil , ErrInternalError
257252 }
258- // Some apps expect no leading zeros, so output as big integer.
259- var resultBI big.Int
260- resultBI .SetBytes (res )
261- return hexutil .Big (resultBI ), nil
253+ return res [:], nil
262254}
263255
264256func (api * publicAPI ) GetBalance (ctx context.Context , address common.Address , blockNrOrHash ethrpc.BlockNumberOrHash ) (* hexutil.Big , error ) {
0 commit comments