Skip to content

test_jumpf_stack_non_returning_rules()

Documentation for tests/osaka/eip7692_eof_v1/eip6206_jumpf/test_jumpf_stack.py::test_jumpf_stack_non_returning_rules@008e492e.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip6206_jumpf/test_jumpf_stack.py::test_jumpf_stack_non_returning_rules --fork Osaka

Tests for JUMPF validation stack rules. Non-returning section cases. Valid cases are executed.

Source code in tests/osaka/eip7692_eof_v1/eip6206_jumpf/test_jumpf_stack.py
19
20
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
@pytest.mark.parametrize(
    "target_inputs",
    [0, 2, 4],
    ids=lambda x: "ti-%d" % x,
)
@pytest.mark.parametrize(
    "stack_height",
    [0, 2, 4],
    ids=lambda x: "h-%d" % x,
)
def test_jumpf_stack_non_returning_rules(
    eof_state_test: EOFStateTestFiller,
    target_inputs: int,
    stack_height: int,
):
    """
    Tests for JUMPF validation stack rules.  Non-returning section cases.
    Valid cases are executed.
    """
    container = Container(
        name="stack-non-retuning_h-%d_ti-%d" % (stack_height, target_inputs),
        sections=[
            Section.Code(
                code=Op.JUMPF[1],
            ),
            Section.Code(
                code=Op.PUSH0 * stack_height + Op.JUMPF[2],
                max_stack_height=stack_height,
            ),
            Section.Code(
                code=Op.POP * target_inputs
                + Op.SSTORE(slot_code_worked, value_code_worked)
                + Op.STOP,
                code_inputs=target_inputs,
                max_stack_height=max(2, target_inputs),
            ),
        ],
    )

    if stack_height < target_inputs:
        container.validity_error = EOFException.STACK_UNDERFLOW

    eof_state_test(
        container=container,
        container_post=Account(storage={slot_code_worked: value_code_worked}),
        data=b"\1",
    )

Parametrized Test Cases

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

Test ID (Abbreviated) stack_height target_inputs
...fork_Osaka-eof_test-h-0-ti-0 0 0
...fork_Osaka-eof_test-h-0-ti-2 0 2
...fork_Osaka-eof_test-h-0-ti-4 0 4
...fork_Osaka-eof_test-h-2-ti-0 2 0
...fork_Osaka-eof_test-h-2-ti-2 2 2
...fork_Osaka-eof_test-h-2-ti-4 2 4
...fork_Osaka-eof_test-h-4-ti-0 4 0
...fork_Osaka-eof_test-h-4-ti-2 4 2
...fork_Osaka-eof_test-h-4-ti-4 4 4
...fork_Osaka-eof_state_test-h-0-ti-0 0 0
...fork_Osaka-eof_state_test-h-0-ti-2 0 2
...fork_Osaka-eof_state_test-h-0-ti-4 0 4
...fork_Osaka-eof_state_test-h-2-ti-0 2 0
...fork_Osaka-eof_state_test-h-2-ti-2 2 2
...fork_Osaka-eof_state_test-h-2-ti-4 2 4
...fork_Osaka-eof_state_test-h-4-ti-0 4 0
...fork_Osaka-eof_state_test-h-4-ti-2 4 2
...fork_Osaka-eof_state_test-h-4-ti-4 4 4
...fork_Osaka-eof_blockchain_test-h-0-ti-0 0 0
...fork_Osaka-eof_blockchain_test-h-0-ti-2 0 2
...fork_Osaka-eof_blockchain_test-h-0-ti-4 0 4
...fork_Osaka-eof_blockchain_test-h-2-ti-0 2 0
...fork_Osaka-eof_blockchain_test-h-2-ti-2 2 2
...fork_Osaka-eof_blockchain_test-h-2-ti-4 2 4
...fork_Osaka-eof_blockchain_test-h-4-ti-0 4 0
...fork_Osaka-eof_blockchain_test-h-4-ti-2 4 2
...fork_Osaka-eof_blockchain_test-h-4-ti-4 4 4