-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[Fix] Square root #2049
[Fix] Square root #2049
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
59429b5
to
2e4926b
Compare
e304c9d
to
23763ac
Compare
assert_eq!((88514, 130701, 83646), assignment.num_nonzeros()); | ||
assert_eq!(55698, assignment.num_private()); | ||
assert_eq!(55761, assignment.num_constraints()); | ||
assert_eq!((90368, 132045, 84980), assignment.num_nonzeros()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pushes us to the next power of two here (2^18, as opposed to 2^17)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch, I didn't notice that, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've addressed the imbalance with this PR:
This PR fixes a non-determinism issue in the square root circuit by ensuring that that result is less than (p - 1)/2, where p is the field modulus.
Note: this PR affects the
elligator2::encode
circuit. If determinism is not needed, we should consider adding asquare_root_unchecked
circuit.This PR depends on #2072