Skip to content

rpc: fix parity_listStorageKeys state version and gate eth_getProof on execution - #23165

Merged
AskAlexSharov merged 2 commits into
mainfrom
awskii/rpc-preexisting-state-fixes
Aug 11, 2026
Merged

rpc: fix parity_listStorageKeys state version and gate eth_getProof on execution#23165
AskAlexSharov merged 2 commits into
mainfrom
awskii/rpc-preexisting-state-fixes

Conversation

@awskii

@awskii awskii commented Aug 11, 2026

Copy link
Copy Markdown
Member

Two state-version bugs in the RPC layer, both independent of each other and of the view-consistency work in #22533.

parity_listStorageKeys reads the account with a latest-state reader — the state after head block bn — but scanned its storage at Min(bn), the first txNum of bn, which is the state after bn-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, uses Min(blockNumber+1).

eth_getProof resolved 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 a PrunedError or a root-hash mismatch instead of reporting that the block is not executed yet.

Changes

  • parity_api.goMin(bn)Min(bn+1) so the storage scan matches the account read.
  • eth_call.go — gate GetProof on rpchelper.CheckBlockExecuted after resolution.

…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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_listStorageKeys storage scan from Min(bn) to Min(bn+1) so it matches the latest-state account read.
  • Add an execution-progress gate (rpchelper.CheckBlockExecuted) to eth_getProof after 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.

Comment thread rpc/jsonrpc/parity_api.go
Comment thread rpc/jsonrpc/eth_call.go
… 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.
@awskii
awskii added this pull request to the merge queue Aug 11, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 11, 2026
@AskAlexSharov
AskAlexSharov added this pull request to the merge queue Aug 11, 2026
Merged via the queue into main with commit 5c2ac90 Aug 11, 2026
138 checks passed
@AskAlexSharov
AskAlexSharov deleted the awskii/rpc-preexisting-state-fixes branch August 11, 2026 17:48
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.

4 participants