diff --git a/machine/src/__internal/debug_builder.rs b/machine/src/__internal/debug_builder.rs index 6cfcaa08..f689e15e 100644 --- a/machine/src/__internal/debug_builder.rs +++ b/machine/src/__internal/debug_builder.rs @@ -26,6 +26,10 @@ where type Var = SC::Val; type M = TwoRowMatrixView<'a, SC::Val>; + fn main(&self) -> Self::M { + self.main + } + fn is_first_row(&self) -> Self::Expr { self.is_first_row } @@ -42,10 +46,6 @@ where } } - fn main(&self) -> Self::M { - self.main - } - fn assert_zero>(&mut self, x: I) { assert_eq!( x.into(), @@ -71,8 +71,8 @@ where SC: StarkConfig, { type EF = SC::Challenge; - type VarEF = SC::Challenge; type ExprEF = SC::Challenge; + type VarEF = SC::Challenge; type MP = TwoRowMatrixView<'a, SC::Challenge>; fn permutation(&self) -> Self::MP { diff --git a/machine/src/__internal/folding_builder.rs b/machine/src/__internal/folding_builder.rs index 85ecfea3..3b521da7 100644 --- a/machine/src/__internal/folding_builder.rs +++ b/machine/src/__internal/folding_builder.rs @@ -2,18 +2,18 @@ use crate::{Machine, ValidaAirBuilder}; use p3_air::{AirBuilder, PairBuilder, PermutationAirBuilder, TwoRowMatrixView}; use valida_machine::config::StarkConfig; -pub struct ConstraintFolder<'a, M: Machine, SC: StarkConfig> { +pub struct ProverConstraintFolder<'a, M: Machine, SC: StarkConfig> { pub(crate) machine: &'a M, pub(crate) main: TwoRowMatrixView<'a, SC::Val>, pub(crate) preprocessed: TwoRowMatrixView<'a, SC::Val>, pub(crate) perm: TwoRowMatrixView<'a, SC::Challenge>, - pub(crate) rand_elems: &'a [SC::Challenge], + pub(crate) perm_challenges: &'a [SC::Challenge], pub(crate) is_first_row: SC::Val, pub(crate) is_last_row: SC::Val, pub(crate) is_transition: SC::Val, } -impl<'a, M, SC> AirBuilder for ConstraintFolder<'a, M, SC> +impl<'a, M, SC> AirBuilder for ProverConstraintFolder<'a, M, SC> where M: Machine, SC: StarkConfig, @@ -23,6 +23,10 @@ where type Var = SC::Val; // TODO: PackedVal type M = TwoRowMatrixView<'a, SC::Val>; // TODO: PackedVal + fn main(&self) -> Self::M { + self.main + } + fn is_first_row(&self) -> Self::Expr { self.is_first_row } @@ -39,16 +43,12 @@ where } } - fn main(&self) -> Self::M { - self.main - } - fn assert_zero>(&mut self, _x: I) { // TODO } } -impl<'a, M, SC> PairBuilder for ConstraintFolder<'a, M, SC> +impl<'a, M, SC> PairBuilder for ProverConstraintFolder<'a, M, SC> where M: Machine, SC: StarkConfig, @@ -58,14 +58,14 @@ where } } -impl<'a, M, SC> PermutationAirBuilder for ConstraintFolder<'a, M, SC> +impl<'a, M, SC> PermutationAirBuilder for ProverConstraintFolder<'a, M, SC> where M: Machine, SC: StarkConfig, { type EF = SC::Challenge; - type VarEF = SC::Challenge; type ExprEF = SC::Challenge; + type VarEF = SC::Challenge; type MP = TwoRowMatrixView<'a, SC::Challenge>; // TODO: packed challenge? fn permutation(&self) -> Self::MP { @@ -74,11 +74,11 @@ where fn permutation_randomness(&self) -> &[Self::EF] { // TODO: implement - self.rand_elems + self.perm_challenges } } -impl<'a, M, SC> ValidaAirBuilder for ConstraintFolder<'a, M, SC> +impl<'a, M, SC> ValidaAirBuilder for ProverConstraintFolder<'a, M, SC> where M: Machine, SC: StarkConfig, diff --git a/machine/src/chip.rs b/machine/src/chip.rs index 7719a36b..38cb71b1 100644 --- a/machine/src/chip.rs +++ b/machine/src/chip.rs @@ -1,5 +1,5 @@ use crate::Machine; -use crate::__internal::{ConstraintFolder, DebugConstraintBuilder}; +use crate::__internal::{DebugConstraintBuilder, ProverConstraintFolder}; use alloc::vec; use alloc::vec::Vec; use valida_util::batch_multiplicative_inverse; @@ -10,7 +10,7 @@ use p3_field::{AbstractExtensionField, AbstractField, ExtensionField, Field, Pow use p3_matrix::{dense::RowMajorMatrix, Matrix, MatrixRowSlices}; pub trait Chip, SC: StarkConfig>: - for<'a> Air> + for<'a> Air> + for<'a> Air> + for<'a> Air> { /// Generate the main trace for the chip given the provided machine. fn generate_trace(&self, machine: &M) -> RowMajorMatrix;