diff --git a/src/poly/multiopen.rs b/src/poly/multiopen.rs index 77a2502f..c6280175 100644 --- a/src/poly/multiopen.rs +++ b/src/poly/multiopen.rs @@ -224,61 +224,74 @@ mod tests { Fp::random(), ]; - let queries = vec![ - MyQuery { - commitment: 0, - point: points[0], - eval: Fp::random(), - }, - MyQuery { - commitment: 0, - point: points[1], - eval: Fp::random(), - }, - MyQuery { - commitment: 1, - point: points[0], - eval: Fp::random(), - }, - MyQuery { - commitment: 1, - point: points[1], - eval: Fp::random(), - }, - MyQuery { - commitment: 2, - point: points[0], - eval: Fp::random(), - }, - MyQuery { - commitment: 2, - point: points[1], - eval: Fp::random(), - }, - MyQuery { - commitment: 2, - point: points[2], - eval: Fp::random(), - }, - MyQuery { - commitment: 3, - point: points[0], - eval: Fp::random(), - }, - MyQuery { - commitment: 3, - point: points[3], - eval: Fp::random(), - }, - MyQuery { - commitment: 4, - point: points[4], - eval: Fp::random(), - }, - ]; + let build_queries = || { + vec![ + MyQuery { + commitment: 0, + point: points[0], + eval: Fp::random(), + }, + MyQuery { + commitment: 0, + point: points[1], + eval: Fp::random(), + }, + MyQuery { + commitment: 1, + point: points[0], + eval: Fp::random(), + }, + MyQuery { + commitment: 1, + point: points[1], + eval: Fp::random(), + }, + MyQuery { + commitment: 2, + point: points[0], + eval: Fp::random(), + }, + MyQuery { + commitment: 2, + point: points[1], + eval: Fp::random(), + }, + MyQuery { + commitment: 2, + point: points[2], + eval: Fp::random(), + }, + MyQuery { + commitment: 3, + point: points[0], + eval: Fp::random(), + }, + MyQuery { + commitment: 3, + point: points[3], + eval: Fp::random(), + }, + MyQuery { + commitment: 4, + point: points[4], + eval: Fp::random(), + }, + ] + }; + + let queries = build_queries(); let (commitment_data, point_sets) = construct_intermediate_sets(queries); + // It shouldn't matter what the point or eval values are; we should get + // the same exact point sets again. + { + let new_queries = build_queries(); + let (_, new_point_sets) = construct_intermediate_sets(new_queries); + + assert_eq!(point_sets, new_point_sets); + } + let mut a = false; let mut a_set = 0; let mut b = false; diff --git a/src/poly/multiopen/prover.rs b/src/poly/multiopen/prover.rs index 124c6307..2e5a9676 100644 --- a/src/poly/multiopen/prover.rs +++ b/src/poly/multiopen/prover.rs @@ -102,9 +102,9 @@ impl Proof { } else { f_poly.map(|f_poly| f_poly * x_5 + &poly) } - }); + }) + .unwrap(); - let f_poly = f_poly.unwrap(); let mut f_blind = Blind(C::Scalar::random()); let mut f_commitment = params.commit(&f_poly, f_blind).to_affine();