Skip to content

test_opcodes_in_legacy()

Documentation for tests/osaka/eip7692_eof_v1/eip3540_eof_v1/test_opcodes_in_legacy.py::test_opcodes_in_legacy@83970623.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip3540_eof_v1/test_opcodes_in_legacy.py::test_opcodes_in_legacy --fork Osaka

Test all EOF only opcodes in legacy contracts and expects failure.

Source code in tests/osaka/eip7692_eof_v1/eip3540_eof_v1/test_opcodes_in_legacy.py
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@pytest.mark.parametrize(
    "code",
    eof_opcode_blocks,
)
def test_opcodes_in_legacy(state_test: StateTestFiller, pre: Alloc, code: Opcodes):
    """Test all EOF only opcodes in legacy contracts and expects failure."""
    env = Environment()

    address_test_contract = pre.deploy_contract(
        code=code + Op.SSTORE(slot_code_executed, value_code_executed),
        storage={slot_code_executed: value_non_execution_canary},
    )

    post = {
        # assert the canary is not over-written. If it was written then the EOF opcode was valid
        address_test_contract: Account(storage={slot_code_executed: value_non_execution_canary}),
    }

    sender = pre.fund_eoa()

    tx = Transaction(
        sender=sender,
        to=address_test_contract,
        gas_limit=5_000_000,
        gas_price=10,
        protected=False,
        data="",
    )

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

Parametrized Test Cases

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

Test ID (Abbreviated) code
...fork_Osaka-blockchain_test-DUPN
...fork_Osaka-blockchain_test-SWAPN
...fork_Osaka-blockchain_test-EXCHANGE
...fork_Osaka-blockchain_test-RJUMP RJUMP_0x0000
...fork_Osaka-blockchain_test-RJUMPI0
...fork_Osaka-blockchain_test-RJUMPI1
...fork_Osaka-blockchain_test-CALLF CALLF_0x0001
...fork_Osaka-blockchain_test-RETF RETF
...fork_Osaka-blockchain_test-JUMPF JUMPF_0x0000
...fork_Osaka-blockchain_test-EXTCALL
...fork_Osaka-blockchain_test-EXTDELEGATECALL
...fork_Osaka-blockchain_test-EXTSTATICCALL
...fork_Osaka-blockchain_test-DATALOAD
...fork_Osaka-blockchain_test-DATALOADN DATALOADN_0x0000
...fork_Osaka-blockchain_test-DATASIZE DATASIZE
...fork_Osaka-blockchain_test-DATACOPY
...fork_Osaka-blockchain_test-EOFCREATE
...fork_Osaka-blockchain_test-RETURNCONTRACT RETURNCONTRACT_0x00
...fork_Osaka-state_test-DUPN
...fork_Osaka-state_test-SWAPN
...fork_Osaka-state_test-EXCHANGE
...fork_Osaka-state_test-RJUMP RJUMP_0x0000
...fork_Osaka-state_test-RJUMPI0
...fork_Osaka-state_test-RJUMPI1
...fork_Osaka-state_test-CALLF CALLF_0x0001
...fork_Osaka-state_test-RETF RETF
...fork_Osaka-state_test-JUMPF JUMPF_0x0000
...fork_Osaka-state_test-EXTCALL
...fork_Osaka-state_test-EXTDELEGATECALL
...fork_Osaka-state_test-EXTSTATICCALL
...fork_Osaka-state_test-DATALOAD
...fork_Osaka-state_test-DATALOADN DATALOADN_0x0000
...fork_Osaka-state_test-DATASIZE DATASIZE
...fork_Osaka-state_test-DATACOPY
...fork_Osaka-state_test-EOFCREATE
...fork_Osaka-state_test-RETURNCONTRACT RETURNCONTRACT_0x00