fix(aiur): replay constrained calls cached as hints - #570
Merged
Conversation
arthurpaulino
force-pushed
the
ap/aiur-hint-cache-fix
branch
from
August 19, 2026 09:58
0e94e50 to
529b134
Compare
arthurpaulino
enabled auto-merge (squash)
August 19, 2026 09:58
arthurpaulino
force-pushed
the
ap/aiur-hint-cache-fix
branch
2 times, most recently
from
August 19, 2026 12:52
61e9960 to
77020a7
Compare
Unconstrained calls cache function queries with zero multiplicity. When a later constrained call reused the same query, the executors previously incremented only the cached callee row. They did not replay its body, so nested function, memory, and gadget lookup obligations could remain inactive. The resulting witness had unbalanced lookup channels and failed verification with UnbalancedChannel. Treat a constrained cache hit with zero multiplicity as promotion: replay the callee body in constrained mode so activation recursively reaches its dependency tree. At return, reuse the existing query, assert that the recomputed output agrees with the cached hint, and increment its multiplicity instead of inserting a duplicate. Apply the same behavior to the bytecode executor and generated Rust executor, then regenerate both codegen outputs. Add a focused Rust prove/verify regression and an aiur-prove case where an unconstrained call is followed by an identical constrained call whose callee performs a nested call. With the fix removed, both reproduce UnbalancedChannel; with the fix restored, they verify successfully. Validation: - lake exe ix codegen - cargo clippy --release - cargo test -p aiur --release prove_verify_promotes_nested_unconstrained_call -- --nocapture - lake test -- aiur-prove - lake test -- --ignored ixvm - exact Nat.add_comm benchmark prove/verify path
arthurpaulino
force-pushed
the
ap/aiur-hint-cache-fix
branch
from
August 19, 2026 19:25
77020a7 to
9755deb
Compare
gabriel-barrett
approved these changes
Aug 19, 2026
gabriel-barrett
added a commit
that referenced
this pull request
Aug 20, 2026
…itter Main's #570 taught the emitter to promote zero-multiplicity hint entries at call and return sites instead of blind-inserting; the recursive-verifier toplevel is generated on this branch, so its runner re-emits under the new pattern. The kernel runner (aiur_ixvm.rs) stays byte-identical to main's — this branch's changes don't alter its emission.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unconstrained calls cache function queries with zero multiplicity. When a later constrained call reused the same query, the executors previously incremented only the cached callee row. They did not replay its body, so nested function, memory, and gadget lookup obligations could remain inactive. The resulting witness had unbalanced lookup channels and failed verification with UnbalancedChannel.
Treat a constrained cache hit with zero multiplicity as promotion: replay the callee body in constrained mode so activation recursively reaches its dependency tree. At return, reuse the existing query, assert that the recomputed output agrees with the cached hint, and increment its multiplicity instead of inserting a duplicate. Apply the same behavior to the bytecode executor and generated Rust executor, then regenerate both codegen outputs.
Add a focused Rust prove/verify regression and an aiur-prove case where an unconstrained call is followed by an identical constrained call whose callee performs a nested call. With the fix removed, both reproduce UnbalancedChannel; with the fix restored, they verify successfully.
Validation: