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), || {
//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<usize, bool> = BTreeMap::new();
@ -1492,4 +1492,4 @@ impl<'a, E: Engine> Circuit<E> for CircomCircuit<'a> {
}
Ok(())
}
}
}