Skip to content

test_blobbasefee_out_of_gas()

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

Generate fixtures for these test cases for Prague with:

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

Tests that the BLOBBASEFEE opcode fails with insufficient gas.

Source code in tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
@pytest.mark.parametrize(
    "call_gas,call_fails",
    [
        pytest.param(BLOBBASEFEE_GAS, False, id="enough_gas"),
        pytest.param(BLOBBASEFEE_GAS - 1, True, id="out_of_gas"),
    ],
)
@pytest.mark.valid_from("Cancun")
def test_blobbasefee_out_of_gas(
    state_test: StateTestFiller,
    pre: Alloc,
    caller_address: Address,
    callee_address: Address,
    tx: Transaction,
    call_fails: bool,
):
    """Tests that the BLOBBASEFEE opcode fails with insufficient gas."""
    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) call_gas call_fails
...fork_Cancun-blockchain_test-enough_gas 2 False
...fork_Cancun-blockchain_test-out_of_gas 1 True
...fork_Cancun-state_test-enough_gas 2 False
...fork_Cancun-state_test-out_of_gas 1 True
...fork_Prague-blockchain_test-enough_gas 2 False
...fork_Prague-blockchain_test-out_of_gas 1 True
...fork_Prague-state_test-enough_gas 2 False
...fork_Prague-state_test-out_of_gas 1 True
...fork_Osaka-blockchain_test-enough_gas 2 False
...fork_Osaka-blockchain_test-out_of_gas 1 True
...fork_Osaka-state_test-enough_gas 2 False
...fork_Osaka-state_test-out_of_gas 1 True