diff --git a/src/circuit/gadget/ecc/chip/mul.rs b/src/circuit/gadget/ecc/chip/mul.rs index 329cd25d..e2f02445 100644 --- a/src/circuit/gadget/ecc/chip/mul.rs +++ b/src/circuit/gadget/ecc/chip/mul.rs @@ -98,6 +98,11 @@ impl From<&EccConfig> for Config { impl Config { pub(super) fn create_gate(&self, meta: &mut ConstraintSystem) { + self.hi_config.create_gate(meta); + self.lo_config.create_gate(meta); + self.complete_config.create_gate(meta); + self.overflow_config.create_gate(meta); + // If `lsb` is 0, (x, y) = (x_p, -y_p). If `lsb` is 1, (x, y) = (0,0). meta.create_gate("LSB check", |meta| { let q_mul_lsb = meta.query_selector(self.q_mul_lsb); @@ -127,11 +132,6 @@ impl Config { ]) .map(move |(name, poly)| (name, q_mul_lsb.clone() * poly)) }); - - self.hi_config.create_gate(meta); - self.lo_config.create_gate(meta); - self.complete_config.create_gate(meta); - self.overflow_config.create_gate(meta); } pub(super) fn assign( diff --git a/src/circuit_description b/src/circuit_description index 8b6cb01d..46141a26 100644 --- a/src/circuit_description +++ b/src/circuit_description @@ -3319,386 +3319,6 @@ PinnedVerificationKey { }, ), ), - Product( - Product( - Product( - Product( - Fixed { - query_index: 22, - column_index: 22, - rotation: Rotation( - 0, - ), - }, - Sum( - Constant( - 0x0000000000000000000000000000000000000000000000000000000000000002, - ), - Negated( - Fixed { - query_index: 22, - column_index: 22, - rotation: Rotation( - 0, - ), - }, - ), - ), - ), - Sum( - Constant( - 0x0000000000000000000000000000000000000000000000000000000000000003, - ), - Negated( - Fixed { - query_index: 22, - column_index: 22, - rotation: Rotation( - 0, - ), - }, - ), - ), - ), - Sum( - Constant( - 0x0000000000000000000000000000000000000000000000000000000000000004, - ), - Negated( - Fixed { - query_index: 22, - column_index: 22, - rotation: Rotation( - 0, - ), - }, - ), - ), - ), - Product( - Sum( - Advice { - query_index: 10, - column_index: 9, - rotation: Rotation( - 1, - ), - }, - Negated( - Scaled( - Advice { - query_index: 9, - column_index: 9, - rotation: Rotation( - 0, - ), - }, - 0x0000000000000000000000000000000000000000000000000000000000000002, - ), - ), - ), - Sum( - Constant( - 0x0000000000000000000000000000000000000000000000000000000000000001, - ), - Negated( - Sum( - Advice { - query_index: 10, - column_index: 9, - rotation: Rotation( - 1, - ), - }, - Negated( - Scaled( - Advice { - query_index: 9, - column_index: 9, - rotation: Rotation( - 0, - ), - }, - 0x0000000000000000000000000000000000000000000000000000000000000002, - ), - ), - ), - ), - ), - ), - ), - Product( - Product( - Product( - Product( - Fixed { - query_index: 22, - column_index: 22, - rotation: Rotation( - 0, - ), - }, - Sum( - Constant( - 0x0000000000000000000000000000000000000000000000000000000000000002, - ), - Negated( - Fixed { - query_index: 22, - column_index: 22, - rotation: Rotation( - 0, - ), - }, - ), - ), - ), - Sum( - Constant( - 0x0000000000000000000000000000000000000000000000000000000000000003, - ), - Negated( - Fixed { - query_index: 22, - column_index: 22, - rotation: Rotation( - 0, - ), - }, - ), - ), - ), - Sum( - Constant( - 0x0000000000000000000000000000000000000000000000000000000000000004, - ), - Negated( - Fixed { - query_index: 22, - column_index: 22, - rotation: Rotation( - 0, - ), - }, - ), - ), - ), - Sum( - Product( - Sum( - Advice { - query_index: 10, - column_index: 9, - rotation: Rotation( - 1, - ), - }, - Negated( - Scaled( - Advice { - query_index: 9, - column_index: 9, - rotation: Rotation( - 0, - ), - }, - 0x0000000000000000000000000000000000000000000000000000000000000002, - ), - ), - ), - Advice { - query_index: 0, - column_index: 0, - rotation: Rotation( - 0, - ), - }, - ), - Product( - Sum( - Constant( - 0x0000000000000000000000000000000000000000000000000000000000000001, - ), - Negated( - Sum( - Advice { - query_index: 10, - column_index: 9, - rotation: Rotation( - 1, - ), - }, - Negated( - Scaled( - Advice { - query_index: 9, - column_index: 9, - rotation: Rotation( - 0, - ), - }, - 0x0000000000000000000000000000000000000000000000000000000000000002, - ), - ), - ), - ), - ), - Sum( - Advice { - query_index: 0, - column_index: 0, - rotation: Rotation( - 0, - ), - }, - Negated( - Advice { - query_index: 15, - column_index: 0, - rotation: Rotation( - 1, - ), - }, - ), - ), - ), - ), - ), - Product( - Product( - Product( - Product( - Fixed { - query_index: 22, - column_index: 22, - rotation: Rotation( - 0, - ), - }, - Sum( - Constant( - 0x0000000000000000000000000000000000000000000000000000000000000002, - ), - Negated( - Fixed { - query_index: 22, - column_index: 22, - rotation: Rotation( - 0, - ), - }, - ), - ), - ), - Sum( - Constant( - 0x0000000000000000000000000000000000000000000000000000000000000003, - ), - Negated( - Fixed { - query_index: 22, - column_index: 22, - rotation: Rotation( - 0, - ), - }, - ), - ), - ), - Sum( - Constant( - 0x0000000000000000000000000000000000000000000000000000000000000004, - ), - Negated( - Fixed { - query_index: 22, - column_index: 22, - rotation: Rotation( - 0, - ), - }, - ), - ), - ), - Sum( - Product( - Sum( - Advice { - query_index: 10, - column_index: 9, - rotation: Rotation( - 1, - ), - }, - Negated( - Scaled( - Advice { - query_index: 9, - column_index: 9, - rotation: Rotation( - 0, - ), - }, - 0x0000000000000000000000000000000000000000000000000000000000000002, - ), - ), - ), - Advice { - query_index: 1, - column_index: 1, - rotation: Rotation( - 0, - ), - }, - ), - Product( - Sum( - Constant( - 0x0000000000000000000000000000000000000000000000000000000000000001, - ), - Negated( - Sum( - Advice { - query_index: 10, - column_index: 9, - rotation: Rotation( - 1, - ), - }, - Negated( - Scaled( - Advice { - query_index: 9, - column_index: 9, - rotation: Rotation( - 0, - ), - }, - 0x0000000000000000000000000000000000000000000000000000000000000002, - ), - ), - ), - ), - ), - Sum( - Advice { - query_index: 1, - column_index: 1, - rotation: Rotation( - 0, - ), - }, - Advice { - query_index: 16, - column_index: 1, - rotation: Rotation( - 1, - ), - }, - ), - ), - ), - ), Product( Product( Product( @@ -3807,7 +3427,7 @@ PinnedVerificationKey { ), }, Advice { - query_index: 17, + query_index: 15, column_index: 5, rotation: Rotation( 1, @@ -3853,7 +3473,7 @@ PinnedVerificationKey { ), Negated( Advice { - query_index: 15, + query_index: 16, column_index: 0, rotation: Rotation( 1, @@ -3967,7 +3587,7 @@ PinnedVerificationKey { }, Negated( Advice { - query_index: 15, + query_index: 16, column_index: 0, rotation: Rotation( 1, @@ -4074,7 +3694,7 @@ PinnedVerificationKey { }, Negated( Advice { - query_index: 16, + query_index: 17, column_index: 1, rotation: Rotation( 1, @@ -4826,7 +4446,7 @@ PinnedVerificationKey { ), }, Advice { - query_index: 17, + query_index: 15, column_index: 5, rotation: Rotation( 1, @@ -4872,7 +4492,7 @@ PinnedVerificationKey { ), Negated( Advice { - query_index: 15, + query_index: 16, column_index: 0, rotation: Rotation( 1, @@ -5768,7 +5388,7 @@ PinnedVerificationKey { ), Negated( Advice { - query_index: 15, + query_index: 16, column_index: 0, rotation: Rotation( 1, @@ -5866,7 +5486,7 @@ PinnedVerificationKey { }, Negated( Advice { - query_index: 15, + query_index: 16, column_index: 0, rotation: Rotation( 1, @@ -5957,7 +5577,7 @@ PinnedVerificationKey { }, Negated( Advice { - query_index: 16, + query_index: 17, column_index: 1, rotation: Rotation( 1, @@ -6691,7 +6311,7 @@ PinnedVerificationKey { ), Negated( Advice { - query_index: 15, + query_index: 16, column_index: 0, rotation: Rotation( 1, @@ -8193,6 +7813,386 @@ PinnedVerificationKey { }, ), ), + Product( + Product( + Product( + Product( + Fixed { + query_index: 22, + column_index: 22, + rotation: Rotation( + 0, + ), + }, + Sum( + Constant( + 0x0000000000000000000000000000000000000000000000000000000000000002, + ), + Negated( + Fixed { + query_index: 22, + column_index: 22, + rotation: Rotation( + 0, + ), + }, + ), + ), + ), + Sum( + Constant( + 0x0000000000000000000000000000000000000000000000000000000000000003, + ), + Negated( + Fixed { + query_index: 22, + column_index: 22, + rotation: Rotation( + 0, + ), + }, + ), + ), + ), + Sum( + Constant( + 0x0000000000000000000000000000000000000000000000000000000000000004, + ), + Negated( + Fixed { + query_index: 22, + column_index: 22, + rotation: Rotation( + 0, + ), + }, + ), + ), + ), + Product( + Sum( + Advice { + query_index: 10, + column_index: 9, + rotation: Rotation( + 1, + ), + }, + Negated( + Scaled( + Advice { + query_index: 9, + column_index: 9, + rotation: Rotation( + 0, + ), + }, + 0x0000000000000000000000000000000000000000000000000000000000000002, + ), + ), + ), + Sum( + Constant( + 0x0000000000000000000000000000000000000000000000000000000000000001, + ), + Negated( + Sum( + Advice { + query_index: 10, + column_index: 9, + rotation: Rotation( + 1, + ), + }, + Negated( + Scaled( + Advice { + query_index: 9, + column_index: 9, + rotation: Rotation( + 0, + ), + }, + 0x0000000000000000000000000000000000000000000000000000000000000002, + ), + ), + ), + ), + ), + ), + ), + Product( + Product( + Product( + Product( + Fixed { + query_index: 22, + column_index: 22, + rotation: Rotation( + 0, + ), + }, + Sum( + Constant( + 0x0000000000000000000000000000000000000000000000000000000000000002, + ), + Negated( + Fixed { + query_index: 22, + column_index: 22, + rotation: Rotation( + 0, + ), + }, + ), + ), + ), + Sum( + Constant( + 0x0000000000000000000000000000000000000000000000000000000000000003, + ), + Negated( + Fixed { + query_index: 22, + column_index: 22, + rotation: Rotation( + 0, + ), + }, + ), + ), + ), + Sum( + Constant( + 0x0000000000000000000000000000000000000000000000000000000000000004, + ), + Negated( + Fixed { + query_index: 22, + column_index: 22, + rotation: Rotation( + 0, + ), + }, + ), + ), + ), + Sum( + Product( + Sum( + Advice { + query_index: 10, + column_index: 9, + rotation: Rotation( + 1, + ), + }, + Negated( + Scaled( + Advice { + query_index: 9, + column_index: 9, + rotation: Rotation( + 0, + ), + }, + 0x0000000000000000000000000000000000000000000000000000000000000002, + ), + ), + ), + Advice { + query_index: 0, + column_index: 0, + rotation: Rotation( + 0, + ), + }, + ), + Product( + Sum( + Constant( + 0x0000000000000000000000000000000000000000000000000000000000000001, + ), + Negated( + Sum( + Advice { + query_index: 10, + column_index: 9, + rotation: Rotation( + 1, + ), + }, + Negated( + Scaled( + Advice { + query_index: 9, + column_index: 9, + rotation: Rotation( + 0, + ), + }, + 0x0000000000000000000000000000000000000000000000000000000000000002, + ), + ), + ), + ), + ), + Sum( + Advice { + query_index: 0, + column_index: 0, + rotation: Rotation( + 0, + ), + }, + Negated( + Advice { + query_index: 16, + column_index: 0, + rotation: Rotation( + 1, + ), + }, + ), + ), + ), + ), + ), + Product( + Product( + Product( + Product( + Fixed { + query_index: 22, + column_index: 22, + rotation: Rotation( + 0, + ), + }, + Sum( + Constant( + 0x0000000000000000000000000000000000000000000000000000000000000002, + ), + Negated( + Fixed { + query_index: 22, + column_index: 22, + rotation: Rotation( + 0, + ), + }, + ), + ), + ), + Sum( + Constant( + 0x0000000000000000000000000000000000000000000000000000000000000003, + ), + Negated( + Fixed { + query_index: 22, + column_index: 22, + rotation: Rotation( + 0, + ), + }, + ), + ), + ), + Sum( + Constant( + 0x0000000000000000000000000000000000000000000000000000000000000004, + ), + Negated( + Fixed { + query_index: 22, + column_index: 22, + rotation: Rotation( + 0, + ), + }, + ), + ), + ), + Sum( + Product( + Sum( + Advice { + query_index: 10, + column_index: 9, + rotation: Rotation( + 1, + ), + }, + Negated( + Scaled( + Advice { + query_index: 9, + column_index: 9, + rotation: Rotation( + 0, + ), + }, + 0x0000000000000000000000000000000000000000000000000000000000000002, + ), + ), + ), + Advice { + query_index: 1, + column_index: 1, + rotation: Rotation( + 0, + ), + }, + ), + Product( + Sum( + Constant( + 0x0000000000000000000000000000000000000000000000000000000000000001, + ), + Negated( + Sum( + Advice { + query_index: 10, + column_index: 9, + rotation: Rotation( + 1, + ), + }, + Negated( + Scaled( + Advice { + query_index: 9, + column_index: 9, + rotation: Rotation( + 0, + ), + }, + 0x0000000000000000000000000000000000000000000000000000000000000002, + ), + ), + ), + ), + ), + Sum( + Advice { + query_index: 1, + column_index: 1, + rotation: Rotation( + 0, + ), + }, + Advice { + query_index: 17, + column_index: 1, + rotation: Rotation( + 1, + ), + }, + ), + ), + ), + ), Product( Fixed { query_index: 19, @@ -13093,7 +13093,7 @@ PinnedVerificationKey { Sum( Sum( Advice { - query_index: 15, + query_index: 16, column_index: 0, rotation: Rotation( 1, @@ -13179,7 +13179,7 @@ PinnedVerificationKey { }, Negated( Advice { - query_index: 15, + query_index: 16, column_index: 0, rotation: Rotation( 1, @@ -13311,7 +13311,7 @@ PinnedVerificationKey { ), Sum( Advice { - query_index: 15, + query_index: 16, column_index: 0, rotation: Rotation( 1, @@ -13338,7 +13338,7 @@ PinnedVerificationKey { ), Negated( Advice { - query_index: 15, + query_index: 16, column_index: 0, rotation: Rotation( 1, @@ -13348,7 +13348,7 @@ PinnedVerificationKey { ), Negated( Advice { - query_index: 16, + query_index: 17, column_index: 1, rotation: Rotation( 1, @@ -13798,7 +13798,7 @@ PinnedVerificationKey { Negated( Scaled( Advice { - query_index: 15, + query_index: 16, column_index: 0, rotation: Rotation( 1, @@ -13910,7 +13910,7 @@ PinnedVerificationKey { Sum( Sum( Advice { - query_index: 15, + query_index: 16, column_index: 0, rotation: Rotation( 1, @@ -13929,7 +13929,7 @@ PinnedVerificationKey { Negated( Scaled( Advice { - query_index: 16, + query_index: 17, column_index: 1, rotation: Rotation( 1, @@ -14173,7 +14173,7 @@ PinnedVerificationKey { ), Sum( Advice { - query_index: 16, + query_index: 17, column_index: 1, rotation: Rotation( 1, @@ -14401,7 +14401,7 @@ PinnedVerificationKey { Sum( Sum( Advice { - query_index: 17, + query_index: 15, column_index: 5, rotation: Rotation( 1, @@ -14487,7 +14487,7 @@ PinnedVerificationKey { }, Negated( Advice { - query_index: 17, + query_index: 15, column_index: 5, rotation: Rotation( 1, @@ -14619,7 +14619,7 @@ PinnedVerificationKey { ), Sum( Advice { - query_index: 17, + query_index: 15, column_index: 5, rotation: Rotation( 1, @@ -14646,7 +14646,7 @@ PinnedVerificationKey { ), Negated( Advice { - query_index: 17, + query_index: 15, column_index: 5, rotation: Rotation( 1, @@ -15266,7 +15266,7 @@ PinnedVerificationKey { Negated( Scaled( Advice { - query_index: 17, + query_index: 15, column_index: 5, rotation: Rotation( 1, @@ -15394,7 +15394,7 @@ PinnedVerificationKey { Sum( Sum( Advice { - query_index: 17, + query_index: 15, column_index: 5, rotation: Rotation( 1, @@ -16424,7 +16424,7 @@ PinnedVerificationKey { }, Scaled( Advice { - query_index: 16, + query_index: 17, column_index: 1, rotation: Rotation( 1, @@ -16457,7 +16457,7 @@ PinnedVerificationKey { ), Negated( Advice { - query_index: 15, + query_index: 16, column_index: 0, rotation: Rotation( 1, @@ -17211,7 +17211,7 @@ PinnedVerificationKey { }, Scaled( Advice { - query_index: 16, + query_index: 17, column_index: 1, rotation: Rotation( 1, @@ -21504,7 +21504,7 @@ PinnedVerificationKey { ), Sum( Advice { - query_index: 17, + query_index: 15, column_index: 5, rotation: Rotation( 1, @@ -21661,7 +21661,7 @@ PinnedVerificationKey { Sum( Sum( Advice { - query_index: 17, + query_index: 15, column_index: 5, rotation: Rotation( 1, @@ -21800,7 +21800,7 @@ PinnedVerificationKey { Sum( Sum( Advice { - query_index: 17, + query_index: 15, column_index: 5, rotation: Rotation( 1, @@ -26460,7 +26460,7 @@ PinnedVerificationKey { ), Sum( Advice { - query_index: 17, + query_index: 15, column_index: 5, rotation: Rotation( 1, @@ -26617,7 +26617,7 @@ PinnedVerificationKey { Sum( Sum( Advice { - query_index: 17, + query_index: 15, column_index: 5, rotation: Rotation( 1, @@ -26756,7 +26756,7 @@ PinnedVerificationKey { Sum( Sum( Advice { - query_index: 17, + query_index: 15, column_index: 5, rotation: Rotation( 1, @@ -27283,6 +27283,15 @@ PinnedVerificationKey { 1, ), ), + ( + Column { + index: 5, + column_type: Advice, + }, + Rotation( + 1, + ), + ), ( Column { index: 0, @@ -27301,15 +27310,6 @@ PinnedVerificationKey { 1, ), ), - ( - Column { - index: 5, - column_type: Advice, - }, - Rotation( - 1, - ), - ), ( Column { index: 7,