Skip to content

test_callf_stack_height_limit_exceeded()

Documentation for tests/osaka/eip7692_eof_v1/eip4750_functions/test_code_validation.py::test_callf_stack_height_limit_exceeded@14a7429a.

Generate fixtures for these test cases for Osaka with:

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

Test for invalid EOF code containing CALLF instruction exceeding the stack height limit. The code reaches the maximum runtime stack height (1024) which is above the EOF limit for the stack height in the type section (1023).

Source code in tests/osaka/eip7692_eof_v1/eip4750_functions/test_code_validation.py
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
@pytest.mark.parametrize("callee_outputs", [1, 2, MAX_CODE_OUTPUTS])
def test_callf_stack_height_limit_exceeded(eof_test, callee_outputs):
    """
    Test for invalid EOF code containing CALLF instruction exceeding the stack height limit.
    The code reaches the maximum runtime stack height (1024)
    which is above the EOF limit for the stack height in the type section (1023).
    """
    callf_stack_height = MAX_RUNTIME_STACK_HEIGHT - callee_outputs
    container = Container(
        sections=[
            Section.Code(
                Op.PUSH0 * callf_stack_height + Op.CALLF[1] + Op.STOP,
                max_stack_height=MAX_RUNTIME_STACK_HEIGHT,
            ),
            Section.Code(
                Op.PUSH0 * callee_outputs + Op.RETF,
                code_outputs=callee_outputs,
                max_stack_height=callee_outputs,
            ),
        ],
    )
    eof_test(container=container, expect_exception=EOFException.MAX_STACK_INCREASE_ABOVE_LIMIT)

Parametrized Test Cases

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

Test ID (Abbreviated) callee_outputs
...fork_Osaka-eof_test-callee_outputs_1 1
...fork_Osaka-eof_test-callee_outputs_2 2
...fork_Osaka-eof_test-callee_outputs_127 127
...fork_Osaka-state_test_from_eof_test-callee_outputs_1 1
...fork_Osaka-state_test_from_eof_test-callee_outputs_2 2
...fork_Osaka-state_test_from_eof_test-callee_outputs_127 127
...fork_Osaka-blockchain_test_from_eof_test-callee_outputs_1 1
...fork_Osaka-blockchain_test_from_eof_test-callee_outputs_2 2
...fork_Osaka-blockchain_test_from_eof_test-callee_outputs_127 127