@@ -261,6 +261,10 @@ impl<S: FlowTestState> TestManager<S> {
261
261
self . per_block_transactions . push ( vec ! [ ] ) ;
262
262
}
263
263
264
+ pub ( crate ) fn total_txs ( & self ) -> usize {
265
+ self . per_block_transactions . iter ( ) . map ( |block| block. len ( ) ) . sum ( )
266
+ }
267
+
264
268
fn last_block_txs_mut ( & mut self ) -> & mut Vec < FlowTestTx > {
265
269
self . per_block_transactions
266
270
. last_mut ( )
@@ -429,21 +433,28 @@ impl<S: FlowTestState> TestManager<S> {
429
433
430
434
/// Verifies all the execution outputs are as expected w.r.t. revert reasons.
431
435
fn verify_execution_outputs (
436
+ block_index : usize ,
432
437
revert_reasons : & [ Option < String > ] ,
433
438
execution_outputs : & [ ( TransactionExecutionInfo , StateMaps ) ] ,
434
439
) {
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 ( ) )
437
442
{
443
+ let preamble = format ! ( "Block {block_index}, transaction {i}:" ) ;
438
444
if let Some ( revert_reason) = revert_reason {
439
445
let actual_revert_reason =
440
446
execution_info. revert_error . as_ref ( ) . unwrap ( ) . to_string ( ) ;
441
447
assert ! (
442
448
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}'"
444
451
) ;
445
452
} 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
+ ) ;
447
458
}
448
459
}
449
460
}
@@ -507,8 +518,8 @@ impl<S: FlowTestState> TestManager<S> {
507
518
"use_kzg_da flag in block contexts must match the test parameter."
508
519
) ;
509
520
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 ( ) )
512
523
{
513
524
// Clone the block info for later use.
514
525
let ( block_txs, revert_reasons) : ( Vec < _ > , Vec < _ > ) = block_txs_with_reason
@@ -519,7 +530,7 @@ impl<S: FlowTestState> TestManager<S> {
519
530
// Execute the transactions.
520
531
let ExecutionOutput { execution_outputs, block_summary, mut final_state } =
521
532
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) ;
523
534
let extended_state_diff = final_state. cache . borrow ( ) . extended_state_diff ( ) ;
524
535
// Update the wrapped state.
525
536
let state_diff = final_state. to_state_diff ( ) . unwrap ( ) ;
0 commit comments