Skip to content

Test Warmth Invariants

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

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_warmth_invariants.py --fork Amsterdam

EIP-2780 invariants for transaction-level account charges.

Two distinct charges are exercised here, and they treat warmth differently:

  • The recipient's intrinsic COLD_ACCOUNT_ACCESS is charged in the intrinsic phase, without reading state, so it is always cold: listing tx.to in the access list pays the access-list cost but does not waive it, and the protocol-warmed coinbase is still charged cold when it is the recipient.
  • A delegated recipient's delegation-target access is a top-frame charge that reads state, so it follows normal warm/cold accounting: WARM_ACCESS when the target is already warm -- the sender, the coinbase, a precompile, the recipient itself, or an access-list entry -- and COLD_ACCOUNT_ACCESS otherwise. The dispatched EVM frame then runs whatever code lives at the target, including the degenerate cases of empty code (EOA, precompile address) or a delegation prefix that itself decodes as the INVALID opcode.

Test Functions Overview

Name Type Cases (Amsterdam) Description
test_intrinsic_charges_recipient_in_access_list state_test 2 Recipient is listed in the access list. The intrinsic charge still
test_intrinsic_charges_recipient_is_coinbase state_test 2 Recipient is the block coinbase, which is implicitly warm before
test_sender_is_coinbase state_test 2 Sender is the block coinbase. The intrinsic charge is unchanged
test_top_frame_charges_delegation_in_access_list state_test 4 Recipient holds a pre-existing EIP-7702 delegation; the delegation
test_top_frame_charges_delegation_is_coinbase state_test 2 Recipient holds a pre-existing EIP-7702 delegation whose target is
test_top_frame_charges_delegation_is_precompile state_test 2 Recipient holds a pre-existing EIP-7702 delegation pointing at a
test_top_frame_charges_delegation_is_recipient state_test 2 Recipient holds a pre-existing EIP-7702 delegation pointing back
test_top_frame_charges_delegation_is_sender state_test 2 Recipient holds a pre-existing EIP-7702 delegation whose target is