Skip to content

test_invalid_zero_excess_blob_gas_in_header()

Documentation for tests/cancun/eip4844_blobs/test_excess_blob_gas.py::test_invalid_zero_excess_blob_gas_in_header@636b5f17.

Generate fixtures for these test cases for Bogota with:

fill -v tests/cancun/eip4844_blobs/test_excess_blob_gas.py::test_invalid_zero_excess_blob_gas_in_header --fork Bogota

Test rejection of blocks where the excessBlobGas in the header drops to zero in a block with or without data blobs, but the excess blobs in the parent are greater than target.

Source code in tests/cancun/eip4844_blobs/test_excess_blob_gas.py
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
@pytest.mark.parametrize("header_excess_blob_gas", [0])
@pytest.mark.parametrize("new_blobs", [0, 1])
@pytest.mark.parametrize_by_fork(
    "parent_blobs",
    lambda fork: SpecHelpers.get_blob_counts(
        fork=fork, upper=fork.max_blobs_per_block()
    ),
)
@pytest.mark.exception_test
@pytest.mark.valid_for_bpo_forks()
def test_invalid_zero_excess_blob_gas_in_header(
    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` in the header drops to
    zero in a block with or without data blobs, but the excess blobs in the
    parent are greater than target.
    """
    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 50 parametrized test cases across 11 forks.