Skip to content

fix(l1): answer -32602 to an eth_getProof request over the key limit - #7709

Open
tcoratger wants to merge 2 commits into
lambdaclass:mainfrom
tcoratger:fix/get-proof-key-limit-invalid-params
Open

tcoratger wants to merge 2 commits into
lambdaclass:mainfrom
tcoratger:fix/get-proof-key-limit-invalid-params

Conversation

@tcoratger

Copy link
Copy Markdown

Motivation

The eth_getProof text of execution-apis (from ethereum/execution-apis#954) says: "Clients MUST accept at least 1024 storage keys in one request, and MAY limit the number of keys above that. For a request over the limit, or for a storage key that is not hex or has more than 64 hex digits, clients MUST return the -32602: Invalid params error."

ethrex caps a call at 1024 keys (#7485), but answers a call over the cap with -32005 (LimitExceeded).

Description

  • GetProofRequest::parse returns RpcErr::InvalidParams (-32602) for more than MAX_PROOF_STORAGE_KEYS keys, with the same message.
  • The batch-wide cap over all eth_getProof calls of one batch keeps -32005; the spec does not address batches.
  • get_proof_parse_rejects_more_storage_keys_than_the_cap now expects InvalidParams; it fails before the change.

Checks: cargo test -p ethrex-rpc --lib proof (12 passed), rustfmt --check on the touched file.

🤖 Generated with Claude Code

execution-apis requires -32602 Invalid params for an eth_getProof request
with more storage keys than the client's limit. The per-call cap answered
-32005 Limit exceeded. The batch-wide cap is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tcoratger
tcoratger requested a review from a team as a code owner December 4, 2026 02:37

@ilitteri ilitteri left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to GetProofRequest::parse gives the right -32602 for a standalone call, but wrapping that same 1,025-key call in a one-item JSON-RPC batch hits validate_batch -> batch_proof_keys_error before dispatch, returning a single -32005 error with id: null instead of a per-item -32602 with the request ID.

Please have batch_proof_keys_error skip calls that individually exceed MAX_PROOF_STORAGE_KEYS when summing the batch budget so their own parser returns -32602 with the original ID (preserving -32005 for batches of individually valid calls that exceed the aggregate cap), and add a one-item batch test.

(Related RPC / eth_getProof PRs on EthLib: ethereum/EthLib#5446 and ethereum/EthLib#5449.)

A one-call JSON-RPC batch whose eth_getProof asks for more storage keys than the
per-call cap was refused as a whole by the batch key budget, with -32005 and a null
id, while the same call on its own gets -32602. Such a call is now left out of the
batch total: its own parser refuses it with -32602 under its id before any trie
work, so it costs the batch nothing. Calls within the cap are still held to the cap
together and refused with -32005 when they exceed it.

Adds a validate_batch test for the total with and without calls over the cap, and
an HTTP test for a one-call batch over the cap.

@ilitteri ilitteri left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed the follow-up fix (f9957f0fca) excluding individually over-cap eth_getProof calls from batch_proof_keys_error so single-call batches return -32602 under the call's own id while aggregate multi-call batches remain capped at -32005, with unit and HTTP batch tests. Looks good to merge.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants