From ef1ca35104d60bbe0bd40e26feda5eb7e6d8e09c Mon Sep 17 00:00:00 2001 From: Tsahi Zidenberg Date: Fri, 8 Mar 2024 13:29:00 -0700 Subject: [PATCH] don't recover from error if over max steps --- arbitrator/prover/src/machine.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/arbitrator/prover/src/machine.rs b/arbitrator/prover/src/machine.rs index b96042fcf..800d79cfb 100644 --- a/arbitrator/prover/src/machine.rs +++ b/arbitrator/prover/src/machine.rs @@ -1772,14 +1772,16 @@ impl Machine { } if let ThreadState::CoThread(recovery_pc) = self.thread_state { - self.thread_state = ThreadState::Main; - self.pc = recovery_pc; - reset_refs!(); - if self.debug_info { - println!("\n{}", "switching to main thread".grey()); - println!("\n{} {:?}", "next opcode: ".grey(), func.code[self.pc.inst()]); + if self.steps < Self::MAX_STEPS { + self.thread_state = ThreadState::Main; + self.pc = recovery_pc; + reset_refs!(); + if self.debug_info { + println!("\n{}", "switching to main thread".grey()); + println!("\n{} {:?}", "next opcode: ".grey(), func.code[self.pc.inst()]); + } + continue; } - continue; } self.status = MachineStatus::Errored; module = &mut self.modules[self.pc.module()]; @@ -1790,7 +1792,7 @@ impl Machine { for _ in 0..n { self.steps += 1; if self.steps == Self::MAX_STEPS { - error!(); // TODO: make this irrecoverable + error!(); } let inst = func.code[self.pc.inst()]; self.pc.inst += 1;