@@ -8,7 +8,7 @@ mod tests {
8
8
use alloy_consensus:: { Transaction , TxEip1559 } ;
9
9
use alloy_eips:: { eip1559:: MIN_PROTOCOL_BASE_FEE , eip2718:: Encodable2718 } ;
10
10
use alloy_primitives:: hex;
11
- use alloy_provider:: { Identity , Provider , ProviderBuilder } ;
11
+ use alloy_provider:: { ext :: TxPoolApi , Identity , Provider , ProviderBuilder } ;
12
12
use alloy_rpc_types_eth:: BlockTransactionsKind ;
13
13
use futures_util:: StreamExt ;
14
14
use op_alloy_consensus:: OpTypedTransaction ;
@@ -181,8 +181,33 @@ mod tests {
181
181
. send_raw_transaction ( signed_tx. encoded_2718 ( ) . as_slice ( ) )
182
182
. await ?;
183
183
184
+ // Create a second reverting transaction
185
+ let tx_request = OpTypedTransaction :: Eip1559 ( TxEip1559 {
186
+ chain_id : 901 ,
187
+ nonce : nonce + 2 ,
188
+ gas_limit : 300000 ,
189
+ max_fee_per_gas : base_fee. into ( ) ,
190
+ input : hex ! ( "60006000fd" ) . into ( ) , // PUSH1 0x00 PUSH1 0x00 REVERT
191
+ ..Default :: default ( )
192
+ } ) ;
193
+ let signed_tx = known_wallet. sign_tx ( tx_request) ?;
194
+ let reverting_tx_2 = provider
195
+ . send_raw_transaction ( signed_tx. encoded_2718 ( ) . as_slice ( ) )
196
+ . await ?;
197
+
198
+ let pool = provider. txpool_status ( ) . await ?;
199
+
200
+ // Before block we should have 3 txs in pool, because they all valid
201
+ assert_eq ! ( pool. pending, 3 , "all txs should be in pending pool" ) ;
202
+ assert_eq ! ( pool. queued, 0 , "queued pool should be empty" ) ;
203
+
184
204
let block_hash = generator. generate_block ( ) . await ?;
185
205
206
+ // After block is produced we will remove one of the reverting txs and place another
207
+ // in queue pool because we have nonce gap
208
+ assert_eq ! ( pool. pending, 0 , "pending pool should be empty" ) ;
209
+ assert_eq ! ( pool. queued, 1 , "queued pool should contain 1 tx" ) ;
210
+
186
211
// query the block and the transactions inside the block
187
212
let block = provider
188
213
. get_block_by_hash ( block_hash)
@@ -198,12 +223,11 @@ mod tests {
198
223
"successful transaction missing from block"
199
224
) ;
200
225
201
- // Verify reverted transaction is NOT included
226
+ // Verify reverted transactions are NOT included
202
227
assert ! (
203
- !block
204
- . transactions
205
- . hashes( )
206
- . any( |hash| hash == * reverting_tx. tx_hash( ) ) ,
228
+ !block. transactions. hashes( ) . any(
229
+ |hash| hash == * reverting_tx. tx_hash( ) || hash == * reverting_tx_2. tx_hash( )
230
+ ) ,
207
231
"reverted transaction unexpectedly included in block"
208
232
) ;
209
233
for hash in block. transactions . hashes ( ) {
0 commit comments