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 Falcon verification to use horner_eval_base #1661

Merged
merged 6 commits into from
Mar 3, 2025

Conversation

Al-Kindi-0
Copy link
Collaborator

As the title says. The current cycle count is around 57500 cycles.

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! Great job 👏

Left a few nits

#[test]
fn test_falcon512_probabilistic_product_failure() {
// Create a polynomial pi that is not equal to h * s2.
// create a polynomial pi that is not equal to h * s2.
Copy link
Contributor

Choose a reason for hiding this comment

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

The random_coefficients use rng - can we either fix a seed, or generate those coefficients deterministically?

Comment on lines 179 to 186
adv_push.2
dup.1 dup.1 ext2inv
push.0.0
loc_storew.4
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can we add the state of the stack after this block?

@@ -218,182 +207,83 @@ export.load_h_s2_and_product.4
push.M u32lt assert
push.M u32lt assert

horner_eval_base
Copy link
Contributor

Choose a reason for hiding this comment

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

can we also add some comments for the state of the stack in this loop? It's quite hard to follow

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.

I ran the miden-base tests on top of this branch, and I'm getting some NotU32 errors (for example, with the scripts::p2id::prove_consume_multiple_notes test).

Would be good to make sure the bus works fine too after we fix those (and #1664 might be useful if there's a bug there)

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.

My bad, miden-base reimplements the dsa::falcon_sign method which was updated in this PR. After updating it, all tests pass.

I also confirmed that the bus is fixed with this PR, which confirms the findings of #1664 that rcombbase was the problem.

@Al-Kindi-0 Al-Kindi-0 force-pushed the al-introduce-horner-eval-ops branch from cec1812 to 6fcd075 Compare February 24, 2025 08:27
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 left a few comments inline - most are pretty small.

@bobbinth
Copy link
Contributor

One other thing, before merging this PR we'd need to update miden-base to make sure the advice state value generation for the Falcon signature works similar to what we have here now, right?

@Al-Kindi-0 Al-Kindi-0 force-pushed the al-introduce-horner-eval-ops branch from 6fcd075 to 3402f34 Compare February 24, 2025 08:44
Base automatically changed from al-introduce-horner-eval-ops to next February 24, 2025 08:58
@Al-Kindi-0
Copy link
Collaborator Author

One other thing, before merging this PR we'd need to update miden-base to make sure the advice state value generation for the Falcon signature works similar to what we have here now, right?

Indeed, we have now changed how and what advice is provided for the signature.

@Al-Kindi-0 Al-Kindi-0 force-pushed the al-update-falcon-with-horner branch 2 times, most recently from 66cfab3 to 4c3f3a4 Compare February 24, 2025 14:16
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 left some more comments inline - these are mostly doc-related.

Also, would you mind making a parallel PR in miden-base?

@Al-Kindi-0
Copy link
Collaborator Author

Also, would you mind making a parallel PR in miden-base?

Sure thing, will open one soon

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 left one small comment inline. After it is addressed, let's merge.

Comment on lines 14 to 16
/// 1. The challenge point at which we evaluate the three aforementioned polynomials to check the
/// product relationship.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure the word "aforementioned" is correct here. Also, I would specify that the challenge point is 2 field 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.

Indeed, this was from the previous order of the bullet points. Changed it now and updated the comment.

@Al-Kindi-0 Al-Kindi-0 force-pushed the al-update-falcon-with-horner branch from 7e72ef6 to 1b82170 Compare March 3, 2025 07:03
@Al-Kindi-0 Al-Kindi-0 force-pushed the al-update-falcon-with-horner branch from 1b82170 to 0891f41 Compare March 3, 2025 07:04
@Al-Kindi-0 Al-Kindi-0 merged commit ec532b1 into next Mar 3, 2025
9 checks passed
@Al-Kindi-0 Al-Kindi-0 deleted the al-update-falcon-with-horner branch March 3, 2025 07:17
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