fix(l2): normalize legacy omitted-withdrawals bodies read from trusted history #7106
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 521 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.374
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7106"
general
weight: 0.35
ElFantasma
Motivation
Older ethrex versions stored post-Shanghai blocks with
withdrawals: Nonewhile the header committed to the empty-withdrawals root.validate_block_bodyrejects that shape, so re-reading such a block from local history fails withWithdrawalsRootNotMatch.The normalization helper and its first call sites already reached
mainby another route, so what remains here are the follow-ups that came out of review, and one of them is load-bearing for a failure that only shows up inside the prover:generate_batch_prover_inputhandsProverInputData.blocksto the guest, and the guest re-encodes those exact blocks and KZG-checks the result against the committed blob (crates/guest-program/src/l2/blobs.rs).BlockBody::encodeusesencode_optional_field, so an absentwithdrawalsfield is omitted while an empty one writes0xc0. Becauseprepare_batch_from_blocknormalizes beforegenerate_blobs_bundle, the blob for a batch containing legacy blocks holds the canonical encoding — so a prover-input path that did not normalize would differ by one byte and fail asInvalidBlobProofinside the zkVM. That is the concrete failure behind the review comment asking forgenerate_batch_prover_inputto normalize too.Description
read_trusted_block(crates/l2/sequencer/utils.rs) is now the only place a block is read from the store and normalized, and bothprepare_batch_from_blockandfetch_blocks_with_respective_fee_configsgo through it. Previously the two duplicated the store read and each carried its own normalization call, so correctness depended on two sites staying identical with nothing pinning them together — and the penalty for drift is a one-byte RLP mismatch surfacing as a KZG failure inside the guest. Routing both through one helper makes the coupling structural. It returnsOk(None)for a missing body, preserving the committer's "no new block to commit" loop exit instead of turning it into an error.ethrex importdeliberately left strict. It still rejects legacy bodies, so an RLP export from a pre-upgrade node cannot be re-imported. That is the mirror image of thereconstructblob-dir case, which this work does normalize, and the asymmetry is intentional:reconstructreads blobs the node itself published to L1 and re-checks them against the committed root, whereasimporttakes an arbitrary file whose provenance the node cannot establish. Widening that boundary should be its own change with its own argument, not a side effect of this one.Noted while reviewing, not addressed here: the based follower applies L1-calldata blocks through
blockchain.add_block(crates/l2/based/block_fetcher.rs), which never callsvalidate_block_body— that path is unaffected by any of this, but it also body-validates nothing today.Checklist
STORE_SCHEMA_VERSION(crates/storage/lib.rs) if the PR includes breaking changes to theStorerequiring a re-sync. — n/a, noStorechanges