Skip to content

Commit

Permalink
o1vm/witness_env/lookup: track arity
Browse files Browse the repository at this point in the history
  • Loading branch information
marcbeunardeau88 committed Feb 4, 2025
1 parent 4a6b7a6 commit 6a507eb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion o1vm/src/interpreters/mips/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,11 @@ impl<Fp: PrimeField, PreImageOracle: PreImageOracleT> InterpreterEnv for Env<Fp,
}

fn add_lookup(&mut self, lookup: Lookup<Self::Variable>) {
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,
Expand All @@ -205,7 +207,7 @@ impl<Fp: PrimeField, PreImageOracle: PreImageOracleT> InterpreterEnv for Env<Fp,
for value in values.iter() {
add_value(*value);
}

// Update multiplicities
if let Some(idx) = table_id.ix_by_value(values.as_slice()) {
match table_id {
LookupTableIDs::PadLookup => self.lookup_multiplicities.pad_lookup[idx] += 1,
Expand All @@ -228,6 +230,8 @@ impl<Fp: PrimeField, PreImageOracle: PreImageOracleT> InterpreterEnv for Env<Fp,
LookupTableIDs::KeccakStepLookup => (),
}
}
//Update arity
self.lookup_arity.push(arity_counter);
}

fn instruction_counter(&self) -> Self::Variable {
Expand Down

0 comments on commit 6a507eb

Please sign in to comment.