EIP4844: Handle barycentric evaluation at roots of unity #3214
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
evaluate_polynomial_in_evaluation_form()
used to panic if the input is a root of unity because it was only used with random inputs and it was extremely extremely unlikely that the input would be a root of unity.However, now we are exposing
compute_kzg_proof()
as a public function (which usesevaluate_polynomial_in_evaluation_form()
) and we don't want it to have such restrictions.This patch allows
evaluate_polynomial_in_evaluation_form()
to return the right answer without panicking. I also added unittests both for this edge case but also for the normal use of the barycentric formula.c-kzg-4844 already implements this behavior, but other libraries should do the same.