Skip to content

Test CALL Gas

Documentation for tests/amsterdam/eip8038_state_access_gas_cost_increase/test_call_gas.py@5fa5938b.

Generate fixtures for these test cases for Amsterdam with:

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

Tests for the EIP-8038 State Access Gas Cost Increase CALL-family regular-gas dimension.

Under EIP-8038 the call opcodes are repriced in their regular gas dimension:

  • account access costs COLD_ACCOUNT_ACCESS (3,000) cold or WARM_ACCESS (100) warm;
  • a positive value transfer adds CALL_VALUE (ACCOUNT_WRITE + CALL_STIPEND = 10,300), charged only by CALL/CALLCODE;
  • a value transfer to a new account additionally creates the account, whose GAS_NEW_ACCOUNT charge is the EIP-8037 state dimension and is asserted via the block header max(regular, state) accounting, never as regular gas;
  • an EIP-7702 delegated target is double-accessed (target leaf plus delegation leaf), each access cold or warm independently.

These tests assert the EIP-8038 regular dimension; the EIP-8037 state dimension for value-to-new-account is covered in eip8037_state_creation_gas_cost_increase/test_state_gas_call.py and is only re-derived here at the seam to feed header gas accounting.

Test Functions Overview

Name Type Cases (Amsterdam) Description
test_account_warmth_reverts_on_subcall_revert state_test 1 Account warmth acquired inside a reverted sub-call does not persist.
test_call_access_gas state_test 8 Measure the access cost of every call opcode with no value transfer.
test_call_exact_gas_oog state_test 8 Drive a cold call at exactly its gas (success) and one gas short (OOG).
test_call_forwarded_gas_63_64 state_test 2 Verify the 63/64 forwarding budget is computed after the repriced
test_call_precompile_is_warm state_test 4 Verify a call to a precompile is warm from the start.
test_call_self_is_warm state_test 4 Verify a self-call is warm: the executing account is pre-warmed.
test_call_to_delegated_target_double_access state_test 16 Measure a call to a 7702-delegated target: 2x2 double access.
test_call_to_double_delegated_target_single_hop state_test 1 Verify delegation resolution is single-hop: A -> B -> C charges two.
test_call_value_alive_target_gas state_test 8 Measure call cost with value transfer to an already-alive target.
test_call_value_stipend_is_usable state_test 2 The CALL value-transfer stipend (CALL_STIPEND = 2,300) is
test_call_value_to_new_account_seam state_test 1 Verify the CALL value-to-new-account regular/state seam.
test_callcode_value_to_nonexistent_no_new_account state_test 1 Verify CALLCODE value to a non-existent target charges CALL_VALUE