Skip to content

test_blobbasefee_during_fork()

Documentation for tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py::test_blobbasefee_during_fork@83970623.

Generate fixtures for these test cases for Prague with:

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

Tests that the BLOBBASEFEE opcode results on exception when called before the fork and succeeds when called after the fork.

Source code in tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
@pytest.mark.parametrize(
    "caller_pre_storage",
    [{block_number: 0xFF for block_number, _ in enumerate(timestamps, start=1)}],
    ids=[""],
)
@pytest.mark.valid_at_transition_to("Cancun")
def test_blobbasefee_during_fork(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
    caller_address: Address,
    callee_address: Address,
    tx: Transaction,
):
    """
    Tests that the BLOBBASEFEE opcode results on exception when called before the fork and
    succeeds when called after the fork.
    """
    code_caller_post_storage = Storage()

    nonce = count(0)

    blocks = []

    for block_number, timestamp in enumerate(timestamps, start=1):
        blocks.append(
            Block(
                txs=[tx.with_nonce(next(nonce))],
                timestamp=timestamp,
            ),
        )
        # pre-set storage just to make sure we detect the change
        code_caller_post_storage[block_number] = 0 if timestamp < 15_000 else 1

    post = {
        caller_address: Account(
            storage=code_caller_post_storage,
        ),
        callee_address: Account(
            balance=0,
        ),
    }
    blockchain_test(
        genesis_environment=Environment(),
        pre=pre,
        blocks=blocks,
        post=post,
    )

Parametrized Test Cases

This test case is only parametrized by fork.

Test ID (Abbreviated) caller_pre_storage
...fork_ShanghaiToCancunAtTime15k-blockchain_test- {1: 255, 2: 255, 3: 255}