Skip to content

test_invalid_tx_blob_count()

Documentation for tests/cancun/eip4844_blobs/test_blob_txs.py::test_invalid_tx_blob_count@21fb11c8.

Generate fixtures for these test cases for Prague with:

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

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
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
@pytest.mark.parametrize_by_fork(
    "blobs_per_tx,tx_error",
    generate_invalid_tx_blob_count_tests,
)
@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.

Test ID (Abbreviated) blobs_per_tx tx_error
...fork_Cancun-too_few_blobs-state_test [0] TransactionException.TYPE_3_TX_ZERO_BLOBS
...fork_Cancun-too_few_blobs-blockchain_test_from_state_test [0] TransactionException.TYPE_3_TX_ZERO_BLOBS
...fork_Cancun-too_many_blobs-state_test [7] TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED
...fork_Cancun-too_many_blobs-blockchain_test_from_state_test [7] TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED
...fork_Prague-too_few_blobs-state_test [0] TransactionException.TYPE_3_TX_ZERO_BLOBS
...fork_Prague-too_few_blobs-blockchain_test_from_state_test [0] TransactionException.TYPE_3_TX_ZERO_BLOBS
...fork_Prague-too_many_blobs-state_test [10] TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED
...fork_Prague-too_many_blobs-blockchain_test_from_state_test [10] TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED
...fork_Osaka-too_few_blobs-state_test [0] TransactionException.TYPE_3_TX_ZERO_BLOBS
...fork_Osaka-too_few_blobs-blockchain_test_from_state_test [0] TransactionException.TYPE_3_TX_ZERO_BLOBS
...fork_Osaka-too_many_blobs-state_test [10] TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED
...fork_Osaka-too_many_blobs-blockchain_test_from_state_test [10] TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED