11use {
22 crate :: {
33 Flashblocks ,
4+ args:: BuilderArgs ,
45 bundle:: FlashblocksBundle ,
5- tests:: assert_has_sequencer_tx,
6+ tests:: { Harness , assert_has_sequencer_tx} ,
67 } ,
78 jsonrpsee:: core:: ClientError ,
9+ macros:: unichain_test,
810 rand:: { Rng , rng} ,
911 rblib:: {
1012 alloy:: {
@@ -139,9 +141,9 @@ pub fn random_bundle_with_reverts(
139141 FlashblocksBundle :: with_transactions ( txs)
140142}
141143
142- #[ tokio :: test ]
143- async fn empty_bundle_rejected ( ) -> eyre:: Result < ( ) > {
144- let ( node, _ ) = Flashblocks :: test_node ( ) . await ? ;
144+ #[ unichain_test ]
145+ async fn empty_bundle_rejected ( harness : Harness ) -> eyre:: Result < ( ) > {
146+ let node = harness . node ( ) ;
145147
146148 let empty_bundle = FlashblocksBundle :: with_transactions ( vec ! [ ] ) ;
147149 let result = BundlesApiClient :: < Flashblocks > :: send_bundle (
@@ -157,9 +159,9 @@ async fn empty_bundle_rejected() -> eyre::Result<()> {
157159
158160/// This bundle should be rejected by because we only support bundles with one
159161/// transaction
160- #[ tokio :: test ]
161- async fn bundle_with_two_txs_rejected ( ) -> eyre:: Result < ( ) > {
162- let ( node, _ ) = Flashblocks :: test_node ( ) . await ? ;
162+ #[ unichain_test ]
163+ async fn bundle_with_two_txs_rejected ( harness : Harness ) -> eyre:: Result < ( ) > {
164+ let node = harness . node ( ) ;
163165
164166 let bundle_with_two_txs = random_valid_bundle ( 2 ) ;
165167
@@ -174,9 +176,9 @@ async fn bundle_with_two_txs_rejected() -> eyre::Result<()> {
174176 Ok ( ( ) )
175177}
176178
177- #[ tokio :: test ]
178- async fn valid_tx_included ( ) -> eyre:: Result < ( ) > {
179- let ( node, _ ) = Flashblocks :: test_node ( ) . await ? ;
179+ #[ unichain_test ]
180+ async fn valid_tx_included ( harness : Harness ) -> eyre:: Result < ( ) > {
181+ let node = harness . node ( ) ;
180182
181183 let bundle_with_one_tx = random_valid_bundle ( 1 ) ;
182184 let bundle_hash = bundle_with_one_tx. hash ( ) ;
@@ -199,9 +201,9 @@ async fn valid_tx_included() -> eyre::Result<()> {
199201 Ok ( ( ) )
200202}
201203
202- #[ tokio :: test ]
203- async fn reverted_tx_not_included ( ) -> eyre:: Result < ( ) > {
204- let ( node, _ ) = Flashblocks :: test_node ( ) . await ? ;
204+ #[ unichain_test ]
205+ async fn reverted_tx_not_included ( harness : Harness ) -> eyre:: Result < ( ) > {
206+ let node = harness . node ( ) ;
205207
206208 let bundle_with_reverts = random_bundle_with_reverts ( 0 , 1 ) ;
207209
@@ -223,9 +225,9 @@ async fn reverted_tx_not_included() -> eyre::Result<()> {
223225
224226/// Bundles that will never be eligible for inclusion in any future block
225227/// should be rejected by the RPC before making it to the orders pool.
226- #[ tokio :: test ]
227- async fn max_block_number_in_past ( ) -> eyre:: Result < ( ) > {
228- let ( node, _ ) = Flashblocks :: test_node ( ) . await ? ;
228+ #[ unichain_test ]
229+ async fn max_block_number_in_past ( harness : Harness ) -> eyre:: Result < ( ) > {
230+ let node = harness . node ( ) ;
229231
230232 let block = node. next_block ( ) . await ?;
231233 assert_eq ! ( block. number( ) , 1 ) ;
@@ -249,10 +251,10 @@ async fn max_block_number_in_past() -> eyre::Result<()> {
249251
250252/// This bundle should be rejected because its `max_timestamp` is in the past
251253/// and it will never be eligible for inclusion in any future block.
252- #[ tokio :: test ]
253- async fn max_block_timestamp_in_past ( ) -> eyre:: Result < ( ) > {
254+ #[ unichain_test ]
255+ async fn max_block_timestamp_in_past ( harness : Harness ) -> eyre:: Result < ( ) > {
254256 // node at genesis, block 0
255- let ( node, _ ) = Flashblocks :: test_node ( ) . await ? ;
257+ let node = harness . node ( ) ;
256258 let genesis_timestamp = node. config ( ) . chain . genesis_timestamp ( ) ;
257259 let mut bundle = random_valid_bundle ( 1 ) ;
258260 bundle. max_timestamp = Some ( genesis_timestamp. saturating_sub ( 1 ) ) ;
@@ -268,10 +270,12 @@ async fn max_block_timestamp_in_past() -> eyre::Result<()> {
268270 Ok ( ( ) )
269271}
270272
271- #[ tokio:: test]
272- async fn min_block_greater_than_max_block ( ) -> eyre:: Result < ( ) > {
273+ #[ unichain_test]
274+ async fn min_block_greater_than_max_block (
275+ harness : Harness ,
276+ ) -> eyre:: Result < ( ) > {
273277 // node at genesis, block 0
274- let ( node, _ ) = Flashblocks :: test_node ( ) . await ? ;
278+ let node = harness . node ( ) ;
275279 let mut bundle = random_valid_bundle ( 1 ) ;
276280 bundle. min_block_number = Some ( 2 ) ;
277281 bundle. max_block_number = Some ( 1 ) ;
@@ -289,9 +293,9 @@ async fn min_block_greater_than_max_block() -> eyre::Result<()> {
289293
290294/// Test that a bundle with the `min_block_number` param set to a future block
291295/// isn't included until that block.
292- #[ tokio :: test ]
293- async fn min_block_number_in_future ( ) -> eyre:: Result < ( ) > {
294- let ( node, _ ) = Flashblocks :: test_node ( ) . await ? ;
296+ #[ unichain_test ]
297+ async fn min_block_number_in_future ( harness : Harness ) -> eyre:: Result < ( ) > {
298+ let node = harness . node ( ) ;
295299
296300 let mut bundle_with_one_tx = random_valid_bundle ( 1 ) ;
297301 bundle_with_one_tx. min_block_number = Some ( 2 ) ;
@@ -321,9 +325,14 @@ async fn min_block_number_in_future() -> eyre::Result<()> {
321325 Ok ( ( ) )
322326}
323327
324- #[ tokio:: test]
325- async fn when_disabled_reverted_txs_are_included ( ) -> eyre:: Result < ( ) > {
326- let ( node, _) = Flashblocks :: test_node_with_revert_protection_off ( ) . await ?;
328+ #[ unichain_test( args = BuilderArgs {
329+ revert_protection: false ,
330+ ..Default :: default ( )
331+ } ) ]
332+ async fn when_disabled_reverted_txs_are_included (
333+ harness : Harness ,
334+ ) -> eyre:: Result < ( ) > {
335+ let node = harness. node ( ) ;
327336
328337 // create a bundle with one valid and one reverting tx
329338 let mut bundle_with_reverts = random_bundle_with_reverts ( 0 , 1 ) ;
0 commit comments