Removes a panic in synthesis

The error case - a witness_256 failure - is folded in the SynthesisError case of its enclosing result.

The panic was found with [comby-rust](https://github.com/huitseeker/comby-rust/blob/master/nopanic.toml) (using the nopanic template).
This commit is contained in:
François Garillot 2021-01-28 15:48:41 -05:00
parent 45f3f5a945
commit f5b6fa6dfb
No known key found for this signature in database
GPG Key ID: A6EFBA9E3F33E320
1 changed files with 2 additions and 2 deletions

View File

@ -78,7 +78,7 @@ impl<Scalar: PrimeField> Circuit<Scalar> for JoinSplit {
let mut rhs = vpub_new.lc();
// Witness rt (merkle tree root)
let rt = witness_u256(cs.namespace(|| "rt"), self.rt.as_ref().map(|v| &v[..])).unwrap();
let rt = witness_u256(cs.namespace(|| "rt"), self.rt.as_ref().map(|v| &v[..]))?;
// Witness h_sig
let h_sig = witness_u256(
@ -88,7 +88,7 @@ impl<Scalar: PrimeField> Circuit<Scalar> for JoinSplit {
.unwrap();
// Witness phi
let phi = witness_u252(cs.namespace(|| "phi"), self.phi.as_ref().map(|v| &v[..])).unwrap();
let phi = witness_u252(cs.namespace(|| "phi"), self.phi.as_ref().map(|v| &v[..]))?;
let mut input_notes = vec![];
let mut lhs_total = self.vpub_old;