diff --git a/halo2_backend/src/plonk/vanishing/prover.rs b/halo2_backend/src/plonk/vanishing/prover.rs index 96ce797ee..da56db956 100644 --- a/halo2_backend/src/plonk/vanishing/prover.rs +++ b/halo2_backend/src/plonk/vanishing/prover.rs @@ -117,7 +117,12 @@ impl Committed { let h_poly = domain.divide_by_vanishing_poly(h_poly); // Obtain final h(X) polynomial - let h_poly = domain.extended_to_coeff(h_poly); + let mut h_poly = domain.extended_to_coeff(h_poly); + + // Truncate it to match the size of the quotient polynomial; the + // evaluation domain might be slightly larger than necessary because + // it always lies on a power-of-two boundary. + h_poly.truncate(((1u64 << domain.k()) as usize) * domain.get_quotient_poly_degree()); // Split h(X) up into pieces let h_pieces = h_poly diff --git a/halo2_backend/src/poly/domain.rs b/halo2_backend/src/poly/domain.rs index 5ca352e6c..706892677 100644 --- a/halo2_backend/src/poly/domain.rs +++ b/halo2_backend/src/poly/domain.rs @@ -328,7 +328,6 @@ impl> EvaluationDomain { /// /// This function will panic if the provided vector is not the correct /// length. - // TODO/FIXME: caller should be responsible for truncating pub fn extended_to_coeff(&self, mut a: Polynomial) -> Vec { assert_eq!(a.values.len(), self.extended_len()); @@ -344,12 +343,6 @@ impl> EvaluationDomain { // transformation we performed earlier. self.distribute_powers_zeta(&mut a.values, false); - // Truncate it to match the size of the quotient polynomial; the - // evaluation domain might be slightly larger than necessary because - // it always lies on a power-of-two boundary. - a.values - .truncate((self.n * self.quotient_poly_degree) as usize); - a.values }