Skip to content

test_fork_transition_excess_blob_gas_at_blob_genesis()

Documentation for tests/cancun/eip4844_blobs/test_excess_blob_gas_fork_transition.py::test_fork_transition_excess_blob_gas_at_blob_genesis@01f496f4.

Generate fixtures for these test cases for Prague with:

fill -v tests/cancun/eip4844_blobs/test_excess_blob_gas_fork_transition.py::test_fork_transition_excess_blob_gas_at_blob_genesis --fork Prague

Test excessBlobGas calculation in the header when the fork is activated.

Also produce enough blocks to test the blob gas price increase when the block is full with SpecHelpers.max_blobs_per_block() blobs.

Source code in tests/cancun/eip4844_blobs/test_excess_blob_gas_fork_transition.py
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
@pytest.mark.valid_at_transition_to("Cancun", subsequent_forks=False)
@pytest.mark.parametrize_by_fork(
    "post_fork_block_count,post_fork_blobs_per_block",
    lambda fork: [
        pytest.param(
            SpecHelpers.get_min_excess_blobs_for_blob_gas_price(fork=fork, blob_gas_price=2)
            // (
                fork.max_blobs_per_block(timestamp=FORK_TIMESTAMP)
                - fork.target_blobs_per_block(timestamp=FORK_TIMESTAMP)
            )
            + 2,
            fork.max_blobs_per_block(timestamp=FORK_TIMESTAMP),
            id="max_blobs",
        ),
        pytest.param(10, 0, id="no_blobs"),
        pytest.param(10, fork.target_blobs_per_block(timestamp=FORK_TIMESTAMP), id="target_blobs"),
    ],
)
def test_fork_transition_excess_blob_gas_at_blob_genesis(
    blockchain_test: BlockchainTestFiller,
    env: Environment,
    pre: Alloc,
    pre_fork_blocks: List[Block],
    post_fork_blocks: List[Block],
    post: Mapping[Address, Account],
):
    """
    Test `excessBlobGas` calculation in the header when the fork is activated.

    Also produce enough blocks to test the blob gas price increase when the block is full with
    `SpecHelpers.max_blobs_per_block()` blobs.
    """
    blockchain_test(
        pre=pre,
        post=post,
        blocks=pre_fork_blocks + post_fork_blocks,
        genesis_environment=env,
    )

Parametrized Test Cases

This test case is only parametrized by fork.

Test ID (Abbreviated) post_fork_block_count post_fork_blobs_per_block
...fork_ShanghaiToCancunAtTime15k-max_blobs-blockchain_test 8 6
...fork_ShanghaiToCancunAtTime15k-no_blobs-blockchain_test 10 0
...fork_ShanghaiToCancunAtTime15k-target_blobs-blockchain_test 10 3