Skip to content

test_invalid_blob_gas_used_in_header()

Documentation for tests/cancun/eip4844_blobs/test_excess_blob_gas.py::test_invalid_blob_gas_used_in_header@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

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

Test rejection of blocks where the blobGasUsed in the header is invalid.

  • blobGasUsed is not equal to the number of data blobs in the block
  • blobGasUsed is the max uint64 value
Source code in tests/cancun/eip4844_blobs/test_excess_blob_gas.py
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
@pytest.mark.parametrize_by_fork(
    "new_blobs,header_blob_gas_used",
    all_invalid_blob_gas_used_combinations,
)
@pytest.mark.parametrize("parent_blobs", [0])
@pytest.mark.exception_test
@pytest.mark.slow()
def test_invalid_blob_gas_used_in_header(
    blockchain_test: BlockchainTestFiller,
    env: Environment,
    pre: Mapping[Address, Account],
    blocks: List[Block],
    new_blobs: int,
    header_blob_gas_used: Optional[int],
    blob_gas_per_blob: int,
) -> None:
    """
    Test rejection of blocks where the `blobGasUsed` in the header is invalid.

    - `blobGasUsed` is not equal to the number of data blobs in the block
    - `blobGasUsed` is the max uint64 value
    """
    if header_blob_gas_used is None:
        raise Exception("test case is badly formatted")

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

Parametrized Test Cases

This test generates 484 parametrized test cases across 4 forks.