Skip to content

test_callf_jumpf_retf_memory_context()

Documentation for tests/osaka/eip7692_eof_v1/eip6206_jumpf/test_jumpf_execution.py::test_callf_jumpf_retf_memory_context@14a7429a.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip6206_jumpf/test_jumpf_execution.py::test_callf_jumpf_retf_memory_context --fork Osaka

Verifies CALLF, JUMPF and RETF don't corrupt memory.

Source code in tests/osaka/eip7692_eof_v1/eip6206_jumpf/test_jumpf_execution.py
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
def test_callf_jumpf_retf_memory_context(
    state_test: StateTestFiller,
    pre: Alloc,
):
    """Verifies CALLF, JUMPF 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(96), Op.MSIZE())
                    + Op.SSTORE(storage.store_next(2), Op.MLOAD(0))
                    + Op.SSTORE(storage.store_next(21), Op.MLOAD(32))
                    + Op.SSTORE(storage.store_next(31), Op.MLOAD(64))
                    + 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.JUMPF[2],
                    code_outputs=0,
                ),
                Section.Code(
                    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.MSTORE(32, 21)
                    + Op.MSTORE(64, 31)
                    + 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