Skip to content

test_swapn_stack_underflow()

Documentation for tests/prague/eip7692_eof_v1/eip663_dupn_swapn_exchange/test_swapn.py::test_swapn_stack_underflow@verkle@v0.0.6.

Generate fixtures for these test cases for Pragueeip7692 with:

Pragueeip7692 only:

fill -v tests/prague/eip7692_eof_v1/eip663_dupn_swapn_exchange/test_swapn.py::test_swapn_stack_underflow --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/eip663_dupn_swapn_exchange/test_swapn.py::test_swapn_stack_underflow --until=PragueEIP7692

Test case out of bounds DUPN immediate.

Source code in tests/prague/eip7692_eof_v1/eip663_dupn_swapn_exchange/test_swapn.py
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
@pytest.mark.parametrize(
    "stack_height",
    [
        0,
        1,
        21,
        2**8 - 1,
    ],
)
@pytest.mark.valid_from(EOF_FORK_NAME)
def test_swapn_stack_underflow(
    stack_height: int,
    eof_test: EOFTestFiller,
):
    """
    Test case out of bounds DUPN immediate.
    """
    eof_code = Container(
        sections=[
            Section.Code(
                code=sum(Op.PUSH2[v] for v in range(0, stack_height))
                + Op.SWAPN[stack_height]
                + Op.STOP,
                max_stack_height=stack_height,
            )
        ],
    )
    eof_test(
        data=eof_code,
        expect_exception=EOFException.STACK_UNDERFLOW,
    )

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 stack_height
stack_height_0 0
stack_height_1 1
stack_height_21 21
stack_height_255 255