Properly handles allocation errors

This commit is contained in:
Kobi Gurkan 2020-01-01 12:29:55 +02:00
parent 5e26ad1cc2
commit 4eb35aaee6

@ -1444,13 +1444,13 @@ impl<'a, E: Engine> Circuit<E> for CircomCircuit<'a> {
cs.alloc_input(|| format!("variable {}", i), || { cs.alloc_input(|| format!("variable {}", i), || {
//println!("variable {}: {}", i, &self.witness[i]); //println!("variable {}: {}", i, &self.witness[i]);
Ok(E::Fr::from_str("1").unwrap()) Ok(E::Fr::from_str("1").unwrap())
}); })?;
} else { } else {
//println!("allocating private input {}", i); //println!("allocating private input {}", i);
cs.alloc(|| format!("variable {}", i), || { cs.alloc(|| format!("variable {}", i), || {
//println!("variable {}: {}", i, &self.witness[i]); //println!("variable {}: {}", i, &self.witness[i]);
Ok(E::Fr::from_str("1").unwrap()) Ok(E::Fr::from_str("1").unwrap())
}); })?;
} }
} }
let mut constrained: BTreeMap<usize, bool> = BTreeMap::new(); let mut constrained: BTreeMap<usize, bool> = BTreeMap::new();