Minor improvements

This commit is contained in:
wborgeaud 2021-07-02 10:58:59 +02:00
parent d456efbc3f
commit 1915ef9b27
5 changed files with 18 additions and 19 deletions

View File

@ -206,12 +206,12 @@ impl<F: Extendable<D>, const D: usize> CommonCircuitData<F, D> {
self.num_constants..self.num_constants + self.config.num_routed_wires
}
/// Range of the `z`s polynomials in the ``.
/// Range of the `z`s polynomials in the `zs_partial_products_commitment`.
pub fn zs_range(&self) -> Range<usize> {
0..self.config.num_challenges
}
/// Range of the sigma polynomials in the `constants_sigmas_commitment`.
/// Range of the partial products polynomials in the `zs_partial_products_commitment`.
pub fn partial_products_range(&self) -> RangeFrom<usize> {
self.config.num_challenges..
}

View File

@ -446,9 +446,7 @@ mod tests {
type FF = QuarticCrandallField;
const D: usize = 4;
let mut config = CircuitConfig::large_config();
config.rate_bits = 2;
config.fri_config.rate_bits = 2;
let config = CircuitConfig::large_config();
let mut builder = CircuitBuilder::<F, D>::new(config);

View File

@ -1,6 +1,5 @@
use std::time::Instant;
use itertools::Itertools;
use log::info;
use rayon::prelude::*;
@ -80,6 +79,10 @@ pub(crate) fn prove<F: Extendable<D>, const D: usize>(
let betas = challenger.get_n_challenges(num_challenges);
let gammas = challenger.get_n_challenges(num_challenges);
assert!(
common_data.max_filtered_constraint_degree<=common_data.config.num_routed_wires,
"When the number of routed wires is smaller that the degree, we should change the logic to avoid computing partial products."
);
let mut partial_products = timed!(
all_wires_permutation_partial_products(&witness, &betas, &gammas, prover_data, common_data),
"to compute partial products"
@ -214,7 +217,7 @@ fn wires_permutation_partial_products<F: Extendable<D>, const D: usize>(
let subgroup = &prover_data.subgroup;
let k_is = &common_data.k_is;
let values = subgroup
.iter()
.par_iter()
.enumerate()
.map(|(i, &x)| {
let s_sigmas = &prover_data.sigmas[i];
@ -329,8 +332,7 @@ fn compute_quotient_polys<'a, F: Extendable<D>, const D: usize>(
ZeroPolyOnCoset::new(common_data.degree_bits, max_filtered_constraint_degree_bits);
let quotient_values: Vec<Vec<F>> = points
// .into_par_iter()
.into_iter()
.into_par_iter()
.enumerate()
.map(|(i, x)| {
let shifted_x = F::coset_shift() * x;
@ -352,7 +354,6 @@ fn compute_quotient_polys<'a, F: Extendable<D>, const D: usize>(
local_constants,
local_wires,
};
dbg!(i);
let mut quotient_values = eval_vanishing_poly_base(
common_data,
i,

View File

@ -3,9 +3,9 @@ use std::ops::Sub;
use crate::util::ceil_div_usize;
/// Compute partial products of the original vector `v` such that no products are of `max_degree` or
/// less elements. This is done until we've computed the product `P` of all elements in the vector.
/// The final product resulting in `P` has `max_degree-1` elements at most since `P` is multiplied
/// Compute partial products of the original vector `v` such that all products consist of `max_degree`
/// or less elements. This is done until we've computed the product `P` of all elements in the vector.
/// The final product resulting in `P` consists of at most `max_degree-1` elements since `P` is multiplied
/// by the `Z` polynomial in the Plonk check.
pub fn partial_products<T: Product + Copy>(v: &[T], max_degree: usize) -> Vec<T> {
let mut res = Vec::new();

View File

@ -37,19 +37,19 @@ pub(crate) fn verify<F: Extendable<D>, const D: usize>(
local_constants,
local_wires,
};
let local_plonk_zs = &proof.openings.plonk_zs;
let next_plonk_zs = &proof.openings.plonk_zs_right;
let local_zs = &proof.openings.plonk_zs;
let next_zs = &proof.openings.plonk_zs_right;
let s_sigmas = &proof.openings.plonk_s_sigmas;
let local_partial_products = &proof.openings.partial_products;
let partial_products = &proof.openings.partial_products;
// Evaluate the vanishing polynomial at our challenge point, zeta.
let vanishing_polys_zeta = eval_vanishing_poly(
common_data,
zeta,
vars,
local_plonk_zs,
next_plonk_zs,
local_partial_products,
local_zs,
next_zs,
partial_products,
s_sigmas,
&betas,
&gammas,