@@ -201,49 +201,30 @@ impl RangeProof {
201201 let value_commitment_scalars = util:: exp_iter ( z) . take ( m) . map ( |z_exp| c * zz * z_exp) ;
202202 let basepoint_scalar = w * ( self . t_x - a * b) + c * ( delta ( n, m, & y, & z) - self . t_x ) ;
203203
204- let Ls = self
205- . ipp_proof
206- . L_vec
207- . iter ( )
208- . map ( |p| p. decompress ( ) . ok_or ( ProofError :: VerificationError ) )
209- . collect :: < Result < Vec < _ > , _ > > ( ) ?;
210-
211- let Rs = self
212- . ipp_proof
213- . R_vec
214- . iter ( )
215- . map ( |p| p. decompress ( ) . ok_or ( ProofError :: VerificationError ) )
216- . collect :: < Result < Vec < _ > , _ > > ( ) ?;
217-
218- let A = self . A . decompress ( ) . ok_or ( ProofError :: VerificationError ) ?;
219- let S = self . S . decompress ( ) . ok_or ( ProofError :: VerificationError ) ?;
220- let T_1 = self . T_1 . decompress ( ) . ok_or ( ProofError :: VerificationError ) ?;
221- let T_2 = self . T_2 . decompress ( ) . ok_or ( ProofError :: VerificationError ) ?;
222-
223- let mega_check = RistrettoPoint :: vartime_multiscalar_mul (
204+ let mega_check = RistrettoPoint :: optional_multiscalar_mul (
224205 iter:: once ( Scalar :: one ( ) )
225206 . chain ( iter:: once ( x) )
226- . chain ( value_commitment_scalars)
227207 . chain ( iter:: once ( c * x) )
228208 . chain ( iter:: once ( c * x * x) )
209+ . chain ( x_sq. iter ( ) . cloned ( ) )
210+ . chain ( x_inv_sq. iter ( ) . cloned ( ) )
229211 . chain ( iter:: once ( -self . e_blinding - c * self . t_x_blinding ) )
230212 . chain ( iter:: once ( basepoint_scalar) )
231213 . chain ( g)
232214 . chain ( h)
233- . chain ( x_sq. iter ( ) . cloned ( ) )
234- . chain ( x_inv_sq. iter ( ) . cloned ( ) ) ,
235- iter:: once ( & A )
236- . chain ( iter:: once ( & S ) )
237- . chain ( value_commitments. iter ( ) )
238- . chain ( iter:: once ( & T_1 ) )
239- . chain ( iter:: once ( & T_2 ) )
240- . chain ( iter:: once ( & gens. pedersen_generators . B_blinding ) )
241- . chain ( iter:: once ( & gens. pedersen_generators . B ) )
242- . chain ( gens. G . iter ( ) )
243- . chain ( gens. H . iter ( ) )
244- . chain ( Ls . iter ( ) )
245- . chain ( Rs . iter ( ) ) ,
246- ) ;
215+ . chain ( value_commitment_scalars) ,
216+ iter:: once ( self . A . decompress ( ) )
217+ . chain ( iter:: once ( self . S . decompress ( ) ) )
218+ . chain ( iter:: once ( self . T_1 . decompress ( ) ) )
219+ . chain ( iter:: once ( self . T_2 . decompress ( ) ) )
220+ . chain ( self . ipp_proof . L_vec . iter ( ) . map ( |L | L . decompress ( ) ) )
221+ . chain ( self . ipp_proof . R_vec . iter ( ) . map ( |R | R . decompress ( ) ) )
222+ . chain ( iter:: once ( Some ( gens. pedersen_generators . B_blinding ) ) )
223+ . chain ( iter:: once ( Some ( gens. pedersen_generators . B ) ) )
224+ . chain ( gens. G . iter ( ) . map ( |& x| Some ( x) ) )
225+ . chain ( gens. H . iter ( ) . map ( |& x| Some ( x) ) )
226+ . chain ( value_commitments. iter ( ) . map ( |& x| Some ( x) ) ) ,
227+ ) . ok_or_else ( || ProofError :: VerificationError ) ?;
247228
248229 if mega_check. is_identity ( ) {
249230 Ok ( ( ) )
0 commit comments