Skip to content

test_jumpf_to_retf()

Documentation for tests/osaka/eip7692_eof_v1/eip6206_jumpf/test_jumpf_execution.py::test_jumpf_to_retf@01f496f4.

Generate fixtures for these test cases for Osaka with:

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

Tests JUMPF to a returning section with RETF.

Source code in tests/osaka/eip7692_eof_v1/eip6206_jumpf/test_jumpf_execution.py
 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
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
@pytest.mark.parametrize(
    "container",
    [
        Container(
            name="forward",
            sections=[
                Section.Code(
                    code=Op.CALLF[1] + Op.SSTORE(slot_code_worked, value_code_worked) + Op.STOP,
                ),
                Section.Code(
                    code=Op.JUMPF[2],
                    code_outputs=0,
                ),
                Section.Code(
                    code=Op.RETF,
                    code_outputs=0,
                ),
            ],
        ),
        Container(
            name="backward",
            sections=[
                Section.Code(
                    code=Op.CALLF[2] + Op.SSTORE(slot_code_worked, value_code_worked) + Op.STOP,
                ),
                Section.Code(
                    code=Op.RETF,
                    code_outputs=0,
                ),
                Section.Code(
                    code=Op.JUMPF[1],
                    code_outputs=0,
                ),
            ],
        ),
        Container(
            name="equal_outputs",
            sections=[
                Section.Code(
                    Op.CALLF[1] + Op.SSTORE + Op.STOP,
                    max_stack_height=2,
                ),
                Section.Code(
                    Op.JUMPF[2],
                    code_outputs=2,
                    max_stack_height=0,
                ),
                Section.Code(
                    Op.PUSH2[value_code_worked] + Op.PUSH2[slot_code_worked] + Op.RETF,
                    code_outputs=2,
                    max_stack_height=2,
                ),
            ],
        ),
        Container(
            name="compatible_outputs",
            sections=[
                Section.Code(
                    code=Op.CALLF[1] + Op.SSTORE + Op.STOP,
                    max_stack_height=2,
                ),
                Section.Code(
                    Op.PUSH2[value_code_worked] + Op.JUMPF[2],
                    code_outputs=2,
                    max_stack_height=1,
                ),
                Section.Code(
                    Op.PUSH2[slot_code_worked] + Op.RETF,
                    code_outputs=1,
                    max_stack_height=1,
                ),
            ],
        ),
    ],
    ids=lambda container: container.name,
)
def test_jumpf_to_retf(eof_state_test: EOFStateTestFiller, container: Container):
    """Tests JUMPF to a returning section with RETF."""
    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) container
...fork_Osaka-eof_test-forward forward
...fork_Osaka-eof_test-backward backward
...fork_Osaka-eof_test-equal_outputs equal_outputs
...fork_Osaka-eof_test-compatible_outputs compatible_outputs
...fork_Osaka-eof_state_test-forward forward
...fork_Osaka-eof_state_test-backward backward
...fork_Osaka-eof_state_test-equal_outputs equal_outputs
...fork_Osaka-eof_state_test-compatible_outputs compatible_outputs
...fork_Osaka-eof_blockchain_test-forward forward
...fork_Osaka-eof_blockchain_test-backward backward
...fork_Osaka-eof_blockchain_test-equal_outputs equal_outputs
...fork_Osaka-eof_blockchain_test-compatible_outputs compatible_outputs