Test State Gas Reservoir¶
Documentation for tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_reservoir.py@b314d18e.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_reservoir.py --fork Amsterdam
Test cases for the EIP-8037 state gas reservoir and its interaction with the EIP-7825 TX_MAX_GAS_LIMIT cap.
EIP-8037 splits execution gas into two pools:
- gas_left (regular gas): capped at TX_MAX_GAS_LIMIT - intrinsic.regular
- state_gas_reservoir: the overflow beyond the regular gas cap
State gas charges draw from the reservoir first, then spill into gas_left. Regular gas charges draw only from gas_left.
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_access_list_gas_is_regular_not_state |
blockchain_test | 4 | Verify EIP-2930 access list gas counts as regular, not state. |
test_access_list_warm_savings_stay_regular |
blockchain_test | 1 | Verify access-list warm savings stay in regular gas. |
test_block_2d_gas_valid_when_cumulative_exceeds_limit |
blockchain_test | 1 | Verify block validity under 2D gas when sum(txGasUsed) > gas_limit. |
test_block_gas_used_no_state_ops |
blockchain_test | 1 | Test block gas_used when regular gas dominates (no state operations). |
test_block_gas_used_with_state_ops |
blockchain_test | 1 | Test block gas_used includes state gas contribution. |
test_block_regular_gas_limit |
blockchain_test | 2 | Test check_transaction enforcement of regular gas against block limit. |
test_block_state_gas_limit_boundary |
blockchain_test | 2 | Verify the per-tx state check at the strict-greater-than boundary. |
test_create_tx_reservoir |
state_test | 2 | Test contract creation with state gas from reservoir or gas_left. |
test_creation_tx_failure_preserves_intrinsic_state_gas |
blockchain_test | 1 | Regression test for the creation tx failure path. |
test_creation_tx_regular_check_uses_full_tx_gas |
blockchain_test | 1 | Verify the regular check uses the full tx.gas (no subtraction). |
test_creation_tx_state_check_exceeded |
blockchain_test | 1 | Verify a creation tx is rejected by the state check. |
test_insufficient_gas_for_sstore_state_cost |
state_test | 1 | Test that execution OOGs when gas is insufficient for SSTORE state cost. |
test_nested_failure_resets_to_tx_reservoir |
blockchain_test | 48 | Verify failure cascade refunds state-gas to the top reservoir. |
test_nested_state_gas_refund_consumed_at_depth |
state_test | 24 | Verify state-gas refund credits propagate through a CALL chain so |
test_reservoir_allocation_boundary |
state_test | 3 | Test state gas reservoir allocation at TX_MAX_GAS_LIMIT boundary. |
test_revert_discards_descendant_storage_clear_credit_through_depth |
state_test | 4 | A reverted ancestor must discard a clear-credit regardless of |
test_single_tx_state_check_exceeds_block_limit |
blockchain_test | 1 | Verify a single tx is rejected when its gas limit exceeds the |
test_sstore_state_gas_entirely_from_gas_left |
state_test | 1 | Test SSTORE state gas charged entirely from gas_left (no reservoir). |
test_sstore_state_gas_source |
state_test | 4 | Test SSTORE zero-to-nonzero drawing state gas from different sources. |
test_subcall_failure_does_not_zero_top_level_state_gas |
blockchain_test | 1 | Verify a subcall failure does not zero the top level execution |
test_subcall_revert_does_not_leak_grandchild_storage_clear_credit |
state_test | 1 | Verify a grandchild's storage-clear reservoir credit cannot leak |
test_subcall_set_clear_revert_pays_no_state_gas |
state_test | 2 | A child frame doing SSTORE 0 to x to 0 then REVERT must bill the |
test_top_level_failure_propagated_state_gas |
state_test | 2 | Verify the top-level failure handling for state gas propagated |
test_top_level_failure_refunds_execution_state_gas |
state_test | 3 | Verify top level tx failure returns execution state gas to the |
test_top_level_failure_spilled_state_gas |
state_test | 2 | Verify the top-level failure handling for state gas that spilled |
test_top_level_failure_zeros_block_state_gas |
blockchain_test | 3 | Verify the block header reflects zero execution state gas after a |
test_top_level_opcode_oog_before_frame_end_does_not_refund_state_gas |
state_test | 1 | Verify an opcode OOG before frame-end settlement does not refund |