@@ -273,6 +273,10 @@ impl<S: FlowTestState> TestManager<S> {
273273 self . per_block_transactions . push ( vec ! [ ] ) ;
274274 }
275275
276+ pub ( crate ) fn total_txs ( & self ) -> usize {
277+ self . per_block_transactions . iter ( ) . map ( |block| block. len ( ) ) . sum ( )
278+ }
279+
276280 fn last_block_txs_mut ( & mut self ) -> & mut Vec < FlowTestTx > {
277281 self . per_block_transactions
278282 . last_mut ( )
@@ -441,21 +445,28 @@ impl<S: FlowTestState> TestManager<S> {
441445
442446 /// Verifies all the execution outputs are as expected w.r.t. revert reasons.
443447 fn verify_execution_outputs (
448+ block_index : usize ,
444449 revert_reasons : & [ Option < String > ] ,
445450 execution_outputs : & [ ( TransactionExecutionInfo , StateMaps ) ] ,
446451 ) {
447- for ( revert_reason, ( execution_info, _) ) in
448- revert_reasons. iter ( ) . zip ( execution_outputs. iter ( ) )
452+ for ( ( i , revert_reason) , ( execution_info, _) ) in
453+ revert_reasons. iter ( ) . enumerate ( ) . zip ( execution_outputs. iter ( ) )
449454 {
455+ let preamble = format ! ( "Block {block_index}, transaction {i}:" ) ;
450456 if let Some ( revert_reason) = revert_reason {
451457 let actual_revert_reason =
452458 execution_info. revert_error . as_ref ( ) . unwrap ( ) . to_string ( ) ;
453459 assert ! (
454460 actual_revert_reason. contains( revert_reason) ,
455- "Expected '{revert_reason}' to be in revert string:\n '{actual_revert_reason}'"
461+ "{preamble} Expected '{revert_reason}' to be in revert \
462+ string:\n '{actual_revert_reason}'"
456463 ) ;
457464 } else {
458- assert ! ( execution_info. revert_error. is_none( ) ) ;
465+ assert ! (
466+ execution_info. revert_error. is_none( ) ,
467+ "{preamble} Expected no revert error, got: {}." ,
468+ execution_info. revert_error. as_ref( ) . unwrap( )
469+ ) ;
459470 }
460471 }
461472 }
@@ -519,8 +530,8 @@ impl<S: FlowTestState> TestManager<S> {
519530 "use_kzg_da flag in block contexts must match the test parameter."
520531 ) ;
521532 let mut alias_keys = HashSet :: new ( ) ;
522- for ( block_txs_with_reason, block_context) in
523- per_block_txs. into_iter ( ) . zip ( block_contexts. into_iter ( ) )
533+ for ( ( block_index , block_txs_with_reason) , block_context) in
534+ per_block_txs. into_iter ( ) . enumerate ( ) . zip ( block_contexts. into_iter ( ) )
524535 {
525536 // Clone the block info for later use.
526537 let ( block_txs, revert_reasons) : ( Vec < _ > , Vec < _ > ) = block_txs_with_reason
@@ -531,7 +542,7 @@ impl<S: FlowTestState> TestManager<S> {
531542 // Execute the transactions.
532543 let ExecutionOutput { execution_outputs, block_summary, mut final_state } =
533544 execute_transactions ( state, & block_txs, block_context) ;
534- Self :: verify_execution_outputs ( & revert_reasons, & execution_outputs) ;
545+ Self :: verify_execution_outputs ( block_index , & revert_reasons, & execution_outputs) ;
535546 let extended_state_diff = final_state. cache . borrow ( ) . extended_state_diff ( ) ;
536547 // Update the wrapped state.
537548 let state_diff = final_state. to_state_diff ( ) . unwrap ( ) ;
0 commit comments