diff --git a/o1vm/src/interpreters/mips/tests_helpers.rs b/o1vm/src/interpreters/mips/tests_helpers.rs index 3840975968..c97b81501c 100644 --- a/o1vm/src/interpreters/mips/tests_helpers.rs +++ b/o1vm/src/interpreters/mips/tests_helpers.rs @@ -95,6 +95,7 @@ where lookup_multiplicities: LookupMultiplicities::new(), lookup_state_idx: 0, lookup_state: vec![], + lookup_arity: vec![], selector: crate::interpreters::mips::column::N_MIPS_SEL_COLS, halt: false, // Keccak related diff --git a/o1vm/src/interpreters/mips/witness.rs b/o1vm/src/interpreters/mips/witness.rs index 3b61250b8a..1c01532bb6 100644 --- a/o1vm/src/interpreters/mips/witness.rs +++ b/o1vm/src/interpreters/mips/witness.rs @@ -115,6 +115,10 @@ pub struct Env { pub scratch_state_inverse: [Fp; SCRATCH_SIZE_INVERSE], pub lookup_state_idx: usize, pub lookup_state: Vec, + // tracks the arity of every lookup + // [1,1,3] means that the lookup state is of size 5, + // containing two lookup of arity one and one of arity three. + pub lookup_arity: Vec, pub halt: bool, pub syscall_env: SyscallEnv, pub selector: usize, @@ -178,9 +182,11 @@ impl InterpreterEnv for Env) { + let mut arity_counter = 0; let mut add_value = |x: Fp| { self.lookup_state_idx += 1; self.lookup_state.push(x); + arity_counter += 1; }; let Lookup { table_id, @@ -201,7 +207,7 @@ impl InterpreterEnv for Env self.lookup_multiplicities.pad_lookup[idx] += 1, @@ -224,6 +230,8 @@ impl InterpreterEnv for Env (), } } + //Update arity + self.lookup_arity.push(arity_counter); } fn instruction_counter(&self) -> Self::Variable { @@ -963,6 +971,7 @@ impl Env { scratch_state_inverse: fresh_scratch_state(), lookup_state_idx: 0, lookup_state: vec![], + lookup_arity: vec![], halt: state.exited, syscall_env, selector,