Skip to content

test_callf_truncated_immediate()

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

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
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
@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