Skip to content

Commit

Permalink
chore: Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Tom French <[email protected]>
  • Loading branch information
ggiraldez and TomAFrench authored Oct 10, 2023
1 parent 58629ca commit 8567062
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions acvm-repo/acvm/src/pwg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,18 @@ impl<'backend, B: BlackBoxFunctionSolver> ACVM<'backend, B> {
if BrilligSolver::<B>::should_skip(witness, brillig)? {
BrilligSolver::<B>::zero_out_brillig_outputs(witness, brillig).map(|_| None)
} else {
let mut solver = match self.brillig_solver.take() {
// If we're resuming execution after resolving a foreign call then
// there will be a cached `BrilligSolver` to avoid recomputation.
let mut solver: BrilligSolver<'_, B> = match self.brillig_solver.take() {
Some(solver) => solver,
None => {
BrilligSolver::new(witness, brillig, self.backend, self.instruction_pointer)?
}
Some(solver) => solver,
};
match solver.solve()? {
BrilligSolverStatus::ForeignCallWait(foreign_call) => {
_ = self.brillig_solver.insert(solver);
// Cache the current state of the solver
self.brillig_solver = Some(solver);
Ok(Some(foreign_call))
}
BrilligSolverStatus::InProgress => {
Expand Down

0 comments on commit 8567062

Please sign in to comment.