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@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_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
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
@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_OPERAND_STACK_HEIGHT - callee_outputs
    container = Container(
        sections=[
            Section.Code(
                Op.PUSH0 * callf_stack_height + Op.CALLF[1] + Op.STOP,
                max_stack_height=MAX_RUNTIME_OPERAND_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_HEIGHT_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