Skip to content

rpc/jsonrpc: include the full BLOCKHASH ancestor chain in executionWitness headers#21529

Merged
awskii merged 2 commits into
mainfrom
awskii/witness-blockhash-headers
May 30, 2026
Merged

rpc/jsonrpc: include the full BLOCKHASH ancestor chain in executionWitness headers#21529
awskii merged 2 commits into
mainfrom
awskii/witness-blockhash-headers

Conversation

@awskii
Copy link
Copy Markdown
Member

@awskii awskii commented May 30, 2026

headers carried only the parent plus blocks hit directly by BLOCKHASH. A stateless verifier validates each header against the next one's parentHash, so it needs the contiguous chain from the parent back to the oldest accessed block. Fill [oldest_accessed .. parent].

No-op when there's no BLOCKHASH gap.

Corpus (zkevm@v0.4.0): fixes 6 of 7 witness_headers fixtures; the 7th (extra_unused_older_ancestor) is a verifier-tolerance test a minimal producer can't match. Refs #20534.

…tness headers

The witness `headers` field carried only the parent header plus the blocks
individually reached via the BLOCKHASH opcode. A stateless verifier validates
each ancestor header against the next block's parentHash, so it needs a
*contiguous* chain from the parent back to the oldest accessed ancestor — the
intermediate headers between them are load-bearing even when no opcode read
them directly.

collectAccessedHeaders now fills the contiguous range [oldest-accessed .. parent]
instead of emitting a sparse set.

Measured against the EEST zkevm@v0.4.0 corpus, this fixes 6 of the 7
eip8025_optional_proofs/witness_headers fixtures (e.g. blockhash_at_offset,
blockhash_boundary, multiple_blockhash_max_wins). The 7th
(extra_unused_older_ancestor) is a verifier-tolerance test ("a contiguous extra
older ancestor should still validate") that a minimal producer cannot match by
strict equality.

Refs #21307.
@awskii awskii requested review from lupin012 and yperbasis as code owners May 30, 2026 13:11
@lupin012 lupin012 added the RPC label May 30, 2026
@awskii awskii added this pull request to the merge queue May 30, 2026
Merged via the queue into main with commit 30de80e May 30, 2026
90 checks passed
@awskii awskii deleted the awskii/witness-blockhash-headers branch May 30, 2026 23:05
awskii added a commit that referenced this pull request May 31, 2026
Two canonical-shape fixes for executionWitness:

- keys: omit when empty. It is never populated, so it always serialized as
  "keys": null; the canonical response shape is {state, codes, headers}.
- headers: emit the ancestor chain ascending by block number instead of
  descending from the parent.

Header order does not affect the test suite (headers compare as a multiset),
and keys carries no data; both align serialization with the canonical format.

Stacked on #21529 (contiguous header chain). Refs #21307, #20534.
pull Bot pushed a commit to Dustin4444/erigon that referenced this pull request May 31, 2026
…gontech#21532)

Two canonical-shape fixes:
- `keys`: omitempty. Never populated, so it always serialized as
`"keys": null`; canonical shape is `{state, codes, headers}`.
- `headers`: emit ascending by block number (was descending).

Order doesn't affect tests (multiset compare) and `keys` carries no data
— serialization alignment only.

Stacked on erigontech#21529. Refs erigontech#20534.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

debug_executionWitness should be 100% correct and work fine for Zilkworm

2 participants