Skip to content

execution/tests: enforce checkNonce/checkTransaction in state harness#21001

Merged
yperbasis merged 2 commits intomainfrom
yperbasis/issue20684
May 6, 2026
Merged

execution/tests: enforce checkNonce/checkTransaction in state harness#21001
yperbasis merged 2 commits intomainfrom
yperbasis/issue20684

Conversation

@yperbasis
Copy link
Copy Markdown
Member

Summary

  • The state-test harness was building Messages with checkNonce=false and checkTransaction=false, bypassing the EIP-2681 saturated-nonce guard and the EIP-3607 / EIP-7702 sender-code check in preCheck.
  • Without those checks, erigon silently executed transactions from senders with malformed delegation designators (prefix-only, short, or trailing-junk code — anything not matching the strict 23-byte 0xef0100||addr form) and from senders whose nonce was already 2^64-1, producing post-state roots that diverged from geth (whose harness runs the equivalents unconditionally).
  • Adds the four reproducer fixtures from State-test sender validation divergences for EIP-7702 malformed delegation code and EIP-2681 saturated nonce #20684 under test-corners/state/ for regression coverage.

Fixes #20684

Test plan

  • evm statetest on all four issue fixtures returns the geth-matching reject-state roots (0xf224752f…, 0x032cd985…, 0xad6d4201…, 0x81198fa9…)
  • TestStateCornerCases passes (now picks up the four new fixtures)
  • TestLegacyCancunState + TestState pass (full legacy + EEST static state-test sweep)
  • make lint clean

🤖 Generated with Claude Code

…rness

The state-test harness was passing checkNonce=false and checkTransaction=false
to NewMessage, bypassing the EIP-2681 saturated-nonce guard and the
EIP-3607 / EIP-7702 sender-code check in preCheck. With the checks off,
erigon silently executed transactions from senders with malformed
delegation designators (prefix-only, short, or trailing-junk code -
anything not matching the strict 23-byte 0xef0100||addr form) and from
senders whose nonce was already 2^64-1, producing post-state roots that
diverged from geth (whose harness runs the equivalent checks
unconditionally).

The four reproducer fixtures from the issue are added under
test-corners/state/ for regression coverage.

Fixes #20684

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens the execution state-test harness to enforce the same sender/nonce validity checks as real transaction processing (and as geth’s state-test harness), fixing consensus/root divergences that occurred when invalid transactions were inadvertently executed during state tests.

Changes:

  • Enable checkNonce and checkTransaction when constructing types.Message in the state-test harness.
  • Add four regression state-test corner fixtures covering malformed EIP-7702 delegation designators and EIP-2681 saturated nonce rejection.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
execution/tests/testutil/state_test_util.go Enables nonce and sender transaction pre-checks in the state-test message builder.
execution/tests/test-corners/state/eip7702-trailing-junk-delegation-sender.json Adds a corner-case fixture for malformed delegation designator with trailing junk.
execution/tests/test-corners/state/eip7702-short-target-delegation-sender.json Adds a corner-case fixture for malformed delegation designator with a short target.
execution/tests/test-corners/state/eip7702-prefix-only-delegation-sender.json Adds a corner-case fixture for prefix-only (malformed) delegation designator sender code.
execution/tests/test-corners/state/eip2681-max-sender-nonce.json Adds a corner-case fixture for saturated sender nonce (2^64-1) rejection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread execution/tests/test-corners/state/eip7702-prefix-only-delegation-sender.json Outdated
Comment thread execution/tests/test-corners/state/eip2681-max-sender-nonce.json Outdated
The harness's stJSON struct only declares Env/Pre/Tx/Out/Post, so the
config.blobSchedule.Osaka block in the four reproducer fixtures was
silently discarded by the parser. Removing it avoids the misleading
mismatch between the unused Osaka schedule and the Prague/Berlin forks
the tests actually run at.

Addresses Copilot review feedback on #21001.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@yperbasis yperbasis added this pull request to the merge queue May 6, 2026
Merged via the queue into main with commit f6e2a5e May 6, 2026
38 checks passed
@yperbasis yperbasis deleted the yperbasis/issue20684 branch May 6, 2026 08:19
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.

State-test sender validation divergences for EIP-7702 malformed delegation code and EIP-2681 saturated nonce

3 participants