Skip to content

test_run_until_out_of_gas()

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

Generate fixtures for these test cases for Osaka with:

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

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

Source code in tests/cancun/eip1153_tstore/test_tstorage.py
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
@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

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

Test ID (Abbreviated) tx_gas_limit bytecode_repeat_times repeat_bytecode
...fork_Cancun-tx_gas_limit_0x055d4a80-state_test-tstore 0x055d4a80 1000
...fork_Cancun-tx_gas_limit_0x055d4a80-state_test-tstore_wide_address_space 0x055d4a80 32
...fork_Cancun-tx_gas_limit_0x055d4a80-state_test-tstore_tload 0x055d4a80 1000
...fork_Cancun-tx_gas_limit_0x055d4a80-blockchain_test_from_state_test-tstore 0x055d4a80 1000
...fork_Cancun-tx_gas_limit_0x055d4a80-blockchain_test_from_state_test-tstore_wide_address_space 0x055d4a80 32
...fork_Cancun-tx_gas_limit_0x055d4a80-blockchain_test_from_state_test-tstore_tload 0x055d4a80 1000
...fork_Prague-tx_gas_limit_0x055d4a80-state_test-tstore 0x055d4a80 1000
...fork_Prague-tx_gas_limit_0x055d4a80-state_test-tstore_wide_address_space 0x055d4a80 32
...fork_Prague-tx_gas_limit_0x055d4a80-state_test-tstore_tload 0x055d4a80 1000
...fork_Prague-tx_gas_limit_0x055d4a80-blockchain_test_from_state_test-tstore 0x055d4a80 1000
...fork_Prague-tx_gas_limit_0x055d4a80-blockchain_test_from_state_test-tstore_wide_address_space 0x055d4a80 32
...fork_Prague-tx_gas_limit_0x055d4a80-blockchain_test_from_state_test-tstore_tload 0x055d4a80 1000
...fork_Osaka-tx_gas_limit_16777216-state_test-tstore 16777216 1000
...fork_Osaka-tx_gas_limit_16777216-state_test-tstore_wide_address_space 16777216 32
...fork_Osaka-tx_gas_limit_16777216-state_test-tstore_tload 16777216 1000
...fork_Osaka-tx_gas_limit_16777216-blockchain_test_from_state_test-tstore 16777216 1000
...fork_Osaka-tx_gas_limit_16777216-blockchain_test_from_state_test-tstore_wide_address_space 16777216 32
...fork_Osaka-tx_gas_limit_16777216-blockchain_test_from_state_test-tstore_tload 16777216 1000