Skip to content

rpc: skip zero→zero keys in detectCollapseSiblings to reduce extra witness nodes#21491

Merged
lupin012 merged 7 commits into
mainfrom
lupin012/fix_witness_zero_zero
May 30, 2026
Merged

rpc: skip zero→zero keys in detectCollapseSiblings to reduce extra witness nodes#21491
lupin012 merged 7 commits into
mainfrom
lupin012/fix_witness_zero_zero

Conversation

@lupin012
Copy link
Copy Markdown
Contributor

@lupin012 lupin012 commented May 28, 2026

detectCollapseSiblings: skip accounts and storage slots whose encoded value is zero both before and after the block (zero→zero no-ops), preventing spurious CollapseTracer fires that added extra nodes to the witness.

debug_executionWitness — witness node count vs Geth

Test Block Geth Erigon before Erigon after Δ before Δ after Status
test_01 15,537,393 1,264 1,265 1,264 +1 0 ✅ fixed
test_02 16,999,999 3,796 3,798 3,796 +2 0 ✅ fixed
test_03 17,034,869 8,731 8,749 8,745 +18 +14 improved −4
test_04 17,999,999 4,853 4,870 4,863 +17 +10 improved −7
test_05 19,426,586 1,060 1,060 1,060 0 0 ✅ pass
test_06 19,999,999 5,782 5,796 5,786 +14 +4 improved −10
test_08 15,999,999 6,265 6,269 6,265 +4 0 ✅ fixed
test_09 18,999,999 3,863 3,874 3,868 +11 +5 improved −6
test_10 20,999,999 6,264 6,267 6,264 +3 0 ✅ fixed

Issue #21312

lupin012 and others added 3 commits May 28, 2026 15:14
Zero→zero SSTORE no-ops were passed to ComputeCommitment as
DeleteUpdate on absent keys, corrupting the HPH trie's internal maps
and triggering spurious CollapseTracer fires → extra witness nodes.

Fix: touchNonZeroKeys replaces touchAll in collapse detection; it reads
pre- and post-block values and skips any key that is zero in both states.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lupin012 lupin012 requested a review from awskii May 28, 2026 13:58
@lupin012 lupin012 changed the title rpc: fix witness zero zero rpc: skip zero→zero keys in detectCollapseSiblings to reduce extra witness nodes May 28, 2026
@awskii
Copy link
Copy Markdown
Member

awskii commented May 28, 2026

With this branch, zkEVM test suite now is on 94% passing rate

@awskii
Copy link
Copy Markdown
Member

awskii commented May 28, 2026

doing much better than my filtering change here #21484 so i close mine in favor of this PR

@awskii awskii marked this pull request as ready for review May 30, 2026 00:59
@awskii awskii requested a review from yperbasis as a code owner May 30, 2026 00:59
@awskii awskii enabled auto-merge May 30, 2026 00:59
@lupin012 lupin012 disabled auto-merge May 30, 2026 12:17
… common.Hash

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lupin012 lupin012 added this pull request to the merge queue May 30, 2026
Merged via the queue into main with commit adb7708 May 30, 2026
89 checks passed
@lupin012 lupin012 deleted the lupin012/fix_witness_zero_zero branch May 30, 2026 22:39
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.

2 participants