Test Authorization Oog¶
Documentation for tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_authorization_oog.py@5fa5938b.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_authorization_oog.py --fork Amsterdam
Out-of-gas rollback semantics for EIP-7702 authorizations under EIP-2780.
At the top frame, EIP-2780 charges each authorization's
state-dependent cost in set_delegation and then charges the
recipient's or contract-creation NEW_ACCOUNT and any
delegation-resolution access -- all before dispatching the call. Two
snapshots bound these two phases:
- Prep-phase OOG -- a charge anywhere in the top-frame preparation
runs out: inside
set_delegation, on the recipient'sNEW_ACCOUNT, or on the delegation-resolution access. The whole preparation shares one snapshot, so every authorization applied so far is rolled back and the frame halts without dispatching. The transaction is still included and consumes its full regular budget; a state-gas reservoir, whose charges are refilled with the rollback, is returned to the sender in full. The sender nonce (bumped at inclusion, before the snapshot) is not rolled back. - Execution-phase failure -- the dispatched call itself reverts or runs out of gas. A second snapshot is taken after preparation, so the applied delegations persist, matching the EIP-7702 "dispatch reverts, delegation remains" rule.
Because the applied delegations persist across an execution-phase
failure, the state gas that paid for them (the authority's
NEW_ACCOUNT leaf and AUTH_BASE indicator bytes) must stay
consumed: only state gas whose state effects are rolled back with the
frame (e.g. an SSTORE inside the dispatched call) is refilled.
Test Functions Overview¶
| Name | Type | Cases (Amsterdam) | Description |
|---|---|---|---|
test_auth_state_charges_survive_dispatch_halt_with_reservoir |
state_test | 1 | The state gas charged for an applied authorization stays consumed |
test_auth_state_charges_survive_dispatch_revert |
state_test | 2 | The state gas charged for an applied authorization stays consumed |
test_auth_state_gas_in_header_on_dispatch_revert |
blockchain_test | 1 | The state gas of an applied authorization is counted in the block's |
test_delegation_persists_on_execution_oog |
state_test | 2 | Once the top-frame preparation completes, an out-of-gas in the |
test_dispatched_frame_state_gas_still_refills_on_revert |
state_test | 1 | State gas charged inside the dispatched call is still refilled |
test_recipient_charge_oog_rolls_back_delegations |
state_test | 4 | A recipient top-frame charge running out of gas rolls back the |
test_recipient_new_account_refilled_on_dispatch_halt_with_reservoir |
state_test | 1 | The recipient NEW_ACCOUNT charge is refilled when the dispatch |
test_reservoir_settlement_by_failure_point |
state_test | 4 | One transaction shape with a non-zero state-gas reservoir, failed |
test_reservoir_settlement_with_value_to_empty_recipient |
state_test | 3 | The many-authorization reservoir transaction, now moving value to an |
test_reverted_dispatch_state_gas_counts_toward_block_limit |
blockchain_test | 2 | The state gas persisted by a reverted transaction's authorization |
test_set_delegation_oog_charge_point |
state_test | 4 | OOG at each distinct charge point inside set_delegation rolls |
test_set_delegation_oog_rolls_back_first_auth |
state_test | 4 | Auth-phase rollback undoes every flavor of the surviving first |