diff --git a/src/core/air/mod.rs b/src/core/air/mod.rs index 246e8d54a..4c67ff063 100644 --- a/src/core/air/mod.rs +++ b/src/core/air/mod.rs @@ -2,6 +2,8 @@ use core::slice; use std::iter::zip; use std::ops::Deref; +use itertools::Itertools; + use self::evaluation::{ ConstraintEvaluator, DomainEvaluationAccumulator, PointEvaluationAccumulator, }; @@ -57,6 +59,12 @@ pub trait AirExt: Air { self.visit_components(&mut visitor); visitor.finalize() } + + fn column_domains(&self) -> ComponentVec { + let mut visitor = ColumnDomainsVisitor::new(); + self.visit_components(&mut visitor); + visitor.finalize() + } } impl> AirExt for A {} @@ -122,6 +130,34 @@ impl<'a, B: Backend> ComponentVisitor for MaskEvaluator<'a, B> { } } +struct ColumnDomainsVisitor { + domains: ComponentVec, +} + +impl ColumnDomainsVisitor { + pub fn new() -> Self { + Self { + domains: Vec::new(), + } + } + + pub fn finalize(self) -> ComponentVec { + self.domains + } +} + +impl ComponentVisitor for ColumnDomainsVisitor { + fn visit>(&mut self, component: &C) { + self.domains.push( + component + .trace_log_degree_bounds() + .iter() + .map(|&log_size| CanonicCoset::new(log_size)) + .collect(), + ); + } +} + /// Holds the mask offsets at each column. /// Holds a vector with an entry for each column. Each entry holds the offsets /// of the mask at that column. @@ -130,7 +166,7 @@ pub struct Mask(pub ColumnVec>); impl Mask { pub fn to_points( &self, - domains: Vec, + domains: &[CanonicCoset], point: CirclePoint, ) -> ColumnVec>> { self.iter() @@ -188,8 +224,8 @@ pub trait Component { .columns .iter() .map(|col| CanonicCoset::new(col.log_size())) - .collect(); - let points = self.mask().to_points(domains, point); + .collect_vec(); + let points = self.mask().to_points(&domains, point); let values = zip(&points, &trace.columns) .map(|(col_points, col)| { col_points diff --git a/src/fibonacci/mod.rs b/src/fibonacci/mod.rs index 7044f314e..1d3925937 100644 --- a/src/fibonacci/mod.rs +++ b/src/fibonacci/mod.rs @@ -205,12 +205,8 @@ pub fn verify_proof(proof: FibonacciProof) -> bool { let composition_polynomial_commitment_scheme = CommitmentSchemeVerifier::new(proof.composition_polynomial_commitment, channel); let oods_point = CirclePoint::::get_random_point(channel); - let trace_domain = CanonicCoset::new(fib.air.component.log_size); - let trace_oods_points = fib - .air - .component - .mask() - .to_points(vec![trace_domain], oods_point); + let trace_domain = &fib.air.column_domains()[0]; + let trace_oods_points = fib.air.component.mask().to_points(trace_domain, oods_point); let mut evaluation_accumulator = PointEvaluationAccumulator::new(random_coeff, fib.air.max_constraint_log_degree_bound());