Test State Gas CALL¶
Documentation for tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_call.py@b314d18e.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_call.py --fork Amsterdam
Test CALL state gas reservoir passing under EIP-8037.
The full state gas reservoir is passed to child call frames with no
63/64 rule. On child success, remaining state gas returns to the
parent. On child revert or exceptional halt, all state gas, both
reservoir and any that spilled into gas_left, is restored to the
parent's reservoir (only CPU gas is consumed for the failed frame).
All CALL-family opcodes (CALL, DELEGATECALL, STATICCALL) pass the full reservoir to child frames.
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_insufficient_balance_returns_reservoir |
state_test | 2 | Test CALL with insufficient balance returns reservoir to parent. |
test_call_new_account_header_gas_used |
blockchain_test | 1 | Verify block gas accounting for CALL creating a new account. |
test_call_new_account_no_regular_account_creation_cost |
state_test | 1 | Verify CALL with value to a non-existent account does not |
test_call_pre_charged_costs_excluded_from_forwarding |
state_test | 1 | Verify pre-charged CALL costs do not reduce the 63/64 forwarding budget. |
test_call_stack_depth_returns_reservoir |
state_test | 1 | Test CALL at stack depth limit returns reservoir. |
test_call_value_to_pre_existing_selfdestructed_account |
blockchain_test | 2 | Verify CALL with value to a pre existing contract that ran |
test_call_value_to_self_destructed_burns_value |
blockchain_test | 4 | Verify value transferred to a same transaction selfdestructed |
test_call_value_to_self_destructed_header_gas_used |
blockchain_test | 4 | Verify block gas accounting for CALL with value to a same |
test_call_value_to_self_destructed_same_tx_account |
state_test | 2 | Smoke test for CALL with value to a same transaction |
test_call_value_transfer_existing_account_no_state_gas |
state_test | 1 | Test CALL with value to existing account charges no state gas. |
test_call_value_transfer_new_account |
state_test | 1 | Test CALL with value to non-existent account charges state gas. |
test_call_zero_value_to_self_destructed_same_tx_account |
blockchain_test | 2 | Verify CALL with zero value to a same transaction selfdestructed |
test_callcode_value_no_new_account_state_gas |
state_test | 1 | Verify CALLCODE with value does not charge new-account state |
test_child_call_uses_reservoir |
state_test | 1 | Test child call can use parent's state gas reservoir. |
test_child_failure_refunds_state_gas_to_reservoir_not_gas_left |
state_test | 3 | Verify state gas from a failing child is restored to the |
test_child_state_gas_tracked_in_parent |
state_test | 1 | Test state gas used by child is accumulated in parent. |
test_create_insufficient_balance_returns_reservoir |
state_test | 1 | Test CREATE with insufficient balance returns reservoir to parent. |
test_create_oog_during_state_gas_charge |
state_test | 2 | Verify the parent reservoir is refunded when a child's CREATE |
test_delegatecall_child_spill_not_double_charged |
state_test | 1 | Test DELEGATECALL child state gas paid from gas_left is not recharged. |
test_delegatecall_reservoir_passing |
state_test | 1 | Test DELEGATECALL passes full reservoir to child. |
test_gas_opcode_excludes_reservoir |
state_test | 1 | Test GAS opcode returns gas_left only, excluding the reservoir. |
test_nested_calls_reservoir_passing |
state_test | 1 | Test reservoir passes through nested calls. |
test_reservoir_restored_after_child_full_drain_and_revert |
state_test | 1 | Test reservoir restored when child exactly exhausts it then reverts. |
test_reservoir_restored_after_child_spill_and_halt |
state_test | 1 | Test parent gets reservoir back after child spill + halt. |
test_reservoir_restored_after_child_spill_and_revert |
state_test | 1 | Test all state gas recovered when child spills then reverts. |
test_reservoir_returned_on_oog |
state_test | 1 | Test state gas reservoir is returned to parent on child OOG. |
test_reservoir_returned_on_revert |
state_test | 1 | Test state gas reservoir is returned to parent on child revert. |
test_sequential_calls_reservoir_restored_between_reverts |
state_test | 1 | Test reservoir restored across sequential child reverts. |
test_staticcall_passes_reservoir |
state_test | 1 | Test STATICCALL passes reservoir but cannot use it for state ops. |
test_top_level_halt_refunds_total_state_gas |
blockchain_test | 6 | Verify a top-level halt refunds the total state-gas consumed |