Skip to content

fix(aiur): replay constrained calls cached as hints - #570

Merged
arthurpaulino merged 1 commit into
mainfrom
ap/aiur-hint-cache-fix
Aug 19, 2026
Merged

fix(aiur): replay constrained calls cached as hints#570
arthurpaulino merged 1 commit into
mainfrom
ap/aiur-hint-cache-fix

Conversation

@arthurpaulino

Copy link
Copy Markdown
Member

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
arthurpaulino force-pushed the ap/aiur-hint-cache-fix branch from 0e94e50 to 529b134 Compare August 19, 2026 09:58
@arthurpaulino
arthurpaulino enabled auto-merge (squash) August 19, 2026 09:58
@arthurpaulino
arthurpaulino force-pushed the ap/aiur-hint-cache-fix branch 2 times, most recently from 61e9960 to 77020a7 Compare August 19, 2026 12:52
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
arthurpaulino force-pushed the ap/aiur-hint-cache-fix branch from 77020a7 to 9755deb Compare August 19, 2026 19:25
@arthurpaulino
arthurpaulino merged commit dffb3f4 into main Aug 19, 2026
11 checks passed
@arthurpaulino
arthurpaulino deleted the ap/aiur-hint-cache-fix branch August 19, 2026 19:46
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants