Skip to content

Commit

Permalink
FRI in Commitment Scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
spapinistarkware committed Mar 15, 2024
1 parent a265fbb commit 7ece89b
Show file tree
Hide file tree
Showing 10 changed files with 625 additions and 435 deletions.
33 changes: 12 additions & 21 deletions src/core/air/component_visitors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use crate::core::circle::CirclePoint;
use crate::core::fields::qm31::SecureField;
use crate::core::fri::CirclePolyDegreeBound;
use crate::core::poly::circle::{CanonicCoset, CirclePoly, SecureCirclePoly};
use crate::core::prover::LOG_BLOWUP_FACTOR;
use crate::core::{ColumnVec, ComponentVec};

pub trait AirExt: Air<CPUBackend> {
Expand Down Expand Up @@ -84,16 +83,16 @@ pub trait AirExt: Air<CPUBackend> {
fn visit<C: Component<B>>(&mut self, component: &C) {
let trace = self.component_traces.next().unwrap();
let (points, values) = component.mask_points_and_values(self.point, trace);
self.component_points.push(points);
self.component_values.push(values);
self.component_points.0.push(points);
self.component_values.0.push(values);
}
}

let mut visitor = MaskEvaluator::<CPUBackend> {
point,
component_traces: component_traces.iter(),
component_points: Vec::new(),
component_values: Vec::new(),
component_points: Default::default(),
component_values: Default::default(),
};
self.visit_components(&mut visitor);
(visitor.component_points, visitor.component_values)
Expand All @@ -116,13 +115,14 @@ pub trait AirExt: Air<CPUBackend> {
.map(|&log_size| CanonicCoset::new(log_size))
.collect_vec();
self.points
.0
.push(component.mask().to_points(&domains, self.point));
}
}

let mut visitor = MaskPointsEvaluator {
point,
points: Vec::new(),
points: Default::default(),
};
self.visit_components(&mut visitor);
visitor.points
Expand Down Expand Up @@ -155,7 +155,7 @@ pub trait AirExt: Air<CPUBackend> {
let mut evaluator = {
ConstraintPointEvaluator {
point,
mask_values: mask_values.iter(),
mask_values: mask_values.0.iter(),
evaluation_accumulator: PointEvaluationAccumulator::new(
random_coeff,
self.max_constraint_log_degree_bound(),
Expand Down Expand Up @@ -203,31 +203,22 @@ pub trait AirExt: Air<CPUBackend> {
}

/// Returns the log degree bounds of the quotient polynomials in descending order.
fn commitment_domains(&self) -> Vec<CanonicCoset> {
fn column_log_sizes(&self) -> Vec<u32> {
struct DomainsVisitor {
domains: Vec<CanonicCoset>,
log_sizes: Vec<u32>,
}

impl<B: Backend> ComponentVisitor<B> for DomainsVisitor {
fn visit<C: Component<B>>(&mut self, component: &C) {
self.domains.extend(
component
.trace_log_degree_bounds()
.iter()
.map(|&log_size| CanonicCoset::new(log_size + LOG_BLOWUP_FACTOR)),
);
self.log_sizes.extend(component.trace_log_degree_bounds());
}
}

let mut domains_visitor = DomainsVisitor {
domains: Vec::new(),
log_sizes: Vec::new(),
};
self.visit_components(&mut domains_visitor);
// Add the composition polynomial's domain.
domains_visitor.domains.push(CanonicCoset::new(
self.max_constraint_log_degree_bound() + LOG_BLOWUP_FACTOR,
));
domains_visitor.domains
domains_visitor.log_sizes
}

fn component_traces<'a>(
Expand Down
190 changes: 0 additions & 190 deletions src/core/commitment_scheme.rs

This file was deleted.

Loading

0 comments on commit 7ece89b

Please sign in to comment.