From feb67fe1422a111b43ce56552ab38b36c39ce798 Mon Sep 17 00:00:00 2001 From: Alon Haramati <91828241+alonh5@users.noreply.github.com> Date: Mon, 4 Mar 2024 10:39:34 +0200 Subject: [PATCH] Pass log blowup factor to commitment scheme. (#423) --- src/core/commitment_scheme.rs | 7 +++++-- src/fibonacci/mod.rs | 10 +++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/core/commitment_scheme.rs b/src/core/commitment_scheme.rs index d94042dfc..c50c9888a 100644 --- a/src/core/commitment_scheme.rs +++ b/src/core/commitment_scheme.rs @@ -24,10 +24,13 @@ pub struct CommitmentSchemeProver> { impl> CommitmentSchemeProver { pub fn new( polynomials: Vec>, - domains: Vec, + log_blowup_factor: u32, channel: &mut Blake2sChannel, ) -> Self { - assert_eq!(polynomials.len(), domains.len(),); + let domains = polynomials + .iter() + .map(|poly| CanonicCoset::new(poly.log_size() + log_blowup_factor)) + .collect_vec(); let evaluations = zip(&polynomials, domains) .map(|(poly, domain)| poly.evaluate(domain.circle_domain()).bit_reverse()) .collect_vec(); diff --git a/src/fibonacci/mod.rs b/src/fibonacci/mod.rs index cbc6a6c98..35fcca922 100644 --- a/src/fibonacci/mod.rs +++ b/src/fibonacci/mod.rs @@ -7,7 +7,6 @@ use self::component::FibonacciComponent; use crate::commitment_scheme::blake2_hash::Blake2sHasher; use crate::commitment_scheme::hasher::Hasher; use crate::commitment_scheme::merkle_decommitment::MerkleDecommitment; -use crate::core::air::evaluation::SECURE_EXTENSION_DEGREE; use crate::core::air::{AirExt, ComponentTrace}; use crate::core::backend::CPUBackend; use crate::core::channel::{Blake2sChannel, Channel as ChannelTrait}; @@ -103,11 +102,8 @@ impl Fibonacci { // Evaluate and commit on trace. let trace = self.get_trace(); let trace_poly = trace.interpolate(); - let trace_commitment_scheme = CommitmentSchemeProver::new( - vec![trace_poly], - vec![self.trace_commitment_domain], - channel, - ); + let trace_commitment_scheme = + CommitmentSchemeProver::new(vec![trace_poly], LOG_BLOWUP_FACTOR, channel); // Evaluate and commit on composition polynomial. let random_coeff = channel.draw_felt(); @@ -118,7 +114,7 @@ impl Fibonacci { .compute_composition_polynomial(random_coeff, &component_traces); let composition_polynomial_commitment_scheme = CommitmentSchemeProver::new( composition_polynomial_poly.to_vec(), - [self.composition_polynomial_commitment_domain; SECURE_EXTENSION_DEGREE].to_vec(), + LOG_BLOWUP_FACTOR, channel, );