Update EIP-8250: charge keyed nonce first use as state gas - #12279
Conversation
|
✅ All reviewers have approved. |
897787f to
92e77c4
Compare
92e77c4 to
94bb25e
Compare
| 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
All Reviewers Have Approved; Performing Automatic Merge...
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:
state_gas_leftand recorded ingas_used.state, notgas_used.execution;STATE_BYTES_PER_STORAGE_SET * CPSB(currently 97,920), since each fresh key creates one ordinary persistent slot;[0]in the same transition, so keyed nonce transactions, which never create the sender account, do not pay it;VERIFYframe may use state gas for this charge. It counts towardMAX_VERIFY_STATE_GAS, notMAX_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.