Skip to content

Miden VM constraints#527

Closed
Al-Kindi-0 wants to merge 9 commits intonextfrom
vm-constraints-new
Closed

Miden VM constraints#527
Al-Kindi-0 wants to merge 9 commits intonextfrom
vm-constraints-new

Conversation

@Al-Kindi-0
Copy link
Copy Markdown
Collaborator

Describe your changes

Checklist before requesting a review

  • Repo forked and branch created from next according to naming convention.
  • Commit messages and codestyle follow conventions.
  • Commits are signed.
  • Relevant issues are linked in the PR description.
  • Tests added for new functionality.
  • Documentation/comments updated according to changes.
  • Updated CHANGELOG.md

Comment thread constraints/hasher.air
# Enforce that when absorbing the next set of elements into the state during linear hash
# computation (i.e. f_abp = 1) the first 4 elements (the capacity portion) are carried over to
# the next row.
enf f_abp * (h' - h) = 0 for h in h;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the doc (https://0xmiden.github.io/miden-vm/design/chiplets/hasher.html#hasher-state-constraints) and the comment, shouldn't this be only for the first 4 elements in h?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this is an example of some stale constraints that need updating.
I am compiling a list now and will fix soon.

Copy link
Copy Markdown
Collaborator

@Leo-Besancon Leo-Besancon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Working my way through the PRs in the order outlined in #537, left a few small comments but I'm not sure they need to be addressed (or if maybe followup PRs address some of them)

Comment thread constraints/miden-vm-old/bitwise.air
Comment thread constraints/ace.air
let op_square = op^2;

enf op_square * (linear_op_0 - non_linear_op_0) + non_linear_op_0 = v0_0;
enf op_square * (linear_op_1 - non_linear_op_1) + non_linear_op_1 = v0_1;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use select(op_square, linear_op_0, non_linear_op_0) here

Comment thread constraints/bitwise.air
let a_and_b = compute_limb_and(a_limb, b_limb);
let a_xor_b = compute_limb_xor(a_limb, b_limb);

enf z = zp * 16 + op_flag * (a_xor_b - a_and_b) + a_and_b;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use select too

Comment thread constraints/hasher.air
# enf match {
# !b & f_absorb_node: is_unchanged(h[j + 4]) for j in 0..4,
# b & f_absorb_node: h[j + 8]' = h[j + 4] for j in 0..4
# }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be able to uncomment this

Comment thread constraints/memory.air
enf f_scw' * (v0' - v0) + binary_not(f_scw') * v0' = 0 when is_constrained_value[0];
enf f_scw' * (v1' - v1) + binary_not(f_scw') * v1' = 0 when is_constrained_value[1];
enf f_scw' * (v2' - v2) + binary_not(f_scw') * v2' = 0 when is_constrained_value[2];
enf f_scw' * (v3' - v3) + binary_not(f_scw') * v3' = 0 when is_constrained_value[3];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use select()

@adr1anh adr1anh self-requested a review February 1, 2026 14:32
Base automatically changed from al-fix-cross-module-constants-and-comprehension-scoping to next February 2, 2026 06:45
@Al-Kindi-0 Al-Kindi-0 closed this Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MidenVM constraints no changelog This PR does not require an entry in the `CHANGELOG.md` file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants