Skip to content

test_invalid_blob_hash_versioning_multiple_txs()

Documentation for tests/cancun/eip4844_blobs/test_blob_txs.py::test_invalid_blob_hash_versioning_multiple_txs@20373115.

Generate fixtures for these test cases for Amsterdam with:

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

Reject blocks that include blob transactions with invalid blob hash version.

  • Multiple blob transactions with single blob all with invalid version
  • Multiple blob transactions with multiple blobs all with invalid version
  • Multiple blob transactions with multiple blobs only one with invalid version
Source code in tests/cancun/eip4844_blobs/test_blob_txs.py
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
@pytest.mark.parametrize(
    "blob_hashes_per_tx",
    [
        [
            add_kzg_version([Hash(1)], Spec.BLOB_COMMITMENT_VERSION_KZG),
            [Hash(2)],
        ],
        [
            add_kzg_version([Hash(1)], Spec.BLOB_COMMITMENT_VERSION_KZG),
            [Hash(x) for x in range(1, 3)],
        ],
        [
            add_kzg_version([Hash(1)], Spec.BLOB_COMMITMENT_VERSION_KZG),
            [Hash(2)]
            + add_kzg_version([Hash(3)], Spec.BLOB_COMMITMENT_VERSION_KZG),
        ],
        [
            add_kzg_version([Hash(1)], Spec.BLOB_COMMITMENT_VERSION_KZG),
            add_kzg_version([Hash(2)], Spec.BLOB_COMMITMENT_VERSION_KZG),
            [Hash(3)],
        ],
    ],
    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")
@pytest.mark.eels_base_coverage
def test_invalid_blob_hash_versioning_multiple_txs(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
    env: Environment,
    block: Block,
) -> None:
    """
    Reject blocks that include blob transactions with invalid blob hash
    version.

    - Multiple blob transactions with single blob all with invalid version
    - Multiple blob transactions with multiple blobs all with invalid version
    - Multiple blob transactions with multiple blobs only one with invalid
        version
    """
    blockchain_test(
        pre=pre,
        post={},
        blocks=[block],
        genesis_environment=env,
    )

Parametrized Test Cases

This test generates 4 parametrized test cases across 4 forks.