Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Schaeff committed Sep 13, 2024
1 parent d9a0a32 commit 6577f2e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions uni-stark/src/check_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
}
8 changes: 4 additions & 4 deletions uni-stark/src/folder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ impl<'a, SC: StarkGenericConfig> AirBuilderWithPublicValues for ProverConstraint
impl<'a, SC: StarkGenericConfig> MultistageAirBuilder for ProverConstraintFolder<'a, SC> {
type Challenge = Val<SC>;

fn multi_stage(&self, stage: usize) -> <Self as AirBuilder>::M {
fn stage_trace(&self, stage: usize) -> <Self as AirBuilder>::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] {
Expand Down Expand Up @@ -142,11 +142,11 @@ impl<'a, SC: StarkGenericConfig> AirBuilderWithPublicValues for VerifierConstrai
impl<'a, SC: StarkGenericConfig> MultistageAirBuilder for VerifierConstraintFolder<'a, SC> {
type Challenge = Val<SC>;

fn multi_stage(&self, stage: usize) -> <Self as AirBuilder>::M {
fn stage_trace(&self, stage: usize) -> <Self as AirBuilder>::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] {
Expand Down
8 changes: 4 additions & 4 deletions uni-stark/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -102,7 +103,7 @@ where
let mut state: ProverState<SC> = ProverState::new(pcs, trace_domain, challenger);
let mut stage = Stage {
trace: stage_0_trace,
challenge_count: <A as MultiStageAir<SymbolicAirBuilder<_>>>::challenge_count(air, 0),
challenge_count: <A as MultiStageAir<SymbolicAirBuilder<_>>>::stage_challenge_count(air, 0),
public_values: stage_0_public_values.to_owned(),
};

Expand All @@ -122,7 +123,7 @@ where
// go to the next stage
stage = Stage {
trace,
challenge_count: <A as MultiStageAir<SymbolicAirBuilder<_>>>::challenge_count(
challenge_count: <A as MultiStageAir<SymbolicAirBuilder<_>>>::stage_challenge_count(
air,
stage_id as u32,
),
Expand Down Expand Up @@ -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<ProcessedStage<SC>>,
pub(crate) challenger: &'a mut SC::Challenger,
Expand Down
8 changes: 4 additions & 4 deletions uni-stark/src/symbolic_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ where
A: MultiStageAir<SymbolicAirBuilder<F>>,
{
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(),
Expand Down Expand Up @@ -188,11 +188,11 @@ impl<F: Field> MultistageAirBuilder for SymbolicAirBuilder<F> {
&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]
}
}
Expand Down
8 changes: 4 additions & 4 deletions uni-stark/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ pub trait MultistageAirBuilder: AirBuilderWithPublicValues {
type Challenge: Clone + Into<Self::Expr>;

/// 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 {
Expand All @@ -23,15 +23,15 @@ pub trait MultiStageAir<AB: AirBuilder>: Air<AB> {
}

/// 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!(),
}
}

/// 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
}
}
2 changes: 1 addition & 1 deletion uni-stark/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ where

let air_widths = (0..stages)
.map(|stage| {
<A as MultiStageAir<SymbolicAirBuilder<Val<SC>>>>::multi_stage_width(air, stage as u32)
<A as MultiStageAir<SymbolicAirBuilder<Val<SC>>>>::stage_width(air, stage as u32)
})
.collect::<Vec<usize>>();
let air_fixed_width = <A as BaseAir<Val<SC>>>::preprocessed_width(air);
Expand Down

0 comments on commit 6577f2e

Please sign in to comment.