@@ -261,6 +261,10 @@ impl<S: FlowTestState> TestManager<S> {
261261 self . per_block_transactions . push ( vec ! [ ] ) ;
262262 }
263263
264+ pub ( crate ) fn total_txs ( & self ) -> usize {
265+ self . per_block_transactions . iter ( ) . map ( |block| block. len ( ) ) . sum ( )
266+ }
267+
264268 fn last_block_txs_mut ( & mut self ) -> & mut Vec < FlowTestTx > {
265269 self . per_block_transactions
266270 . last_mut ( )
@@ -429,21 +433,28 @@ impl<S: FlowTestState> TestManager<S> {
429433
430434 /// Verifies all the execution outputs are as expected w.r.t. revert reasons.
431435 fn verify_execution_outputs (
436+ block_index : usize ,
432437 revert_reasons : & [ Option < String > ] ,
433438 execution_outputs : & [ ( TransactionExecutionInfo , StateMaps ) ] ,
434439 ) {
435- for ( revert_reason, ( execution_info, _) ) in
436- revert_reasons. iter ( ) . zip ( execution_outputs. iter ( ) )
440+ for ( ( i , revert_reason) , ( execution_info, _) ) in
441+ revert_reasons. iter ( ) . enumerate ( ) . zip ( execution_outputs. iter ( ) )
437442 {
443+ let preamble = format ! ( "Block {block_index}, transaction {i}:" ) ;
438444 if let Some ( revert_reason) = revert_reason {
439445 let actual_revert_reason =
440446 execution_info. revert_error . as_ref ( ) . unwrap ( ) . to_string ( ) ;
441447 assert ! (
442448 actual_revert_reason. contains( revert_reason) ,
443- "Expected '{revert_reason}' to be in revert string:\n '{actual_revert_reason}'"
449+ "{preamble} Expected '{revert_reason}' to be in revert \
450+ string:\n '{actual_revert_reason}'"
444451 ) ;
445452 } else {
446- assert ! ( execution_info. revert_error. is_none( ) ) ;
453+ assert ! (
454+ execution_info. revert_error. is_none( ) ,
455+ "{preamble} Expected no revert error, got: {}." ,
456+ execution_info. revert_error. as_ref( ) . unwrap( )
457+ ) ;
447458 }
448459 }
449460 }
@@ -507,8 +518,8 @@ impl<S: FlowTestState> TestManager<S> {
507518 "use_kzg_da flag in block contexts must match the test parameter."
508519 ) ;
509520 let mut alias_keys = HashSet :: new ( ) ;
510- for ( block_txs_with_reason, block_context) in
511- per_block_txs. into_iter ( ) . zip ( block_contexts. into_iter ( ) )
521+ for ( ( block_index , block_txs_with_reason) , block_context) in
522+ per_block_txs. into_iter ( ) . enumerate ( ) . zip ( block_contexts. into_iter ( ) )
512523 {
513524 // Clone the block info for later use.
514525 let ( block_txs, revert_reasons) : ( Vec < _ > , Vec < _ > ) = block_txs_with_reason
@@ -519,7 +530,7 @@ impl<S: FlowTestState> TestManager<S> {
519530 // Execute the transactions.
520531 let ExecutionOutput { execution_outputs, block_summary, mut final_state } =
521532 execute_transactions ( state, & block_txs, block_context) ;
522- Self :: verify_execution_outputs ( & revert_reasons, & execution_outputs) ;
533+ Self :: verify_execution_outputs ( block_index , & revert_reasons, & execution_outputs) ;
523534 let extended_state_diff = final_state. cache . borrow ( ) . extended_state_diff ( ) ;
524535 // Update the wrapped state.
525536 let state_diff = final_state. to_state_diff ( ) . unwrap ( ) ;
0 commit comments