Test Top Frame Charges¶
Documentation for tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_top_frame_charges.py@49633827.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_top_frame_charges.py --fork Amsterdam
Dedicated tests for the EIP-2780 top-frame charge layer.
The top-frame layer applies after intrinsic gas is deducted but before the EVM dispatches at the transaction's outermost frame. Two charges may fire there, depending on the recipient:
NEW_ACCOUNT(state gas) when the recipient is empty and the transaction transfers value, or when a creation transaction's target leaf did not exist before the transaction.COLD_ACCOUNT_ACCESS(execution gas) when the recipient holds an EIP-7702 delegation.
Each test parametrizes over the interesting outcomes for that charge: running out of gas at the boundary, succeeding through the charge and into the EVM, and (for the execution charge) succeeding through the charge but reverting from the delegated code. For creation transactions, the charge keys on the transaction pre-state being empty, and — being consumed on any successful halt — survives the created account's own destruction.
Test Functions Overview¶
| Name | Type | Cases (Amsterdam) | Description |
|---|---|---|---|
test_initcode_selfdestruct_keeps_top_frame_state_charge |
state_test | 6 | A creation transaction whose init code SELFDESTRUCTs keeps the |
test_initcode_selfdestruct_state_gas_in_header |
blockchain_test | 1 | The top-frame NEW_ACCOUNT surviving an init-code |
test_receipt_status_top_frame_oog_between_successful_txs |
blockchain_test | 3 | Pin the failed receipt status of a top-frame OOG transaction that |
test_top_frame_execution_charge |
state_test | 6 | Recipient is an existing EIP-7702 delegation, so the top-frame |
test_top_frame_new_account_charged_as_state_gas |
blockchain_test | 1 | The top-frame NEW_ACCOUNT charge for a value transfer to an |
test_top_frame_new_account_skipped_for_create_target_funded_same_block |
blockchain_test | 2 | A creation transaction whose target was funded by an *earlier |
test_top_frame_new_account_skipped_for_nonce_only_recipient |
state_test | 1 | A recipient that is alive only by its nonce (nonce=1, zero |
test_top_frame_new_account_skipped_for_prefunded_create_target |
state_test | 2 | A creation transaction whose nonce-derived target address already |
test_top_frame_state_charge |
state_test | 2 | Recipient is empty and the transaction transfers a non-zero value, |
test_top_frame_state_charge_empty_precompile |
state_test | 1 | An empty precompile recipient is still empty per EIP-161, so a |