diff --git a/snark-verifier/src/system/halo2.rs b/snark-verifier/src/system/halo2.rs index 4555b647..b83d14e2 100644 --- a/snark-verifier/src/system/halo2.rs +++ b/snark-verifier/src/system/halo2.rs @@ -178,6 +178,7 @@ struct Polynomials<'a, F: PrimeField> { cs: &'a ConstraintSystem, zk: bool, query_instance: bool, + degree: usize, num_proof: usize, num_fixed: usize, num_permutation_fixed: usize, @@ -234,6 +235,7 @@ impl<'a, F: PrimeField> Polynomials<'a, F> { cs, zk, query_instance, + degree, num_proof, num_fixed: cs.num_fixed_columns(), num_permutation_fixed: cs.permutation().get_columns().len(), @@ -653,7 +655,7 @@ impl<'a, F: PrimeField> Polynomials<'a, F> { }) .collect_vec(); let numerator = Expression::DistributePowers(constraints, self.alpha().into()); - QuotientPolynomial { chunk_degree: 1, numerator } + QuotientPolynomial { num_chunk: self.degree - 1, chunk_degree: 1, numerator } } fn accumulator_indices( diff --git a/snark-verifier/src/util/protocol.rs b/snark-verifier/src/util/protocol.rs index 31ea253b..f1a880e2 100644 --- a/snark-verifier/src/util/protocol.rs +++ b/snark-verifier/src/util/protocol.rs @@ -146,13 +146,16 @@ where #[derive(Clone, Debug, Serialize, Deserialize)] pub struct QuotientPolynomial { + // Note that `num_chunk` might be larger than necessary, due to the degree of + // constraint system (in the form of 2^k + 1) + pub num_chunk: usize, pub chunk_degree: usize, pub numerator: Expression, } impl QuotientPolynomial { pub fn num_chunk(&self) -> usize { - Integer::div_ceil(&(self.numerator.degree() - 1), &self.chunk_degree) + self.num_chunk } }