From 4eb35aaee6f18b8210c8417983b4744dba30255f Mon Sep 17 00:00:00 2001 From: Kobi Gurkan Date: Wed, 1 Jan 2020 12:29:55 +0200 Subject: [PATCH] Properly handles allocation errors --- phase2/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phase2/src/lib.rs b/phase2/src/lib.rs index d630747..3d05a7b 100644 --- a/phase2/src/lib.rs +++ b/phase2/src/lib.rs @@ -1444,13 +1444,13 @@ impl<'a, E: Engine> Circuit for CircomCircuit<'a> { cs.alloc_input(|| format!("variable {}", i), || { //println!("variable {}: {}", i, &self.witness[i]); Ok(E::Fr::from_str("1").unwrap()) - }); + })?; } else { //println!("allocating private input {}", i); cs.alloc(|| format!("variable {}", i), || { //println!("variable {}: {}", i, &self.witness[i]); Ok(E::Fr::from_str("1").unwrap()) - }); + })?; } } let mut constrained: BTreeMap = BTreeMap::new(); @@ -1492,4 +1492,4 @@ impl<'a, E: Engine> Circuit for CircomCircuit<'a> { } Ok(()) } -} \ No newline at end of file +}