@@ -94,13 +94,7 @@ impl SchnorrVerifierGate {
9494 let input_hash = [ signature. 0 . x . clone ( ) , pk. x . clone ( ) , msg. clone ( ) ] ;
9595 let challenge = self . rescue_hash_gate . hash ( ctx, & input_hash) ?; // larger than mod with high prob
9696
97- let lhs = self . combined_mul (
98- ctx,
99- & signature. 1 . 0 ,
100- & challenge,
101- & assigned_generator,
102- pk,
103- ) ?;
97+ let lhs = self . combined_mul ( ctx, & signature. 1 . 0 , & challenge, & assigned_generator, pk) ?;
10498
10599 self . ecc_gate . constrain_equal ( ctx, & lhs, & signature. 0 ) ?;
106100
@@ -133,15 +127,22 @@ impl SchnorrVerifierGate {
133127 let jubjub_mod =
134128 Base :: from_bytes ( & jub_jub_scalar_bytes) . expect ( "Failed to deserialise modulus" ) ; // This will not fail as jubjub mod is smaller than BLS
135129
136- let mult_remainder = scalar_2. value ( ) . map ( |& val| {
137- let ( mult, remainder) = fe_to_big ( val) . div_rem ( & fe_to_big ( jubjub_mod) ) ;
138- [ big_to_fe ( mult) , big_to_fe ( remainder) ]
139- } ) . transpose_vec ( 2 ) ;
130+ let mult_remainder = scalar_2
131+ . value ( )
132+ . map ( |& val| {
133+ let ( mult, remainder) = fe_to_big ( val) . div_rem ( & fe_to_big ( jubjub_mod) ) ;
134+ [ big_to_fe ( mult) , big_to_fe ( remainder) ]
135+ } )
136+ . transpose_vec ( 2 ) ;
140137
141138 self . ecc_gate . main_gate . assert_zero_sum (
142139 ctx,
143- & [ Term :: Assigned ( scalar_2, - Base :: ONE ) , Term :: Unassigned ( mult_remainder[ 0 ] , jubjub_mod) , Term :: Unassigned ( mult_remainder[ 1 ] , Base :: ONE ) ] ,
144- Base :: ZERO
140+ & [
141+ Term :: Assigned ( scalar_2, -Base :: ONE ) ,
142+ Term :: Unassigned ( mult_remainder[ 0 ] , jubjub_mod) ,
143+ Term :: Unassigned ( mult_remainder[ 1 ] , Base :: ONE ) ,
144+ ] ,
145+ Base :: ZERO ,
145146 ) ?;
146147
147148 let neg_scalar_2 = self
@@ -151,15 +152,19 @@ impl SchnorrVerifierGate {
151152
152153 self . ecc_gate . main_gate . assert_zero_sum (
153154 ctx,
154- & [ Term :: Assigned ( scalar_2, Base :: ONE ) , Term :: Assigned ( & neg_scalar_2, Base :: ONE ) , Term :: Unassigned ( mult_remainder[ 0 ] + Value :: known ( Base :: ONE ) , - jubjub_mod) ] ,
155- Base :: ZERO
155+ & [
156+ Term :: Assigned ( scalar_2, Base :: ONE ) ,
157+ Term :: Assigned ( & neg_scalar_2, Base :: ONE ) ,
158+ Term :: Unassigned ( mult_remainder[ 0 ] + Value :: known ( Base :: ONE ) , -jubjub_mod) ,
159+ ] ,
160+ Base :: ZERO ,
156161 ) ?;
157162
158163 // Decompose scalar into bits
159164 let mut decomposition_1 =
160165 self . ecc_gate
161166 . main_gate
162- . to_bits ( ctx, & scalar_1, Base :: NUM_BITS as usize ) ?;
167+ . to_bits ( ctx, scalar_1, Base :: NUM_BITS as usize ) ?;
163168 decomposition_1. reverse ( ) ; // to get MSB first
164169
165170 let mut decomposition_2 =
0 commit comments