Skip to content

test_invalid_blob_hash_versioning_single_tx()

Documentation for tests/cancun/eip4844_blobs/test_blob_txs.py::test_invalid_blob_hash_versioning_single_tx@21507778.

Generate fixtures for these test cases for Amsterdam with:

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

Reject blob transactions with invalid blob hash version.

  • Transaction with single blob with invalid version
  • Transaction with multiple blobs all with invalid version
  • Transaction with multiple blobs either with invalid version
Source code in tests/cancun/eip4844_blobs/test_blob_txs.py
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
@pytest.mark.parametrize(
    "blob_hashes_per_tx",
    [
        [[Hash(1)]],
        [[Hash(x) for x in range(2)]],
        [
            add_kzg_version([Hash(1)], Spec.BLOB_COMMITMENT_VERSION_KZG)
            + [Hash(2)]
        ],
        [
            [Hash(1)]
            + add_kzg_version([Hash(2)], Spec.BLOB_COMMITMENT_VERSION_KZG)
        ],
    ],
    ids=[
        "single_blob",
        "multiple_blobs",
        "multiple_blobs_single_bad_hash_1",
        "multiple_blobs_single_bad_hash_2",
    ],
)
@pytest.mark.parametrize(
    "tx_error",
    [TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH],
    ids=[""],
)
@pytest.mark.exception_test
@pytest.mark.valid_from("Cancun")
def test_invalid_blob_hash_versioning_single_tx(
    state_test: StateTestFiller,
    state_env: Environment,
    pre: Alloc,
    txs: List[Transaction],
    header_verify: Optional[Header],
    rlp_modifier: Optional[Header],
) -> None:
    """
    Reject blob transactions with invalid blob hash version.

    - Transaction with single blob with invalid version
    - Transaction with multiple blobs all with invalid version
    - Transaction with multiple blobs either with invalid version
    """
    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 4 parametrized test cases across 4 forks.