Skip to content

Commit

Permalink
Merge pull request #1864 from o1-labs/dw/serializer-interpreter-1
Browse files Browse the repository at this point in the history
Continue serializer interpreter - building witness
  • Loading branch information
dannywillems authored Feb 29, 2024
2 parents 86e9260 + 0a27b40 commit 489c7dd
Show file tree
Hide file tree
Showing 4 changed files with 289 additions and 59 deletions.
30 changes: 0 additions & 30 deletions msm/src/serialization/columns.rs

This file was deleted.

31 changes: 19 additions & 12 deletions msm/src/serialization/interpreter.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
pub trait InterpreterEnv {
type Position;

type Variable;
type Variable: Clone
+ std::ops::Add<Self::Variable, Output = Self::Variable>
+ std::ops::Sub<Self::Variable, Output = Self::Variable>
+ std::ops::Mul<Self::Variable, Output = Self::Variable>
+ std::fmt::Debug;

fn copy(&mut self, x: &Self::Variable, position: Self::Position) -> Self::Variable;

fn get_column_for_kimchi_limb(j: usize) -> Self::Position;

fn get_column_for_intermediate_limb(j: usize) -> Self::Position;

fn get_column_for_msm_limb(j: usize) -> Self::Position;

/// Check that the value is in the range [0, 2^15-1]
fn range_check15(&mut self, _value: &Self::Variable) {
Expand All @@ -13,22 +25,17 @@ pub trait InterpreterEnv {
// TODO
}

fn constant(value: u128) -> Self::Variable;

/// Extract the bits from the variable `x` between `highest_bit` and `lowest_bit`, and store
/// the result in `position`.
/// `lowest_bit` becomes the least-significant bit of the resulting value.
fn bitmask(
/// The value `x` is expected to be encoded in big-endian
fn bitmask_be(
&mut self,
x: &Self::Variable,
highest_bit: u128,
lowest_bit: u128,
highest_bit: u32,
lowest_bit: u32,
position: Self::Position,
) -> Self::Variable;

/// Deserialize the next field element given as input
fn deserialize_field_element(&mut self);

/// Copy the value `value` in the column `position`
fn copy(&mut self, _position: Self::Position, _value: Self::Variable) {
// TODO
}
}
1 change: 0 additions & 1 deletion msm/src/serialization/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pub mod columns;
pub mod interpreter;
pub mod witness;
Loading

0 comments on commit 489c7dd

Please sign in to comment.