Skip to content

Test Top Frame Charges

Documentation for tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_top_frame_charges.py@5fa5938b.

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.
  • COLD_ACCOUNT_ACCESS (regular 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 regular charge) succeeding through the charge but reverting from the delegated code.

Test Functions Overview

Name Type Cases (Amsterdam) Description
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_nonce_only_recipient state_test 1 A recipient that is alive only by its nonce (nonce=1, zero
test_top_frame_regular_charge state_test 6 Recipient is an existing EIP-7702 delegation, so the top-frame
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