Skip to content

test_invalid_static_excess_blob_gas()

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

Generate fixtures for these test cases for Amsterdam with:

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

Test rejection of blocks where the excessBlobGas remains unchanged but the parent blobs included are not TARGET_BLOBS_PER_BLOCK.

Test is parametrized to MAX_BLOBS_PER_BLOCK and TARGET_BLOBS_PER_BLOCK.

Source code in tests/cancun/eip4844_blobs/test_excess_blob_gas.py
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
@pytest.mark.parametrize_by_fork(
    "parent_blobs",
    lambda fork: [
        b
        for b in range(0, fork.max_blobs_per_block() + 1)
        if b != fork.target_blobs_per_block()
    ],
)
@pytest.mark.parametrize_by_fork(
    "parent_excess_blobs", lambda fork: [1, fork.target_blobs_per_block()]
)
@pytest.mark.parametrize("new_blobs", [1])
@pytest.mark.exception_test
def test_invalid_static_excess_blob_gas(
    blockchain_test: BlockchainTestFiller,
    env: Environment,
    pre: Mapping[Address, Account],
    blocks: List[Block],
    correct_excess_blob_gas: int,
    parent_excess_blob_gas: int,
) -> None:
    """
    Test rejection of blocks where the `excessBlobGas` remains unchanged but
    the parent blobs included are not `TARGET_BLOBS_PER_BLOCK`.

    Test is parametrized to `MAX_BLOBS_PER_BLOCK` and `TARGET_BLOBS_PER_BLOCK`.
    """
    blocks[-1].rlp_modifier = Header(excess_blob_gas=parent_excess_blob_gas)
    blocks[-1].header_verify = None
    blocks[-1].exception = BlockException.INCORRECT_EXCESS_BLOB_GAS
    blockchain_test(
        pre=pre,
        post={},
        blocks=blocks,
        genesis_environment=env,
    )

Parametrized Test Cases

This test generates 42 parametrized test cases across 4 forks.