Skip to content

test_blobbasefee_stack_overflow()

Documentation for tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py::test_blobbasefee_stack_overflow@ffe48572.

Generate fixtures for these test cases for Bogota with:

fill -v tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py::test_blobbasefee_stack_overflow --fork Bogota

Tests that the BLOBBASEFEE opcode produces a stack overflow by using it repeatedly.

Source code in tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py
@pytest.mark.parametrize(
    "callee_code,call_fails",
    [
        pytest.param(Op.BLOBBASEFEE * 1024, False, id="no_stack_overflow"),
        pytest.param(Op.BLOBBASEFEE * 1025, True, id="stack_overflow"),
    ],
)
@pytest.mark.valid_from("Cancun")
def test_blobbasefee_stack_overflow(
    state_test: StateTestFiller,
    pre: Alloc,
    caller_address: Address,
    callee_address: Address,
    tx: Transaction,
    call_fails: bool,
) -> None:
    """
    Tests that the BLOBBASEFEE opcode produces a stack overflow by using it
    repeatedly.
    """
    post = {
        caller_address: Account(
            storage={1: 0 if call_fails else 1},
        ),
        callee_address: Account(
            balance=0,
        ),
    }
    state_test(
        pre=pre,
        tx=tx,
        post=post,
    )

Parametrized Test Cases

This test generates 2 parametrized test cases across 5 forks.