diff --git a/provers/stark/src/constraints/evaluator.rs b/provers/stark/src/constraints/evaluator.rs index defac9fe2..8a4423187 100644 --- a/provers/stark/src/constraints/evaluator.rs +++ b/provers/stark/src/constraints/evaluator.rs @@ -184,12 +184,12 @@ impl ConstraintEvaluator { .collect(); // Compute all the transition constraints at this point of the LDE domain. - let evaluations_transition = - air.compute_transition(&TransitionEvaluationContext::Prover { - frame: &frame, - periodic_values: &periodic_values, - rap_challenges, - }); + let transition_evaluation_context = TransitionEvaluationContext::new_prover( + &frame, + &periodic_values, + rap_challenges, + ); + let evaluations_transition = air.compute_transition(&transition_evaluation_context); #[cfg(all(debug_assertions, not(feature = "parallel")))] transition_evaluations.push(evaluations_transition.clone()); diff --git a/provers/stark/src/debug.rs b/provers/stark/src/debug.rs index fe3553614..b2c4e52f2 100644 --- a/provers/stark/src/debug.rs +++ b/provers/stark/src/debug.rs @@ -93,11 +93,9 @@ pub fn validate_trace( .iter() .map(|col| col[step].clone()) .collect(); - let evaluations = air.compute_transition(&TransitionEvaluationContext::Prover { - frame: &frame, - periodic_values: &periodic_values, - rap_challenges, - }); + let transition_evaluation_context = + TransitionEvaluationContext::new_prover(&frame, &periodic_values, rap_challenges); + let evaluations = air.compute_transition(&transition_evaluation_context); // Iterate over each transition evaluation. When the evaluated step is not from // the exemption steps corresponding to the transition, it should have zero as a diff --git a/provers/stark/src/traits.rs b/provers/stark/src/traits.rs index dcddde4ec..afb1b3014 100644 --- a/provers/stark/src/traits.rs +++ b/provers/stark/src/traits.rs @@ -41,6 +41,36 @@ where }, } +impl<'a, F, E> TransitionEvaluationContext<'a, F, E> +where + F: IsSubFieldOf, + E: IsField, +{ + pub fn new_prover( + frame: &'a Frame<'a, F, E>, + periodic_values: &'a [FieldElement], + rap_challenges: &'a [FieldElement], + ) -> Self { + Self::Prover { + frame, + periodic_values, + rap_challenges, + } + } + + pub fn new_verifier( + frame: &'a Frame<'a, E, E>, + periodic_values: &'a [FieldElement], + rap_challenges: &'a [FieldElement], + ) -> Self { + Self::Verifier { + frame, + periodic_values, + rap_challenges, + } + } +} + /// AIR is a representation of the Constraints pub trait AIR { type Field: IsFFTField + IsSubFieldOf + Send + Sync; diff --git a/provers/stark/src/verifier.rs b/provers/stark/src/verifier.rs index a1ca0effd..57c1bcbda 100644 --- a/provers/stark/src/verifier.rs +++ b/provers/stark/src/verifier.rs @@ -274,12 +274,13 @@ pub trait IsStarkVerifier { let ood_frame = (proof.trace_ood_evaluations).into_frame(num_main_trace_columns, A::STEP_SIZE); + let transition_evaluation_context = TransitionEvaluationContext::new_verifier( + &ood_frame, + &periodic_values, + &challenges.rap_challenges, + ); let transition_ood_frame_evaluations = - air.compute_transition(&TransitionEvaluationContext::Verifier { - frame: &ood_frame, - periodic_values: &periodic_values, - rap_challenges: &challenges.rap_challenges, - }); + air.compute_transition(&transition_evaluation_context); let mut denominators = vec![FieldElement::::zero(); air.num_transition_constraints()];