Skip to content
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

EIP7594: Universal Verification in verify_cell_kzg_proof_batch #3812

Merged
merged 11 commits into from
Jun 28, 2024

Conversation

b-wagn
Copy link
Contributor

@b-wagn b-wagn commented Jun 21, 2024

Summary

This PR adds an implementation of the universal verification equation for verifying multiple cell KZG proofs.
Before, the spec recommended to use the universal verification equation in a comment, but the code specified verifying proofs individually.

The following has been changed:

  • improved tests for verify_cell_kzg_proof_batch
  • added a function verify_cell_kzg_proof_batch_impl that is called by verify_cell_kzg_proof_batch
  • added a function coset_shift_for_cell to get the shift that specifies a coset
  • added a function verify_cell_kzg_proof_batch_challenge to get the challenge used for random linear combination

Motivation

Arguably one of the most important if not the most important thing to do right in terms of security for PeerDAS is how to verify cell proofs. To me, it feels dangerous to leave it to the implementors to read the and implement it correctly, given that verification is that important. In other words, I don't believe it is a good idea (especially for verification) that we actively cause a gap between what is specified and what will be implemented.

I would be happy to hear your feedback before investing more time.

Notes

I did not implement the efficient way of computing the combined interpolation polynomial (Appendix of the blogpost) and instead used a fully equivalent naive way of doing this. The rationale behind this is that we do not want to make the spec to complicated. At the same time, the "random linear combination" part is important to have in the spec, as it is no longer fully equivalent to a naive implementation that verifies each proof individually. Concretely, it really changes the success probability of an adversary (by a negligible amount).

@hwwhww hwwhww added the EIP-7594 PeerDAS label Jun 24, 2024
@b-wagn b-wagn marked this pull request as ready for review June 24, 2024 19:38
Copy link
Member

@jtraglia jtraglia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really great start @b-wagn! This spec implementation is quite clear & easy to read. I support adding the universal verification to the spec for the same reasons you listed. While this was only a quick initial review, I only noticed small nits. And thanks so much for cleaning up @kevaundray's trailing whitespace 😄

The list of all commitments is provided in row_commitments_bytes.

This function implements the universal verification equation introduced here:
https://ethresear.ch/t/a-universal-verification-equation-for-data-availability-sampling/13240
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps let's link to the relevant func instead of the blog post here. The main func should link to the blog post.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by relevant func in this context?

Sure, I will add the link to the blog post to verify_cell_kzg_proof_batch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant to say that we are currently linking to the ethresearch post three times throughout the file. Perhaps we should only link once. Maybe this is the right function doc to do so, and we should remove it from the other function docs. (Sorry for the confusion, I meant to add a comment in a different function doc.)

Copy link
Member

@jtraglia jtraglia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 thanks!

Copy link
Contributor

@asn-d6 asn-d6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work here! Thanks a lot!

Left a bunch of comments. Most of them are nitpicks that can be ignored.

I do think we should think a bit whether the concepts of k and k_i in the impl function and their connection to row_indices and column_indices can be clarified further.

The list of all commitments is provided in row_commitments_bytes.

This function implements the universal verification equation introduced here:
https://ethresear.ch/t/a-universal-verification-equation-for-data-availability-sampling/13240
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant to say that we are currently linking to the ethresearch post three times throughout the file. Perhaps we should only link once. Maybe this is the right function doc to do so, and we should remove it from the other function docs. (Sorry for the confusion, I meant to add a comment in a different function doc.)

specs/_features/eip7594/polynomial-commitments-sampling.md Outdated Show resolved Hide resolved
specs/_features/eip7594/polynomial-commitments-sampling.md Outdated Show resolved Hide resolved
Copy link
Contributor

@asn-d6 asn-d6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@asn-d6 asn-d6 merged commit 83da380 into ethereum:dev Jun 28, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EIP-7594 PeerDAS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants