Description
Several tests manually compute gas budgets by dividing available gas by raw constants from fork.gas_costs() (e.g. G_ACCESS_LIST_ADDRESS, G_TX_DATA_FLOOR_TOKEN_COST, PER_EMPTY_ACCOUNT_COST). This pattern breaks when a new fork reprices these costs, which is what happens in Amsterdam with EIP-7976 (calldata repricing) and EIP-7981 (access list repricing).
Related to #2049 (migration from fork.gas_costs to bytecode.gas_cost(fork)), that issue covers opcode-level gas costs, while this tracks intrinsic transaction gas calculations that should use the fork's intrinsic_cost() calculator via binary search instead of manual division.
Anti-pattern
gas_available = some_limit - intrinsic_cost()
count = gas_available // SOME_GAS_CONSTANT
Safe pattern
count = max_count_with_intrinsic_cost_at_most(
lambda n: intrinsic_cost(..., n),
some_limit,
)
Already fixed
Still unfixed
EIP-7825 (tests/osaka/eip7825_transaction_gas_limit_cap/test_tx_gas_limit.py)
test_tx_gas_limit_cap_contract_creation — gas_available // total_cost_floor_per_token
test_maximum_gas_refund — tx_gas_limit_cap // iteration_cost
EIP-7702 (tests/prague/eip7702_set_code_tx/)
test_gas.py — max_gas // Spec.PER_EMPTY_ACCOUNT_COST
test_set_code_txs.py — gas_for_delegations // Spec.PER_EMPTY_ACCOUNT_COST
Benchmarks (tests/benchmark/)
test_transaction_types.py — gas_amount // total_cost_floor_per_token, gas_after_address // gas_per_storage_key
test_system.py — (per_tx_gas - intrinsic_cost) // (access_list_addr_cost + cost)
Description
Several tests manually compute gas budgets by dividing available gas by raw constants from
fork.gas_costs()(e.g.G_ACCESS_LIST_ADDRESS,G_TX_DATA_FLOOR_TOKEN_COST,PER_EMPTY_ACCOUNT_COST). This pattern breaks when a new fork reprices these costs, which is what happens in Amsterdam with EIP-7976 (calldata repricing) and EIP-7981 (access list repricing).Related to #2049 (migration from
fork.gas_coststobytecode.gas_cost(fork)), that issue covers opcode-level gas costs, while this tracks intrinsic transaction gas calculations that should use the fork'sintrinsic_cost()calculator via binary search instead of manual division.Anti-pattern
Safe pattern
Already fixed
test_tx_gas_limit_cap_access_list_with_diff_keys(chore(test-tests): Fix EIP-7825 gas-cap test #2250)test_tx_gas_limit_cap_access_list_with_diff_addr(chore(test-tests): Fix EIP-7825 gas-cap test #2250)test_tx_gas_limit_cap_authorized_tx(chore(test-tests): Fix EIP-7825 gas-cap test #2250)test_tx_gas_limit_cap_full_calldata(chore(test-tests): Fix EIP-7825 gas-cap test #2250, chore(tests): EIP-7825 test fix to avoid 3 failures on EIP-7976 ci run #2286)_exact_size_transactions_implin EIP-7934 tests (chore(test-tests): Fix EIP-7934 and EIP-7623 for Amsterdam #2252)test_refundsin EIP-7623 tests (chore(test-tests): Fix EIP-7934 and EIP-7623 for Amsterdam #2252)Still unfixed
EIP-7825 (
tests/osaka/eip7825_transaction_gas_limit_cap/test_tx_gas_limit.py)test_tx_gas_limit_cap_contract_creation—gas_available // total_cost_floor_per_tokentest_maximum_gas_refund—tx_gas_limit_cap // iteration_costEIP-7702 (
tests/prague/eip7702_set_code_tx/)test_gas.py—max_gas // Spec.PER_EMPTY_ACCOUNT_COSTtest_set_code_txs.py—gas_for_delegations // Spec.PER_EMPTY_ACCOUNT_COSTBenchmarks (
tests/benchmark/)test_transaction_types.py—gas_amount // total_cost_floor_per_token,gas_after_address // gas_per_storage_keytest_system.py—(per_tx_gas - intrinsic_cost) // (access_list_addr_cost + cost)