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

Feat(field): add mersenne31 field #623

Closed
wants to merge 0 commits into from

Conversation

PatStiles
Copy link
Collaborator

Add Mersenne31 Field

Description

Re-opens pr #565 addressing #540 due to merge issues.

Implements the following:

  • Mersenne31 Field based on Plonky3
  • Its complex field extension and its respective quadratic, and cubic field extension
  • Unit tests for the field
  • Differential fuzzing against Plonky3

TODO:

  • Unit test for the complex extension
  • Unit test for the complex quadratic extension
  • Unit test for the complex cubic extension
  • Fuzz test for the field extensions

Type of change

Please delete options that are not relevant.

  • New feature

Checklist

  • Linked to Github Issue
  • Unit tests added
  • This change is an Optimization
    • Benchmarks added/run

@PatStiles PatStiles requested review from schouhy, ajgara and a team as code owners October 22, 2023 08:59
@codecov-commenter
Copy link

codecov-commenter commented Oct 22, 2023

Codecov Report

Merging #623 (731921e) into main (6d686d3) will decrease coverage by 0.16%.
The diff coverage is 88.75%.

@@            Coverage Diff             @@
##             main     #623      +/-   ##
==========================================
- Coverage   97.11%   96.96%   -0.16%     
==========================================
  Files         114      117       +3     
  Lines       26540    27029     +489     
==========================================
+ Hits        25775    26209     +434     
- Misses        765      820      +55     
Files Coverage Δ
math/src/field/fields/mersenne31/field.rs 96.51% <96.51%> (ø)
...elds/fft_friendly/u64_mersenne_montgomery_field.rs 0.00% <0.00%> (ø)
math/src/field/fields/mersenne31/extension.rs 83.95% <83.95%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more


#[inline(never)]
#[no_mangle]
#[export_name = "util::rand_mersenne31_field_elements"]
Copy link
Contributor

Choose a reason for hiding this comment

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

The [no_mangle] and other stuff is not necessary. Changes are similar to those in the PR for MiniGoldilocks

if *a == Self::zero() || *a == MERSENNE_31_PRIME_FIELD_ORDER {
return Err(FieldError::InvZeroError);
}
let p101 = Self::mul(&Self::pow(a, 4u32), a);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are doing powers of 2, it could be good at some time to implement a special version of pow to avoid the square and multiply steps

@PatStiles PatStiles closed this Nov 6, 2023
@PatStiles PatStiles mentioned this pull request Nov 6, 2023
1 task
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.

4 participants