Skip to content

rpc/jsonrpc: omit empty keys and order witness headers ascending#21532

Merged
awskii merged 2 commits into
mainfrom
awskii/witness-keys-headerorder
May 31, 2026
Merged

rpc/jsonrpc: omit empty keys and order witness headers ascending#21532
awskii merged 2 commits into
mainfrom
awskii/witness-keys-headerorder

Conversation

@awskii

@awskii awskii commented May 30, 2026

Copy link
Copy Markdown
Member

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 #21529. Refs #20534.

@awskii awskii requested review from lupin012 and yperbasis as code owners May 30, 2026 21:08
Base automatically changed from awskii/witness-blockhash-headers to main May 30, 2026 23:05
@lupin012 lupin012 added the RPC label May 31, 2026
AskAlexSharov pushed a commit that referenced this pull request May 31, 2026
Return `headers` as RLP-encoded bytes instead of JSON header objects,
matching the canonical witness format a stateless verifier consumes.
Field type `[]map[string]any` → `[]hexutil.Bytes`; drops
`marshalWitnessHeader`.

Diverges from Geth's `debug_executionWitness` (header objects) —
deliberate, the target is the canonical format.

Corpus (zkevm@v0.4.0): header hashes match (RLP round-trips), 2846/2881,
no regressions. Suite's `rpcHeaderHashes` switches to RLP decode with
#21487.

Stacked on #21532. Refs #20534.
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.
@awskii awskii force-pushed the awskii/witness-keys-headerorder branch from 295f431 to d90014f Compare May 31, 2026 13:44
@awskii awskii added this pull request to the merge queue May 31, 2026
@awskii awskii removed this pull request from the merge queue due to a manual request May 31, 2026
Return `headers` as RLP-encoded bytes instead of JSON header objects,
matching the canonical stateless-witness format (Reth compatibility).
Field type `[]map[string]any` → `[]hexutil.Bytes`; drops
`marshalWitnessHeader`.

Diverges from Geth's `debug_executionWitness` (header objects) —
deliberate; the target is Reth-canonical.

Corpus (zkevm@v0.4.0): header hashes match (RLP round-trips), no
regressions, no decode errors.

Re-raise of the earlier #21537 (its branch was lost). Stacked on #21532.
Refs #20534.
@awskii awskii enabled auto-merge May 31, 2026 16:19
@awskii awskii added this pull request to the merge queue May 31, 2026
Merged via the queue into main with commit ac68bfc May 31, 2026
89 checks passed
@awskii awskii deleted the awskii/witness-keys-headerorder branch May 31, 2026 17:29
awskii added a commit that referenced this pull request Jun 1, 2026
main (#21532) changed ExecutionWitnessResult.Headers to []hexutil.Bytes
(RLP-encoded). Update rpcHeaderHashes to RLP-decode like expectedHeaderHashes
instead of reading a map["hash"] field.
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.

3 participants