Skip to content

test_sstore_state_gas_all_tx_types()

Documentation for tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_sstore.py::test_sstore_state_gas_all_tx_types@87aba1a3.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_sstore.py::test_sstore_state_gas_all_tx_types --fork Amsterdam

Test SSTORE state gas works across all transaction types.

With the gas limit pinned to the cap (zero reservoir), each tx type's SSTORE state gas spills into gas_left despite differing intrinsic costs.

Source code in tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_sstore.py
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
@pytest.mark.with_all_typed_transactions
@pytest.mark.valid_from("EIP8037")
def test_sstore_state_gas_all_tx_types(
    state_test: StateTestFiller,
    pre: Alloc,
    typed_transaction: Transaction,
) -> None:
    """
    Test SSTORE state gas works across all transaction types.

    With the gas limit pinned to the cap (zero reservoir), each tx
    type's SSTORE state gas spills into gas_left despite differing
    intrinsic costs.
    """
    storage = Storage()
    contract = pre.deploy_contract(
        code=Op.SSTORE(storage.store_next(1), 1),
    )

    tx = typed_transaction.copy(to=contract, state_gas_reservoir=0)

    post = {contract: Account(storage=storage)}
    state_test(pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test generates 5 parametrized test cases across 1 fork.