@@ -21,10 +21,8 @@ use transcript::TranscriptProtocol;
2121/// When all constraints are added, the verifying code calls `verify` 
2222/// which consumes the `Verifier` instance, samples random challenges 
2323/// that instantiate the randomized constraints, and verifies the proof. 
24- pub  struct  Verifier < ' a ,  ' b >  { 
25-     bp_gens :  & ' b  BulletproofGens , 
26-     pc_gens :  & ' b  PedersenGens , 
27-     transcript :  & ' a  mut  Transcript , 
24+ pub  struct  Verifier < ' t >  { 
25+     transcript :  & ' t  mut  Transcript , 
2826    constraints :  Vec < LinearCombination > , 
2927
3028    /// Records the number of low-level variables allocated in the 
@@ -41,7 +39,7 @@ pub struct Verifier<'a, 'b> {
4139     /// when non-randomized variables are committed. 
4240     /// After that, the option will flip to None and additional calls to `randomize_constraints` 
4341     /// will invoke closures immediately. 
44-      deferred_constraints :  Vec < Box < Fn ( & mut  RandomizingVerifier < ' a ,   ' b > )  -> Result < ( ) ,  R1CSError > > > , 
42+      deferred_constraints :  Vec < Box < Fn ( & mut  RandomizingVerifier < ' t > )  -> Result < ( ) ,  R1CSError > > > , 
4543
4644    /// Index of a pending multiplier that's not fully assigned yet. 
4745     pending_multiplier :  Option < usize > , 
@@ -54,12 +52,12 @@ pub struct Verifier<'a, 'b> {
5452/// monomorphize the closures for the proving and verifying code. 
5553/// However, this type cannot be instantiated by the user and therefore can only be used within 
5654/// the callback provided to `specify_randomized_constraints`. 
57- pub  struct  RandomizingVerifier < ' a ,   ' b >  { 
58-     verifier :  Verifier < ' a ,   ' b > , 
55+ pub  struct  RandomizingVerifier < ' t >  { 
56+     verifier :  Verifier < ' t > , 
5957} 
6058
61- impl < ' a ,   ' b >  ConstraintSystem  for  Verifier < ' a ,   ' b >  { 
62-     type  RandomizedCS  = RandomizingVerifier < ' a ,   ' b > ; 
59+ impl < ' t >  ConstraintSystem  for  Verifier < ' t >  { 
60+     type  RandomizedCS  = RandomizingVerifier < ' t > ; 
6361
6462    fn  multiply ( 
6563        & mut  self , 
@@ -129,7 +127,7 @@ impl<'a, 'b> ConstraintSystem for Verifier<'a, 'b> {
129127    } 
130128} 
131129
132- impl < ' a ,   ' b >  ConstraintSystem  for  RandomizingVerifier < ' a ,   ' b >  { 
130+ impl < ' t >  ConstraintSystem  for  RandomizingVerifier < ' t >  { 
133131    type  RandomizedCS  = Self ; 
134132
135133    fn  multiply ( 
@@ -163,24 +161,18 @@ impl<'a, 'b> ConstraintSystem for RandomizingVerifier<'a, 'b> {
163161    } 
164162} 
165163
166- impl < ' a ,   ' b >  RandomizedConstraintSystem  for  RandomizingVerifier < ' a ,   ' b >  { 
164+ impl < ' t >  RandomizedConstraintSystem  for  RandomizingVerifier < ' t >  { 
167165    fn  challenge_scalar ( & mut  self ,  label :  & ' static  [ u8 ] )  -> Scalar  { 
168166        self . verifier . transcript . challenge_scalar ( label) 
169167    } 
170168} 
171169
172- impl < ' a ,   ' b >  Verifier < ' a ,   ' b >  { 
170+ impl < ' t >  Verifier < ' t >  { 
173171    /// Construct an empty constraint system with specified external 
174172     /// input variables. 
175173     /// 
176174     /// # Inputs 
177175     /// 
178-      /// The `bp_gens` and `pc_gens` are generators for Bulletproofs 
179-      /// and for the Pedersen commitments, respectively.  The 
180-      /// [`BulletproofGens`] should have `gens_capacity` greater than 
181-      /// the number of multiplication constraints that will eventually 
182-      /// be added into the constraint system. 
183-      /// 
184176     /// The `transcript` parameter is a Merlin proof transcript.  The 
185177     /// `VerifierCS` holds onto the `&mut Transcript` until it consumes 
186178     /// itself during [`VerifierCS::verify`], releasing its borrow of the 
@@ -201,16 +193,10 @@ impl<'a, 'b> Verifier<'a, 'b> {
201193     /// 
202194     /// The second element is a list of [`Variable`]s corresponding to 
203195     /// the external inputs, which can be used to form constraints. 
204-      pub  fn  new ( 
205-         bp_gens :  & ' b  BulletproofGens , 
206-         pc_gens :  & ' b  PedersenGens , 
207-         transcript :  & ' a  mut  Transcript , 
208-     )  -> Self  { 
196+      pub  fn  new ( transcript :  & ' t  mut  Transcript )  -> Self  { 
209197        transcript. r1cs_domain_sep ( ) ; 
210198
211199        Verifier  { 
212-             bp_gens, 
213-             pc_gens, 
214200            transcript, 
215201            num_vars :  0 , 
216202            V :  Vec :: new ( ) , 
@@ -317,7 +303,17 @@ impl<'a, 'b> Verifier<'a, 'b> {
317303    } 
318304
319305    /// Consume this `VerifierCS` and attempt to verify the supplied `proof`. 
320-      pub  fn  verify ( mut  self ,  proof :  & R1CSProof )  -> Result < ( ) ,  R1CSError >  { 
306+      /// The `pc_gens` and `bp_gens` are generators for Pedersen commitments and 
307+      /// Bulletproofs vector commitments, respectively.  The 
308+      /// [`BulletproofGens`] should have `gens_capacity` greater than 
309+      /// the number of multiplication constraints that will eventually 
310+      /// be added into the constraint system. 
311+      pub  fn  verify ( 
312+         mut  self , 
313+         proof :  & R1CSProof , 
314+         pc_gens :  & PedersenGens , 
315+         bp_gens :  & BulletproofGens , 
316+     )  -> Result < ( ) ,  R1CSError >  { 
321317        // Commit a length _suffix_ for the number of high-level variables. 
322318        // We cannot do this in advance because user can commit variables one-by-one, 
323319        // but this suffix provides safe disambiguation because each variable 
@@ -342,11 +338,11 @@ impl<'a, 'b> Verifier<'a, 'b> {
342338        use  std:: iter; 
343339        use  util; 
344340
345-         if  self . bp_gens . gens_capacity  < padded_n { 
341+         if  bp_gens. gens_capacity  < padded_n { 
346342            return  Err ( R1CSError :: InvalidGeneratorsLength ) ; 
347343        } 
348344        // We are performing a single-party circuit proof, so party index is 0. 
349-         let  gens = self . bp_gens . share ( 0 ) ; 
345+         let  gens = bp_gens. share ( 0 ) ; 
350346
351347        self . transcript . commit_point ( b"A_I2" ,  & proof. A_I2 ) ; 
352348        self . transcript . commit_point ( b"A_O2" ,  & proof. A_O2 ) ; 
@@ -458,8 +454,8 @@ impl<'a, 'b> Verifier<'a, 'b> {
458454                . chain ( iter:: once ( proof. S2 . decompress ( ) ) ) 
459455                . chain ( self . V . iter ( ) . map ( |V_i | V_i . decompress ( ) ) ) 
460456                . chain ( T_points . iter ( ) . map ( |T_i | T_i . decompress ( ) ) ) 
461-                 . chain ( iter:: once ( Some ( self . pc_gens . B ) ) ) 
462-                 . chain ( iter:: once ( Some ( self . pc_gens . B_blinding ) ) ) 
457+                 . chain ( iter:: once ( Some ( pc_gens. B ) ) ) 
458+                 . chain ( iter:: once ( Some ( pc_gens. B_blinding ) ) ) 
463459                . chain ( gens. G ( padded_n) . map ( |& G_i | Some ( G_i ) ) ) 
464460                . chain ( gens. H ( padded_n) . map ( |& H_i | Some ( H_i ) ) ) 
465461                . chain ( proof. ipp_proof . L_vec . iter ( ) . map ( |L_i | L_i . decompress ( ) ) ) 
0 commit comments