From e0a0facfb49d09611e190d4e28f6a9e7b380015a Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Tue, 26 Mar 2024 18:29:50 +0000 Subject: [PATCH 1/3] Break stuf --- optimism/src/main.rs | 6 +++--- optimism/src/mips/witness.rs | 10 +++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/optimism/src/main.rs b/optimism/src/main.rs index 274a37250e..5d12191cae 100644 --- a/optimism/src/main.rs +++ b/optimism/src/main.rs @@ -81,7 +81,7 @@ pub fn main() -> ExitCode { let mips_reset_pre_folding_witness = |witness_columns: &mut MIPSWitness>| { let MIPSWitness { cols } = witness_columns; // Resize without deallocating - cols.iter_mut().for_each(Vec::clear); + cols.iter_mut().for_each(Vec::::clear); }; let mut mips_current_pre_folding_witness = MIPSWitness { @@ -144,7 +144,7 @@ pub fn main() -> ExitCode { } // TODO: unify witness of MIPS to include the instruction and the error - for i in 0..MIPS_COLUMNS { + /*for i in 0..MIPS_COLUMNS { if i < SCRATCH_SIZE { mips_current_pre_folding_witness.cols[i].push(env.scratch_state[i]); } else if i == MIPS_COLUMNS - 2 { @@ -165,7 +165,7 @@ pub fn main() -> ExitCode { &mips_current_pre_folding_witness, ); mips_reset_pre_folding_witness(&mut mips_current_pre_folding_witness); - } + }*/ } if !mips_current_pre_folding_witness .instruction_counter() diff --git a/optimism/src/mips/witness.rs b/optimism/src/mips/witness.rs index e3d9640709..a981cec53a 100644 --- a/optimism/src/mips/witness.rs +++ b/optimism/src/mips/witness.rs @@ -63,7 +63,7 @@ pub struct Env { pub registers: Registers, pub registers_write_index: Registers, pub scratch_state_idx: usize, - pub scratch_state: [Fp; SCRATCH_SIZE], + pub scratch_state: [u64; SCRATCH_SIZE], pub halt: bool, pub syscall_env: SyscallEnv, pub preimage_oracle: PreImageOracle, @@ -74,7 +74,7 @@ pub struct Env { pub hash_counter: u64, } -fn fresh_scratch_state() -> [Fp; N] { +fn fresh_scratch_state() -> [Fp; N] { array::from_fn(|_| Fp::zero()) } @@ -323,7 +323,7 @@ impl InterpreterEnv for Env { self.write_column(position, 0); 0 } else { - self.write_field_column(position, Fp::from(*x).inverse().unwrap()); + self.write_column(position, 0); 1 // Placeholder value } } @@ -809,10 +809,6 @@ impl Env { } pub fn write_column(&mut self, column: Column, value: u64) { - self.write_field_column(column, value.into()) - } - - pub fn write_field_column(&mut self, column: Column, value: Fp) { match column { Column::ScratchState(idx) => self.scratch_state[idx] = value, Column::InstructionCounter => panic!("Cannot overwrite the column {:?}", column), From dc1e6f566c99ec9e226e9c5a3b36383e7c81c4cb Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Wed, 27 Mar 2024 10:54:32 +0100 Subject: [PATCH 2/3] Fresh state are now u64. No need to use Fp --- optimism/src/mips/witness.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/optimism/src/mips/witness.rs b/optimism/src/mips/witness.rs index a981cec53a..e17112e3fe 100644 --- a/optimism/src/mips/witness.rs +++ b/optimism/src/mips/witness.rs @@ -74,8 +74,8 @@ pub struct Env { pub hash_counter: u64, } -fn fresh_scratch_state() -> [Fp; N] { - array::from_fn(|_| Fp::zero()) +fn fresh_scratch_state() -> [u64; N] { + array::from_fn(|_| 0) } const KUNIT: usize = 1024; // a kunit of memory is 1024 things (bytes, kilobytes, ...) From 84cbabdecba77ab0063ef5f25855732dbaf3c569 Mon Sep 17 00:00:00 2001 From: querolita Date: Thu, 4 Apr 2024 12:39:49 +0200 Subject: [PATCH 3/3] fix clippy --- optimism/.gitignore | 1 + optimism/src/main.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/optimism/.gitignore b/optimism/.gitignore index 53df36bb78..b7314c49ea 100644 --- a/optimism/.gitignore +++ b/optimism/.gitignore @@ -1 +1,2 @@ rpcs.sh +snapshot-state* \ No newline at end of file diff --git a/optimism/src/main.rs b/optimism/src/main.rs index 5d12191cae..584e0873ba 100644 --- a/optimism/src/main.rs +++ b/optimism/src/main.rs @@ -7,7 +7,7 @@ use kimchi_optimism::{ keccak::column::{KeccakWitness, KeccakWitnessTrait, ZKVM_KECCAK_COLS}, mips::{ column::{MIPSWitness, MIPSWitnessTrait, MIPS_COLUMNS}, - witness::{self as mips_witness, SCRATCH_SIZE}, + witness::{self as mips_witness}, }, preimage_oracle::PreImageOracle, proof, DOMAIN_SIZE, @@ -78,7 +78,7 @@ pub fn main() -> ExitCode { ark_ec::short_weierstrass_jacobian::GroupAffine, >::default(); - let mips_reset_pre_folding_witness = |witness_columns: &mut MIPSWitness>| { + let _mips_reset_pre_folding_witness = |witness_columns: &mut MIPSWitness>| { let MIPSWitness { cols } = witness_columns; // Resize without deallocating cols.iter_mut().for_each(Vec::::clear);