Skip to content

Commit

Permalink
adds PublicVar type to AirBuilderWithPublicValues trait
Browse files Browse the repository at this point in the history
  • Loading branch information
tess-eract committed May 15, 2024
1 parent dbbacf2 commit b499aec
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion air/src/air.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ pub trait AirBuilder: Sized {
}

pub trait AirBuilderWithPublicValues: AirBuilder {
fn public_values(&self) -> &[Self::F];
type PublicVar: Into<Self::Expr> + Copy;

fn public_values(&self) -> &[Self::PublicVar];
}

pub trait PairBuilder: AirBuilder {
Expand Down
4 changes: 3 additions & 1 deletion uni-stark/src/check_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ where
}

impl<'a, F: Field> AirBuilderWithPublicValues for DebugConstraintBuilder<'a, F> {
fn public_values(&self) -> &[Self::F] {
type PublicVar = F;

fn public_values(&self) -> &[Self::PublicVar] {
self.public_values
}
}
4 changes: 4 additions & 0 deletions uni-stark/src/folder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ impl<'a, SC: StarkGenericConfig> AirBuilder for ProverConstraintFolder<'a, SC> {
}

impl<'a, SC: StarkGenericConfig> AirBuilderWithPublicValues for ProverConstraintFolder<'a, SC> {
type PublicVar = Self::F;

fn public_values(&self) -> &[Self::F] {
self.public_values
}
Expand Down Expand Up @@ -96,6 +98,8 @@ impl<'a, SC: StarkGenericConfig> AirBuilder for VerifierConstraintFolder<'a, SC>
}
}
impl<'a, SC: StarkGenericConfig> AirBuilderWithPublicValues for VerifierConstraintFolder<'a, SC> {
type PublicVar = Self::F;

fn public_values(&self) -> &[Self::F] {
self.public_values
}
Expand Down
4 changes: 3 additions & 1 deletion uni-stark/src/symbolic_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ impl<F: Field> AirBuilder for SymbolicAirBuilder<F> {
}

impl<F: Field> AirBuilderWithPublicValues for SymbolicAirBuilder<F> {
fn public_values(&self) -> &[Self::F] {
type PublicVar = F;

fn public_values(&self) -> &[Self::PublicVar] {
self.public_values.as_slice()
}
}

0 comments on commit b499aec

Please sign in to comment.