Skip to content

test_run_until_out_of_gas()

Documentation for tests/cancun/eip1153_tstore/test_tstorage.py::test_run_until_out_of_gas@20373115.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/cancun/eip1153_tstore/test_tstorage.py::test_run_until_out_of_gas --fork Amsterdam

Use TSTORE over and over to different keys until we run out of gas.

Source code in tests/cancun/eip1153_tstore/test_tstorage.py
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
@pytest.mark.ported_from(
    [
        "https://github.com/ethereum/tests/blob/v13.3/src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/15_tstoreCannotBeDosdFiller.yml",  # noqa: E501
        "https://github.com/ethereum/tests/blob/v13.3/src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/21_tstoreCannotBeDosdOOOFiller.yml",  # noqa: E501
    ],
    pr=["https://github.com/ethereum/execution-specs/pull/2385"],
)
@LoopRunUntilOutOfGasCases.parametrize()
@pytest.mark.slow()
@pytest.mark.parametrize_by_fork("tx_gas_limit", max_tx_gas_limit)
def test_run_until_out_of_gas(
    state_test: StateTestFiller,
    pre: Alloc,
    tx_gas_limit: int,
    repeat_bytecode: Bytecode,
    bytecode_repeat_times: int,
) -> None:
    """Use TSTORE over and over to different keys until we run out of gas."""
    bytecode = (
        Op.JUMPDEST
        + repeat_bytecode * bytecode_repeat_times
        + Op.JUMP(Op.PUSH0)
    )
    code_address = pre.deploy_contract(code=bytecode)
    tx = Transaction(
        sender=pre.fund_eoa(), to=code_address, gas_limit=tx_gas_limit
    )
    post = {
        code_address: Account(code=bytecode, storage={}),
    }
    state_test(pre=pre, tx=tx, post=post)

Parametrized Test Cases

This test generates 2 parametrized test cases across 4 forks.