Skip to content

Test CREATE Gas

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

Generate fixtures for these test cases for Amsterdam with:

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

Tests for the EIP-8038 State Access Gas Cost Increase CREATE/CREATE2 regular-gas dimension.

Under EIP-8038 the contract-creation opcodes are repriced in their regular gas dimension to CREATE_ACCESS (ACCOUNT_WRITE + COLD_STORAGE_ACCESS = 11,000), on top of which the EIP-3860 init code word cost (2 per word) and, for CREATE2 only, an additional keccak word cost (6 per word) are charged. The new-account creation and per-byte code deposit charges are the EIP-8037 state dimension, covered in eip8037_state_creation_gas_cost_increase/test_state_gas_create.py.

These tests isolate and assert the EIP-8038 regular dimension. At the contract-creating-transaction boundary the state component is re-derived only to feed the max(regular, state) block-header accounting.

Test Functions Overview

Name Type Cases (Amsterdam) Description
test_create_tx_gas_boundary state_test 4 Drive a creation tx at each of the four gas boundary points.
test_aborted_create_does_not_warm_address state_test 6 Verify a silently-aborted CREATE does not warm the target address.
test_create2_keccak_word_delta state_test 3 Verify CREATE2 costs exactly the keccak word surcharge over CREATE.
test_create2_to_occupied_address state_test 1 Verify CREATE2 to an occupied address creates nothing and refunds.
test_create_regular_gas state_test 8 Measure the regular gas of CREATE/CREATE2 and assert the schedule.