Skip to content

eth_getStorageValues documentation uses the wrong wire schema #23305

Description

@BenWhite713

Summary

The Erigon eth_getStorageValues documentation describes three positional parameters:

address — STRING — The account address to query storage for

storageKeys — ARRAY of STRING — List of 32-byte storage slot keys (hex-encoded)

blockNumber — STRING or NUMBER — Block number or tag ("latest", "earliest", etc.)

It also states:

An object mapping each requested storage key to its 32-byte value.

The public endpoint does not implement that schema. It accepts two parameters: a requests object mapping addresses to slot arrays, followed by the block selector. It returns an object mapping each address to an array of values.

Affected revision

Reproduction

Use an address with an available state slot, or replace the address and slot with values from your node.

Request shown by the documentation

RPC_URL="${RPC_URL:-http://127.0.0.1:8545}"
ADDRESS=0x3a220f351252089d385b29beca14e27f204c296a
SLOT=0x0000000000000000000000000000000000000000000000000000000000000000

curl -s -H 'Content-Type: application/json' --data \
  "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_getStorageValues\",\"params\":[\"${ADDRESS}\",[\"${SLOT}\"],\"latest\"]}" \
  "$RPC_URL"

Observed response:

{
  "error": {
    "code": -32602,
    "message": "invalid argument 0: json: cannot unmarshal string into Go value of type map[common.Address][]common.Hash"
  }
}

Request accepted by the implementation

curl -s -H 'Content-Type: application/json' --data \
  "{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"eth_getStorageValues\",\"params\":[{\"${ADDRESS}\":[\"${SLOT}\"]},\"latest\"]}" \
  "$RPC_URL"

The successful response has this shape:

{
  "result": {
    "0x3a220f351252089d385b29beca14e27f204c296a": [
      "0x0000000000000000000000000000000000000000000000000000000000000002"
    ]
  }
}

Expected behavior

The documentation should describe the schema implemented by the endpoint:

[
  {"0xADDRESS": ["0xSLOT"]},
  "latest"
]

with a response of:

{"0xADDRESS": ["0xVALUE"]}

Alternatively, if the three-positional-parameter schema is intended, the RPC handler must be changed to accept it. At present the documentation and endpoint disagree.

Relevant code

  • rpc/jsonrpc/eth_api.go:105 declares the two-argument RPC method.
  • rpc/jsonrpc/eth_accounts.go:149 accepts map[common.Address][]common.Hash and a block selector.
  • rpc/jsonrpc/eth_accounts.go:191-205 constructs map[common.Address][]hexutil.Bytes and preserves slot order in each address's array.

Impact

Clients generated from the method page send a request that is rejected with -32602. Clients that follow the implementation receive an address-keyed array, not a storage-key-keyed object, so a strict response decoder generated from the page can also fail.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions