diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f9937475a..1ca35d6371 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,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 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)). +- Added regression coverage for the exact `max_num_continuations` continuation-stack boundary ([#2995](https://github.com/0xMiden/miden-vm/pull/2995)). #### Changes diff --git a/processor/src/fast/tests/mod.rs b/processor/src/fast/tests/mod.rs index 6cce8f8fa6..6871d9c778 100644 --- a/processor/src/fast/tests/mod.rs +++ b/processor/src/fast/tests/mod.rs @@ -611,6 +611,33 @@ fn test_continuation_stack_limit_exceeded() { assert_matches!(err, ExecutionError::Internal(msg) if msg.contains("continuation stack")); } +/// Tests that a continuation stack size exactly equal to `max_num_continuations` succeeds. +#[test] +fn test_continuation_stack_limit_exactly_max_continuations_succeeds() { + let mut host = DefaultHost::default(); + + let program = { + let mut forest = MastForest::new(); + + let leaf_id = BasicBlockNodeBuilder::new(vec![Operation::Noop], Vec::new()) + .add_to_forest(&mut forest) + .unwrap(); + + let root = JoinNodeBuilder::new([leaf_id, leaf_id]).add_to_forest(&mut forest).unwrap(); + forest.make_root(root); + Program::new(forest.into(), root) + }; + + // A single join peaks at three continuations after the join start step: + // FinishJoin(root), StartNode(second), StartNode(first). + let options = ExecutionOptions::default().with_max_num_continuations(3); + + let processor = + FastProcessor::new_with_options(StackInputs::default(), AdviceInputs::default(), options); + + processor.execute_sync(&program, &mut host).unwrap(); +} + // TEST HELPERS // -----------------------------------------------------------------------------------------------