-
Notifications
You must be signed in to change notification settings - Fork 305
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
Remove restriction to binary-only multiplicities #1577
Remove restriction to binary-only multiplicities #1577
Conversation
Btw, why does starky lack tests? |
We have an open issue for it (#1514). All tests were specific to the zkEVM and migrated to the new repo. I agree this definitely needs some more testing. I have pinged the person who assigned themselves this task but no answer yet. |
Related to testing, have you tested this? Haven't reviewed yet but it's failing on our integration tests there https://github.com/0xPolygonZero/zk_evm/tree/develop. |
I ran all the tests in the plonky2 repository. I'm still running tests elsewhere. Thanks for pointing to your other repository, I'll try to run those tests, too. Update: the I'll see about making you a fix quickly. |
Here's your fix to make |
ee8a8ff
to
51746e2
Compare
I already have a branch working with main. But moving deps to your current branch gives me an quotient polynomial evaluation error. |
51746e2
to
1d60d98
Compare
Thanks. I found the bug. I cleaned up the code a bit while fixing the bug.
|
1d60d98
to
26b7e7a
Compare
let (first_col, first_filter) = cols_filts.next().unwrap(); | ||
|
||
let mut filter_col = Vec::with_capacity(degree); | ||
let first_combined = (0..degree) |
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 removed the duplication of logic here, and replaced it with a single call to reduce
further down.
@@ -761,79 +761,35 @@ pub(crate) fn get_helper_cols<F: Field>( | |||
.len() | |||
.div_ceil(constraint_degree.checked_sub(1).unwrap_or(1)); | |||
|
|||
let mut helper_columns = Vec::with_capacity(num_helper_columns); |
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.
Iterators in Rust have a size hint, so collect
automatically does what we were trying to do manually via with_capacity
here.
For things touching |
// Dummy value. Cannot be zero since it will be batch-inverted. | ||
F::ONE | ||
} | ||
let mut combined = F::batch_multiplicative_inverse(&combined); |
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.
If I remember correctly, the reason why the previous code did not use batch_multiplicative_inverse
(and was therefore more complicated). was because the filter column is often (not always!) sparse, so we wanted to avoid inverting a lot of values that would be later zeroed out. However, I am not sure how much of an impact it would actually have, and this code does look much nicer!
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.
Yes, though the code in main already uses batch multiplicative inverse.
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'm good with this
Please feel free to merge when you are ready. |
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.
LGTM too
This is a simpler PR to prepare the ground for #1575