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

Cleanup roots of unity in KZGSettings #467

Merged
merged 10 commits into from
Aug 5, 2024

Conversation

asn-d6
Copy link
Contributor

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

This PR makes some steps towards #439

Leftover things to do:

  • Completely remove max_width. This is not a variable field so it doesn't need to be in KZGSettings. It's a parameter of the system, and by having it as a variable it makes things more confusing. IMO we should just use FIELD_ELEMENTS_PER_EXT_BLOB directly where it's appropriate, and FIELD_ELEMENTS_PER_BLOB in FK20.
  • At some point we should stop this domain_size + 1 artifact stemming from expand_root_of_unity() since it's needless and confusing. I decided to not do it because it would also change the 4844 code and I would ideally like it to remain as it was.

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.

Thanks, that's a very important change.
I left some minor comments.

Also, I totally agree with removing domain_size / max_width.

src/common.h Outdated Show resolved Hide resolved
src/common.h Show resolved Hide resolved
src/common.h Show resolved Hide resolved
src/common.h Show resolved Hide resolved
src/common.h Outdated Show resolved Hide resolved
* It is the reversed version of `expanded_roots_of_unity`. Essentially:
* `reverse_roots_of_unity = reverse(expanded_roots_of_unity)`
*
* This array is primarily used in FFTs.
Copy link
Member

Choose a reason for hiding this comment

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

I don't feel that this remark adds all that much.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the python pseudocode in an attempt to highlight the difference between this and brp_roots_of_unity (both in terms of "reverse" vs "reverse-bit order" and in terms of excluding the last element).

With regards to "This array is primarily used in FFTs.", I was confused on why we need the reverse roots in the first place, so this would be useful to me, but I understand that it might be superfluous.

@asn-d6 asn-d6 merged commit 17cf3d5 into ethereum:main Aug 5, 2024
38 checks passed
@asn-d6
Copy link
Contributor Author

asn-d6 commented Aug 5, 2024

Thanks a lot for the help @jtraglia !

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