Skip to content

test_invalid_tx_blob_count()

Documentation for tests/cancun/eip4844_blobs/test_blob_txs.py::test_invalid_tx_blob_count@verkle@v0.0.6.

Generate fixtures for these test cases for Cancun with:

Cancun only:

fill -v tests/cancun/eip4844_blobs/test_blob_txs.py::test_invalid_tx_blob_count --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_blob_txs.py::test_invalid_tx_blob_count --until=Cancun

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
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
@pytest.mark.parametrize(
    "blobs_per_tx,tx_error",
    [
        ([0], TransactionException.TYPE_3_TX_ZERO_BLOBS),
        (
            [SpecHelpers.max_blobs_per_block() + 1],
            TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED,
        ),
    ],
    ids=["too_few_blobs", "too_many_blobs"],
)
@pytest.mark.valid_from("Cancun")
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],
):
    """
    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

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 blobs_per_tx tx_error
too_few_blobs [0] TransactionException.TYPE_3_TX_ZERO_BLOBS
too_many_blobs [7] TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED
too_few_blobs [0] TransactionException.TYPE_3_TX_ZERO_BLOBS
too_many_blobs [7] TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED