Skip to content

test_blobbasefee_stack_overflow()

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

Generate fixtures for these test cases for Prague with:

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

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

Source code in tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py
 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
108
109
110
111
112
113
@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,
):
    """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(
        env=Environment(),
        pre=pre,
        tx=tx,
        post=post,
    )

Parametrized Test Cases

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

Test ID (Abbreviated) callee_code call_fails
...fork_Cancun-blockchain_test-no_stack_overflow False
...fork_Cancun-blockchain_test-stack_overflow True
...fork_Cancun-state_test-no_stack_overflow False
...fork_Cancun-state_test-stack_overflow True
...fork_Prague-blockchain_test-no_stack_overflow False
...fork_Prague-blockchain_test-stack_overflow True
...fork_Prague-state_test-no_stack_overflow False
...fork_Prague-state_test-stack_overflow True
...fork_Osaka-blockchain_test-no_stack_overflow False
...fork_Osaka-blockchain_test-stack_overflow True
...fork_Osaka-state_test-no_stack_overflow False
...fork_Osaka-state_test-stack_overflow True