Skip to content

Test SSTORE Gas

Documentation for tests/amsterdam/eip8038_state_access_gas_cost_increase/test_sstore_gas.py@5fa5938b.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip8038_state_access_gas_cost_increase/test_sstore_gas.py --fork Amsterdam

Tests for EIP-8038: State Access Gas Cost Increase.

Covers the EIP-8038 SSTORE regular (non-state) gas schedule. The state-creation charge for a zero-to-nonzero write is owned by EIP-8037 and is asserted separately; here every expectation is taken from the regular_cost dimension only.

The regular SSTORE cost is the slot-access cost (COLD_STORAGE_ACCESS when the key is cold, else WARM_SLOAD) plus, on the first change of the slot in the transaction (original == current != new), the write cost STORAGE_WRITE (modeled as COLD_STORAGE_WRITE - COLD_STORAGE_ACCESS).

Test Functions Overview

Name Type Cases (Amsterdam) Description
test_sstore_cold_then_warm_same_slot state_test 1 A first SSTORE on a cold slot warms it; the second in-frame
test_sstore_regular_gas state_test 10 Measure the regular SSTORE gas for each EIP-8038 row and assert it.