execution/stagedsync: drop block write buffer from calcFees/finalize readers (#23140) - #23147
Closed
sudeepdino008 wants to merge 1 commit into
Conversation
…ize readers (#23140) calcFees and finalize (finalizeTx and the block-end finalizeSystemTx) read through NewVersionedStateReader(be.versionMap, ...), so the version map supplies all accumulated in-block state. The state reader passed alongside is only the pre-block base. It therefore does not need the BlockStateCache write buffer. Pass nil block cache to these readers. Values are unchanged: a version-map miss means no tx wrote the key, so the read falls to the pre-block base, which the plain reader serves. The finalize-comment claiming the buffer is load-bearing was stale — the version map has supplied in-block state since the parallel commitment work landed. The block-complete engine.Finalize IBS (withdrawals/EIP-7002/7251) still uses the write buffer; a later part of #23140 moves it to the version map.
sudeepdino008
added a commit
that referenced
this pull request
Aug 11, 2026
… map (#23140) The block-complete engine.Finalize IBS (withdrawals, EIP-7002/7251 system calls) read prior-tx in-block state through the BlockStateCache write buffer via an empty local version map. Give it be.versionMap and a pre-block-only reader: at block end every cell is Done and versionedReadCore applies self-destruct/revival, so the version map is a strict superset of the old blockCache read for this reader — and fixes the block 24839300 trie-root race (a tip-adjacent historic block's withdrawal read the pre-block balance and stomped a prior tx's update). TestFinalizeIBSSeesVersionMapWrite pins it. The per-tx calcFees/finalize readers keep the block write buffer. Dropping it there (folded-out #23147) regressed the 2016 EIP-161 empty-account sweep window: CachedReaderV3.ReadAccountData populates the buffer's committed tier as a read side-effect that feeds the deferred-commitment touchmap, so a nil base corrupted the commitment structure and produced a wrong trie root some blocks later (block 2676607 on a from-0 mainnet re-execution).
Member
Author
|
Folding this out. Its change (nil block cache for the per-tx calcFees/finalize readers) regressed the 2016 EIP-161 empty-account sweep window: |
sudeepdino008
added a commit
that referenced
this pull request
Aug 12, 2026
… map (#23140) The block-complete engine.Finalize IBS (withdrawals, EIP-7002/7251 system calls) read prior-tx in-block state through the BlockStateCache write buffer via an empty local version map. Give it be.versionMap and a pre-block-only reader: at block end every cell is Done and versionedReadCore applies self-destruct/revival, so the version map is a strict superset of the old blockCache read for this reader — and fixes the block 24839300 trie-root race (a tip-adjacent historic block's withdrawal read the pre-block balance and stomped a prior tx's update). TestFinalizeIBSSeesVersionMapWrite pins it. The per-tx calcFees/finalize readers keep the block write buffer. Dropping it there (folded-out #23147) regressed the 2016 EIP-161 empty-account sweep window: CachedReaderV3.ReadAccountData populates the buffer's committed tier as a read side-effect that feeds the deferred-commitment touchmap, so a nil base corrupted the commitment structure and produced a wrong trie root some blocks later (block 2676607 on a from-0 mainnet re-execution).
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.
Part 2 of removing
BlockStateCache(#23140). Stacked on #23146.calcFeesandfinalize(per-txfinalizeTxand the block-endfinalizeSystemTx) read throughNewVersionedStateReader(be.versionMap, ...). The version map supplies all accumulated in-block state; the state reader passed alongside is only the pre-block base. So these readers do not need theBlockStateCachewrite buffer.This passes
nilblock cache to those readers. Values are unchanged — a version-map miss means no tx wrote the key, so the read falls to the pre-block base, which the plain reader serves. The finalize comment claiming the buffer was load-bearing was stale; the version map has supplied in-block state since the parallel-commitment work landed.The block-complete
engine.FinalizeIBS (withdrawals, EIP-7002/7251) still uses the buffer via an empty local version map. The next part moves it tobe.versionMap.