Skip to content

Commit

Permalink
fix: don't unwrap on OOR lookup (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-camuto committed Nov 10, 2023
1 parent fc8d113 commit 50c30b2
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions halo2_proofs/src/plonk/mv_lookup/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,27 @@ impl<F: WithSmallOrderMulGroup<3>> Argument<F> {

let m_values: Vec<F> = {
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::RwLock;
let m_values: Vec<AtomicU64> = (0..params.n()).map(|_| AtomicU64::new(0)).collect();

for compressed_input_expression in compressed_inputs_expressions.iter() {
compressed_input_expression
let res: Result<(), Error> = compressed_input_expression
.par_iter()
.take(params.n() as usize - blinding_factors - 1)
.for_each(|fi| {
let index = table_index_value_mapping
.map(|fi| {
let index = match table_index_value_mapping
.get(&fi.to_repr().as_ref().to_owned())
.unwrap();
{
Some(value) => value,
None => {
log::error!("value is OOR of lookup");
return Err(Error::Synthesis);
}
};
m_values[*index].fetch_add(1, Ordering::Relaxed);
});
Ok(())
})
.collect();
res?
}

m_values
Expand Down

0 comments on commit 50c30b2

Please sign in to comment.