@@ -518,7 +518,7 @@ fn get_params_for_sub_circuit_test() -> CircuitsParams {
518518 max_exp_steps : 5000 ,
519519 max_keccak_rows : 0 , // dynamic?
520520 max_poseidon_rows : 0 ,
521- max_vertical_circuit_rows : 0 ,
521+ max_vertical_circuit_rows : MAX_VERTICLE_ROWS , // is it good?
522522 max_inner_blocks : 64 ,
523523 max_rlp_rows : 6000 ,
524524 max_ec_ops : PrecompileEcParams {
@@ -529,7 +529,7 @@ fn get_params_for_sub_circuit_test() -> CircuitsParams {
529529 }
530530}
531531
532- fn test_with < C : SubCircuit < Fr > + Circuit < Fr > > ( block : & Block < Fr > ) -> MockProver < Fr > {
532+ fn test_with < C : SubCircuit < Fr > + Circuit < Fr > > ( block : & Block < Fr > ) {
533533 let num_row = C :: min_num_rows_block ( block) . 1 ;
534534 let k = zkevm_circuits:: util:: log2_ceil ( num_row + 256 ) ;
535535 log:: debug!(
@@ -538,7 +538,8 @@ fn test_with<C: SubCircuit<Fr> + Circuit<Fr>>(block: &Block<Fr>) -> MockProver<F
538538 ) ;
539539 //debug_assert!(k <= 22);
540540 let circuit = C :: new_from_block ( block) ;
541- MockProver :: < Fr > :: run ( k, & circuit, circuit. instance ( ) ) . unwrap ( )
541+ let prover = MockProver :: < Fr > :: run ( k, & circuit, circuit. instance ( ) ) . unwrap ( ) ;
542+ prover. assert_satisfied_par ( ) ;
542543}
543544
544545type ScrollSuperCircuit = SuperCircuit < Fr , MAX_TXS , MAX_CALLDATA , MAX_INNER_BLOCKS , 0x100 > ;
@@ -595,56 +596,71 @@ pub fn run_test(
595596 log:: debug!( "witness_block created" ) ;
596597 //builder.sdb.list_accounts();
597598
599+ let check_ccc = || {
600+ let row_usage = ScrollSuperCircuit :: min_num_rows_block_subcircuits ( & witness_block) ;
601+ let mut overflow = false ;
602+ for ( num, limit) in row_usage. iter ( ) . zip_eq ( get_sub_circuit_limit_l2 ( ) . iter ( ) ) {
603+ if num. row_num_real > * limit {
604+ log:: warn!(
605+ "ccc detail: suite.id {}, st.id {}, circuit {}, num {}, limit {}" ,
606+ suite. id,
607+ st. id,
608+ num. name,
609+ num. row_num_real,
610+ limit
611+ ) ;
612+ overflow = true ;
613+ }
614+ }
615+ let max_row_usage = row_usage. iter ( ) . max_by_key ( |r| r. row_num_real ) . unwrap ( ) ;
616+ if overflow {
617+ log:: warn!(
618+ "ccc overflow: st.id {}, detail {} {}" ,
619+ st. id,
620+ max_row_usage. name,
621+ max_row_usage. row_num_real
622+ ) ;
623+ panic ! ( "{} {}" , max_row_usage. name, max_row_usage. row_num_real) ;
624+ } else {
625+ log:: info!(
626+ "ccc ok: st.id {}, detail {} {}" ,
627+ st. id,
628+ max_row_usage. name,
629+ max_row_usage. row_num_real
630+ ) ;
631+ }
632+ } ;
633+
598634 if !circuits_config. super_circuit {
599635 if ( * CIRCUIT ) . is_empty ( ) {
600636 CircuitTestBuilder :: < 1 , 1 > :: new_from_block ( witness_block)
601637 . copy_checks ( None )
602638 . run ( ) ;
639+ } else if ( * CIRCUIT ) == "ccc" {
640+ check_ccc ( ) ;
603641 } else {
604- let prover = match ( * CIRCUIT ) . as_str ( ) {
642+ match ( * CIRCUIT ) . as_str ( ) {
605643 "modexp" => test_with :: < ModExpCircuit < Fr > > ( & witness_block) ,
606644 "bytecode" => test_with :: < BytecodeCircuit < Fr > > ( & witness_block) ,
607645 "ecc" => test_with :: < EccCircuit < Fr , 9 > > ( & witness_block) ,
608- "sig" => test_with :: < SigCircuit < Fr > > ( & witness_block) ,
646+ "sig" => {
647+ if !witness_block
648+ . precompile_events
649+ . get_ecrecover_events ( )
650+ . is_empty ( )
651+ {
652+ test_with :: < SigCircuit < Fr > > ( & witness_block) ;
653+ } else {
654+ log:: warn!( "no ec recover event {}, skip" , st. id) ;
655+ }
656+ }
609657 _ => unimplemented ! ( ) ,
610658 } ;
611- prover. assert_satisfied_par ( ) ;
612659 }
613660 } else {
614661 log:: debug!( "test super circuit {}" , * CIRCUIT ) ;
615662 if ( * CIRCUIT ) == "ccc" {
616- let row_usage = ScrollSuperCircuit :: min_num_rows_block_subcircuits ( & witness_block) ;
617- let mut overflow = false ;
618- for ( num, limit) in row_usage. iter ( ) . zip_eq ( get_sub_circuit_limit_l2 ( ) . iter ( ) ) {
619- if num. row_num_real > * limit {
620- log:: warn!(
621- "ccc detail: suite.id {}, st.id {}, circuit {}, num {}, limit {}" ,
622- suite. id,
623- st. id,
624- num. name,
625- num. row_num_real,
626- limit
627- ) ;
628- overflow = true ;
629- }
630- }
631- let max_row_usage = row_usage. iter ( ) . max_by_key ( |r| r. row_num_real ) . unwrap ( ) ;
632- if overflow {
633- log:: warn!(
634- "ccc overflow: st.id {}, detail {} {}" ,
635- st. id,
636- max_row_usage. name,
637- max_row_usage. row_num_real
638- ) ;
639- panic ! ( "{} {}" , max_row_usage. name, max_row_usage. row_num_real) ;
640- } else {
641- log:: info!(
642- "ccc ok: st.id {}, detail {} {}" ,
643- st. id,
644- max_row_usage. name,
645- max_row_usage. row_num_real
646- ) ;
647- }
663+ check_ccc ( ) ;
648664 } else {
649665 // TODO: do we need to automatically adjust this k?
650666 let k = 20 ;
0 commit comments