Skip to content

test_invalid_excess_blob_gas_above_target_change()

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

Generate fixtures for these test cases for Bogota with:

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

Test rejection of blocks where the excessBlobGas.

  • decreases more than BLOB_TARGET_GAS_PER_BLOCK in a single block with zero blobs.
  • increases more than BLOB_TARGET_GAS_PER_BLOCK in a single block with max blobs.
Source code in tests/cancun/eip4844_blobs/test_excess_blob_gas.py
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
@pytest.mark.parametrize_by_fork(
    "header_excess_blobs_delta,parent_blobs",
    generate_invalid_excess_blob_gas_above_target_change_tests,
)
@pytest.mark.parametrize("new_blobs", [1])
@pytest.mark.exception_test
@pytest.mark.valid_for_bpo_forks()
def test_invalid_excess_blob_gas_above_target_change(
    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`.

    - decreases more than `BLOB_TARGET_GAS_PER_BLOCK` in a single block
        with zero blobs.
    - increases more than `BLOB_TARGET_GAS_PER_BLOCK` in a single block
        with max 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 4 parametrized test cases across 11 forks.