@@ -280,6 +280,10 @@ impl<S: FlowTestState> TestManager<S> {
280280 self . per_block_transactions . push ( vec ! [ ] ) ;
281281 }
282282
283+ pub ( crate ) fn total_txs ( & self ) -> usize {
284+ self . per_block_transactions . iter ( ) . map ( |block| block. len ( ) ) . sum ( )
285+ }
286+
283287 fn last_block_txs_mut ( & mut self ) -> & mut Vec < FlowTestTx > {
284288 self . per_block_transactions
285289 . last_mut ( )
@@ -462,22 +466,29 @@ impl<S: FlowTestState> TestManager<S> {
462466
463467 /// Verifies all the execution outputs are as expected w.r.t. revert reasons.
464468 fn verify_execution_outputs (
469+ block_index : usize ,
465470 revert_reasons : & [ Option < String > ] ,
466471 execution_outputs : & [ ( TransactionExecutionInfo , StateMaps ) ] ,
467472 ) {
468473 assert_eq ! ( revert_reasons. len( ) , execution_outputs. len( ) ) ;
469- for ( revert_reason, ( execution_info, _) ) in
470- revert_reasons. iter ( ) . zip ( execution_outputs. iter ( ) )
474+ for ( ( i , revert_reason) , ( execution_info, _) ) in
475+ revert_reasons. iter ( ) . enumerate ( ) . zip ( execution_outputs. iter ( ) )
471476 {
477+ let preamble = format ! ( "Block {block_index}, transaction {i}:" ) ;
472478 if let Some ( revert_reason) = revert_reason {
473479 let actual_revert_reason =
474480 execution_info. revert_error . as_ref ( ) . unwrap ( ) . to_string ( ) ;
475481 assert ! (
476482 actual_revert_reason. contains( revert_reason) ,
477- "Expected '{revert_reason}' to be in revert string:\n '{actual_revert_reason}'"
483+ "{preamble} Expected '{revert_reason}' to be in revert \
484+ string:\n '{actual_revert_reason}'"
478485 ) ;
479486 } else {
480- assert ! ( execution_info. revert_error. is_none( ) ) ;
487+ assert ! (
488+ execution_info. revert_error. is_none( ) ,
489+ "{preamble} Expected no revert error, got: {}." ,
490+ execution_info. revert_error. as_ref( ) . unwrap( )
491+ ) ;
481492 }
482493 }
483494 }
@@ -545,8 +556,8 @@ impl<S: FlowTestState> TestManager<S> {
545556 "use_kzg_da flag in block contexts must match the test parameter."
546557 ) ;
547558 let mut alias_keys = HashSet :: new ( ) ;
548- for ( block_txs_with_reason, block_context) in
549- per_block_txs. into_iter ( ) . zip ( block_contexts. into_iter ( ) )
559+ for ( ( block_index , block_txs_with_reason) , block_context) in
560+ per_block_txs. into_iter ( ) . enumerate ( ) . zip ( block_contexts. into_iter ( ) )
550561 {
551562 let ( block_txs, revert_reasons) : ( Vec < _ > , Vec < _ > ) = block_txs_with_reason
552563 . into_iter ( )
@@ -557,7 +568,7 @@ impl<S: FlowTestState> TestManager<S> {
557568 // Execute the transactions.
558569 let ExecutionOutput { execution_outputs, block_summary, mut final_state } =
559570 execute_transactions ( state, & block_txs, block_context) ;
560- Self :: verify_execution_outputs ( & revert_reasons, & execution_outputs) ;
571+ Self :: verify_execution_outputs ( block_index , & revert_reasons, & execution_outputs) ;
561572 let extended_state_diff = final_state. cache . borrow ( ) . extended_state_diff ( ) ;
562573 // Update the wrapped state.
563574 let state_diff = final_state. to_state_diff ( ) . unwrap ( ) ;
0 commit comments