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@verkle@v0.0.6.

Generate fixtures for these test cases for Cancun with:

Cancun only:

fill -v tests/cancun/eip4844_blobs/test_excess_blob_gas.py::test_invalid_excess_blob_gas_above_target_change --fork=Cancun --evm-bin=/path/to/evm-tool-dev-version

For all forks up to and including Cancun:

fill -v tests/cancun/eip4844_blobs/test_excess_blob_gas.py::test_invalid_excess_blob_gas_above_target_change --until=Cancun

Test rejection of blocks where the excessBlobGas

  • decreases more than TARGET_BLOB_GAS_PER_BLOCK in a single block with zero blobs
  • increases more than TARGET_BLOB_GAS_PER_BLOCK in a single block with max blobs
Source code in tests/cancun/eip4844_blobs/test_excess_blob_gas.py
501
502
503
504
505
506
507
508
509
510
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
@pytest.mark.parametrize(
    "header_excess_blobs_delta,parent_blobs",
    [
        (-1, 0),
        (+1, SpecHelpers.max_blobs_per_block()),
    ],
    ids=["zero_blobs_decrease_more_than_expected", "max_blobs_increase_more_than_expected"],
)
@pytest.mark.parametrize("new_blobs", [1])
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],
):
    """
    Test rejection of blocks where the `excessBlobGas`

    - decreases more than `TARGET_BLOB_GAS_PER_BLOCK` in a single block with zero blobs
    - increases more than `TARGET_BLOB_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,
        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.

Skipped Parameters

For more concise readability, the table below does not list the following parameter values: fork, blockchain_test, state_test, state_test_only, eof_test, eof_state_test.

Test ID new_blobs header_excess_blobs_delta parent_blobs
new_blobs_1-zero_blobs_decrease_more_than_expected 1 -1 0
new_blobs_1-max_blobs_increase_more_than_expected 1 1 6