Skip to content

Commit

Permalink
feat: move truncation out of "EvaluationDomain::extended_to_coeff"
Browse files Browse the repository at this point in the history
  • Loading branch information
guorong009 committed Oct 16, 2024
1 parent 2d0029b commit b43497b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 6 additions & 1 deletion halo2_backend/src/plonk/vanishing/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ impl<C: CurveAffine> Committed<C> {
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
Expand Down
7 changes: 0 additions & 7 deletions halo2_backend/src/poly/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ impl<F: WithSmallOrderMulGroup<3>> EvaluationDomain<F> {
///
/// 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<F, ExtendedLagrangeCoeff>) -> Vec<F> {
assert_eq!(a.values.len(), self.extended_len());

Expand All @@ -344,12 +343,6 @@ impl<F: WithSmallOrderMulGroup<3>> EvaluationDomain<F> {
// 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
}

Expand Down

0 comments on commit b43497b

Please sign in to comment.