File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -226,10 +226,13 @@ pub fn test_range<G: PrimeGroup, R: RngCore>(
226226 // `var_C` is a Pedersen commitment to `var_x`.
227227 let var_C = instance. allocate_eq ( var_x * var_G + var_r * var_H) ;
228228 // `var_x` = sum(bases[i] * var_b[i])
229+ // This equation is "trivial", in that it does not contain any scalar var.
230+ // Our linear relation is smart enough to check this outside of the proof,
231+ // which is what a normal implementation would do.
229232 instance. append_equation (
230233 var_C,
231234 ( 0 ..BITS )
232- . map ( |i| var_Ds[ i] * vars_b [ i ] * bases[ i] )
235+ . map ( |i| var_Ds[ i] * bases[ i] )
233236 . sum :: < Sum < _ > > ( ) ,
234237 ) ;
235238
@@ -253,11 +256,10 @@ pub fn test_range<G: PrimeGroup, R: RngCore>(
253256 let mut s = ( 0 ..BITS )
254257 . map ( |_| G :: Scalar :: random ( & mut rng) )
255258 . collect :: < Vec < _ > > ( ) ;
256- let partial_sum = ( 0 ..BITS - 1 )
257- . map ( |i| b [ i ] * bases[ i] * s[ i] )
259+ let partial_sum = ( 1 ..BITS )
260+ . map ( |i| bases[ i] * s[ i] )
258261 . sum :: < G :: Scalar > ( ) ;
259- s[ BITS - 1 ] = r - partial_sum;
260- s[ BITS - 1 ] *= ( b[ BITS - 1 ] * bases[ BITS - 1 ] ) . invert ( ) . unwrap ( ) ;
262+ s[ 0 ] = r - partial_sum;
261263 let s2 = ( 0 ..BITS )
262264 . map ( |i| ( G :: Scalar :: ONE - b[ i] ) * s[ i] )
263265 . collect :: < Vec < _ > > ( ) ;
You can’t perform that action at this time.
0 commit comments