Minor improvements to multiopen.

This commit is contained in:
Sean Bowe 2020-10-15 17:16:44 -06:00
parent 9d572c181d
commit 1e9f7f37c6
No known key found for this signature in database
GPG key ID: 95684257D8F8B031
2 changed files with 67 additions and 54 deletions

View file

@ -224,61 +224,74 @@ mod tests {
Fp::random(), Fp::random(),
]; ];
let queries = vec![ let build_queries = || {
MyQuery { vec![
commitment: 0, MyQuery {
point: points[0], commitment: 0,
eval: Fp::random(), point: points[0],
}, eval: Fp::random(),
MyQuery { },
commitment: 0, MyQuery {
point: points[1], commitment: 0,
eval: Fp::random(), point: points[1],
}, eval: Fp::random(),
MyQuery { },
commitment: 1, MyQuery {
point: points[0], commitment: 1,
eval: Fp::random(), point: points[0],
}, eval: Fp::random(),
MyQuery { },
commitment: 1, MyQuery {
point: points[1], commitment: 1,
eval: Fp::random(), point: points[1],
}, eval: Fp::random(),
MyQuery { },
commitment: 2, MyQuery {
point: points[0], commitment: 2,
eval: Fp::random(), point: points[0],
}, eval: Fp::random(),
MyQuery { },
commitment: 2, MyQuery {
point: points[1], commitment: 2,
eval: Fp::random(), point: points[1],
}, eval: Fp::random(),
MyQuery { },
commitment: 2, MyQuery {
point: points[2], commitment: 2,
eval: Fp::random(), point: points[2],
}, eval: Fp::random(),
MyQuery { },
commitment: 3, MyQuery {
point: points[0], commitment: 3,
eval: Fp::random(), point: points[0],
}, eval: Fp::random(),
MyQuery { },
commitment: 3, MyQuery {
point: points[3], commitment: 3,
eval: Fp::random(), point: points[3],
}, eval: Fp::random(),
MyQuery { },
commitment: 4, MyQuery {
point: points[4], commitment: 4,
eval: Fp::random(), point: points[4],
}, eval: Fp::random(),
]; },
]
};
let queries = build_queries();
let (commitment_data, point_sets) = construct_intermediate_sets(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 = false;
let mut a_set = 0; let mut a_set = 0;
let mut b = false; let mut b = false;

View file

@ -102,9 +102,9 @@ impl<C: CurveAffine> Proof<C> {
} else { } else {
f_poly.map(|f_poly| f_poly * x_5 + &poly) 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_blind = Blind(C::Scalar::random());
let mut f_commitment = params.commit(&f_poly, f_blind).to_affine(); let mut f_commitment = params.commit(&f_poly, f_blind).to_affine();