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

Field generator macros #154

Merged
merged 5 commits into from
Jun 17, 2024

Conversation

kilic
Copy link
Collaborator

@kilic kilic commented Apr 25, 2024

This PR adds field generator macros and as a result removes many duplicates. There is an important breaking change that it now wraps all field representations for example as ReprFq([u8; SIZE]).

Also it will help to add new fields and thus new curves. For example base field for BLS12-381 which has 6 limbs internal representation can be added as:

impl_field!(
    bls12381_scalar,
    Fp,
    modulus = "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",
    mul_gen = "2",
    zeta = "1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac",
    from_uniform = [96],
);

@kilic kilic force-pushed the field-gen-macro branch 2 times, most recently from ce1512f to 84edae1 Compare May 13, 2024 22:54
@kilic kilic force-pushed the field-gen-macro branch from bb5d509 to b6b05d5 Compare May 25, 2024 13:58
Copy link
Contributor

@davidnevadoc davidnevadoc left a comment

Choose a reason for hiding this comment

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

Finished first pass and left some comments.
Looking amazing so far :)

derive/src/field/mod.rs Show resolved Hide resolved
src/derive/field/tower.rs Outdated Show resolved Hide resolved
src/derive/field/tower.rs Outdated Show resolved Hide resolved
src/bn256/fq2.rs Outdated Show resolved Hide resolved
@kilic kilic mentioned this pull request May 30, 2024
Copy link
Contributor

@davidnevadoc davidnevadoc left a comment

Choose a reason for hiding this comment

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

LGTM! Good job 🎉
Left some minor comments, but I think this can be merged.
Since it is such a big change, I wouldn't mind having an extra review though.

derive/src/field/arith.rs Show resolved Hide resolved
derive/src/field/arith.rs Show resolved Hide resolved
derive/src/field/asm/limb4.rs Show resolved Hide resolved
src/pluto_eris/fp12.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@han0110 han0110 left a comment

Choose a reason for hiding this comment

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

LGTM! Nice rework! Just left some small suggestions.

derive/src/field/mod.rs Show resolved Hide resolved
derive/src/field/mod.rs Show resolved Hide resolved
src/derive/field/tower.rs Outdated Show resolved Hide resolved
calculate extension field zeta in compile time

bring back some removed comments
@davidnevadoc davidnevadoc added this pull request to the merge queue Jun 17, 2024
Merged via the queue into privacy-scaling-explorations:main with commit 6abfdbb Jun 17, 2024
12 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