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

update 2-adic generator to 0x64fdd1a46201e246 #1579

Merged
merged 2 commits into from
Apr 26, 2024

Conversation

benediamond
Copy link
Contributor

  • this is a first step towards addressing FFT with 2^48 as the primitive root #850. note that 0x64fdd1a46201e246^(2^30) == 0x1000000000000 holds modulo p, as desired. we don't actually change the FFT in this PR; but this paves the way for that as a future change.
  • both Hermez and Miden already currently use this new generator.

upon changing the main 2^32nd root of unity of Goldilocks, a few auxiliary values also need to change. these include:

  • the multiplicative generator here. this is a generator of Goldilocks' entire multiplicative group of units, which moreover "lifts" the main 2-adic generator above in the sense that MULTIPLICATIVE_GROUP_GENERATOR^((p - 1) / 2^32) == POWER_OF_TWO_GENERATOR holds. this isn't too hard to construct; essentially, it amounts to finding a multiplicative generator of $\mathbb{F}_p^*$'s order-(p - 1) / 2^32 subgroup, which is not hard.
  • in the extension fields, we need to do something analogous, but for 2-adic generators. for example, in the quadratic extension of Goldilocks given by X^2 - 7, we now get 2^33-order 2-adicity; the value EXT_POWER_OF_TWO_GENERATOR needs to be a primitive 2^33nd root of unity which moreover lifts POWER_OF_TWO_GENERATOR, in the sense that EXT_POWER_OF_TWO_GENERATOR^2 = POWER_OF_TWO_GENERATOR. this is a bit tricky to do; we were able to construct this efficiently using essentially a Pohlig–Hellman-type idea.
  • Finally, this 2-adic generator itself also needs to be lifted to a full multiplicative generator EXT_MULTIPLICATIVE_GROUP_GENERATOR of $\mathbb{F}_{p^2}^*$, i.e., so that EXT_MULTIPLICATIVE_GROUP_GENERATOR^((p^2 - 1) / 2^33) == EXT_POWER_OF_TWO_GENERATOR holds.

we also need to do something analogous for the quartic and quintic extensions.

this necesstitates that we also change the various lifts of the two-adic generator; i.e. the lifts to mult. generators of the _entire_ field, as well as the lifts to 2-adic generators of the various extension fields.
Copy link
Collaborator

@Nashtare Nashtare left a comment

Choose a reason for hiding this comment

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

LGTM, but I'd hold off merging this into main until we have reached a decision regarding version bump. As @dlubarov pointed out we may need to bump the major version for once, as this would be a hard proof backwards incompatibility.

@muursh
Copy link
Contributor

muursh commented Apr 24, 2024

Yeah I'd agree that we'd want a major version bump for this

@Nashtare Nashtare merged commit c4fbd3a into 0xPolygonZero:main Apr 26, 2024
4 checks passed
hratoanina pushed a commit that referenced this pull request Jul 16, 2024
* update 2-adic generator to `0x64fdd1a46201e246`

this necesstitates that we also change the various lifts of the two-adic generator; i.e. the lifts to mult. generators of the _entire_ field, as well as the lifts to 2-adic generators of the various extension fields.

* cargo fmt

---------

Co-authored-by: Benjamin Diamond <bdiamond@ulvetanna.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants