Skip to content

Commit

Permalink
fix mem example
Browse files Browse the repository at this point in the history
  • Loading branch information
ColoCarletti committed Dec 5, 2024
1 parent dce2ef2 commit 291bcfd
Showing 1 changed file with 43 additions and 20 deletions.
63 changes: 43 additions & 20 deletions provers/stark/src/examples/read_only_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ use crate::{
transition::TransitionConstraint,
},
context::AirContext,
frame::Frame,
proof::options::ProofOptions,
trace::TraceTable,
traits::AIR,
traits::{TransitionEvaluationContext, AIR},
};
use lambdaworks_crypto::fiat_shamir::is_transcript::IsTranscript;
use lambdaworks_math::field::traits::IsPrimeField;
Expand Down Expand Up @@ -52,11 +51,22 @@ where

fn evaluate(
&self,
frame: &Frame<F, F>,
evaluation_context: &TransitionEvaluationContext<F, F>,
transition_evaluations: &mut [FieldElement<F>],
_periodic_values: &[FieldElement<F>],
_rap_challenges: &[FieldElement<F>],
) {
let (frame, _periodic_values, _rap_challenges) = match evaluation_context {
TransitionEvaluationContext::Prover {
frame,
periodic_values,
rap_challenges,
}
| TransitionEvaluationContext::Verifier {
frame,
periodic_values,
rap_challenges,
} => (frame, periodic_values, rap_challenges),
};

let first_step = frame.get_evaluation_step(0);
let second_step = frame.get_evaluation_step(1);

Expand Down Expand Up @@ -105,11 +115,22 @@ where

fn evaluate(
&self,
frame: &Frame<F, F>,
evaluation_context: &TransitionEvaluationContext<F, F>,
transition_evaluations: &mut [FieldElement<F>],
_periodic_values: &[FieldElement<F>],
_rap_challenges: &[FieldElement<F>],
) {
let (frame, _periodic_values, _rap_challenges) = match evaluation_context {
TransitionEvaluationContext::Prover {
frame,
periodic_values,
rap_challenges,
}
| TransitionEvaluationContext::Verifier {
frame,
periodic_values,
rap_challenges,
} => (frame, periodic_values, rap_challenges),
};

let first_step = frame.get_evaluation_step(0);
let second_step = frame.get_evaluation_step(1);

Expand Down Expand Up @@ -159,11 +180,22 @@ where

fn evaluate(
&self,
frame: &Frame<F, F>,
evaluation_context: &TransitionEvaluationContext<F, F>,
transition_evaluations: &mut [FieldElement<F>],
_periodic_values: &[FieldElement<F>],
rap_challenges: &[FieldElement<F>],
) {
let (frame, _periodic_values, rap_challenges) = match evaluation_context {
TransitionEvaluationContext::Prover {
frame,
periodic_values,
rap_challenges,
}
| TransitionEvaluationContext::Verifier {
frame,
periodic_values,
rap_challenges,
} => (frame, periodic_values, rap_challenges),
};

let first_step = frame.get_evaluation_step(0);
let second_step = frame.get_evaluation_step(1);

Expand Down Expand Up @@ -344,15 +376,6 @@ where
fn pub_inputs(&self) -> &Self::PublicInputs {
&self.pub_inputs
}

fn compute_transition_verifier(
&self,
frame: &Frame<Self::FieldExtension, Self::FieldExtension>,
periodic_values: &[FieldElement<Self::FieldExtension>],
rap_challenges: &[FieldElement<Self::FieldExtension>],
) -> Vec<FieldElement<Self::Field>> {
self.compute_transition_prover(frame, periodic_values, rap_challenges)
}
}

/// Given the adress and value columns, it returns the trace table with 5 columns, which are:
Expand Down

0 comments on commit 291bcfd

Please sign in to comment.