Skip to content

test_unreachable_code_sections()

Documentation for tests/osaka/eip7692_eof_v1/eip4750_functions/test_code_validation.py::test_unreachable_code_sections@b48d1dc8.

Generate fixtures for these test cases for Osaka with:

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

Test cases for EOF unreachable code sections (i.e. code sections not reachable from the code section 0).

Source code in tests/osaka/eip7692_eof_v1/eip4750_functions/test_code_validation.py
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
@pytest.mark.parametrize(
    "container",
    [
        Container(
            name="unreachable1",
            sections=[
                Section.Code(Op.INVALID),
                Section.Code(Op.INVALID),  # unreachable
            ],
        ),
        Container(
            name="unreachable1_selfjumpf",
            sections=[
                Section.Code(Op.INVALID),
                Section.Code(Op.JUMPF[1]),  # unreachable
            ],
        ),
        Container(
            name="unreachable1_selfcallf",
            sections=[
                Section.Code(Op.INVALID),
                Section.Code(Op.CALLF[1] + Op.STOP),  # unreachable
            ],
        ),
        Container(
            name="unreachable1_jumpf0",
            sections=[
                Section.Code(Op.INVALID),
                Section.Code(Op.JUMPF[0]),  # unreachable
            ],
        ),
        Container(
            name="unreachable1_callf0",
            sections=[
                Section.Code(Op.INVALID),
                Section.Code(Op.CALLF[0] + Op.STOP),  # unreachable
            ],
        ),
        Container(
            name="unreachable1_selfcall_jumpf0",
            sections=[
                Section.Code(Op.INVALID),
                Section.Code(Op.CALLF[1] + Op.JUMPF[0]),  # unreachable
            ],
        ),
        Container(
            name="unreachable12_of3_2jumpf1",
            sections=[
                Section.Code(Op.INVALID),
                Section.Code(Op.STOP),  # unreachable
                Section.Code(Op.JUMPF[1]),  # unreachable
            ],
        ),
        Container(
            name="unreachable12_of3_2callf1",
            sections=[
                Section.Code(Op.INVALID),
                Section.Code(Op.STOP),  # unreachable
                Section.Code(Op.CALLF[1] + Op.STOP),  # unreachable
            ],
        ),
        Container(
            name="unreachable12_of3_jumpf_loop",
            sections=[
                Section.Code(Op.INVALID),
                Section.Code(Op.JUMPF[2]),  # unreachable
                Section.Code(Op.JUMPF[1]),  # unreachable
            ],
        ),
        Container(
            name="unreachable12_of3_callf_loop_stop",
            sections=[
                Section.Code(Op.INVALID),
                Section.Code(Op.CALLF[2] + Op.STOP),  # unreachable
                Section.Code(Op.CALLF[1] + Op.STOP),  # unreachable
            ],
        ),
        Container(
            name="unreachable12_of3_callf_loop_retf",
            sections=[
                Section.Code(Op.INVALID),
                Section.Code(Op.CALLF[2] + Op.RETF, code_outputs=0),  # unreachable
                Section.Code(Op.CALLF[1] + Op.RETF, code_outputs=0),  # unreachable
            ],
        ),
        Container(
            name="unreachable12_of3_callf_loop_mixed",
            sections=[
                Section.Code(Op.INVALID),
                Section.Code(Op.CALLF[2] + Op.STOP),  # unreachable
                Section.Code(Op.CALLF[1] + Op.RETF, code_outputs=0),  # unreachable
            ],
        ),
        Container(
            name="selfjumpf0_unreachable1",
            sections=[
                Section.Code(Op.JUMPF[0]),  # self-reference
                Section.Code(Op.JUMPF[1]),  # unreachable
            ],
        ),
        Container(
            name="unreachable2_of3",
            sections=[
                Section.Code(Op.CALLF[1] + Op.STOP),
                Section.Code(Op.RETF, code_outputs=0),
                Section.Code(Op.INVALID),  # unreachable
            ],
        ),
        Container(
            name="unreachable1_of3",
            sections=[
                Section.Code(Op.CALLF[2] + Op.STOP),
                Section.Code(Op.INVALID),  # unreachable
                Section.Code(Op.RETF, code_outputs=0),
            ],
        ),
        Container(
            name="unreachable1_of4",
            sections=[
                Section.Code(Op.CALLF[3] + Op.STOP),
                Section.Code(Op.INVALID),  # unreachable
                Section.Code(Op.RETF, code_outputs=0),
                Section.Code(Op.CALLF[2] + Op.RETF, code_outputs=0),
            ],
        ),
        Container(
            name="unreachable2_of3_retf",
            sections=[
                Section.Code(Op.JUMPF[1]),
                Section.Code(Op.STOP),
                Section.Code(Op.RETF, code_outputs=0),
            ],
        ),
        Container(
            name="unreachable2-255",
            sections=[
                Section.Code(Op.JUMPF[1]),
                Section.Code(Op.JUMPF[1]),  # self-reference
            ]
            + [Section.Code(Op.JUMPF[i]) for i in range(3, 255)]  # unreachable
            + [Section.Code(Op.STOP)],  # unreachable
        ),
        Container(
            name="unreachable255",
            sections=[Section.Code(Op.JUMPF[i]) for i in range(1, 255)]
            + [
                Section.Code(Op.JUMPF[254]),  # self-reference
                Section.Code(Op.STOP),  # unreachable
            ],
        ),
    ],
    ids=container_name,
)
def test_unreachable_code_sections(
    eof_test: EOFTestFiller,
    container: Container,
):
    """
    Test cases for EOF unreachable code sections
    (i.e. code sections not reachable from the code section 0).
    """
    eof_test(container=container, expect_exception=EOFException.UNREACHABLE_CODE_SECTIONS)

