Skip to content

test_jumpf_diff_min_stack_height()

Documentation for tests/prague/eip7692_eof_v1/eip6206_jumpf/test_jumpf_stack.py::test_jumpf_diff_min_stack_height@verkle@v0.0.6.

Generate fixtures for these test cases for Pragueeip7692 with:

Pragueeip7692 only:

fill -v tests/prague/eip7692_eof_v1/eip6206_jumpf/test_jumpf_stack.py::test_jumpf_diff_min_stack_height --fork=PragueEIP7692 --evm-bin=/path/to/evm-tool-dev-version

For all forks up to and including Pragueeip7692:

fill -v tests/prague/eip7692_eof_v1/eip6206_jumpf/test_jumpf_stack.py::test_jumpf_diff_min_stack_height --until=PragueEIP7692

Tests jumpf with a different min stack height

Source code in tests/prague/eip7692_eof_v1/eip6206_jumpf/test_jumpf_stack.py
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
284
@pytest.mark.parametrize(
    ["target_inputs", "target_outputs", "stack_height", "expected_exception"],
    [
        pytest.param(1, 0, 1, EOFException.STACK_UNDERFLOW, id="less_stack"),
        pytest.param(2, 1, 2, EOFException.STACK_UNDERFLOW, id="same_stack"),
        pytest.param(
            3, 2, 3, EOFException.JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS, id="more_stack"
        ),
        pytest.param(
            2, 2, 1, EOFException.JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS, id="less_output"
        ),
        pytest.param(1, 1, 1, EOFException.STACK_UNDERFLOW, id="same_output"),
        pytest.param(0, 0, 1, EOFException.STACK_UNDERFLOW, id="more_output"),
    ],
)
def test_jumpf_diff_min_stack_height(
    eof_test: EOFTestFiller,
    target_inputs: int,
    target_outputs: int,
    stack_height: int,
    expected_exception: EOFException,
):
    """
    Tests jumpf with a different min stack height
    """
    current_section_outputs = 1
    eof_test(
        data=Container(
            sections=[
                Section.Code(Op.CALLF(1) + Op.STOP, max_stack_height=1),
                Section.Code(
                    (Op.PUSH0 * (stack_height - 1))  # (0, 0)
                    + Op.PUSH0  # (stack_height - 1, stack_height - 1)
                    + Op.RJUMPI[1]  # (stack_height, stack_height)
                    + Op.PUSH0  # (stack_height - 1, stack_height - 1)
                    + Op.JUMPF(2),  # (stack_height - 1, stack_height)
                    code_outputs=current_section_outputs,
                ),
                Section.Code(
                    Op.POP * (target_inputs - target_outputs) + Op.RETF,
                    code_inputs=target_inputs,
                    code_outputs=target_outputs,
                    max_stack_height=target_inputs,
                ),
            ]
        ),
        expect_exception=expected_exception,
    )

Parametrized Test Cases

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

Skipped Parameters

For more concise readability, the table below does not list the following parameter values: fork, blockchain_test, state_test, state_test_only, eof_test, eof_state_test.

Test ID target_inputs target_outputs stack_height expected_exception
less_stack 1 0 1 EOFException.STACK_UNDERFLOW
same_stack 2 1 2 EOFException.STACK_UNDERFLOW
more_stack 3 2 3 EOFException.JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS
less_output 2 2 1 EOFException.JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS
same_output 1 1 1 EOFException.STACK_UNDERFLOW
more_output 0 0 1 EOFException.STACK_UNDERFLOW