Skip to content

Commit

Permalink
cherry-pick pse pr#29 to let quotient has same number of chunk as it …
Browse files Browse the repository at this point in the history
…in prover (#34)
  • Loading branch information
kunxian-xia committed Apr 22, 2024
1 parent 114cea6 commit a769973
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion snark-verifier/src/system/halo2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ struct Polynomials<'a, F: PrimeField> {
cs: &'a ConstraintSystem<F>,
zk: bool,
query_instance: bool,
degree: usize,
num_proof: usize,
num_fixed: usize,
num_permutation_fixed: usize,
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(
Expand Down
5 changes: 4 additions & 1 deletion snark-verifier/src/util/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,16 @@ where

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct QuotientPolynomial<F: Clone> {
// 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<F>,
}

impl<F: Clone> QuotientPolynomial<F> {
pub fn num_chunk(&self) -> usize {
Integer::div_ceil(&(self.numerator.degree() - 1), &self.chunk_degree)
self.num_chunk
}
}

Expand Down

0 comments on commit a769973

Please sign in to comment.