Skip to content

test_max_blobs_per_tx_fork_transition()

Documentation for tests/osaka/eip7594_peerdas/test_max_blob_per_tx.py::test_max_blobs_per_tx_fork_transition@88e9fb8f.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7594_peerdas/test_max_blob_per_tx.py::test_max_blobs_per_tx_fork_transition --fork Osaka

Test MAX_BLOBS_PER_TX limit enforcement across fork transition.

Source code in tests/osaka/eip7594_peerdas/test_max_blob_per_tx.py
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
@pytest.mark.parametrize_by_fork(
    "blob_count",
    lambda fork: [
        fork.max_blobs_per_tx(timestamp=FORK_TIMESTAMP) + 1,
        fork.max_blobs_per_block(timestamp=FORK_TIMESTAMP) + 1,
    ],
)
@pytest.mark.valid_at_transition_to("Osaka")
@pytest.mark.exception_test
def test_max_blobs_per_tx_fork_transition(
    fork: Fork,
    blockchain_test: BlockchainTestFiller,
    env: Environment,
    pre: Alloc,
    tx: Transaction,
    blob_count: int,
) -> None:
    """Test `MAX_BLOBS_PER_TX` limit enforcement across fork transition."""
    expected_exception = (
        TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED
        if blob_count > fork.max_blobs_per_block(timestamp=FORK_TIMESTAMP)
        else TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED
    )
    pre_fork_block = Block(
        txs=[
            tx
            if blob_count < fork.max_blobs_per_block(timestamp=FORK_TIMESTAMP - 1)
            else tx.with_error(expected_exception)
        ],
        timestamp=FORK_TIMESTAMP - 1,
        exception=None
        if blob_count < fork.max_blobs_per_block(timestamp=FORK_TIMESTAMP - 1)
        else [expected_exception],
    )
    fork_block = Block(
        txs=[tx.with_nonce(1).with_error(expected_exception)],
        timestamp=FORK_TIMESTAMP,
        exception=[expected_exception],
    )
    post_fork_block = Block(
        txs=[tx.with_nonce(1).with_error(expected_exception)],
        timestamp=FORK_TIMESTAMP + 1,
        exception=[expected_exception],
    )
    blockchain_test(
        pre=pre,
        post={},
        blocks=[pre_fork_block, fork_block, post_fork_block],
        genesis_environment=env,
    )

Parametrized Test Cases

This test case is only parametrized by fork.

Test ID (Abbreviated) blob_count
...fork_PragueToOsakaAtTime15k-blob_count_7-blockchain_test 7
...fork_PragueToOsakaAtTime15k-blob_count_10-blockchain_test 10