Parametrized Test Cases

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

Test ID (Abbreviated) container
...fork_Osaka-eof_test-unreachable1 unreachable1
...fork_Osaka-eof_test-unreachable1_selfjumpf unreachable1_selfjumpf
...fork_Osaka-eof_test-unreachable1_selfcallf unreachable1_selfcallf
...fork_Osaka-eof_test-unreachable1_jumpf0 unreachable1_jumpf0
...fork_Osaka-eof_test-unreachable1_callf0 unreachable1_callf0
...fork_Osaka-eof_test-unreachable1_selfcall_jumpf0 unreachable1_selfcall_jumpf0
...fork_Osaka-eof_test-unreachable12_of3_2jumpf1 unreachable12_of3_2jumpf1
...fork_Osaka-eof_test-unreachable12_of3_2callf1 unreachable12_of3_2callf1
...fork_Osaka-eof_test-unreachable12_of3_jumpf_loop unreachable12_of3_jumpf_loop
...fork_Osaka-eof_test-unreachable12_of3_callf_loop_stop unreachable12_of3_callf_loop_stop
...fork_Osaka-eof_test-unreachable12_of3_callf_loop_retf unreachable12_of3_callf_loop_retf
...fork_Osaka-eof_test-unreachable12_of3_callf_loop_mixed unreachable12_of3_callf_loop_mixed
...fork_Osaka-eof_test-selfjumpf0_unreachable1 selfjumpf0_unreachable1
...fork_Osaka-eof_test-unreachable2_of3 unreachable2_of3
...fork_Osaka-eof_test-unreachable1_of3 unreachable1_of3
...fork_Osaka-eof_test-unreachable1_of4 unreachable1_of4
...fork_Osaka-eof_test-unreachable2_of3_retf unreachable2_of3_retf
...fork_Osaka-eof_test-unreachable2-255 unreachable2-255
...fork_Osaka-eof_test-unreachable255 unreachable255
...fork_Osaka-state_test_from_eof_test-unreachable1 unreachable1
...fork_Osaka-state_test_from_eof_test-unreachable1_selfjumpf unreachable1_selfjumpf
...fork_Osaka-state_test_from_eof_test-unreachable1_selfcallf unreachable1_selfcallf
...fork_Osaka-state_test_from_eof_test-unreachable1_jumpf0 unreachable1_jumpf0
...fork_Osaka-state_test_from_eof_test-unreachable1_callf0 unreachable1_callf0
...fork_Osaka-state_test_from_eof_test-unreachable1_selfcall_jumpf0 unreachable1_selfcall_jumpf0
...fork_Osaka-state_test_from_eof_test-unreachable12_of3_2jumpf1 unreachable12_of3_2jumpf1
...fork_Osaka-state_test_from_eof_test-unreachable12_of3_2callf1 unreachable12_of3_2callf1
...fork_Osaka-state_test_from_eof_test-unreachable12_of3_jumpf_loop unreachable12_of3_jumpf_loop
...fork_Osaka-state_test_from_eof_test-unreachable12_of3_callf_loop_stop unreachable12_of3_callf_loop_stop
...fork_Osaka-state_test_from_eof_test-unreachable12_of3_callf_loop_retf unreachable12_of3_callf_loop_retf
...fork_Osaka-state_test_from_eof_test-unreachable12_of3_callf_loop_mixed unreachable12_of3_callf_loop_mixed
...fork_Osaka-state_test_from_eof_test-selfjumpf0_unreachable1 selfjumpf0_unreachable1
...fork_Osaka-state_test_from_eof_test-unreachable2_of3 unreachable2_of3
...fork_Osaka-state_test_from_eof_test-unreachable1_of3 unreachable1_of3
...fork_Osaka-state_test_from_eof_test-unreachable1_of4 unreachable1_of4
...fork_Osaka-state_test_from_eof_test-unreachable2_of3_retf unreachable2_of3_retf
...fork_Osaka-state_test_from_eof_test-unreachable2-255 unreachable2-255
...fork_Osaka-state_test_from_eof_test-unreachable255 unreachable255
...fork_Osaka-blockchain_test_from_eof_test-unreachable1 unreachable1
...fork_Osaka-blockchain_test_from_eof_test-unreachable1_selfjumpf unreachable1_selfjumpf
...fork_Osaka-blockchain_test_from_eof_test-unreachable1_selfcallf unreachable1_selfcallf
...fork_Osaka-blockchain_test_from_eof_test-unreachable1_jumpf0 unreachable1_jumpf0
...fork_Osaka-blockchain_test_from_eof_test-unreachable1_callf0 unreachable1_callf0
...fork_Osaka-blockchain_test_from_eof_test-unreachable1_selfcall_jumpf0 unreachable1_selfcall_jumpf0
...fork_Osaka-blockchain_test_from_eof_test-unreachable12_of3_2jumpf1 unreachable12_of3_2jumpf1
...fork_Osaka-blockchain_test_from_eof_test-unreachable12_of3_2callf1 unreachable12_of3_2callf1
...fork_Osaka-blockchain_test_from_eof_test-unreachable12_of3_jumpf_loop unreachable12_of3_jumpf_loop
...fork_Osaka-blockchain_test_from_eof_test-unreachable12_of3_callf_loop_stop unreachable12_of3_callf_loop_stop
...fork_Osaka-blockchain_test_from_eof_test-unreachable12_of3_callf_loop_retf unreachable12_of3_callf_loop_retf
...fork_Osaka-blockchain_test_from_eof_test-unreachable12_of3_callf_loop_mixed unreachable12_of3_callf_loop_mixed
...fork_Osaka-blockchain_test_from_eof_test-selfjumpf0_unreachable1 selfjumpf0_unreachable1
...fork_Osaka-blockchain_test_from_eof_test-unreachable2_of3 unreachable2_of3
...fork_Osaka-blockchain_test_from_eof_test-unreachable1_of3 unreachable1_of3
...fork_Osaka-blockchain_test_from_eof_test-unreachable1_of4 unreachable1_of4
...fork_Osaka-blockchain_test_from_eof_test-unreachable2_of3_retf unreachable2_of3_retf
...fork_Osaka-blockchain_test_from_eof_test-unreachable2-255 unreachable2-255
...fork_Osaka-blockchain_test_from_eof_test-unreachable255 unreachable255