Skip to content

test_blob_type_tx_pre_fork()

Documentation for tests/cancun/eip4844_blobs/test_blob_txs.py::test_blob_type_tx_pre_fork@008e492e.

Generate fixtures for these test cases for Prague with:

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

Reject blocks with blob type transactions before Cancun fork.

Blocks sent by NewPayloadV2 (Shanghai) that contain blob type transactions, furthermore blobs field within NewPayloadV2 method must be computed as INVALID, due to an invalid block hash.

Source code in tests/cancun/eip4844_blobs/test_blob_txs.py
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
@pytest.mark.parametrize(
    [
        "blobs_per_tx",
        "parent_excess_blobs",
        "tx_max_fee_per_blob_gas",
        "tx_error",
    ],
    [
        (
            [0],
            None,
            1,
            [TransactionException.TYPE_3_TX_PRE_FORK, TransactionException.TYPE_3_TX_ZERO_BLOBS],
        ),
        ([1], None, 1, TransactionException.TYPE_3_TX_PRE_FORK),
    ],
    ids=["no_blob_tx", "one_blob_tx"],
)
@pytest.mark.valid_at_transition_to("Cancun")
def test_blob_type_tx_pre_fork(
    state_test: StateTestFiller,
    pre: Alloc,
    txs: List[Transaction],
):
    """
    Reject blocks with blob type transactions before Cancun fork.

    Blocks sent by NewPayloadV2 (Shanghai) that contain blob type transactions, furthermore blobs
    field within NewPayloadV2 method must be computed as INVALID, due to an invalid block hash.
    """
    assert len(txs) == 1
    state_test(
        pre=pre,
        post={},
        tx=txs[0],
        env=Environment(),  # `env` fixture has blob fields
    )

Parametrized Test Cases

This test case is only parametrized by fork and fixture format.

Test ID (Abbreviated) blobs_per_tx parent_excess_blobs tx_max_fee_per_blob_gas tx_error
...fork_ShanghaiToCancunAtTime15k-state_test-no_blob_tx [0] None 1 [, ]
...fork_ShanghaiToCancunAtTime15k-state_test-one_blob_tx [1] None 1 TransactionException.TYPE_3_TX_PRE_FORK
...fork_ShanghaiToCancunAtTime15k-blockchain_test_from_state_test-no_blob_tx [0] None 1 [, ]
...fork_ShanghaiToCancunAtTime15k-blockchain_test_from_state_test-one_blob_tx [1] None 1 TransactionException.TYPE_3_TX_PRE_FORK