Skip to content

test_invalid_tx_blob_count()

Documentation for tests/cancun/eip4844_blobs/test_blob_txs.py::test_invalid_tx_blob_count@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/cancun/eip4844_blobs/test_blob_txs.py::test_invalid_tx_blob_count --fork Amsterdam

Reject blocks that include blob transactions with invalid blob counts.

  • blob count == 0 in type 3 transaction
  • blob count > MAX_BLOBS_PER_BLOCK in type 3 transaction
Source code in tests/cancun/eip4844_blobs/test_blob_txs.py
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
@pytest.mark.parametrize_by_fork(
    "blobs_per_tx,tx_error",
    generate_invalid_tx_blob_count_tests,
)
@pytest.mark.exception_test
@pytest.mark.valid_from("Cancun")
@pytest.mark.eels_base_coverage
def test_invalid_tx_blob_count(
    state_test: StateTestFiller,
    state_env: Environment,
    pre: Alloc,
    txs: List[Transaction],
    header_verify: Optional[Header],
    rlp_modifier: Optional[Header],
) -> None:
    """
    Reject blocks that include blob transactions with invalid blob counts.

    - `blob count == 0` in type 3 transaction
    - `blob count > MAX_BLOBS_PER_BLOCK` in type 3 transaction
    """
    assert len(txs) == 1
    state_test(
        pre=pre,
        post={},
        tx=txs[0],
        env=state_env,
        blockchain_test_header_verify=header_verify,
        blockchain_test_rlp_modifier=rlp_modifier,
    )

Parametrized Test Cases

This test generates 2 parametrized test cases across 4 forks.