From 05d1f49c981dd87df9d36098d60974a03966dfe2 Mon Sep 17 00:00:00 2001 From: Kitaro Mohan Date: Mon, 13 Apr 2026 10:40:47 +0800 Subject: [PATCH 1/2] processor: add exact continuation stack limit regression test --- CHANGELOG.md | 1 + processor/src/fast/tests/mod.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e34020d061..b9cf9d0c27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,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. #### 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 // ----------------------------------------------------------------------------------------------- From 2001d3639c4c9c20c12fe21c459e43ef05f06e0c Mon Sep 17 00:00:00 2001 From: Kitaro Mohan Date: Wed, 15 Apr 2026 09:18:02 +0800 Subject: [PATCH 2/2] changelog: link continuation stack regression entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9cf9d0c27..9a43140573 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,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. +- Added regression coverage for the exact `max_num_continuations` continuation-stack boundary ([#2995](https://github.com/0xMiden/miden-vm/pull/2995)). #### Changes