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@88e9fb8f.

Generate fixtures for these test cases for Osaka with:

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

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
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
@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,
    genesis_environment: Environment,
    pre: Alloc,
    pre_fork_blocks: List[Block],
    post_fork_blocks: List[Block],
    post: Mapping[Address, Account],
) -> None:
    """
    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=genesis_environment,
    )

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