Skip to content

test_blobbasefee_out_of_gas()

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

Generate fixtures for these test cases for Osaka with:

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

Tests that the BLOBBASEFEE opcode fails with insufficient gas.

Source code in tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
@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,
) -> None:
    """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-state_test-enough_gas 2 False
...fork_Cancun-state_test-out_of_gas 1 True
...fork_Cancun-blockchain_test_from_state_test-enough_gas 2 False
...fork_Cancun-blockchain_test_from_state_test-out_of_gas 1 True
...fork_Prague-state_test-enough_gas 2 False
...fork_Prague-state_test-out_of_gas 1 True
...fork_Prague-blockchain_test_from_state_test-enough_gas 2 False
...fork_Prague-blockchain_test_from_state_test-out_of_gas 1 True
...fork_Osaka-state_test-enough_gas 2 False
...fork_Osaka-state_test-out_of_gas 1 True
...fork_Osaka-blockchain_test_from_state_test-enough_gas 2 False
...fork_Osaka-blockchain_test_from_state_test-out_of_gas 1 True