Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: cherry-pick pse pr#29 to let quotient has same number of chunk as it … #34

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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