From 6577f2ed2e6ecd5f950074ecf0b3fa95bac44b01 Mon Sep 17 00:00:00 2001 From: schaeff Date: Fri, 13 Sep 2024 15:21:05 +0200 Subject: [PATCH] clean --- uni-stark/src/check_constraints.rs | 4 ++-- uni-stark/src/folder.rs | 8 ++++---- uni-stark/src/prover.rs | 8 ++++---- uni-stark/src/symbolic_builder.rs | 8 ++++---- uni-stark/src/traits.rs | 8 ++++---- uni-stark/src/verifier.rs | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/uni-stark/src/check_constraints.rs b/uni-stark/src/check_constraints.rs index 9014dbc3e..6a7b48cd1 100644 --- a/uni-stark/src/check_constraints.rs +++ b/uni-stark/src/check_constraints.rs @@ -151,11 +151,11 @@ impl<'a, F: Field> MultistageAirBuilder for DebugConstraintBuilder<'a, F> { self.public_values[stage] } - fn multi_stage(&self, stage: usize) -> Self::M { + fn stage_trace(&self, stage: usize) -> Self::M { self.stages[stage] } - fn challenges(&self, stage: usize) -> &[Self::Expr] { + fn stage_challenges(&self, stage: usize) -> &[Self::Expr] { self.challenges[stage] } } diff --git a/uni-stark/src/folder.rs b/uni-stark/src/folder.rs index 1d353251b..307337922 100644 --- a/uni-stark/src/folder.rs +++ b/uni-stark/src/folder.rs @@ -80,11 +80,11 @@ impl<'a, SC: StarkGenericConfig> AirBuilderWithPublicValues for ProverConstraint impl<'a, SC: StarkGenericConfig> MultistageAirBuilder for ProverConstraintFolder<'a, SC> { type Challenge = Val; - fn multi_stage(&self, stage: usize) -> ::M { + fn stage_trace(&self, stage: usize) -> ::M { self.stages[stage].clone() } - fn challenges(&self, stage: usize) -> &[Self::Challenge] { + fn stage_challenges(&self, stage: usize) -> &[Self::Challenge] { &self.challenges[stage] } fn stage_public_values(&self, stage: usize) -> &[Self::PublicVar] { @@ -142,11 +142,11 @@ impl<'a, SC: StarkGenericConfig> AirBuilderWithPublicValues for VerifierConstrai impl<'a, SC: StarkGenericConfig> MultistageAirBuilder for VerifierConstraintFolder<'a, SC> { type Challenge = Val; - fn multi_stage(&self, stage: usize) -> ::M { + fn stage_trace(&self, stage: usize) -> ::M { self.stages[stage] } - fn challenges(&self, stage: usize) -> &[Self::Challenge] { + fn stage_challenges(&self, stage: usize) -> &[Self::Challenge] { &self.challenges[stage] } fn stage_public_values(&self, stage: usize) -> &[Self::PublicVar] { diff --git a/uni-stark/src/prover.rs b/uni-stark/src/prover.rs index b4e0bc64e..255a32fa5 100644 --- a/uni-stark/src/prover.rs +++ b/uni-stark/src/prover.rs @@ -17,7 +17,8 @@ use tracing::{info_span, instrument}; use crate::symbolic_builder::{get_log_quotient_degree, SymbolicAirBuilder}; use crate::traits::MultiStageAir; use crate::{ - Commitments, Domain, OpenedValues, PackedChallenge, PackedVal, ProcessedStage, Proof, ProverConstraintFolder, StarkGenericConfig, StarkProvingKey, Val + Commitments, Domain, OpenedValues, PackedChallenge, PackedVal, ProcessedStage, Proof, + ProverConstraintFolder, StarkGenericConfig, StarkProvingKey, Val, }; struct UnusedCallback; @@ -102,7 +103,7 @@ where let mut state: ProverState = ProverState::new(pcs, trace_domain, challenger); let mut stage = Stage { trace: stage_0_trace, - challenge_count: >>::challenge_count(air, 0), + challenge_count: >>::stage_challenge_count(air, 0), public_values: stage_0_public_values.to_owned(), }; @@ -122,7 +123,7 @@ where // go to the next stage stage = Stage { trace, - challenge_count: >>::challenge_count( + challenge_count: >>::stage_challenge_count( air, stage_id as u32, ), @@ -407,7 +408,6 @@ where .collect() } -/// Updating with each new trace in every stage pub struct ProverState<'a, SC: StarkGenericConfig> { pub(crate) processed_stages: Vec>, pub(crate) challenger: &'a mut SC::Challenger, diff --git a/uni-stark/src/symbolic_builder.rs b/uni-stark/src/symbolic_builder.rs index 1f11c746a..767ad1961 100644 --- a/uni-stark/src/symbolic_builder.rs +++ b/uni-stark/src/symbolic_builder.rs @@ -50,10 +50,10 @@ where A: MultiStageAir>, { let widths: Vec<_> = (0..air.stage_count()) - .map(|i| air.multi_stage_width(i as u32)) + .map(|i| air.stage_width(i as u32)) .collect(); let challenges: Vec<_> = (0..air.stage_count()) - .map(|i| air.challenge_count(i as u32)) + .map(|i| air.stage_challenge_count(i as u32)) .collect(); let mut builder = SymbolicAirBuilder::new( air.preprocessed_width(), @@ -188,11 +188,11 @@ impl MultistageAirBuilder for SymbolicAirBuilder { &self.public_values[stage] } - fn multi_stage(&self, stage: usize) -> Self::M { + fn stage_trace(&self, stage: usize) -> Self::M { self.stages[stage].clone() } - fn challenges(&self, stage: usize) -> &[Self::Challenge] { + fn stage_challenges(&self, stage: usize) -> &[Self::Challenge] { &self.challenges[stage] } } diff --git a/uni-stark/src/traits.rs b/uni-stark/src/traits.rs index 724dc182d..8314b0ceb 100644 --- a/uni-stark/src/traits.rs +++ b/uni-stark/src/traits.rs @@ -4,10 +4,10 @@ pub trait MultistageAirBuilder: AirBuilderWithPublicValues { type Challenge: Clone + Into; /// Traces from each stage. - fn multi_stage(&self, stage: usize) -> Self::M; + fn stage_trace(&self, stage: usize) -> Self::M; /// Challenges from each stage, drawn from the base field - fn challenges(&self, stage: usize) -> &[Self::Challenge]; + fn stage_challenges(&self, stage: usize) -> &[Self::Challenge]; fn stage_public_values(&self, stage: usize) -> &[Self::PublicVar] { match stage { @@ -23,7 +23,7 @@ pub trait MultiStageAir: Air { } /// The number of columns in a given higher-stage trace. - fn multi_stage_width(&self, stage: u32) -> usize { + fn stage_width(&self, stage: u32) -> usize { match stage { 0 => self.width(), _ => unimplemented!(), @@ -31,7 +31,7 @@ pub trait MultiStageAir: Air { } /// The number of challenges produced at the end of each stage - fn challenge_count(&self, _stage: u32) -> usize { + fn stage_challenge_count(&self, _stage: u32) -> usize { 0 } } diff --git a/uni-stark/src/verifier.rs b/uni-stark/src/verifier.rs index 41aea03db..420fd3a8d 100644 --- a/uni-stark/src/verifier.rs +++ b/uni-stark/src/verifier.rs @@ -74,7 +74,7 @@ where let air_widths = (0..stages) .map(|stage| { - >>>::multi_stage_width(air, stage as u32) + >>>::stage_width(air, stage as u32) }) .collect::>(); let air_fixed_width = >>::preprocessed_width(air);