@@ -470,19 +470,19 @@ async fn test_flashblocks_number_contract_builder_tx(rbuilder: LocalInstance) ->
470470 let flashblocks_listener = rbuilder. spawn_flashblocks_listener ( ) ;
471471 let provider = rbuilder. provider ( ) . await ?;
472472
473- // Deploy flashblocks number contract
473+ // Deploy flashblocks number contract which will be in flashblocks 1
474474 let deploy_tx = driver
475475 . create_transaction ( )
476476 . deploy_flashblock_number_contract ( )
477477 . with_bundle ( BundleOpts :: default ( ) )
478478 . send ( )
479479 . await ?;
480480
481- // Create transactions for flashblocks 2-4
482- let transactions_phase1 = create_flashblock_transactions ( & driver, 2 ..5 ) . await ?;
481+ // Create valid transactions for flashblocks 2-4
482+ let user_transactions = create_flashblock_transactions ( & driver, 2 ..5 ) . await ?;
483483
484- // Build first block
485- let block1 = driver. build_new_block_with_current_timestamp ( None ) . await ?;
484+ // Build block with deploy tx in first flashblock, and a random valid transfer in every other flashblock
485+ let block = driver. build_new_block_with_current_timestamp ( None ) . await ?;
486486
487487 // Verify contract deployment
488488 let receipt = provider
@@ -499,29 +499,29 @@ async fn test_flashblocks_number_contract_builder_tx(rbuilder: LocalInstance) ->
499499 ) ;
500500
501501 // Verify first block structure
502- assert_eq ! ( block1 . transactions. len( ) , 10 ) ;
503- let block1_txs = block1
502+ assert_eq ! ( block . transactions. len( ) , 10 ) ;
503+ let txs = block
504504 . transactions
505505 . as_transactions ( )
506506 . expect ( "transactions not in block" ) ;
507507
508- // Verify builder txs (should be regular since not registered)
508+ // Verify builder txs (should be regular since builder tx is not registered yet )
509509 verify_builder_txs (
510- & block1_txs ,
510+ & txs ,
511511 & [ 1 , 2 , 4 , 6 , 8 ] ,
512512 Some ( Address :: ZERO ) ,
513513 "Should have regular builder tx" ,
514514 ) ;
515515
516516 // Verify deploy tx position
517517 assert_eq ! (
518- block1_txs [ 3 ] . inner. inner. tx_hash( ) ,
518+ txs [ 3 ] . inner. inner. tx_hash( ) ,
519519 * deploy_tx. tx_hash( ) ,
520520 "Deploy tx not in correct position"
521521 ) ;
522522
523523 // Verify user transactions
524- verify_tx_matches ( & block1_txs , & [ 5 , 7 , 9 ] , & transactions_phase1 ) ;
524+ verify_user_tx_hashes ( & txs , & [ 5 , 7 , 9 ] , & user_transactions ) ;
525525
526526 // Initialize contract
527527 let init_tx = driver
@@ -539,34 +539,35 @@ async fn test_flashblocks_number_contract_builder_tx(rbuilder: LocalInstance) ->
539539 . await ?
540540 . expect ( "init tx not mined" ) ;
541541
542- // Create transactions for testing contract calls
543- let transactions_phase2 = create_flashblock_transactions ( & driver, 1 ..5 ) . await ?;
542+ // Create user transactions for flashblocks 1 - 5
543+ let user_transactions = create_flashblock_transactions ( & driver, 1 ..5 ) . await ?;
544544
545- // Build second block after initialization
546- let block2 = driver. build_new_block_with_current_timestamp ( None ) . await ?;
547- assert_eq ! ( block2. transactions. len( ) , 10 ) ;
548- let block2_txs = block2
545+ // Build second block after initialization which will call the flashblock number contract
546+ // with builder registered
547+ let block = driver. build_new_block_with_current_timestamp ( None ) . await ?;
548+ assert_eq ! ( block. transactions. len( ) , 10 ) ;
549+ let txs = block
549550 . transactions
550551 . as_transactions ( )
551552 . expect ( "transactions not in block" ) ;
552553
553- // Fallback block should have regular builder tx
554+ // Fallback block should have regular builder tx after deposit tx
554555 assert_eq ! (
555- block2_txs [ 1 ] . to( ) ,
556+ txs [ 1 ] . to( ) ,
556557 Some ( Address :: ZERO ) ,
557558 "Fallback block should have regular builder tx"
558559 ) ;
559560
560561 // Other builder txs should call the contract
561562 verify_builder_txs (
562- & block2_txs ,
563+ & txs ,
563564 & [ 2 , 4 , 6 , 8 ] ,
564565 Some ( contract_address) ,
565566 "Should call flashblocks contract" ,
566567 ) ;
567568
568569 // Verify user transactions, 3 blocks in total built
569- verify_tx_matches ( & block2_txs , & [ 3 , 5 , 7 , 9 ] , & transactions_phase2 ) ;
570+ verify_user_tx_hashes ( & txs , & [ 3 , 5 , 7 , 9 ] , & user_transactions ) ;
570571
571572 // Verify flashblock number incremented correctly
572573 let contract = FlashblocksNumber :: new ( contract_address, provider. clone ( ) ) ;
@@ -646,7 +647,7 @@ fn verify_builder_txs(
646647}
647648
648649// Helper to verify transaction matches
649- fn verify_tx_matches (
650+ fn verify_user_tx_hashes (
650651 block_txs : & [ impl AsRef < OpTxEnvelope > ] ,
651652 indices : & [ usize ] ,
652653 expected_txs : & [ TxHash ] ,
0 commit comments