Test State Gas Set Code¶
Documentation for tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_set_code.py@c74f1a67.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_set_code.py --fork Amsterdam
Test EIP-7702 SetCode authorization state gas under EIP-8037.
Each authorization charges intrinsic state gas for the new account plus auth base bytes, and intrinsic regular gas. When the authority account already exists, the new-account state gas is refunded to the state gas reservoir.
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_auth_refund_block_gas_accounting |
state_test | 6 | Verify block + receipt gas accounting against per-authorization |
test_auth_refund_bypasses_one_fifth_cap |
state_test | 1 | Test auth refund to reservoir bypasses the ⅕ refund cap. |
test_auth_refund_reservoir_cannot_fund_regular_gas |
state_test | 2 | Verify the auth NEW_ACCOUNT refund funds state gas only, not regular. |
test_auth_sender_billing_after_failure |
state_test | 2 | Verify sender billing distinguishes new vs existing account auth |
test_auth_state_gas_in_header_after_failure |
state_test | 6 | Verify block header reflects intrinsic state gas from a 7702 |
test_auth_with_calldata_and_access_list |
state_test | 1 | Test authorization combined with calldata and access list. |
test_auth_with_multiple_sstores |
state_test | 1 | Test authorization combined with multiple SSTOREs. |
test_authorization_exact_state_gas_boundary |
blockchain_test | 2 | Test exact intrinsic gas boundary including auth state gas. |
test_authorization_state_gas_scaling |
state_test | 2 | Test authorization intrinsic state gas scales with count. |
test_authorization_to_precompile_address |
state_test | 1 | Test authorization targeting a precompile address charges state gas. |
test_authorization_with_sstore |
state_test | 1 | Test SetCode authorization combined with SSTORE. |
test_duplicate_signer_authorizations |
state_test | 1 | Test multiple authorizations from the same signer. |
test_existing_account_auth_header_gas_used_reflects_refund |
state_test | 2 | Verify the block header gas_used reflects the existing-authority |
test_existing_account_refund |
state_test | 1 | Test authorization targeting existing account refunds state gas. |
test_existing_account_refund_enables_sstore |
state_test | 1 | Test auth refund to reservoir enables subsequent state ops. |
test_existing_auth_refund_survives_top_level_revert |
state_test | 1 | Verify the existing-authority auth refund still flows through |
test_invalid_auth_rule1_refill_by_reason |
state_test | 3 | Verify an invalid authorization refills its full intrinsic state gas. |
test_invalid_chain_id_auth_still_charges_intrinsic_state_gas |
state_test | 1 | Test invalid-chain-id authorization still charges intrinsic state gas. |
test_invalid_nonce_auth_still_charges_intrinsic_state_gas |
state_test | 1 | Test invalid-nonce authorization still charges intrinsic state gas. |
test_many_authorizations_state_gas |
state_test | 1 | Test many authorizations with state gas from reservoir. |
test_mixed_auths_header_gas_used_reflects_existing_refunds |
state_test | 2 | Verify the block header gas_used deducts only the existing-authority |
test_mixed_new_and_existing_auths |
state_test | 1 | Test mixed new and existing account authorizations. |
test_mixed_valid_and_invalid_auths |
state_test | 3 | Test mixed valid and invalid authorizations state gas charging. |
test_multi_tx_block_auth_refund_and_sstore |
blockchain_test | 1 | Test multi-transaction block with auth refund and SSTORE state gas. |
test_same_authority_increasing_nonce_net_once |
state_test | 1 | Verify the per authority once invariant across valid auths. |
test_same_tx_clear_then_reset_pre_delegated |
state_test | 1 | Verify clear then reset of a pre delegated authority in one tx. |
test_same_tx_create_then_clear_double_auth_base_refill |
state_test | 1 | Verify the create then clear double AUTH_BASE refill in one tx. |
test_self_sponsored_authorization |
state_test | 1 | Test self-sponsored authorization where sender is also the signer. |
test_set_code_tx_below_total_intrinsic |
state_test | 9 | Reject set_code tx when gas_limit covers regular but not state intrinsic. |