Skip to content

Test Fork Transition

Documentation for tests/amsterdam/eip8038_state_access_gas_cost_increase/test_fork_transition.py@ffe48572.

Generate fixtures for these test cases for Amsterdam with:

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

Fork-transition tests for EIP-8038: State-access gas cost update.

"Same operation, different gas" across the Amsterdam boundary. A block at timestamp=14_999 runs under the pre-fork (parent) schedule; a block at timestamp=15_000 runs under the EIP-8038 schedule. Every before/after magnitude is derived from the opcode's own cost at each fork (bytecode.gas_cost / execution_cost / refund) — nothing is hardcoded.

Four proof styles are used:

  • Opcode costs that are pure execution gas (BALANCE cold access, the EXT* code-read surcharge and the CREATE base) are measured exactly with CodeGasMeasure in each regime and asserted against the derived cost.
  • Charges that cannot be measured from inside the frame that pays them (a value-bearing CALL, SELFDESTRUCT to a fresh beneficiary, the SSTORE clear refund) are pinned per block through the transaction receipt's cumulative_gas_used, which sums both gas dimensions and so pins a charge that the fork moves between them.
  • Intrinsic repricings are pinned by setting gas_limit to the regime's exact minimum and pinning the receipt, and by straddling validity: one gas_limit that is sufficient before the fork and INTRINSIC_GAS_TOO_LOW after (access lists), or the reverse (authorizations, whose intrinsic falls).
  • Model-level repricings the runtime cannot isolate (the SSTORE execution/state split) are compared across the two schedules via the bytecode's own cost methods while the operation is exercised in both blocks.

Test Functions Overview

Name Type Cases (Amsterdam) Description
test_access_list_intrinsic_at_transition blockchain_test 1 The per-entry access-list intrinsic surcharge rises across the
test_access_list_intrinsic_straddles_validity blockchain_test 1 One gas_limit straddles validity at the boundary: it covers the
test_auth_intrinsic_at_transition blockchain_test 1 The 7702 authorization intrinsic falls across the boundary.
test_call_value_cost_at_transition blockchain_test 1 CALL_VALUE rises across the boundary, becoming
test_cold_account_access_at_transition blockchain_test 1 BALANCE of a cold account costs COLD_ACCOUNT_ACCESS, which
test_create_base_cost_at_transition blockchain_test 1 The CREATE execution base cost changes across the boundary
test_ext_code_surcharge_at_transition blockchain_test 1 The EIP-8038 EXT* code-read surcharge appears at the fork. The
test_same_account_accessed_at_both_prices blockchain_test 1 One account, accessed on both sides of the boundary, is cold and
test_selfdestruct_account_write_at_transition blockchain_test 1 SELFDESTRUCT gains an ACCOUNT_WRITE charge when it sends a
test_sstore_write_cost_at_transition blockchain_test 1 The SSTORE first-change cost is repriced across the Amsterdam
test_storage_clear_refund_at_transition blockchain_test 1 REFUND_STORAGE_CLEAR rises across the boundary, and a slot is