Skip to content

test_callf_truncated_immediate()

Documentation for tests/osaka/eip7692_eof_v1/eip4750_functions/test_code_validation.py::test_callf_truncated_immediate@01f496f4.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip4750_functions/test_code_validation.py::test_callf_truncated_immediate --fork Osaka

Test cases for CALLF instructions with truncated immediate bytes.

Source code in tests/osaka/eip7692_eof_v1/eip4750_functions/test_code_validation.py
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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
@pytest.mark.parametrize(
    "container",
    [
        Container(
            name="imm0",
            sections=[
                Section.Code(
                    code=Op.CALLF,
                )
            ],
        ),
        Container(
            name="imm1",
            sections=[
                Section.Code(
                    code=Op.CALLF + b"\x00",
                )
            ],
        ),
        Container(
            name="imm_from_next_section",
            sections=[
                Section.Code(
                    code=Op.PUSH0 + Op.PUSH0 + Op.CALLF[1] + Op.STOP,
                ),
                Section.Code(
                    code=Op.CALLF + b"\x00",  # would be valid with "02" + Op.RETF.
                    code_inputs=2,
                    code_outputs=1,
                    max_stack_height=2,
                ),
                Section.Code(
                    code=Op.SUB + Op.RETF,  # SUB (0x02) can be confused with CALLF[2].
                    code_inputs=2,
                    code_outputs=1,
                    max_stack_height=2,
                ),
            ],
        ),
    ],
    ids=container_name,
)
def test_callf_truncated_immediate(
    eof_test: EOFTestFiller,
    container: Container,
):
    """Test cases for CALLF instructions with truncated immediate bytes."""
    eof_test(container=container, expect_exception=EOFException.TRUNCATED_INSTRUCTION)

Parametrized Test Cases

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

Test ID (Abbreviated) container
...fork_Osaka-eof_test-imm0 imm0
...fork_Osaka-eof_test-imm1 imm1
...fork_Osaka-eof_test-imm_from_next_section imm_from_next_section
...fork_Osaka-state_test_from_eof_test-imm0 imm0
...fork_Osaka-state_test_from_eof_test-imm1 imm1
...fork_Osaka-state_test_from_eof_test-imm_from_next_section imm_from_next_section
...fork_Osaka-blockchain_test_from_eof_test-imm0 imm0
...fork_Osaka-blockchain_test_from_eof_test-imm1 imm1
...fork_Osaka-blockchain_test_from_eof_test-imm_from_next_section imm_from_next_section