@@ -398,6 +398,18 @@ impl SubCircuitConfig<Fr> for SuperCircuitConfig<Fr> {
398
398
}
399
399
}
400
400
401
+ /// Row usage for each sub circuit
402
+ #[ derive( Clone , Default , Debug ) ]
403
+ pub struct SubcircuitRowUsage {
404
+ /// Subcircuit name
405
+ pub name : String ,
406
+ // TODO: better name?
407
+ /// Without padding
408
+ pub row_num_real : usize ,
409
+ /// With padding
410
+ pub row_num_total : usize ,
411
+ }
412
+
401
413
/// The Super Circuit contains all the zkEVM circuits
402
414
#[ derive( Clone , Default , Debug ) ]
403
415
pub struct SuperCircuit <
@@ -457,7 +469,7 @@ impl<
457
469
num_rows_evm_circuit
458
470
}
459
471
/// Return the minimum number of rows required to prove the block
460
- pub fn min_num_rows_block_subcircuits ( block : & Block < Fr > ) -> ( Vec < usize > , Vec < usize > ) {
472
+ pub fn min_num_rows_block_subcircuits ( block : & Block < Fr > ) -> Vec < SubcircuitRowUsage > {
461
473
let evm = EvmCircuit :: min_num_rows_block ( block) ;
462
474
let state = StateCircuit :: min_num_rows_block ( block) ;
463
475
let bytecode = BytecodeCircuit :: min_num_rows_block ( block) ;
@@ -491,14 +503,37 @@ impl<
491
503
#[ cfg( feature = "zktrie" ) ]
492
504
mpt,
493
505
] ;
494
- let ( rows_without_padding, rows_with_padding) : ( Vec < usize > , Vec < usize > ) =
495
- rows. into_iter ( ) . unzip ( ) ;
496
- log:: debug!(
497
- "subcircuit rows(without padding): {:?}" ,
498
- rows_without_padding
499
- ) ;
500
- log:: debug!( "subcircuit rows(with padding): {:?}" , rows_with_padding) ;
501
- ( rows_without_padding, rows_with_padding)
506
+ let sub_circuit_names: Vec < String > = [
507
+ "evm" ,
508
+ "state" ,
509
+ "bytecode" ,
510
+ "copy" ,
511
+ "keccak" ,
512
+ "tx" ,
513
+ "rlp" ,
514
+ "exp" ,
515
+ "modexp" ,
516
+ "pi" ,
517
+ "poseidon" ,
518
+ "sig" ,
519
+ "ecc" ,
520
+ #[ cfg( feature = "zktrie" ) ]
521
+ "mpt" ,
522
+ ]
523
+ . into_iter ( )
524
+ . map ( |s| s. to_string ( ) )
525
+ . collect ( ) ;
526
+ let row_usage_details = sub_circuit_names
527
+ . into_iter ( )
528
+ . zip_eq ( rows. into_iter ( ) )
529
+ . map ( |( name, ( row_num_real, row_num_total) ) | SubcircuitRowUsage {
530
+ name,
531
+ row_num_real,
532
+ row_num_total,
533
+ } )
534
+ . collect_vec ( ) ;
535
+ log:: debug!( "row_usage_details {row_usage_details:?}" ) ;
536
+ row_usage_details
502
537
}
503
538
}
504
539
@@ -583,10 +618,10 @@ impl<
583
618
584
619
/// Return the minimum number of rows required to prove the block
585
620
fn min_num_rows_block ( block : & Block < Fr > ) -> ( usize , usize ) {
586
- let ( rows_without_padding , rows_with_padding ) = Self :: min_num_rows_block_subcircuits ( block) ;
621
+ let row_usage = Self :: min_num_rows_block_subcircuits ( block) ;
587
622
(
588
- itertools:: max ( rows_without_padding ) . unwrap ( ) ,
589
- itertools:: max ( rows_with_padding ) . unwrap ( ) ,
623
+ itertools:: max ( row_usage . iter ( ) . map ( |x| x . row_num_real ) ) . unwrap ( ) ,
624
+ itertools:: max ( row_usage . iter ( ) . map ( |x| x . row_num_total ) ) . unwrap ( ) ,
590
625
)
591
626
}
592
627
0 commit comments