rpc: fix parity_listStorageKeys state version and gate eth_getProof on execution - #23165
Merged
Conversation
…n execution parity_listStorageKeys read the account with a latest-state reader (state after the head block) but scanned its storage at Min(bn), the first txNum of the head block, i.e. the state after bn-1. A slot written in the head block was missing from the listing and a slot deleted in it was still listed. state.Dumper, the equivalent path, uses Min(blockNumber+1). eth_getProof resolved a block by canonical hash only. Canonical hashes exist for blocks the header stage has downloaded but execution has not reached, so a request for one walked the history path and surfaced a PrunedError or a root-hash mismatch instead of saying the block is not executed yet.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes two state-version correctness issues in the RPC layer: it aligns parity_listStorageKeys account vs storage reads to the same state version, and it ensures eth_getProof rejects requests for blocks that are canonical-by-hash but not yet executed (so commitment history is unavailable).
Changes:
- Adjust
parity_listStorageKeysstorage scan fromMin(bn)toMin(bn+1)so it matches the latest-state account read. - Add an execution-progress gate (
rpchelper.CheckBlockExecuted) toeth_getProofafter canonical block resolution.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| rpc/jsonrpc/parity_api.go | Aligns storage scan txNum boundary with latest-state account reads (and needs a nil-head guard). |
| rpc/jsonrpc/eth_call.go | Adds a “block must be executed” gate for eth_getProof (and needs view-consistent block resolution). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
… read The execution gate read the plain roTx while the block tag was still resolved through the overlay, so during a commit an overlay-resolved head could be reported as not executed. Resolve on the committed view instead, which is also where the commitment-history reads happen. This overlaps the same change in #22533; whichever lands first, the other is a trivial conflict. rawdb.ReadCurrentBlockNumber returns nil when no head header is set, so listStorageKeys dereferenced a nil pointer instead of returning an error.
lupin012
approved these changes
Aug 11, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two state-version bugs in the RPC layer, both independent of each other and of the view-consistency work in #22533.
parity_listStorageKeysreads the account with a latest-state reader — the state after head blockbn— but scanned its storage atMin(bn), the first txNum ofbn, which is the state afterbn-1. The account and its storage therefore came from different blocks: a slot written in the head block was missing from the listing, and a slot deleted in it was still listed.state.Dumper, the equivalent path, usesMin(blockNumber+1).eth_getProofresolved a block by canonical hash alone. Canonical hashes exist for blocks the header stage has downloaded but execution has not reached, so a request for one walked the history path and surfaced aPrunedErroror a root-hash mismatch instead of reporting that the block is not executed yet.Changes
parity_api.go—Min(bn)→Min(bn+1)so the storage scan matches the account read.eth_call.go— gateGetProofonrpchelper.CheckBlockExecutedafter resolution.