Skip to content

test_reentrant_call()

Documentation for tests/cancun/eip1153_tstore/test_tstorage_reentrancy_contexts.py::test_reentrant_call@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/cancun/eip1153_tstore/test_tstorage_reentrancy_contexts.py::test_reentrant_call --fork Amsterdam

Test transient storage in different reentrancy contexts.

Source code in tests/cancun/eip1153_tstore/test_tstorage_reentrancy_contexts.py
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
@ReentrancyTestCases.parametrize()
def test_reentrant_call(
    state_test: StateTestFiller,
    pre: Alloc,
    bytecode: Bytecode,
    expected_storage: Dict,
) -> None:
    """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

This test generates 8 parametrized test cases across 4 forks.