Skip to content

Test Fork Transition

Documentation for tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_fork_transition.py@49633827.

Generate fixtures for these test cases for Amsterdam with:

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

Fork-transition tests for EIP-2780.

EIP-2780 reshapes the intrinsic transaction cost at the Amsterdam fork boundary. These tests send identical transactions in a pre-fork block and a post-fork block (straddling the transition timestamp) and assert that the per-transaction gas paid changes by the EIP-2780 amount only once the fork activates.

For these shapes the post-fork intrinsic decomposes from the flat pre-fork TX_BASE of 21_000 as follows:

  • A plain call to an existing account drops to TX_BASE (12_000) plus the new COLD_ACCOUNT_ACCESS recipient charge; adding value re-raises it to exactly 21_000 (the value-transfer cost is invariant across the fork by design).
  • A self-transfer is fully carved out post-fork: it pays only the lowered TX_BASE with no recipient or value-transfer charge, regardless of value, the largest reduction.
  • A contract creation splits the flat pre-fork TX_CREATE into the CREATE_ACCESS execution intrinsic and a top-frame NEW_ACCOUNT state charge.

Test Functions Overview

Name Type Cases (Amsterdam) Description
test_creation_tx_intrinsic_across_amsterdam_transition blockchain_test 2 Pin the EIP-2780 creation-transaction change across the Amsterdam
test_intrinsic_reduction_across_amsterdam_transition blockchain_test 4 Pin the EIP-2780 intrinsic change across the Amsterdam boundary.
test_intrinsic_validity_across_amsterdam_transition blockchain_test 2 Pin the intrinsic-validity flip across the Amsterdam boundary.
test_setcode_tx_across_amsterdam_transition blockchain_test 1 Pin the EIP-2780 authorization repricing across the Amsterdam