@@ -273,6 +273,10 @@ impl<S: FlowTestState> TestManager<S> {
273
273
self . per_block_transactions . push ( vec ! [ ] ) ;
274
274
}
275
275
276
+ pub ( crate ) fn total_txs ( & self ) -> usize {
277
+ self . per_block_transactions . iter ( ) . map ( |block| block. len ( ) ) . sum ( )
278
+ }
279
+
276
280
fn last_block_txs_mut ( & mut self ) -> & mut Vec < FlowTestTx > {
277
281
self . per_block_transactions
278
282
. last_mut ( )
@@ -445,22 +449,29 @@ impl<S: FlowTestState> TestManager<S> {
445
449
446
450
/// Verifies all the execution outputs are as expected w.r.t. revert reasons.
447
451
fn verify_execution_outputs (
452
+ block_index : usize ,
448
453
revert_reasons : & [ Option < String > ] ,
449
454
execution_outputs : & [ ( TransactionExecutionInfo , StateMaps ) ] ,
450
455
) {
451
456
assert_eq ! ( revert_reasons. len( ) , execution_outputs. len( ) ) ;
452
- for ( revert_reason, ( execution_info, _) ) in
453
- revert_reasons. iter ( ) . zip ( execution_outputs. iter ( ) )
457
+ for ( ( i , revert_reason) , ( execution_info, _) ) in
458
+ revert_reasons. iter ( ) . enumerate ( ) . zip ( execution_outputs. iter ( ) )
454
459
{
460
+ let preamble = format ! ( "Block {block_index}, transaction {i}:" ) ;
455
461
if let Some ( revert_reason) = revert_reason {
456
462
let actual_revert_reason =
457
463
execution_info. revert_error . as_ref ( ) . unwrap ( ) . to_string ( ) ;
458
464
assert ! (
459
465
actual_revert_reason. contains( revert_reason) ,
460
- "Expected '{revert_reason}' to be in revert string:\n '{actual_revert_reason}'"
466
+ "{preamble} Expected '{revert_reason}' to be in revert \
467
+ string:\n '{actual_revert_reason}'"
461
468
) ;
462
469
} else {
463
- assert ! ( execution_info. revert_error. is_none( ) ) ;
470
+ assert ! (
471
+ execution_info. revert_error. is_none( ) ,
472
+ "{preamble} Expected no revert error, got: {}." ,
473
+ execution_info. revert_error. as_ref( ) . unwrap( )
474
+ ) ;
464
475
}
465
476
}
466
477
}
@@ -524,8 +535,8 @@ impl<S: FlowTestState> TestManager<S> {
524
535
"use_kzg_da flag in block contexts must match the test parameter."
525
536
) ;
526
537
let mut alias_keys = HashSet :: new ( ) ;
527
- for ( block_txs_with_reason, block_context) in
528
- per_block_txs. into_iter ( ) . zip ( block_contexts. into_iter ( ) )
538
+ for ( ( block_index , block_txs_with_reason) , block_context) in
539
+ per_block_txs. into_iter ( ) . enumerate ( ) . zip ( block_contexts. into_iter ( ) )
529
540
{
530
541
let ( block_txs, revert_reasons) : ( Vec < _ > , Vec < _ > ) = block_txs_with_reason
531
542
. into_iter ( )
@@ -536,7 +547,7 @@ impl<S: FlowTestState> TestManager<S> {
536
547
// Execute the transactions.
537
548
let ExecutionOutput { execution_outputs, block_summary, mut final_state } =
538
549
execute_transactions ( state, & block_txs, block_context) ;
539
- Self :: verify_execution_outputs ( & revert_reasons, & execution_outputs) ;
550
+ Self :: verify_execution_outputs ( block_index , & revert_reasons, & execution_outputs) ;
540
551
let extended_state_diff = final_state. cache . borrow ( ) . extended_state_diff ( ) ;
541
552
// Update the wrapped state.
542
553
let state_diff = final_state. to_state_diff ( ) . unwrap ( ) ;
0 commit comments