plonky2/src/fri/mod.rs
Daniel Lubarov b922def48e
Better errors for insufficient (routed) wires for FRI (#288)
For examlpe, if I change a test to use `ConstantArityBits(4, 5)`, I get

    To efficiently perform FRI checks with an arity of 16, at least 152 wires are needed. Consider reducing arity.
2021-10-05 23:28:04 -07:00

44 lines
1.3 KiB
Rust

use crate::fri::reduction_strategies::FriReductionStrategy;
pub mod commitment;
pub mod proof;
pub mod prover;
pub mod recursive_verifier;
pub mod reduction_strategies;
pub mod verifier;
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct FriConfig {
pub proof_of_work_bits: u32,
pub reduction_strategy: FriReductionStrategy,
/// Number of query rounds to perform.
pub num_query_rounds: usize,
}
/// Parameters which are generated during preprocessing, in contrast to `FriConfig` which is
/// user-specified.
#[derive(Debug)]
pub(crate) struct FriParams {
/// The arity of each FRI reduction step, expressed as the log2 of the actual arity.
/// For example, `[3, 2, 1]` would describe a FRI reduction tree with 8-to-1 reduction, then
/// a 4-to-1 reduction, then a 2-to-1 reduction. After these reductions, the reduced polynomial
/// is sent directly.
pub reduction_arity_bits: Vec<usize>,
}
impl FriParams {
pub(crate) fn total_arities(&self) -> usize {
self.reduction_arity_bits.iter().sum()
}
pub(crate) fn max_arity_bits(&self) -> Option<usize> {
self.reduction_arity_bits.iter().copied().max()
}
pub(crate) fn max_arity(&self) -> Option<usize> {
self.max_arity_bits().map(|bits| 1 << bits)
}
}