@@ -112,10 +112,12 @@ def test_valid_max_blobs_per_tx(
112
112
@pytest .mark .valid_from ("Osaka" )
113
113
@pytest .mark .exception_test
114
114
def test_invalid_max_blobs_per_tx (
115
+ fork : Fork ,
115
116
state_test : StateTestFiller ,
116
117
pre : Alloc ,
117
118
env : Environment ,
118
119
tx : Transaction ,
120
+ blob_count : int ,
119
121
):
120
122
"""
121
123
Test that transactions exceeding MAX_BLOBS_PER_TX are rejected.
@@ -127,41 +129,50 @@ def test_invalid_max_blobs_per_tx(
127
129
env = env ,
128
130
pre = pre ,
129
131
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
134
135
),
135
136
post = {},
136
137
)
137
138
138
139
139
140
@pytest .mark .parametrize_by_fork (
140
141
"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
+ ],
142
146
)
143
147
@pytest .mark .valid_at_transition_to ("Osaka" )
144
148
@pytest .mark .exception_test
145
149
def test_max_blobs_per_tx_fork_transition (
150
+ fork : Fork ,
146
151
blockchain_test : BlockchainTestFiller ,
147
152
env : Environment ,
148
153
pre : Alloc ,
149
154
tx : Transaction ,
155
+ blob_count : int ,
150
156
):
151
157
"""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
+ )
152
163
pre_fork_block = Block (
153
164
txs = [tx ],
154
165
timestamp = FORK_TIMESTAMP - 1 ,
155
166
)
156
167
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 )],
158
169
timestamp = FORK_TIMESTAMP ,
159
- exception = [TransactionException . TYPE_3_TX_BLOB_COUNT_EXCEEDED ],
170
+ exception = [expected_exception ],
160
171
)
161
172
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 )],
163
174
timestamp = FORK_TIMESTAMP + 1 ,
164
- exception = [TransactionException . TYPE_3_TX_BLOB_COUNT_EXCEEDED ],
175
+ exception = [expected_exception ],
165
176
)
166
177
blockchain_test (
167
178
pre = pre ,
0 commit comments