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@2867859a.
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
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211 | @pytest.mark.parametrize_by_fork(
"blob_count",
lambda fork: [
fork.transitions_to().max_blobs_per_tx() + 1,
fork.transitions_to().max_blobs_per_block() + 1,
],
)
@pytest.mark.valid_at_transition_to("Osaka")
@pytest.mark.exception_test
def test_max_blobs_per_tx_fork_transition(
fork: TransitionFork,
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.transitions_to().max_blobs_per_block()
else TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED
)
pre_fork_block = Block(
txs=[
tx
if blob_count < fork.transitions_from().max_blobs_per_block()
else tx.with_error(expected_exception)
],
timestamp=fork.at_timestamp - 1,
exception=None
if blob_count < fork.transitions_from().max_blobs_per_block()
else [expected_exception],
)
fork_block = Block(
txs=[tx.with_nonce(1).with_error(expected_exception)],
timestamp=fork.at_timestamp,
exception=[expected_exception],
)
post_fork_block = Block(
txs=[tx.with_nonce(1).with_error(expected_exception)],
timestamp=fork.at_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 generates 2 parametrized test cases across 1 fork.