Skip to content

Commit 83a02aa

Browse files
authored
chore(tests): update max blob per tx test errors. (#1997)
1 parent 58849ad commit 83a02aa

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

tests/osaka/eip7594_peerdas/test_max_blob_per_tx.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,12 @@ def test_valid_max_blobs_per_tx(
112112
@pytest.mark.valid_from("Osaka")
113113
@pytest.mark.exception_test
114114
def test_invalid_max_blobs_per_tx(
115+
fork: Fork,
115116
state_test: StateTestFiller,
116117
pre: Alloc,
117118
env: Environment,
118119
tx: Transaction,
120+
blob_count: int,
119121
):
120122
"""
121123
Test that transactions exceeding MAX_BLOBS_PER_TX are rejected.
@@ -127,41 +129,50 @@ def test_invalid_max_blobs_per_tx(
127129
env=env,
128130
pre=pre,
129131
tx=tx.with_error(
130-
[
131-
TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED,
132-
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED,
133-
]
132+
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED
133+
if blob_count > fork.max_blobs_per_block()
134+
else TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED
134135
),
135136
post={},
136137
)
137138

138139

139140
@pytest.mark.parametrize_by_fork(
140141
"blob_count",
141-
lambda fork: [fork.max_blobs_per_tx(timestamp=FORK_TIMESTAMP) + 1],
142+
lambda fork: [
143+
fork.max_blobs_per_tx(timestamp=FORK_TIMESTAMP) + 1,
144+
fork.max_blobs_per_block(timestamp=FORK_TIMESTAMP) + 1,
145+
],
142146
)
143147
@pytest.mark.valid_at_transition_to("Osaka")
144148
@pytest.mark.exception_test
145149
def test_max_blobs_per_tx_fork_transition(
150+
fork: Fork,
146151
blockchain_test: BlockchainTestFiller,
147152
env: Environment,
148153
pre: Alloc,
149154
tx: Transaction,
155+
blob_count: int,
150156
):
151157
"""Test `MAX_BLOBS_PER_TX` limit enforcement across fork transition."""
158+
expected_exception = (
159+
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED
160+
if blob_count > fork.max_blobs_per_block(timestamp=FORK_TIMESTAMP)
161+
else TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED
162+
)
152163
pre_fork_block = Block(
153164
txs=[tx],
154165
timestamp=FORK_TIMESTAMP - 1,
155166
)
156167
fork_block = Block(
157-
txs=[tx.with_nonce(1).with_error(TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED)],
168+
txs=[tx.with_nonce(1).with_error(expected_exception)],
158169
timestamp=FORK_TIMESTAMP,
159-
exception=[TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED],
170+
exception=[expected_exception],
160171
)
161172
post_fork_block = Block(
162-
txs=[tx.with_nonce(2).with_error(TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED)],
173+
txs=[tx.with_nonce(2).with_error(expected_exception)],
163174
timestamp=FORK_TIMESTAMP + 1,
164-
exception=[TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED],
175+
exception=[expected_exception],
165176
)
166177
blockchain_test(
167178
pre=pre,

0 commit comments

Comments
 (0)