core/blockstm, core: exclude base-code senders from V2 nonce pre-compute; harden witness parity harness - #2383
Merged
Merged
Conversation
…te code V2's same-sender nonce pre-compute assumed only a sender's own txs, or an in-block auth-list entry, can move its nonce. A sender carrying a delegation designator at base state can also have its nonce bumped by any CALL into it whose delegate code executes CREATE, which the auth-list exclusion does not cover since the delegation predates the block. Route such senders through the MVStore-aware nonce path so the read is recorded and validated, matching the serial processor's result. Adds V2Env.BaseCodeSize, a computeSenderNonces unit case, and an integration test executing a block with a base-state-delegated sender through V2. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…stdata codes The 241-block harness compared state roots even when V2 surfaced a ReadErr, which drops the affected tx at settlement and shows up as a misleading root mismatch; the serial helper never checked StateDB.Error at all. Both now fail the block explicitly. The dataset builder fetched code only for tx.To() addresses and cached it by address without a block dimension, so EIP-7702 authorities re-delegated between dataset blocks had stale or missing pre-block designators. Fetch authorities too, key the cache by block, verify fetched code against the account's code hash, and add the three designators missing for blocks 83014074, 83014100 and 83020871. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2383 +/- ##
===========================================
+ Coverage 55.21% 55.23% +0.01%
===========================================
Files 912 912
Lines 165870 165880 +10
===========================================
+ Hits 91591 91625 +34
+ Misses 68818 68789 -29
- Partials 5461 5466 +5
... and 17 files with indirect coverage changes
🚀 New features to boost your workflow:
|
cffls
marked this pull request as ready for review
September 2, 2026 23:03
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
Contributor
Author
|
@claude review |
pratikspatil024
approved these changes
Sep 3, 2026
marcello33
approved these changes
Sep 4, 2026
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.
Summary
V2 BlockSTM nonce pre-compute.
computeSenderNoncespre-assigns nonces for senders with two or more txs in a block, on the assumption that only the sender's own txs (or an in-block EIP-7702 auth-list entry, already excluded) can move its nonce. A sender that carries a delegation designator at base state breaks that assumption: any CALL into it runs the delegate code in the sender's own frame, and a CREATE there bumps the sender's nonce mid-block. Because aSenderNonceshit short-circuitsPDB.GetNoncewithout recording a read, validation could never correct the stale value, so V2 and the serial processor could disagree on such a block. Senders with base-state code are now excluded from the pre-compute and take the MVStore-aware nonce path (read recorded and validated), matching serial. AddsV2Env.BaseCodeSize, acomputeSenderNoncesunit case, and an integration test that runs a block with a base-state-delegated sender through V2.Witness parity harness and testdata. While verifying with the 241-block mainnet witness suite,
TestV2BlockSTMAllBlocksreported 3 stateRoot mismatches ondevelop(not onmaster). Root cause was a testdata gap exposed by #2180's base-read-error detection, not an executor bug: three blocks contain a SetCodeTx whose authority was already delegated, and the authority's pre-block designator blob was missing fromcodes.tar.gz. Serial reads the same blob, gets nil, and silently proceeds (the harness never checkedStateDB.Error); V2 now surfacesReadErrand drops the tx at settlement, which the harness misreported as a root mismatch.masterpassed only because its V2 had no read-error detection at all. Fixes: the V2 runner fails onReadErr,executeStatelessSerialsurfacesStateDB.Error, both runners count serial errors as failures, the dataset builder now fetches 7702 authorities, keys its cache by block, and verifies fetched code against the account hash, and the three missing designators are supplied (two reconstructed and keccak-verified from the dataset's own auth lists, one via a historicaleth_getCode).Performance. Measured on the 241 mainnet blocks (48,920 txs):
BaseNonce, every sender)BaseCodeSize, multi-tx senders only)The exclusion fired 0 times across 5,371 multi-tx senders, and V2 exec/vfail counts are unchanged within noise (58,306/9,386 on
developvs 57,797/8,877 here).diffguard (
-base origin/develop, mutation on): complexity max 9, sizes/churn/dead-code pass, mutation 100% (12/12). It also reports acore -> coredependency cycle, which is a tool artifact (the diff adds no import lines to any non-test file and Go rejects self-imports).Executed tests
BOR_BLOCKSTM_TEST=1 go test ./core/ -run TestV2BlockSTMAllBlocks— 241/241 consistent, 0 failures (238/241 ondevelopbefore the testdata fix; 241/241 onmaster).BOR_BLOCKSTM_TEST=1 go test ./core/ -run TestAllBlocksConsistency— 241/241 consistent, 0 failures.go test ./core/blockstm/— full package.go test ./core/ -run 'TestV2_DelegatedSenderNonceParity|TestV2_DelegateCodeReadConsistency|TestV2_ExistMissesPriorTxNonce|TestV2SerialParity_MetamorphicCreate2|TestV2ExecutorVsSerial_SeedCorpus'.nonce too low); after, both reject it identically.Rollout notes
Consensus-relevant: changes which senders V2 pre-computes nonces for, bringing V2 into line with the serial processor for delegated senders. No protocol, config, or storage change; backwards-compatible; no coordinated upgrade required. Nodes running
parallelevm.enable=true(the default) should pick this up in the next release. Everything else in the PR is test-only.🤖 Generated with Claude Code