-
Notifications
You must be signed in to change notification settings - Fork 36
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 poly degree 0 underflow #10
Conversation
Great work! I specially like the test case 💫 |
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.
The fix is correct.
Please treat my comments as suggestions.
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.
What do you think about running cargo clippy --fix
on the whole thing as well?
halo2_proofs/src/plonk/evaluation.rs
Outdated
let mut idx = 0; | ||
if degree != 0 { | ||
// same as unstable degree.ilog() | ||
idx = (degree as f32).log2().floor() as usize; |
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.
Good catch with the versioning.
I would prefer idx = (31 - (degree as u32).leading_zeros()) as usize
over introducing floating-point math.
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.
NP, let's back to the origin code :)
I guess it should be ok, let me try |
All CI & lint issues are addressed! |
substract underflow if poly's degree is 0, which happens if we have an empty/constant value gate.
Another issue is if I don't update the rust-toolchain to 1.66, I got: