diff --git a/CHANGELOG.md b/CHANGELOG.md index 66f2006f3f..2934696b2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ #### Fixes - `FastProcessor` now correctly returns an error if the maximum number of cycles was exceeded during execution ([#2537](https://github.com/0xMiden/miden-vm/pull/2537)) +- `FastProcessor` now correctly only executes `trace` decorators when tracing is enabled (with `ExecutionOptions`) ([#2539](https://github.com/0xMiden/miden-vm/pull/2539)) #### Changes diff --git a/miden-vm/tests/integration/operations/decorators/events.rs b/miden-vm/tests/integration/operations/decorators/events.rs index 42f8bc729a..74cc791d4d 100644 --- a/miden-vm/tests/integration/operations/decorators/events.rs +++ b/miden-vm/tests/integration/operations/decorators/events.rs @@ -35,7 +35,6 @@ fn test_event_handling() { } #[test] -#[ignore = "issue #2479"] fn test_trace_handling() { let source = "\ begin @@ -76,7 +75,6 @@ fn test_trace_handling() { } #[test] -#[ignore = "issue #2479"] fn test_debug_with_debugging() { let source: &str = "\ begin diff --git a/processor/src/fast/mod.rs b/processor/src/fast/mod.rs index 030f631787..785a5cc346 100644 --- a/processor/src/fast/mod.rs +++ b/processor/src/fast/mod.rs @@ -782,12 +782,14 @@ impl FastProcessor { // do nothing }, Decorator::Trace(id) => { - let clk = self.clk; - let process = &mut self.state(); - if let Err(err) = host.on_trace(process, *id) { - return ControlFlow::Break(BreakReason::Err( - ExecutionError::TraceHandlerError { clk, trace_id: *id, err }, - )); + if self.options.enable_tracing() { + let clk = self.clk; + let process = &mut self.state(); + if let Err(err) = host.on_trace(process, *id) { + return ControlFlow::Break(BreakReason::Err( + ExecutionError::TraceHandlerError { clk, trace_id: *id, err }, + )); + } } }, }; diff --git a/processor/src/tests/debug_mode_decorator_tests.rs b/processor/src/tests/debug_mode_decorator_tests.rs index bfd7932c96..dac97778de 100644 --- a/processor/src/tests/debug_mode_decorator_tests.rs +++ b/processor/src/tests/debug_mode_decorator_tests.rs @@ -33,7 +33,6 @@ fn create_debug_test_program() -> Program { /// Test that verifies decorators only execute in debug mode #[test] -#[ignore = "issue #2479"] fn test_decorators_only_execute_in_debug_mode() { // Test implementation to verify decorators only execute in debug mode @@ -107,7 +106,8 @@ fn test_decorators_only_execute_in_debug_mode() { &mut self, process: &ProcessState<'_>, ) -> impl FutureMaybeSend, EventError>> { - async { ::on_event(self, process) } + let result = ::on_event(self, process); + async { result } } } @@ -136,7 +136,6 @@ fn test_decorators_only_execute_in_debug_mode() { /// Test that verifies decorators do NOT execute when debug mode is OFF #[test] -#[ignore = "issue #2479"] fn test_decorators_only_execute_in_debug_mode_off() { // Create a test program with a Trace decorator let program = create_debug_test_program(); @@ -165,7 +164,6 @@ fn test_decorators_only_execute_in_debug_mode_off() { /// Test that verifies decorators DO execute when debug mode is ON #[test] -#[ignore = "issue #2479"] fn test_decorators_only_execute_in_debug_mode_on() { // Create a test program with a Trace decorator let program = create_debug_test_program(); @@ -196,7 +194,6 @@ fn test_decorators_only_execute_in_debug_mode_on() { /// Test that demonstrates the zero overhead principle by comparing execution /// with debug mode on vs off for a more complex program #[test] -#[ignore = "issue #2479"] fn test_zero_overhead_when_debug_off() { // Create a more complex program with multiple decorators let mut mast_forest = MastForest::new(); diff --git a/processor/src/tests/mod.rs b/processor/src/tests/mod.rs index d1166360aa..706539bd93 100644 --- a/processor/src/tests/mod.rs +++ b/processor/src/tests/mod.rs @@ -21,6 +21,7 @@ use super::*; use crate::fast::FastProcessor; mod debug; +mod debug_mode_decorator_tests; // AdviceMap inlined in the script // ------------------------------------------------------------------------------------------------