Skip to content

test_reentrant_call()

Documentation for tests/cancun/eip1153_tstore/test_tstorage_reentrancy_contexts.py::test_reentrant_call@verkle@v0.0.6.

Generate fixtures for these test cases for Cancun with:

Cancun only:

fill -v tests/cancun/eip1153_tstore/test_tstorage_reentrancy_contexts.py::test_reentrant_call --fork=Cancun --evm-bin=/path/to/evm-tool-dev-version

For all forks up to and including Cancun:

fill -v tests/cancun/eip1153_tstore/test_tstorage_reentrancy_contexts.py::test_reentrant_call --until=Cancun

Test transient storage in different reentrancy contexts.

Source code in tests/cancun/eip1153_tstore/test_tstorage_reentrancy_contexts.py
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
@ReentrancyTestCases.parametrize()
def test_reentrant_call(
    state_test: StateTestFiller, pre: Alloc, bytecode: Bytecode, expected_storage: Dict
):
    """
    Test transient storage in different reentrancy contexts.
    """
    env = Environment()

    callee_address = pre.deploy_contract(bytecode)

    tx = Transaction(
        sender=pre.fund_eoa(),
        to=callee_address,
        data=Hash(1),
        gas_limit=1_000_000,
    )

    post = {callee_address: Account(code=bytecode, storage=expected_storage)}

    state_test(env=env, pre=pre, post=post, tx=tx)

Parametrized Test Cases

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

Skipped Parameters

For more concise readability, the table below does not list the following parameter values: fork, blockchain_test, state_test, state_test_only, eof_test, eof_state_test.

Test ID bytecode expected_storage
tstore_in_reentrant_call {0: 1, 1: 256, 2: 256}
tload_after_reentrant_tstore {0: 1, 1: 256, 2: 257}
manipulate_in_reentrant_call {0: 1, 1: 256, 2: 257, 3: 257}
tstore_in_call_then_tload_return_in_staticcall {0: 1, 1: 1, 2: 256, 3: 257, 4: 257}
tstore_before_revert_has_no_effect {0: 0, 1: 256, 2: 256}
revert_undoes_all {0: 0, 1: 256, 2: 257}
revert_undoes_tstorage_after_successful_call {0: 0, 1: 1, 2: 256, 3: 256}
tstore_before_invalid_has_no_effect {0: 0, 1: 256, 2: 256}
invalid_undoes_all {0: 0, 1: 256, 2: 257}
invalid_undoes_tstorage_after_successful_call {0: 0, 1: 0, 2: 256, 3: 256}
tstore_in_reentrant_call {0: 1, 1: 256, 2: 256}
tload_after_reentrant_tstore {0: 1, 1: 256, 2: 257}
manipulate_in_reentrant_call {0: 1, 1: 256, 2: 257, 3: 257}
tstore_in_call_then_tload_return_in_staticcall {0: 1, 1: 1, 2: 256, 3: 257, 4: 257}
tstore_before_revert_has_no_effect {0: 0, 1: 256, 2: 256}
revert_undoes_all {0: 0, 1: 256, 2: 257}
revert_undoes_tstorage_after_successful_call {0: 0, 1: 1, 2: 256, 3: 256}
tstore_before_invalid_has_no_effect {0: 0, 1: 256, 2: 256}
invalid_undoes_all {0: 0, 1: 256, 2: 257}
invalid_undoes_tstorage_after_successful_call {0: 0, 1: 0, 2: 256, 3: 256}