-
Notifications
You must be signed in to change notification settings - Fork 112
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
verify_cell_kzg_proof_batch()
: Abstract commitment to interpolation poly
#494
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.
That's a good idea! Thanks.
Left two comments.
); | ||
|
||
// Mark the cell as being used | ||
is_cell_used[index] = true; |
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.
As this PR only moved this, this is a comment that probably should be addressed in a separate PR:
We set is_cell_used
at indices which are not a multiple of FIELD_ELEMENTS_PER_CELL
, but only read it at multiples of FIELD_ELEMENTS_PER_CELL
.
This seems unnecessary. Why not just set is_cell_used[cell_indices[i]] = true
in the outer loop and making the is_cell_used
array smaller?
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 point. Let's handle this on another PR.
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. Thanks!
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! Thank you both :)
After a bunch of failed attempts to simplify
verify_cell_kzg_proof_batch()
, I found a good spot to apply a scalpel.This refactoring is fairly clean and moves away four allocations from the main function into a smaller contained function.
The first commit only moves code (can be verified with
git diff --color-moved
) while the second applies a few minor changes.There is a few more minor improvements that can be done, but they all have drawbacks. This seems quite clean IMO.