Skip to content

test_invalid_max_blobs_per_tx()

Documentation for tests/osaka/eip7594_peerdas/test_max_blob_per_tx.py::test_invalid_max_blobs_per_tx@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/osaka/eip7594_peerdas/test_max_blob_per_tx.py::test_invalid_max_blobs_per_tx --fork Amsterdam

Test that transactions exceeding MAX_BLOBS_PER_TX are rejected. Verifies that individual transactions cannot contain more than the maximum allowed number of blobs per transaction, even if the total would be within the block limit.

Source code in tests/osaka/eip7594_peerdas/test_max_blob_per_tx.py
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
@pytest.mark.parametrize_by_fork(
    "blob_count",
    lambda fork: [
        fork.max_blobs_per_tx() + 1,
        fork.max_blobs_per_tx() + 2,
        fork.max_blobs_per_block(),
        fork.max_blobs_per_block() + 1,
    ],
)
@pytest.mark.valid_from("Osaka")
@pytest.mark.exception_test
def test_invalid_max_blobs_per_tx(
    fork: Fork,
    state_test: StateTestFiller,
    pre: Alloc,
    env: Environment,
    tx: Transaction,
    blob_count: int,
) -> None:
    """
    Test that transactions exceeding MAX_BLOBS_PER_TX are rejected. Verifies
    that individual transactions cannot contain more than the maximum allowed
    number of blobs per transaction, even if the total would be within the
    block limit.
    """
    state_test(
        env=env,
        pre=pre,
        tx=tx.with_error(
            TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED
            if blob_count > fork.max_blobs_per_block()
            else TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED
        ),
        post={},
    )

Parametrized Test Cases

This test generates 4 parametrized test cases across 2 forks.