diff --git a/CHANGELOG.md b/CHANGELOG.md index 03a6ee22c8..3175404c90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Replaced unsound `ptr::read` with safe unbox in panic recovery, removing UB from potential double-drop ([#2934](https://github.com/0xMiden/miden-vm/pull/2934)). - Reverted `InvokeKind::ProcRef` back to `InvokeKind::Exec` in `visit_mut_procref` and added an explanatory comment (#2893). +- Fixed `FastProcessor` so `after_exit` trace decorators execute when tracing is enabled without debug mode, and added a tracing-only regression test. - Fixed the release dry-run publish cycle between `miden-air` and `miden-ace-codegen`, and preserved leaf-only DAG imports with explicit snapshots ([#2931](https://github.com/0xMiden/miden-vm/pull/2931)). #### Changes diff --git a/processor/src/fast/mod.rs b/processor/src/fast/mod.rs index 0f9556ea3f..9553456216 100644 --- a/processor/src/fast/mod.rs +++ b/processor/src/fast/mod.rs @@ -529,7 +529,7 @@ impl FastProcessor { current_forest: &MastForest, host: &mut impl BaseHost, ) -> ControlFlow { - if !self.in_debug_mode() { + if !self.should_execute_decorators() { return ControlFlow::Continue(()); } diff --git a/processor/src/fast/tests/fast_decorator_execution_tests.rs b/processor/src/fast/tests/fast_decorator_execution_tests.rs index c5e4b7bff4..3dbccd894c 100644 --- a/processor/src/fast/tests/fast_decorator_execution_tests.rs +++ b/processor/src/fast/tests/fast_decorator_execution_tests.rs @@ -69,6 +69,28 @@ fn test_before_enter_decorator_executed_once_fast() { assert_eq!(order[1].0, 2, "Second trace should be after_exit"); } +#[test] +fn test_after_exit_trace_executes_with_tracing_only_fast() { + let after_exit_decorator = Decorator::Trace(2); + let operations = [Operation::Noop]; + + let program = create_test_program(&[], &[after_exit_decorator], &operations); + + let mut host = TestHost::new(); + let processor = FastProcessor::new(StackInputs::default()) + .with_advice(AdviceInputs::default()) + .with_tracing(true); + + let result = processor.execute_sync(&program, &mut host); + assert!(result.is_ok(), "Execution failed: {:?}", result); + + assert_eq!( + host.get_trace_count(2), + 1, + "after_exit trace decorator should execute when tracing is enabled without debug mode" + ); +} + #[test] fn test_multiple_before_enter_decorators_each_once_fast() { let before_enter_decorators = [Decorator::Trace(1), Decorator::Trace(2), Decorator::Trace(3)];