Skip to content

test_run_until_out_of_gas()

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

Generate fixtures for these test cases for Prague with:

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

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

Source code in tests/cancun/eip1153_tstore/test_tstorage.py
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
@LoopRunUntilOutOfGasCases.parametrize()
def test_run_until_out_of_gas(
    state_test: StateTestFiller,
    pre: Alloc,
    repeat_bytecode: Bytecode,
    bytecode_repeat_times: int,
):
    """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=30_000_000,
    )
    post = {
        code_address: Account(code=bytecode, storage={}),
    }
    state_test(env=Environment(), pre=pre, tx=tx, post=post)

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Test ID (Abbreviated) bytecode_repeat_times repeat_bytecode
...fork_Cancun-blockchain_test-tstore 1000
...fork_Cancun-blockchain_test-tstore_wide_address_space 32
...fork_Cancun-blockchain_test-tstore_tload 1000
...fork_Cancun-state_test-tstore 1000
...fork_Cancun-state_test-tstore_wide_address_space 32
...fork_Cancun-state_test-tstore_tload 1000
...fork_Prague-blockchain_test-tstore 1000
...fork_Prague-blockchain_test-tstore_wide_address_space 32
...fork_Prague-blockchain_test-tstore_tload 1000
...fork_Prague-state_test-tstore 1000
...fork_Prague-state_test-tstore_wide_address_space 32
...fork_Prague-state_test-tstore_tload 1000
...fork_Osaka-blockchain_test-tstore 1000
...fork_Osaka-blockchain_test-tstore_wide_address_space 32
...fork_Osaka-blockchain_test-tstore_tload 1000
...fork_Osaka-state_test-tstore 1000
...fork_Osaka-state_test-tstore_wide_address_space 32
...fork_Osaka-state_test-tstore_tload 1000