@@ -282,6 +282,10 @@ impl<S: FlowTestState> TestManager<S> {
282282 self . per_block_transactions . push ( vec ! [ ] ) ;
283283 }
284284
285+ pub ( crate ) fn total_txs ( & self ) -> usize {
286+ self . per_block_transactions . iter ( ) . map ( |block| block. len ( ) ) . sum ( )
287+ }
288+
285289 fn last_block_txs_mut ( & mut self ) -> & mut Vec < FlowTestTx > {
286290 self . per_block_transactions
287291 . last_mut ( )
@@ -471,22 +475,29 @@ impl<S: FlowTestState> TestManager<S> {
471475
472476 /// Verifies all the execution outputs are as expected w.r.t. revert reasons.
473477 fn verify_execution_outputs (
478+ block_index : usize ,
474479 revert_reasons : & [ Option < String > ] ,
475480 execution_outputs : & [ ( TransactionExecutionInfo , StateMaps ) ] ,
476481 ) {
477482 assert_eq ! ( revert_reasons. len( ) , execution_outputs. len( ) ) ;
478- for ( revert_reason, ( execution_info, _) ) in
479- revert_reasons. iter ( ) . zip ( execution_outputs. iter ( ) )
483+ for ( ( i , revert_reason) , ( execution_info, _) ) in
484+ revert_reasons. iter ( ) . enumerate ( ) . zip ( execution_outputs. iter ( ) )
480485 {
486+ let preamble = format ! ( "Block {block_index}, transaction {i}:" ) ;
481487 if let Some ( revert_reason) = revert_reason {
482488 let actual_revert_reason =
483489 execution_info. revert_error . as_ref ( ) . unwrap ( ) . to_string ( ) ;
484490 assert ! (
485491 actual_revert_reason. contains( revert_reason) ,
486- "Expected '{revert_reason}' to be in revert string:\n '{actual_revert_reason}'"
492+ "{preamble} Expected '{revert_reason}' to be in revert \
493+ string:\n '{actual_revert_reason}'"
487494 ) ;
488495 } else {
489- assert ! ( execution_info. revert_error. is_none( ) ) ;
496+ assert ! (
497+ execution_info. revert_error. is_none( ) ,
498+ "{preamble} Expected no revert error, got: {}." ,
499+ execution_info. revert_error. as_ref( ) . unwrap( )
500+ ) ;
490501 }
491502 }
492503 }
@@ -553,8 +564,8 @@ impl<S: FlowTestState> TestManager<S> {
553564 "use_kzg_da flag in block contexts must match the test parameter."
554565 ) ;
555566 let mut alias_keys = HashSet :: new ( ) ;
556- for ( block_txs_with_reason, block_context) in
557- per_block_txs. into_iter ( ) . zip ( block_contexts. into_iter ( ) )
567+ for ( ( block_index , block_txs_with_reason) , block_context) in
568+ per_block_txs. into_iter ( ) . enumerate ( ) . zip ( block_contexts. into_iter ( ) )
558569 {
559570 let ( block_txs, revert_reasons) : ( Vec < _ > , Vec < _ > ) = block_txs_with_reason
560571 . into_iter ( )
@@ -565,7 +576,7 @@ impl<S: FlowTestState> TestManager<S> {
565576 // Execute the transactions.
566577 let ExecutionOutput { execution_outputs, block_summary, mut final_state } =
567578 execute_transactions ( state, & block_txs, block_context) ;
568- Self :: verify_execution_outputs ( & revert_reasons, & execution_outputs) ;
579+ Self :: verify_execution_outputs ( block_index , & revert_reasons, & execution_outputs) ;
569580 let extended_state_diff = final_state. cache . borrow ( ) . extended_state_diff ( ) ;
570581 // Update the wrapped state.
571582 let state_diff = final_state. to_state_diff ( ) . unwrap ( ) ;
0 commit comments