Check h_evals/h_commitments lengths in vanishing argument verifier.

This commit is contained in:
Sean Bowe 2020-12-22 08:38:22 -07:00
parent bd73089123
commit 65ed1d8568
No known key found for this signature in database
GPG key ID: 95684257D8F8B031
3 changed files with 14 additions and 3 deletions

View file

@ -9,10 +9,14 @@ use crate::{
};
impl<C: CurveAffine> Proof<C> {
pub(in crate::plonk) fn check_lengths(&self, _vk: &VerifyingKey<C>) -> Result<(), Error> {
// TODO: check h_evals
pub(in crate::plonk) fn check_lengths(&self, vk: &VerifyingKey<C>) -> Result<(), Error> {
if self.h_commitments.len() != self.h_evals.len() {
return Err(Error::IncompatibleParams);
}
// TODO: check h_commitments
if self.h_commitments.len() != vk.domain.get_quotient_poly_degree() {
return Err(Error::IncompatibleParams);
}
Ok(())
}

View file

@ -182,6 +182,8 @@ impl<'a, C: CurveAffine> Proof<C> {
.map(|p| p.check_lengths(vk))
.transpose()?;
self.vanishing.check_lengths(vk)?;
if self.lookups.len() != vk.cs.lookups.len() {
return Err(Error::IncompatibleParams);
}

View file

@ -382,4 +382,9 @@ impl<G: Group> EvaluationDomain<G> {
pub fn get_barycentric_weight(&self) -> G::Scalar {
self.barycentric_weight
}
/// Gets the quotient polynomial's degree (as a multiple of n)
pub fn get_quotient_poly_degree(&self) -> usize {
self.quotient_poly_degree as usize
}
}