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

verify_cell_kzg_proof_batch(): Abstract commitment to interpolation poly #494

Merged
merged 9 commits into from
Aug 16, 2024

Conversation

asn-d6
Copy link
Contributor

@asn-d6 asn-d6 commented Aug 16, 2024

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.

src/eip7594/eip7594.c Outdated Show resolved Hide resolved
src/eip7594/eip7594.c Outdated Show resolved Hide resolved
src/eip7594/eip7594.c Outdated Show resolved Hide resolved
src/eip7594/eip7594.c Outdated Show resolved Hide resolved
src/eip7594/eip7594.c Outdated Show resolved Hide resolved
src/eip7594/eip7594.c Outdated Show resolved Hide resolved
src/eip7594/eip7594.c Outdated Show resolved Hide resolved
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.

That's a good idea! Thanks.
Left two comments.

);

// Mark the cell as being used
is_cell_used[index] = true;
Copy link
Contributor

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?

Copy link
Contributor Author

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.

src/eip7594/eip7594.c Outdated Show resolved Hide resolved
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

@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! Thank you both :)

@jtraglia jtraglia merged commit 65e39fe into ethereum:main Aug 16, 2024
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants