Skip to content

Commit

Permalink
Merge pull request #1880 from AleoHQ/fix/unwrap
Browse files Browse the repository at this point in the history
Handle unwrap in `verify_deployment`
  • Loading branch information
howardwu authored Aug 14, 2023
2 parents f315728 + 86fb522 commit f56ce2b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions synthesizer/process/src/stack/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,19 @@ impl<N: Network> Stack<N> {
cfg_iter!(call_stacks).zip_eq(deployment.verifying_keys()).try_for_each(
|((function_name, call_stack, assignments), (_, (verifying_key, certificate)))| {
// Synthesize the circuit.
let _response = self.execute_function::<A>(call_stack.clone()).unwrap();

if let Err(err) = self.execute_function::<A>(call_stack.clone()) {
bail!("Failed to synthesize the circuit for '{function_name}': {err}")
}
// Check the certificate.
match assignments.read().last() {
None => {
bail!("The assignment for function '{}' is missing in '{program_id}'", function_name)
}
None => bail!("The assignment for function '{function_name}' is missing in '{program_id}'"),
Some((assignment, _metrics)) => {
// Ensure the certificate is valid.
if !certificate.verify(&function_name.to_string(), assignment, verifying_key) {
bail!("The certificate for function '{}' is invalid in '{program_id}'", function_name)
bail!("The certificate for function '{function_name}' is invalid in '{program_id}'")
}
}
};

Ok(())
},
)?;
Expand Down

0 comments on commit f56ce2b

Please sign in to comment.