Skip to content

test_blobbasefee_stack_overflow()

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

Generate fixtures for these test cases for Osaka with:

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

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

Source code in tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
@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(
        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-state_test-no_stack_overflow False
...fork_Cancun-state_test-stack_overflow True
...fork_Cancun-blockchain_test_from_state_test-no_stack_overflow False
...fork_Cancun-blockchain_test_from_state_test-stack_overflow True
...fork_Prague-state_test-no_stack_overflow False
...fork_Prague-state_test-stack_overflow True
...fork_Prague-blockchain_test_from_state_test-no_stack_overflow False
...fork_Prague-blockchain_test_from_state_test-stack_overflow True
...fork_Osaka-state_test-no_stack_overflow False
...fork_Osaka-state_test-stack_overflow True
...fork_Osaka-blockchain_test_from_state_test-no_stack_overflow False
...fork_Osaka-blockchain_test_from_state_test-stack_overflow True