mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-05-22 09:49:26 +00:00
Add quotient_degree_factor function
This commit is contained in:
parent
9c6b2394f1
commit
fc502add01
@ -82,7 +82,7 @@ where
|
|||||||
.flat_map(|mut quotient_poly| {
|
.flat_map(|mut quotient_poly| {
|
||||||
quotient_poly.trim();
|
quotient_poly.trim();
|
||||||
quotient_poly
|
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");
|
.expect("Quotient has failed, the vanishing polynomial is not divisible by `Z_H");
|
||||||
// Split quotient into degree-n chunks.
|
// Split quotient into degree-n chunks.
|
||||||
quotient_poly.chunks(degree)
|
quotient_poly.chunks(degree)
|
||||||
@ -162,7 +162,7 @@ where
|
|||||||
{
|
{
|
||||||
let degree = 1 << degree_bits;
|
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!(
|
assert!(
|
||||||
max_degree_bits <= rate_bits,
|
max_degree_bits <= rate_bits,
|
||||||
"Having constraints of degree higher than the rate is not supported yet."
|
"Having constraints of degree higher than the rate is not supported yet."
|
||||||
|
|||||||
@ -65,6 +65,11 @@ pub trait Stark<F: RichField + Extendable<D>, const D: usize>: Sync {
|
|||||||
/// The maximum constraint degree.
|
/// The maximum constraint degree.
|
||||||
fn constraint_degree(&self) -> usize;
|
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.
|
/// Computes the FRI instance used to prove this Stark.
|
||||||
// TODO: Permutation polynomials.
|
// TODO: Permutation polynomials.
|
||||||
fn fri_instance(
|
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 no_blinding_oracle = FriOracleInfo { blinding: false };
|
||||||
let trace_info = FriPolynomialInfo::from_range(0, 0..Self::COLUMNS);
|
let trace_info = FriPolynomialInfo::from_range(0, 0..Self::COLUMNS);
|
||||||
let quotient_info =
|
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 {
|
let zeta_batch = FriBatchInfo {
|
||||||
point: zeta,
|
point: zeta,
|
||||||
polynomials: [trace_info.clone(), quotient_info].concat(),
|
polynomials: [trace_info.clone(), quotient_info].concat(),
|
||||||
|
|||||||
@ -98,7 +98,7 @@ where
|
|||||||
// So to reconstruct `t(zeta)` we can compute `reduce_with_powers(chunk, zeta^n)` for each
|
// 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.
|
// `quotient_degree_factor`-sized chunk of the original evaluations.
|
||||||
for (i, chunk) in quotient_polys_zeta
|
for (i, chunk) in quotient_polys_zeta
|
||||||
.chunks(stark.constraint_degree() - 1)
|
.chunks(stark.quotient_degree_factor())
|
||||||
.enumerate()
|
.enumerate()
|
||||||
{
|
{
|
||||||
ensure!(vanishing_polys_zeta[i] == z_h_zeta * reduce_with_powers(chunk, zeta_pow_deg));
|
ensure!(vanishing_polys_zeta[i] == z_h_zeta * reduce_with_powers(chunk, zeta_pow_deg));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user