Test State Gas Ordering¶
Documentation for tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_ordering.py@5c024cbb.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_ordering.py --fork Amsterdam
Test state gas consumption ordering under EIP-8037.
When an opcode charges both regular gas and state gas, regular gas MUST be charged first. If regular gas OOGs, state gas is not consumed. This prevents the parent's reservoir from being inflated on frame failure.
Each test gives a child frame exactly 1 gas less than needed, then uses a probe contract to detect whether the parent's reservoir was inflated by incorrectly consumed state gas.
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_call_oog_reservoir_inflation_detection |
state_test | 1 | Detect CALL state gas ordering via reservoir inflation. |
test_create_oog_full_burn_no_state_credit |
blockchain_test | 4 | Verify a CREATE OOG inside a non-creation tx burns the whole |
test_create_oog_reservoir_inflation_detection |
state_test | 4 | Detect CREATE/CREATE2 state-gas ordering via parent-reservoir |
test_selfdestruct_oog_reservoir_inflation_detection |
state_test | 1 | Detect SELFDESTRUCT state gas ordering via reservoir inflation. |
test_sstore_oog_reservoir_inflation_detection |
state_test | 1 | Detect SSTORE state gas ordering via reservoir inflation. |