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@20373115.

Generate fixtures for these test cases for Cancun with:

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

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
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
@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.transitions_to(), blob_gas_price=2
            )
            // (
                fork.transitions_to().max_blobs_per_block()
                - fork.transitions_to().target_blobs_per_block()
            )
            + 2,
            fork.transitions_to().max_blobs_per_block(),
            id="max_blobs",
        ),
        pytest.param(10, 0, id="no_blobs"),
        pytest.param(
            10,
            fork.transitions_to().target_blobs_per_block(),
            id="target_blobs",
        ),
    ],
)
@pytest.mark.eels_base_coverage
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 generates 3 parametrized test cases across 1 fork.