@@ -276,6 +276,10 @@ impl<S: FlowTestState> TestManager<S> {
276276 self . per_block_transactions . push ( vec ! [ ] ) ;
277277 }
278278
279+ pub ( crate ) fn total_txs ( & self ) -> usize {
280+ self . per_block_transactions . iter ( ) . map ( |block| block. len ( ) ) . sum ( )
281+ }
282+
279283 fn last_block_txs_mut ( & mut self ) -> & mut Vec < FlowTestTx > {
280284 self . per_block_transactions
281285 . last_mut ( )
@@ -465,22 +469,29 @@ impl<S: FlowTestState> TestManager<S> {
465469
466470 /// Verifies all the execution outputs are as expected w.r.t. revert reasons.
467471 fn verify_execution_outputs (
472+ block_index : usize ,
468473 revert_reasons : & [ Option < String > ] ,
469474 execution_outputs : & [ ( TransactionExecutionInfo , StateMaps ) ] ,
470475 ) {
471476 assert_eq ! ( revert_reasons. len( ) , execution_outputs. len( ) ) ;
472- for ( revert_reason, ( execution_info, _) ) in
473- revert_reasons. iter ( ) . zip ( execution_outputs. iter ( ) )
477+ for ( ( i , revert_reason) , ( execution_info, _) ) in
478+ revert_reasons. iter ( ) . enumerate ( ) . zip ( execution_outputs. iter ( ) )
474479 {
480+ let preamble = format ! ( "Block {block_index}, transaction {i}:" ) ;
475481 if let Some ( revert_reason) = revert_reason {
476482 let actual_revert_reason =
477483 execution_info. revert_error . as_ref ( ) . unwrap ( ) . to_string ( ) ;
478484 assert ! (
479485 actual_revert_reason. contains( revert_reason) ,
480- "Expected '{revert_reason}' to be in revert string:\n '{actual_revert_reason}'"
486+ "{preamble} Expected '{revert_reason}' to be in revert \
487+ string:\n '{actual_revert_reason}'"
481488 ) ;
482489 } else {
483- assert ! ( execution_info. revert_error. is_none( ) ) ;
490+ assert ! (
491+ execution_info. revert_error. is_none( ) ,
492+ "{preamble} Expected no revert error, got: {}." ,
493+ execution_info. revert_error. as_ref( ) . unwrap( )
494+ ) ;
484495 }
485496 }
486497 }
@@ -547,8 +558,8 @@ impl<S: FlowTestState> TestManager<S> {
547558 "use_kzg_da flag in block contexts must match the test parameter."
548559 ) ;
549560 let mut alias_keys = HashSet :: new ( ) ;
550- for ( block_txs_with_reason, block_context) in
551- per_block_txs. into_iter ( ) . zip ( block_contexts. into_iter ( ) )
561+ for ( ( block_index , block_txs_with_reason) , block_context) in
562+ per_block_txs. into_iter ( ) . enumerate ( ) . zip ( block_contexts. into_iter ( ) )
552563 {
553564 let ( block_txs, revert_reasons) : ( Vec < _ > , Vec < _ > ) = block_txs_with_reason
554565 . into_iter ( )
@@ -559,7 +570,7 @@ impl<S: FlowTestState> TestManager<S> {
559570 // Execute the transactions.
560571 let ExecutionOutput { execution_outputs, block_summary, mut final_state } =
561572 execute_transactions ( state, & block_txs, block_context) ;
562- Self :: verify_execution_outputs ( & revert_reasons, & execution_outputs) ;
573+ Self :: verify_execution_outputs ( block_index , & revert_reasons, & execution_outputs) ;
563574 let extended_state_diff = final_state. cache . borrow ( ) . extended_state_diff ( ) ;
564575 // Update the wrapped state.
565576 let state_diff = final_state. to_state_diff ( ) . unwrap ( ) ;
0 commit comments