Skip to content

test_invalid_static_excess_blob_gas_from_zero_on_blobs_above_target()

Documentation for tests/cancun/eip4844_blobs/test_excess_blob_gas.py::test_invalid_static_excess_blob_gas_from_zero_on_blobs_above_target@88e9fb8f.

Generate fixtures for these test cases for Osaka with:

fill -v tests/cancun/eip4844_blobs/test_excess_blob_gas.py::test_invalid_static_excess_blob_gas_from_zero_on_blobs_above_target --fork Osaka

Test rejection of blocks where the excessBlobGas does not increase from zero, even when the included blobs is above target.

Test is parametrized to [TARGET_BLOBS_PER_BLOCK+1, MAX_BLOBS_PER_BLOCK] new blobs.

Source code in tests/cancun/eip4844_blobs/test_excess_blob_gas.py
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
@pytest.mark.parametrize("header_excess_blob_gas", [0])
@pytest.mark.parametrize_by_fork(
    "parent_blobs",
    lambda fork: range(fork.target_blobs_per_block() + 1, fork.max_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_static_excess_blob_gas_from_zero_on_blobs_above_target(
    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` does not increase from
    zero, even when the included blobs is above target.

    Test is parametrized to `[TARGET_BLOBS_PER_BLOCK+1, MAX_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,
        tag="-".join(
            [
                f"correct:{hex(correct_excess_blob_gas)}",
                f"header:{hex(header_excess_blob_gas)}",
            ]
        ),
    )

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Test ID (Abbreviated) parent_blobs new_blobs parent_excess_blobs header_excess_blob_gas
...fork_Cancun-parent_blobs_4-blockchain_test-new_blobs_1-parent_excess_blobs_0-header_excess_blob_gas_0 4 1 0 0
...fork_Cancun-parent_blobs_5-blockchain_test-new_blobs_1-parent_excess_blobs_0-header_excess_blob_gas_0 5 1 0 0
...fork_Cancun-parent_blobs_6-blockchain_test-new_blobs_1-parent_excess_blobs_0-header_excess_blob_gas_0 6 1 0 0
...fork_Prague-parent_blobs_7-blockchain_test-new_blobs_1-parent_excess_blobs_0-header_excess_blob_gas_0 7 1 0 0
...fork_Prague-parent_blobs_8-blockchain_test-new_blobs_1-parent_excess_blobs_0-header_excess_blob_gas_0 8 1 0 0
...fork_Prague-parent_blobs_9-blockchain_test-new_blobs_1-parent_excess_blobs_0-header_excess_blob_gas_0 9 1 0 0
...fork_Osaka-parent_blobs_7-blockchain_test-new_blobs_1-parent_excess_blobs_0-header_excess_blob_gas_0 7 1 0 0
...fork_Osaka-parent_blobs_8-blockchain_test-new_blobs_1-parent_excess_blobs_0-header_excess_blob_gas_0 8 1 0 0
...fork_Osaka-parent_blobs_9-blockchain_test-new_blobs_1-parent_excess_blobs_0-header_excess_blob_gas_0 9 1 0 0