Skip to content

test_callf_retf_memory_context()

Documentation for tests/osaka/eip7692_eof_v1/eip4750_functions/test_callf_execution.py::test_callf_retf_memory_context@3719e927.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip4750_functions/test_callf_execution.py::test_callf_retf_memory_context --fork Osaka

Verifies CALLF and RETF don't corrupt memory.

Source code in tests/osaka/eip7692_eof_v1/eip4750_functions/test_callf_execution.py
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
def test_callf_retf_memory_context(
    state_test: StateTestFiller,
    pre: Alloc,
):
    """Verifies CALLF and RETF don't corrupt memory."""
    env = Environment()
    storage = Storage()
    contract_address = pre.deploy_contract(
        code=Container(
            sections=[
                Section.Code(
                    Op.SSTORE(storage.store_next(value_code_worked), value_code_worked)
                    + Op.MSTORE(0, 1)
                    + Op.CALLF[1]
                    + Op.SSTORE(storage.store_next(64), Op.MSIZE())
                    + Op.SSTORE(storage.store_next(2), Op.MLOAD(0))
                    + Op.SSTORE(storage.store_next(3), Op.MLOAD(32))
                    + Op.STOP,
                ),
                Section.Code(
                    Op.SSTORE(storage.store_next(32), Op.MSIZE())
                    + Op.SSTORE(storage.store_next(1), Op.MLOAD(0))
                    + Op.MSTORE(0, 2)
                    + Op.MSTORE(32, 3)
                    + Op.RETF,
                    code_outputs=0,
                ),
            ],
        ),
    )
    post = {
        contract_address: Account(storage=storage),
    }
    tx = Transaction(
        to=contract_address,
        gas_limit=500_000,
        sender=pre.fund_eoa(),
    )
    state_test(env=env, pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test case is only parametrized by fork and fixture format.

Test ID (Abbreviated)
...fork_Osaka-state_test
...fork_Osaka-blockchain_test_from_state_test