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

In batch cell verification, take commitment for each cell #3834

Merged
merged 13 commits into from
Jul 10, 2024

Conversation

jtraglia
Copy link
Member

@jtraglia jtraglia commented Jul 5, 2024

In verify_cell_kzg_proof_batch(), we used to take as input a list of deduplicated commitments. This PR changes it so that it takes as input all the commitments. This is done for UI reasons since it's more natural for clients who do batch verification across multiple sidecars, and also for security reasons because it forces us to validate all the received sidecar commitments.

Specifically, to verify all cells from column 0 and column 1 we would pass something like this to verify_cell_kzg_proof_batch():

Inputs:
row_commitments = {commitment1, commitment2, commitment3}
row_indices = {0,1,2,0,1,2}
column_indices = {0,0,0,1,1,1}
cells = {cell1, cell2, cell3, cell4, cell5, cell6}
proofs = {proof1, proof2, proof3, proof4, proof5, proof6}

whereas after this PR we would give inputs:

Inputs:
row_commitments = {commitment1, commitment2, commitment3, commitment1, commitment2, commitment3}
column_indices = {0,0,0,1,1,1}
cells = {cell1, cell2, cell3, cell4, cell5, cell6}
proofs = {proof1, proof2, proof3, proof4, proof5, proof6}

Keep in mind that the helper function verify_cell_kzg_proof_batch_impl() stays the same as before (using the old input format), and we have the public function verify_cell_kzg_proof_batch() move from the new input format to the old input format, by checking the commitments provided and recreating row_indices.

@jtraglia jtraglia added the EIP-7594 PeerDAS label Jul 5, 2024
@dankrad
Copy link
Contributor

dankrad commented Jul 8, 2024

This will make verification slower, right? If you know which commitments are duplicates, then the commitment MSM will be smaller.

@jtraglia
Copy link
Member Author

jtraglia commented Jul 8, 2024

This will make verification slower, right?

It shouldn't make much of a difference. The public method will create a set of commitments and indices to each. The core verification method (verify_cell_kzg_proof_batch_impl) still accepts row indices like before. So the MSM will be the exact same and potentially better as there's no longer the opportunity for unused commitments.

@asn-d6
Copy link
Contributor

asn-d6 commented Jul 9, 2024

Instead of doing a review, I pushed two commits as you suggested.
Please check them out and let me know what you think.

@asn-d6 asn-d6 force-pushed the cell-commitments branch from fbc508b to cbc30a9 Compare July 9, 2024 11:32
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!
Maybe we should see if @b-wagn can also review this?

Copy link
Contributor

@b-wagn b-wagn left a comment

Choose a reason for hiding this comment

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

LGTM, API change seems reasonable to me.

@jtraglia jtraglia merged commit 9a9fa96 into ethereum:dev Jul 10, 2024
26 of 27 checks passed
@jtraglia jtraglia deleted the cell-commitments branch July 10, 2024 15:41
@jimmygchen
Copy link
Contributor

Thanks @jtraglia @asn-d6 the change looks good to me!

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.

6 participants