Skip to content

test_jumpf_and_retf()

Documentation for tests/osaka/eip7692_eof_v1/eip6206_jumpf/test_jumpf_execution.py::test_jumpf_and_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_and_retf --fork Osaka

Tests JUMPF and RETF in the same section.

Source code in tests/osaka/eip7692_eof_v1/eip6206_jumpf/test_jumpf_execution.py
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
@pytest.mark.parametrize(
    "container",
    [
        Container(
            name="1_to_2_arg0",
            sections=[
                Section.Code(
                    Op.CALLF[1] + Op.STOP,
                ),
                Section.Code(
                    Op.PUSH0 + Op.RJUMPI[3] + Op.JUMPF[2] + Op.RETF,
                    code_outputs=0,
                ),
                Section.Code(
                    Op.SSTORE(slot_code_worked, value_code_worked) + Op.RETF,
                    code_outputs=0,
                ),
            ],
        ),
        Container(
            name="1_to_2_arg1",
            sections=[
                Section.Code(
                    Op.PUSH1[1] + Op.CALLF[1] + Op.STOP,
                ),
                Section.Code(
                    Op.RJUMPI[1]
                    + Op.RETF
                    + Op.SSTORE(slot_code_worked, value_code_worked)
                    + Op.JUMPF[2],
                    code_inputs=1,
                    code_outputs=0,
                ),
                Section.Code(
                    Op.RETF,
                    code_outputs=0,
                ),
            ],
        ),
        Container(
            name="1_to_0_to_1",
            sections=[
                Section.Code(
                    Op.ISZERO(Op.SLOAD(slot_code_worked)) + Op.CALLF[1] + Op.STOP,
                ),
                Section.Code(
                    Op.RJUMPI[1]
                    + Op.RETF
                    + Op.SSTORE(slot_code_worked, value_code_worked)
                    + Op.JUMPF[0],
                    code_inputs=1,
                    code_outputs=0,
                ),
            ],
        ),
        Container(
            name="retf_in_nonreturning",
            sections=[
                Section.Code(
                    Op.PUSH0 + Op.JUMPF[1],
                ),
                Section.Code(
                    Op.RJUMPI[1] + Op.RETF + Op.JUMPF[0],
                    code_inputs=1,
                ),
            ],
            validity_error=EOFException.INVALID_NON_RETURNING_FLAG,
        ),
        Container(
            name="jumpf_to_returning",
            sections=[
                Section.Code(
                    Op.PUSH0 + Op.JUMPF[1],
                ),
                Section.Code(
                    Op.RJUMPI[1] + Op.RETF + Op.JUMPF[2],
                    code_inputs=1,
                ),
                Section.Code(
                    Op.RETF,
                    code_outputs=0,
                ),
            ],
            validity_error=EOFException.INVALID_NON_RETURNING_FLAG,
        ),
        Container(
            name="jumpf_to_returning_2",
            sections=[
                Section.Code(
                    Op.PUSH0 + Op.JUMPF[1],
                ),
                Section.Code(
                    Op.RJUMPI[3] + Op.JUMPF[2] + Op.RETF,
                    code_inputs=1,
                ),
                Section.Code(
                    Op.RETF,
                    code_outputs=0,
                ),
            ],
            validity_error=EOFException.INVALID_NON_RETURNING_FLAG,
        ),
    ],
    ids=lambda container: container.name,
)
def test_jumpf_and_retf(eof_state_test: EOFStateTestFiller, container: Container):
    """Tests JUMPF and RETF in the same section."""
    eof_state_test(
        container=container,
        container_post=Account(storage={slot_code_worked: value_code_worked}),
    )

Parametrized Test Cases

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

Test ID (Abbreviated) container
...fork_Osaka-eof_test-1_to_2_arg0 1_to_2_arg0
...fork_Osaka-eof_test-1_to_2_arg1 1_to_2_arg1
...fork_Osaka-eof_test-1_to_0_to_1 1_to_0_to_1
...fork_Osaka-eof_test-retf_in_nonreturning retf_in_nonreturning
...fork_Osaka-eof_test-jumpf_to_returning jumpf_to_returning
...fork_Osaka-eof_test-jumpf_to_returning_2 jumpf_to_returning_2
...fork_Osaka-eof_state_test-1_to_2_arg0 1_to_2_arg0
...fork_Osaka-eof_state_test-1_to_2_arg1 1_to_2_arg1
...fork_Osaka-eof_state_test-1_to_0_to_1 1_to_0_to_1
...fork_Osaka-eof_state_test-retf_in_nonreturning retf_in_nonreturning
...fork_Osaka-eof_state_test-jumpf_to_returning jumpf_to_returning
...fork_Osaka-eof_state_test-jumpf_to_returning_2 jumpf_to_returning_2
...fork_Osaka-eof_blockchain_test-1_to_2_arg0 1_to_2_arg0
...fork_Osaka-eof_blockchain_test-1_to_2_arg1 1_to_2_arg1
...fork_Osaka-eof_blockchain_test-1_to_0_to_1 1_to_0_to_1
...fork_Osaka-eof_blockchain_test-retf_in_nonreturning retf_in_nonreturning
...fork_Osaka-eof_blockchain_test-jumpf_to_returning jumpf_to_returning
...fork_Osaka-eof_blockchain_test-jumpf_to_returning_2 jumpf_to_returning_2