diff --git a/triton-vm/src/program.rs b/triton-vm/src/program.rs index 0fbc5dc40..b96b2092d 100644 --- a/triton-vm/src/program.rs +++ b/triton-vm/src/program.rs @@ -425,9 +425,19 @@ impl Program { &self, public_input: PublicInput, non_determinism: NonDeterminism, + ) -> Result<(AlgebraicExecutionTrace, Vec)> { + let state = VMState::new(self, public_input, non_determinism); + self.trace_execution_of_state(state) + } + + /// Trace the execution of a [`Program`] from a given [`VMState`]. Consider using + /// [`trace_execution`][Self::trace_execution], unless you know this is what you want. + pub fn trace_execution_of_state( + &self, + mut state: VMState, ) -> Result<(AlgebraicExecutionTrace, Vec)> { let mut aet = AlgebraicExecutionTrace::new(self.clone()); - let mut state = VMState::new(self, public_input, non_determinism); + assert_eq!(self.instructions, state.program); assert_eq!(self.len_bwords(), aet.instruction_multiplicities.len()); while !state.halting {