diff --git a/zkevm-circuits/src/sig_circuit.rs b/zkevm-circuits/src/sig_circuit.rs index b11b28fafd..8b25064b88 100644 --- a/zkevm-circuits/src/sig_circuit.rs +++ b/zkevm-circuits/src/sig_circuit.rs @@ -136,48 +136,49 @@ impl SubCircuitConfig for SigCircuitConfig { let limb_bits = 88; let num_limbs = 3; - // let range = RangeConfig::::configure( - // meta, - // RangeStrategy::Vertical, - // &num_advice, - // &num_lookup_advice, - // 1, - // LOG_TOTAL_NUM_ROWS - 1, - // 0, - // LOG_TOTAL_NUM_ROWS, - // ); - - // let ecdsa_k1_config = - // FpConfig::construct(range.clone(), limb_bits, num_limbs, modulus::()); - // let ecdsa_r1_config = FpConfig::construct(range, limb_bits, num_limbs, modulus::()); - let ecdsa_k1_config = FpConfig::configure( + let range = RangeConfig::::configure( meta, - FpStrategy::Simple, + RangeStrategy::Vertical, &num_advice, &num_lookup_advice, 1, LOG_TOTAL_NUM_ROWS - 1, - 88, - 3, - modulus::(), 0, - LOG_TOTAL_NUM_ROWS, // maximum k of the chip + LOG_TOTAL_NUM_ROWS, ); - // TODO: check if ecdsa_r1_config parameters need to be tuned. - let ecdsa_r1_config = FpConfig::configure( - meta, - FpStrategy::Simple, - &num_advice, - &num_lookup_advice, - 1, - LOG_TOTAL_NUM_ROWS - 1, - 88, - 3, - modulus::(), - 0, - LOG_TOTAL_NUM_ROWS, // maximum k of the chip - ); + let ecdsa_k1_config = + FpConfig::construct(range.clone(), limb_bits, num_limbs, modulus::()); + let ecdsa_r1_config = FpConfig::construct(range, limb_bits, num_limbs, modulus::()); + + // let ecdsa_k1_config = FpConfig::configure( + // meta, + // FpStrategy::Simple, + // &num_advice, + // &num_lookup_advice, + // 1, + // LOG_TOTAL_NUM_ROWS - 1, + // 88, + // 3, + // modulus::(), + // 0, + // LOG_TOTAL_NUM_ROWS, // maximum k of the chip + // ); + + // // TODO: check if ecdsa_r1_config parameters need to be tuned. + // let ecdsa_r1_config = FpConfig::configure( + // meta, + // FpStrategy::Simple, + // &num_advice, + // &num_lookup_advice, + // 1, + // LOG_TOTAL_NUM_ROWS - 1, + // 88, + // 3, + // modulus::(), + // 0, + // LOG_TOTAL_NUM_ROWS, // maximum k of the chip + // ); // we need one phase 2 column to store RLC results #[cfg(feature = "onephase")] @@ -245,8 +246,8 @@ impl SubCircuitConfig for SigCircuitConfig { impl SigCircuitConfig { pub(crate) fn load_range(&self, layouter: &mut impl Layouter) -> Result<(), Error> { // two chips use one `range` config, just load once - self.ecdsa_k1_config.range.load_lookup_table(layouter)?; self.ecdsa_r1_config.range.load_lookup_table(layouter) + //self.ecdsa_k1_config.range.load_lookup_table(layouter) } } @@ -298,7 +299,7 @@ impl SubCircuit for SigCircuit { layouter: &mut impl Layouter, ) -> Result<(), Error> { // only initialze one RangeConfig which two chips (r1 & k1) shares - config.ecdsa_k1_config.range.load_lookup_table(layouter)?; + //config.ecdsa_k1_config.range.load_lookup_table(layouter)?; config.ecdsa_r1_config.range.load_lookup_table(layouter)?; @@ -593,6 +594,7 @@ impl SigCircuit { // ======================================= assert!(*v == 0 || *v == 1, "v is not boolean"); println!("V is {}, pub key x: {:?} y: {:?}", v, x, y); + // println!(" bn256::Fr : {:?} y: {:?}", Fr); // we constrain: // - v + 2*tmp = y where y is already range checked (88 bits)