Skip to content

Update EIP-8250: charge keyed nonce first use as state gas - #12279

Merged
eth-bot merged 1 commit into
ethereum:masterfrom
soispoke:codex/eip-8250-first-use-state-gas
Sep 2, 2026
Merged

Update EIP-8250: charge keyed nonce first use as state gas#12279
eth-bot merged 1 commit into
ethereum:masterfrom
soispoke:codex/eip-8250-first-use-state-gas

Conversation

@soispoke

@soispoke soispoke commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

EIP-8141 gives each frame separate execution gas and state gas budgets. EIP-8250 still charges 20,000 gas for creating a keyed nonce from the approving frame's execution gas.

This PR:

  • charges keyed nonce creation as state gas, drawn from state_gas_left and recorded in gas_used.state, not gas_used.execution;
  • prices it at EIP-8037's cost for one new storage slot, STATE_BYTES_PER_STORAGE_SET * CPSB (currently 97,920), since each fresh key creates one ordinary persistent slot;
  • states the sender account creation charge for the legacy key [0] in the same transition, so keyed nonce transactions, which never create the sender account, do not pay it;
  • keeps the state gas charge, nonce consumption, and payment approval atomic;
  • extends EIP-8141 Structural Rule 6 so a VERIFY frame may use state gas for this charge. It counts toward MAX_VERIFY_STATE_GAS, not MAX_VERIFY_GAS.

For example, a transaction with two fresh keys budgets 195,840 state gas on its approving frame. The payer still pays it and it still counts toward block state gas, but it no longer consumes validation execution gas. Under the current 500,000 MAX_VERIFY_STATE_GAS, a validation prefix with no other state budget can create at most five fresh keys.

@github-actions github-actions Bot added c-update Modifies an existing proposal s-draft This EIP is a Draft t-core labels Sep 2, 2026
@eth-bot

eth-bot commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

✅ All reviewers have approved.

@soispoke
soispoke force-pushed the codex/eip-8250-first-use-state-gas branch 2 times, most recently from 897787f to 92e77c4 Compare September 2, 2026 06:45
@soispoke
soispoke force-pushed the codex/eip-8250-first-use-state-gas branch from 92e77c4 to 94bb25e Compare September 2, 2026 06:48
@soispoke
soispoke marked this pull request as ready for review September 2, 2026 06:54
@soispoke
soispoke requested a review from eth-bot as a code owner September 2, 2026 06:54
Comment thread EIPS/eip-8250.md
A "send another transaction with the same legacy nonce" cancellation strategy does not invalidate a pending non-zero-key frame transaction. Replacement requires the same `(sender, nonce_keys, nonce_seq)` under the relevant mempool replacement rules, or another transaction that intentionally consumes an overlapping keyed domain.

Each consumed `(sender, nonce_key != 0)` occupies one persistent slot in `NONCE_MANAGER` storage; entries are not deleted. State growth is priced by `KEYED_NONCE_FIRST_USE_GAS` per first-use key, bounding new keyed slots per block by the block gas limit divided by `20000`, before accounting for other transaction costs. `nonce_seq == MAX_NONCE_SEQ` is reserved as the exhausted state; a key whose current sequence reaches it cannot be advanced further.
Each consumed `(sender, nonce_key != 0)` occupies one persistent slot in `NONCE_MANAGER` storage, and entries are never deleted. Creating a slot consumes state gas, so a block can create at most `block_gas_limit // KEYED_NONCE_FIRST_USE_STATE_GAS` new keyed nonce slots. `nonce_seq == MAX_NONCE_SEQ` represents an exhausted key; a key at that sequence cannot advance further.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since first use is now charged as state gas, should this per-block bound divide by the block state gas limit rather than block_gas_limit? EIP-8037 gives state gas its own block dimension, so the effective cap on new keyed slots per block looks tighter than block_gas_limit // KEYED_NONCE_FIRST_USE_STATE_GAS.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

EIP-8037 gives state gas a separate used counter, but not a separate limit so both dimensions are independently capped by the same block_gas_limit

the current formula is the absolute maximum when no other state gas is used

at any point in a block, the remaining capacity is (block_gas_limit - block_state_gas_used) // KEYED_NONCE_FIRST_USE_STATE_GAS

@eth-bot
eth-bot enabled auto-merge (squash) September 2, 2026 11:37

@eth-bot eth-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All Reviewers Have Approved; Performing Automatic Merge...

@eth-bot
eth-bot merged commit 94f5a3e into ethereum:master Sep 2, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c-update Modifies an existing proposal s-draft This EIP is a Draft t-core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants