execution/commitment: materialize collapse-sibling branch in toWitnessTrie - #21892
Merged
Merged
Conversation
…n witness debug_executionWitness left the surviving sibling of a collapsing storage branch blinded on a zero-value write: the sibling extension was emitted but the branch it points to stayed a bare HashNode, so a strict sparse-trie verifier (reth) could not re-form the collapsing branch and the post-state root diverged (#21869). In exclusion-proof (legacy) mode, materialize that branch via witnessMaterializeBranch with a subtrie-root check, mirroring the absent-slot exclusion path; both materializing sites now share witnessMaterializeBranchChild. Canonical mode stays minimal.
AskAlexSharov
approved these changes
Jun 19, 2026
The diverging-extension site half-built the ShortNode and left its Val to be filled later in two separate pathDivergenceFound blocks (the FullNode and AccountNode cases). Build the child in one place via witnessDivergedBranchChild — the materialized branch in exclusion-proof mode, else its hash (computed when the cell carries no hash-ref) — and drop both fill-in blocks. No behavior change: the absent-account, absent-slot, and collapse-sibling witness tests cover the diverged paths and the witness root stays equal to the commitment root.
Member
Author
|
Comparing What the reth-only nodes are
Do we need them? No. Three independent reasons:
|
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.
debug_executionWitnessblinded the surviving sibling of a collapsing storage branch on a zero-value write (#21869). On a slot delete from a two-child branch,toWitnessTrieemitted the sibling extension but left the branch it points to a bareHashNode. reth'sstatelessverifier can't re-form the collapsed branch from a blinded node, so it returnsBlindedNodeand the post-state root diverges.Repro: mainnet block 25335936, zero-write to slot
0x43cb…, sibling0x43cdblinded →SparseTrieError(BlindedNode(Nibbles(0x43cd))).Fix: in exclusion-proof (legacy) mode, materialize that branch via
witnessMaterializeBranchwith a subtrie-root check instead of aHashNode. Same hash, witness root unchanged; canonical mode stays minimal. The absent-slot path and this one now sharewitnessMaterializeBranchChild.Test:
Test_WitnessTrie_GenerateWitness/CollapseSiblingExtensionMustBeMaterialized— two-child storage branch, sibling is an extension over a sub-branch, delete the other child, assert the sub-branch is aFullNodenot aHashNode. End-to-end: block 25335936 witness passes rethstateless(VALID; state nodes 16395 → 16396).Fixes #21869