Add quotient_degree_factor function

This commit is contained in:
wborgeaud 2022-02-04 20:24:58 +01:00
parent 9c6b2394f1
commit fc502add01
3 changed files with 9 additions and 4 deletions

View File

@ -82,7 +82,7 @@ where
.flat_map(|mut quotient_poly| {
quotient_poly.trim();
quotient_poly
.pad(degree * (stark.constraint_degree() - 1))
.pad(degree * stark.quotient_degree_factor())
.expect("Quotient has failed, the vanishing polynomial is not divisible by `Z_H");
// Split quotient into degree-n chunks.
quotient_poly.chunks(degree)
@ -162,7 +162,7 @@ where
{
let degree = 1 << degree_bits;
let max_degree_bits = log2_ceil(stark.constraint_degree() - 1);
let max_degree_bits = log2_ceil(stark.quotient_degree_factor());
assert!(
max_degree_bits <= rate_bits,
"Having constraints of degree higher than the rate is not supported yet."

View File

@ -65,6 +65,11 @@ pub trait Stark<F: RichField + Extendable<D>, const D: usize>: Sync {
/// The maximum constraint degree.
fn constraint_degree(&self) -> usize;
/// The maximum constraint degree.
fn quotient_degree_factor(&self) -> usize {
1.max(self.constraint_degree() - 1)
}
/// Computes the FRI instance used to prove this Stark.
// TODO: Permutation polynomials.
fn fri_instance(
@ -77,7 +82,7 @@ pub trait Stark<F: RichField + Extendable<D>, const D: usize>: Sync {
let no_blinding_oracle = FriOracleInfo { blinding: false };
let trace_info = FriPolynomialInfo::from_range(0, 0..Self::COLUMNS);
let quotient_info =
FriPolynomialInfo::from_range(1, 0..(self.constraint_degree() - 1) * num_challenges);
FriPolynomialInfo::from_range(1, 0..self.quotient_degree_factor() * num_challenges);
let zeta_batch = FriBatchInfo {
point: zeta,
polynomials: [trace_info.clone(), quotient_info].concat(),

View File

@ -98,7 +98,7 @@ where
// So to reconstruct `t(zeta)` we can compute `reduce_with_powers(chunk, zeta^n)` for each
// `quotient_degree_factor`-sized chunk of the original evaluations.
for (i, chunk) in quotient_polys_zeta
.chunks(stark.constraint_degree() - 1)
.chunks(stark.quotient_degree_factor())
.enumerate()
{
ensure!(vanishing_polys_zeta[i] == z_h_zeta * reduce_with_powers(chunk, zeta_pow_deg));