Test State Gas CREATE¶
Documentation for tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_create.py@b314d18e.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_create.py --fork Amsterdam
Test CREATE and CREATE2 state gas charging under EIP-8037.
Contract creation charges state gas for the new account and for code deposit. Regular gas for CREATE is charged separately.
Tests for [EIP-8037: State Creation Gas Cost Increase] (https://eips.ethereum.org/EIPS/eip-8037).
Test Functions Overview¶
| Name | Type | Cases (Amsterdam) | Description |
|---|---|---|---|
test_code_deposit_halt_discards_initcode_state_gas |
blockchain_test | 4 | Verify initcode state gas excluded from block on deposit halt. |
test_code_deposit_oog_preserves_parent_reservoir |
state_test | 1 | Test parent reservoir preserved after child code deposit OOG. |
test_code_deposit_state_gas_scales_with_size |
state_test | 6 | Test code deposit state gas scales linearly with code size. |
test_create2_address_collision |
state_test | 1 | Test CREATE2 returns zero on address collision. |
test_create2_child_spill_not_double_charged |
state_test | 1 | Test CREATE2 child state gas paid from gas_left is not recharged. |
test_create_charges_state_gas |
state_test | 1 | Test CREATE charges state gas for new account and code deposit. |
test_create_child_halt_refunds_state_gas |
state_test | 4 | Verify CREATE/CREATE2 child halt refunds parent's account gas. |
test_create_child_revert_refunds_state_gas |
blockchain_test | 4 | Verify CREATE/CREATE2 child REVERT refunds parent's account gas. |
test_create_code_deposit_oog_refunds_state_gas |
state_test | 2 | Verify CREATE/CREATE2 code-deposit OOG refunds account state gas. |
test_create_collision_burned_gas_counted_in_block_regular |
blockchain_test | 2 | Verify gas burned by a CREATE/CREATE2 address collision counts |
test_create_collision_refunds_state_gas |
state_test | 2 | Verify CREATE/CREATE2 address collision refunds account state gas. |
test_create_initcode_halt_no_code_deposit_state_gas |
blockchain_test | 1 | Verify initcode exceptional halt excludes code deposit state gas. |
test_create_insufficient_state_gas |
state_test | 1 | Test CREATE OOGs when state gas is insufficient. |
test_create_mixed_success_and_failure_block_accounting |
blockchain_test | 2 | Verify block state gas excludes refunded charges from failed CREATE. |
test_create_no_double_charge_new_account |
state_test | 1 | Verify CREATE does not double-charge new-account gas. |
test_create_revert_no_code_deposit_state_gas |
state_test | 1 | Test reverted CREATE does not charge code deposit state gas. |
test_create_silent_failure_refunds_state_gas |
blockchain_test | 2 | Verify CREATE silent failure refunds account state gas. |
test_create_stack_depth_state_gas_consumed |
state_test | 1 | Verify the state gas reservoir survives a deep recursion of |
test_create_tx_below_total_intrinsic |
state_test | 2 | Reject CREATE tx when gas_limit covers regular but not state intrinsic. |
test_create_tx_collision_refunds_intrinsic_new_account |
blockchain_test | 1 | Verify the NEW_ACCOUNT × CPSB portion of intrinsic_state_gas is |
test_create_tx_collision_refunds_reservoir |
blockchain_test | 1 | Verify the state-gas reservoir is refunded on a depth-0 CREATE-tx |
test_create_tx_header_gas_used |
blockchain_test | 1 | Verify block header gas_used for a successful CREATE transaction. |
test_create_tx_intrinsic_gas_boundary |
state_test | 2 | Test CREATE tx intrinsic gas boundary includes state component. |
test_create_tx_state_gas |
state_test | 1 | Test contract creation transaction charges intrinsic state gas. |
test_create_with_reservoir |
state_test | 2 | Test CREATE/CREATE2 with state gas funded from the reservoir. |
test_failed_create_header_gas_used |
blockchain_test | 4 | Verify block header gas_used for failed CREATE/CREATE2 via opcode. |
test_failed_create_tx_refunds_intrinsic_new_account |
state_test | 2 | Verify the NEW_ACCOUNT × CPSB portion of intrinsic_state_gas is |
test_inner_create_fail_refunds_in_creation_tx |
blockchain_test | 8 | Verify failed inner CREATEs inside a creation tx refund state |
test_inner_create_succeeds_code_deposit_state_gas |
blockchain_test | 6 | Verify state gas accumulation and top-level failure refund in a |
test_max_initcode_size_gas_metering_via_create |
state_test | 4 | Verify 2D gas metering for CREATE with max initcode size. |
test_nested_create_code_deposit_cannot_borrow_parent_gas |
state_test | 1 | Test nested CREATE code deposit does not borrow parent gas. |
test_nested_create_fail_parent_revert_state_gas |
blockchain_test | 8 | Verify factory nonce is rolled back when the factory reverts after |
test_oversized_initcode_opcode_no_state_gas |
blockchain_test | 4 | Verify CREATE/CREATE2 with oversized initcode fails the size |
test_oversized_initcode_tx_no_state_gas |
blockchain_test | 2 | Verify a creation tx with oversized initcode is rejected before |
test_parent_state_gas_after_child_failure |
state_test | 4 | Test parent state-gas pools after CREATE child failure. |
test_repeated_create_same_code_charges_each_account |
state_test | 1 | Test code deposit is charged per-account, not per code hash. |
test_selfdestruct_in_create_tx_initcode |
blockchain_test | 1 | Verify state gas accounting when a creation tx's initcode |
test_sstore_oog_no_reservoir_inflation |
state_test | 2 | Verify SSTORE state gas is not charged when regular gas OOGs. |
test_state_gas_spill_header_gas_used |
blockchain_test | 1 | Verify header gas_used when state gas spills into gas_left. |