Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update recursive verifier to use Horner eval ops instead of rcomb_* #1665

Open
wants to merge 8 commits into
base: next
Choose a base branch
from

Conversation

Al-Kindi-0
Copy link
Collaborator

As a side effect, we now have a very accurate formula to estimate the cycle count of the recursive verifier as a function of its parameters.
Putting in draft as some older PRs need to be merged before this one.

@Al-Kindi-0 Al-Kindi-0 marked this pull request as draft February 17, 2025 16:18
@Al-Kindi-0 Al-Kindi-0 force-pushed the al-update-recursive-verifier-after-horner-eval branch from c294a7d to 03bc93e Compare March 3, 2025 08:09
@Al-Kindi-0 Al-Kindi-0 marked this pull request as ready for review March 3, 2025 08:10
@Al-Kindi-0 Al-Kindi-0 requested review from bobbinth and plafer March 3, 2025 08:10
Copy link
Contributor

@plafer plafer left a comment

Choose a reason for hiding this comment

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

Very cool!

Left some questions and nits

memchr = { version = "2.7", default-features = false }
miden-crypto = { version = "0.13", default-features = false }
#miden-crypto = { version = "0.13", default-features = false }
miden-crypto = {git = "https://github.com/0xPolygonMiden/crypto", branch = "al-update-winter", default-features = false }
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remember to update this before we merge

Copy link
Contributor

@plafer plafer Mar 10, 2025

Choose a reason for hiding this comment

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

@Al-Kindi-0 we can revert this now

EDIT: or are we waiting for miden-crypto v0.14.0?

@plafer plafer mentioned this pull request Mar 4, 2025
@bobbinth
Copy link
Contributor

bobbinth commented Mar 5, 2025

@Al-Kindi-0 - should this PR be based on #1658? Basically, the sequence would be:

  • Release miden-crypto v0.14.0
  • Merge #1658.
  • Merge this PR.

Right?

Comment on lines +99 to +114
let mut main_and_aux_frame_states = ood_main_trace_frame.current().to_vec();
main_and_aux_frame_states.extend_from_slice(
ood_aux_trace_frame
.as_ref()
.expect("execution trace should have an auxiliary segment")
.current(),
);
main_and_aux_frame_states.extend_from_slice(ood_main_trace_frame.next());
main_and_aux_frame_states.extend_from_slice(
ood_aux_trace_frame
.as_ref()
.expect("execution trace should have an auxiliary segment")
.next(),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add a small comment here explaining what arrangement we are trying to achieve? I think it is something like:

[main_current_elements, aux_current_elements, main_next_elements, aux_next_elements]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's correct, will add a comment explaining that.

@Al-Kindi-0
Copy link
Collaborator Author

@Al-Kindi-0 - should this PR be based on #1658? Basically, the sequence would be:

* Release `miden-crypto` v0.14.0

* Merge [#1658](https://github.com/0xPolygonMiden/miden-vm/pull/1658).

* Merge this PR.

Right?

That is correct, we should make a new release of the crypto crate with the new Winterfell release, update the Miden VM PR migrating to the new Winterfell release i.e., #1658, and then we can merge the current PR.

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you! Not a very deep review from me, but I left some comments inline (mostly doc-related).

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you! I added a few more small comments inline.

Comment on lines 35 to 37
# OOD_TRACE_CURRENT_PTR: (71 + 7) * 2 * 2 = 312
# OOD_CONSTRAINT_EVALS_PTR: 8 * 2 = 16
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this say:

# OOD_TRACE_CURRENT_PTR: (71 + 7) * 2 = 156
# OOD_TRACE_NEXT_PTR: (71 + 7) * 2 = 156
# OOD_CONSTRAINT_EVALS_PTR: 8 * 2 = 16

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Missed updating these, thanks, fixed now

@@ -141,7 +140,7 @@ export.verify
# VI) Evaluate the constraints over the OOD frame and assert equality with H(z)
#==============================================================================================

# TODO: Compare with the evaluation of the constraints on the EvaluationFrame
# Compare with the evaluation of the constraints on the trace columns OOD evaluation frame.
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the TDDO stay here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We usually remove todos when we have open issues tracking them. Re-added it now.

push.0x020407
## field extension degree || FRI folding factor || FRI remainder polynomial max degree || blowup factor
push.0x02040708
# => [PROOF_OPTIONS, MODULUS1, MODULUS0, TRACE_INFO, trace_length, num_queries, blowup, grinding, ...]
Copy link
Contributor

Choose a reason for hiding this comment

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

MODULUS1 and MODULUS0 are single elements, right? If so, these should be modulus1, modulus0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good point, fixed

@Al-Kindi-0 Al-Kindi-0 force-pushed the al-update-recursive-verifier-after-horner-eval branch 2 times, most recently from a547563 to 34d4a9d Compare March 9, 2025 12:22
Copy link
Contributor

@plafer plafer left a comment

Choose a reason for hiding this comment

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

LGTM! (assuming we merge after we update the Cargo.toml with the new miden-crypto release)

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.

3 participants