@@ -269,6 +269,10 @@ impl<S: FlowTestState> TestManager<S> {
269269 self . per_block_transactions . push ( vec ! [ ] ) ;
270270 }
271271
272+ pub ( crate ) fn total_txs ( & self ) -> usize {
273+ self . per_block_transactions . iter ( ) . map ( |block| block. len ( ) ) . sum ( )
274+ }
275+
272276 fn last_block_txs_mut ( & mut self ) -> & mut Vec < FlowTestTx > {
273277 self . per_block_transactions
274278 . last_mut ( )
@@ -441,22 +445,29 @@ 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 ) {
447452 assert_eq ! ( revert_reasons. len( ) , execution_outputs. len( ) ) ;
448- for ( revert_reason, ( execution_info, _) ) in
449- revert_reasons. iter ( ) . zip ( execution_outputs. iter ( ) )
453+ for ( ( i , revert_reason) , ( execution_info, _) ) in
454+ revert_reasons. iter ( ) . enumerate ( ) . zip ( execution_outputs. iter ( ) )
450455 {
456+ let preamble = format ! ( "Block {block_index}, transaction {i}:" ) ;
451457 if let Some ( revert_reason) = revert_reason {
452458 let actual_revert_reason =
453459 execution_info. revert_error . as_ref ( ) . unwrap ( ) . to_string ( ) ;
454460 assert ! (
455461 actual_revert_reason. contains( revert_reason) ,
456- "Expected '{revert_reason}' to be in revert string:\n '{actual_revert_reason}'"
462+ "{preamble} Expected '{revert_reason}' to be in revert \
463+ string:\n '{actual_revert_reason}'"
457464 ) ;
458465 } else {
459- assert ! ( execution_info. revert_error. is_none( ) ) ;
466+ assert ! (
467+ execution_info. revert_error. is_none( ) ,
468+ "{preamble} Expected no revert error, got: {}." ,
469+ execution_info. revert_error. as_ref( ) . unwrap( )
470+ ) ;
460471 }
461472 }
462473 }
@@ -523,8 +534,8 @@ impl<S: FlowTestState> TestManager<S> {
523534 "use_kzg_da flag in block contexts must match the test parameter."
524535 ) ;
525536 let mut alias_keys = HashSet :: new ( ) ;
526- for ( block_txs_with_reason, block_context) in
527- per_block_txs. into_iter ( ) . zip ( block_contexts. into_iter ( ) )
537+ for ( ( block_index , block_txs_with_reason) , block_context) in
538+ per_block_txs. into_iter ( ) . enumerate ( ) . zip ( block_contexts. into_iter ( ) )
528539 {
529540 let ( block_txs, revert_reasons) : ( Vec < _ > , Vec < _ > ) = block_txs_with_reason
530541 . into_iter ( )
@@ -535,7 +546,7 @@ impl<S: FlowTestState> TestManager<S> {
535546 // Execute the transactions.
536547 let ExecutionOutput { execution_outputs, block_summary, mut final_state } =
537548 execute_transactions ( state, & block_txs, block_context) ;
538- Self :: verify_execution_outputs ( & revert_reasons, & execution_outputs) ;
549+ Self :: verify_execution_outputs ( block_index , & revert_reasons, & execution_outputs) ;
539550 let extended_state_diff = final_state. cache . borrow ( ) . extended_state_diff ( ) ;
540551 // Update the wrapped state.
541552 let state_diff = final_state. to_state_diff ( ) . unwrap ( ) ;
0 commit comments