Skip to content

Commit 605149d

Browse files
committed
crate new methods for evaluation_context
1 parent 4c73313 commit 605149d

File tree

4 files changed

+45
-16
lines changed

4 files changed

+45
-16
lines changed

provers/stark/src/constraints/evaluator.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,12 @@ impl<A: AIR> ConstraintEvaluator<A> {
184184
.collect();
185185

186186
// Compute all the transition constraints at this point of the LDE domain.
187-
let evaluations_transition =
188-
air.compute_transition(&TransitionEvaluationContext::Prover {
189-
frame: &frame,
190-
periodic_values: &periodic_values,
191-
rap_challenges,
192-
});
187+
let transition_evaluation_context = TransitionEvaluationContext::new_prover(
188+
&frame,
189+
&periodic_values,
190+
rap_challenges,
191+
);
192+
let evaluations_transition = air.compute_transition(&transition_evaluation_context);
193193

194194
#[cfg(all(debug_assertions, not(feature = "parallel")))]
195195
transition_evaluations.push(evaluations_transition.clone());

provers/stark/src/debug.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,9 @@ pub fn validate_trace<A: AIR>(
9393
.iter()
9494
.map(|col| col[step].clone())
9595
.collect();
96-
let evaluations = air.compute_transition(&TransitionEvaluationContext::Prover {
97-
frame: &frame,
98-
periodic_values: &periodic_values,
99-
rap_challenges,
100-
});
96+
let transition_evaluation_context =
97+
TransitionEvaluationContext::new_prover(&frame, &periodic_values, rap_challenges);
98+
let evaluations = air.compute_transition(&transition_evaluation_context);
10199

102100
// Iterate over each transition evaluation. When the evaluated step is not from
103101
// the exemption steps corresponding to the transition, it should have zero as a

provers/stark/src/traits.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,36 @@ where
4141
},
4242
}
4343

44+
impl<'a, F, E> TransitionEvaluationContext<'a, F, E>
45+
where
46+
F: IsSubFieldOf<E>,
47+
E: IsField,
48+
{
49+
pub fn new_prover(
50+
frame: &'a Frame<'a, F, E>,
51+
periodic_values: &'a [FieldElement<F>],
52+
rap_challenges: &'a [FieldElement<E>],
53+
) -> Self {
54+
Self::Prover {
55+
frame,
56+
periodic_values,
57+
rap_challenges,
58+
}
59+
}
60+
61+
pub fn new_verifier(
62+
frame: &'a Frame<'a, E, E>,
63+
periodic_values: &'a [FieldElement<E>],
64+
rap_challenges: &'a [FieldElement<E>],
65+
) -> Self {
66+
Self::Verifier {
67+
frame,
68+
periodic_values,
69+
rap_challenges,
70+
}
71+
}
72+
}
73+
4474
/// AIR is a representation of the Constraints
4575
pub trait AIR {
4676
type Field: IsFFTField + IsSubFieldOf<Self::FieldExtension> + Send + Sync;

provers/stark/src/verifier.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,13 @@ pub trait IsStarkVerifier<A: AIR> {
274274

275275
let ood_frame =
276276
(proof.trace_ood_evaluations).into_frame(num_main_trace_columns, A::STEP_SIZE);
277+
let transition_evaluation_context = TransitionEvaluationContext::new_verifier(
278+
&ood_frame,
279+
&periodic_values,
280+
&challenges.rap_challenges,
281+
);
277282
let transition_ood_frame_evaluations =
278-
air.compute_transition(&TransitionEvaluationContext::Verifier {
279-
frame: &ood_frame,
280-
periodic_values: &periodic_values,
281-
rap_challenges: &challenges.rap_challenges,
282-
});
283+
air.compute_transition(&transition_evaluation_context);
283284

284285
let mut denominators =
285286
vec![FieldElement::<A::FieldExtension>::zero(); air.num_transition_constraints()];

0 commit comments

Comments
 (0)