Skip to content

test_invalid_excess_blob_gas_target_blobs_increase_from_zero()

Documentation for tests/cancun/eip4844_blobs/test_excess_blob_gas.py::test_invalid_excess_blob_gas_target_blobs_increase_from_zero@2867859a.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/cancun/eip4844_blobs/test_excess_blob_gas.py::test_invalid_excess_blob_gas_target_blobs_increase_from_zero --fork Amsterdam

Test rejection of blocks where the excessBlobGas increases from zero, even when the included blobs are on or below target.

Test is parametrized according to [0, TARGET_BLOBS_PER_BLOCK new blobs.

Source code in tests/cancun/eip4844_blobs/test_excess_blob_gas.py
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
@pytest.mark.parametrize_by_fork(
    "header_excess_blobs_delta",
    lambda fork: range(1, fork.max_blobs_per_block()),
)
@pytest.mark.parametrize_by_fork(
    "parent_blobs",
    lambda fork: range(0, fork.target_blobs_per_block() + 1),
)
@pytest.mark.parametrize("parent_excess_blobs", [0])  # Start at 0
@pytest.mark.parametrize("new_blobs", [1])
@pytest.mark.exception_test
def test_invalid_excess_blob_gas_target_blobs_increase_from_zero(
    blockchain_test: BlockchainTestFiller,
    env: Environment,
    pre: Mapping[Address, Account],
    blocks: List[Block],
    correct_excess_blob_gas: int,
    header_excess_blob_gas: Optional[int],
) -> None:
    """
    Test rejection of blocks where the `excessBlobGas` increases from zero,
    even when the included blobs are on or below target.

    Test is parametrized according to `[0, TARGET_BLOBS_PER_BLOCK` new blobs.
    """
    if header_excess_blob_gas is None:
        raise Exception("test case is badly formatted")

    if header_excess_blob_gas == correct_excess_blob_gas:
        raise Exception("invalid test case")

    blockchain_test(
        pre=pre,
        post={},
        blocks=blocks,
        genesis_environment=env,
    )

Parametrized Test Cases

This test generates 300 parametrized test cases across 4 forks.