Skip to content

test_fork_transition_excess_blob_gas_post_blob_genesis()

Documentation for tests/cancun/eip4844_blobs/test_excess_blob_gas_fork_transition.py::test_fork_transition_excess_blob_gas_post_blob_genesis@20373115.

Generate fixtures for these test cases for BPO2 with:

fill -v tests/cancun/eip4844_blobs/test_excess_blob_gas_fork_transition.py::test_fork_transition_excess_blob_gas_post_blob_genesis --fork BPO2

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

Source code in tests/cancun/eip4844_blobs/test_excess_blob_gas_fork_transition.py
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
@pytest.mark.valid_for_bpo_forks
@pytest.mark.valid_at_transition_to("Prague", subsequent_forks=True)
@pytest.mark.parametrize_by_fork(
    "post_fork_block_count,pre_fork_blobs_per_block,post_fork_blobs_per_block",
    lambda fork: [
        pytest.param(
            SpecHelpers.get_min_excess_blobs_for_blob_gas_price(
                fork=fork.transitions_from(), blob_gas_price=2
            )
            // (
                fork.transitions_to().max_blobs_per_block()
                - fork.transitions_to().target_blobs_per_block()
            )
            + 2,
            fork.transitions_from().max_blobs_per_block(),
            fork.transitions_to().max_blobs_per_block(),
            id="max_blobs_before_and_after",
        ),
        pytest.param(
            10,
            0,
            fork.transitions_to().max_blobs_per_block(),
            id="no_blobs_before_and_max_blobs_after",
        ),
        pytest.param(
            10,
            fork.transitions_from().max_blobs_per_block(),
            0,
            id="max_blobs_before_and_no_blobs_after",
        ),
        pytest.param(
            10,
            fork.transitions_from().target_blobs_per_block(),
            fork.transitions_to().target_blobs_per_block(),
            id="target_blobs_before_and_after",
        ),
        pytest.param(
            10,
            1,
            fork.transitions_to().max_blobs_per_block(),
            id="single_blob_before_and_max_blobs_after",
        ),
        pytest.param(
            10,
            fork.transitions_from().max_blobs_per_block(),
            1,
            id="max_blobs_before_and_single_blob_after",
        ),
    ],
)
@pytest.mark.parametrize("block_base_fee_per_gas", [7, 16, 23])
@pytest.mark.slow
def test_fork_transition_excess_blob_gas_post_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.
    """
    blockchain_test(
        pre=pre,
        post=post,
        blocks=pre_fork_blocks + post_fork_blocks,
        genesis_environment=genesis_environment,
    )

Parametrized Test Cases

This test generates 18 parametrized test cases across 3 forks.