Skip to content

test: Regression-test top-level tx execution at sender nonce 2^64-2#1608

Merged
chfast merged 1 commit into
ipsilon:masterfrom
cavdarahmet:add-regression-test-nonce-max-minus-1-tx
Jul 22, 2026
Merged

test: Regression-test top-level tx execution at sender nonce 2^64-2#1608
chfast merged 1 commit into
ipsilon:masterfrom
cavdarahmet:add-regression-test-nonce-max-minus-1-tx

Conversation

@cavdarahmet

Copy link
Copy Markdown
Contributor

Closes #1495 (I think — see note below).

A top-level CALL or CREATE transaction from a sender at nonce 2^64-2 must
execute normally; only nonce == 2^64-1 is invalid per EIP-2681. #1495
reported that evmone incorrectly aborted such transactions as a "light
failure" after bumping the sender's nonce.

I could not reproduce the bug on current master. It looks like it was
fixed incidentally by #1589 ("Compute the create address in the VM"),
which moved the EIP-2681 nonce check out of the path shared by all
depth-0 messages and into create_impl, which only runs for nested,
bytecode-triggered CREATE/CREATE2. That PR doesn't mention #1495 or
EIP-2681, so this may be worth double-checking on your end.

Since there was no test covering this scenario, I added two (CALL and
CREATE, both at sender nonce 2^64-2) so a future refactor can't
silently reintroduce the bug.

Tested with ctest -R "evmone/unittests": 1133/1133 passed.

@chfast

chfast commented Jul 22, 2026

Copy link
Copy Markdown
Member

Thanks for the report and test. I'm aware of the issue, but it may take some time to fix it (it has lower priority due to unrachability in real networks).

@cavdarahmet

Copy link
Copy Markdown
Contributor Author

Thanks for the reply! Just to clarify — #1495 itself already looks resolved (fixed by #1589, confirmed by bisecting with evmone-cli t8n), so it's probably fine to close that one. Thanks for looking into it!

@chfast
chfast force-pushed the add-regression-test-nonce-max-minus-1-tx branch 2 times, most recently from 3596179 to c55fd60 Compare July 22, 2026 17:44
Per EIP-2681 only a transaction with nonce >= 2^64-1 is invalid; an
account nonce that merely reaches 2^64-1 during an otherwise valid
transaction must not abort execution. Before ipsilon#1589 the create-address
host path re-checked the sender nonce against MAX_NONCE for every
depth-0 message, after transition() had already bumped it, so a
top-level CALL or CREATE from a sender at 2^64-2 (ipsilon#1495) -- and a
set-code tx whose self-signed authorization bumps the sender to 2^64-1
(ipsilon#1496) -- were wrongly aborted as light failures. ipsilon#1589 dissolved that
host path, leaving the EIP-2681 check only in tx validation (pre-bump)
and create_impl (nested CREATE), which incidentally fixed both cases.

Add regression tests so a future refactor cannot silently reintroduce
the abort: top-level CALL and CREATE at sender nonce MAX_NONCE - 1, and
an EIP-7702 self-authorization that drives the sender to MAX_NONCE. The
7702 test asserts a storage write by the top-level callee, proving the
call executed rather than being skipped.

Co-authored-by: Ahmet <mail.a.cavdar@gmail.com>
@chfast
chfast force-pushed the add-regression-test-nonce-max-minus-1-tx branch from c55fd60 to d0563c1 Compare July 22, 2026 18:00
@chfast
chfast merged commit bef66c9 into ipsilon:master Jul 22, 2026
18 of 21 checks passed
LouisTsai-Csie pushed a commit to ethereum/execution-specs that referenced this pull request Jul 24, 2026
Add regression tests verifying that reaching the maximum account nonce
(2**64-1) during execution is valid: per EIP-2681 only a transaction whose
nonce is 2**64-1 is invalid, not one that merely increments an account to
that value.

Ported from ipsilon/evmone#1608:

* top-level CALL from a sender at nonce 2**64-2
* top-level CREATE from a sender at nonce 2**64-2 (created-account nonce
  fork-gated per EIP-161)
* EIP-7702 self-sponsored set-code tx whose authorization drives the sender
  to 2**64-1
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.

Top-level tx at nonce 2^64-2 is skipped as light failure (EIP-2681 mismatch)

2 participants