@@ -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 ( )
@@ -441,22 +445,29 @@ impl<S: FlowTestState> TestManager<S> {
441
445
442
446
/// Verifies all the execution outputs are as expected w.r.t. revert reasons.
443
447
fn verify_execution_outputs (
448
+ block_index : usize ,
444
449
revert_reasons : & [ Option < String > ] ,
445
450
execution_outputs : & [ ( TransactionExecutionInfo , StateMaps ) ] ,
446
451
) {
447
452
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 ( ) )
450
455
{
456
+ let preamble = format ! ( "Block {block_index}, transaction {i}:" ) ;
451
457
if let Some ( revert_reason) = revert_reason {
452
458
let actual_revert_reason =
453
459
execution_info. revert_error . as_ref ( ) . unwrap ( ) . to_string ( ) ;
454
460
assert ! (
455
461
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}'"
457
464
) ;
458
465
} 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
+ ) ;
460
471
}
461
472
}
462
473
}
@@ -520,8 +531,8 @@ impl<S: FlowTestState> TestManager<S> {
520
531
"use_kzg_da flag in block contexts must match the test parameter."
521
532
) ;
522
533
let mut alias_keys = HashSet :: new ( ) ;
523
- for ( block_txs_with_reason, block_context) in
524
- per_block_txs. into_iter ( ) . zip ( block_contexts. into_iter ( ) )
534
+ for ( ( block_index , block_txs_with_reason) , block_context) in
535
+ per_block_txs. into_iter ( ) . enumerate ( ) . zip ( block_contexts. into_iter ( ) )
525
536
{
526
537
let ( block_txs, revert_reasons) : ( Vec < _ > , Vec < _ > ) = block_txs_with_reason
527
538
. into_iter ( )
@@ -532,7 +543,7 @@ impl<S: FlowTestState> TestManager<S> {
532
543
// Execute the transactions.
533
544
let ExecutionOutput { execution_outputs, block_summary, mut final_state } =
534
545
execute_transactions ( state, & block_txs, block_context) ;
535
- Self :: verify_execution_outputs ( & revert_reasons, & execution_outputs) ;
546
+ Self :: verify_execution_outputs ( block_index , & revert_reasons, & execution_outputs) ;
536
547
let extended_state_diff = final_state. cache . borrow ( ) . extended_state_diff ( ) ;
537
548
// Update the wrapped state.
538
549
let state_diff = final_state. to_state_diff ( ) . unwrap ( ) ;
0 commit comments