Skip to content

test_eof_execution()

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

Generate fixtures for these test cases for Osaka with:

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

Test simple contracts that are expected to succeed on call.

Source code in tests/osaka/eip7692_eof_v1/eip3540_eof_v1/test_execution.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
@pytest.mark.parametrize(
    "container",
    (
        Container(
            name="store_from_push",
            sections=[Section.Code(Op.SSTORE(*EXPECTED_STORAGE) + Op.STOP)],
        ),
        Container(
            name="store_with_data",
            sections=[
                Section.Code(Op.SSTORE(Op.DATALOADN[0], Op.DATALOADN[32]) + Op.STOP),
                Section.Data(
                    EXPECTED_STORAGE[0].rjust(32, b"\x00") + EXPECTED_STORAGE[1].rjust(32, b"\x00")
                ),
            ],
        ),
    ),
    ids=lambda x: x.name,
)
def test_eof_execution(
    state_test: StateTestFiller,
    pre: Alloc,
    container: Container,
):
    """Test simple contracts that are expected to succeed on call."""
    env = Environment()

    storage = Storage()
    sender = pre.fund_eoa()
    container_address = pre.deploy_contract(container)
    caller_contract = Op.SSTORE(
        storage.store_next(1), Op.CALL(Op.GAS, container_address, 0, 0, 0, 0, 0)
    )
    caller_address = pre.deploy_contract(caller_contract)

    tx = Transaction(
        to=caller_address,
        gas_limit=1_000_000,
        gas_price=10,
        protected=False,
        sender=sender,
    )

    post = {
        caller_address: Account(storage=storage),
        container_address: Account(storage=dict([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.

Test ID (Abbreviated) container
...fork_Osaka-blockchain_test-store_from_push store_from_push
...fork_Osaka-blockchain_test-store_with_data store_with_data
...fork_Osaka-state_test-store_from_push store_from_push
...fork_Osaka-state_test-store_with_data store_with_data