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

Add Stark101 tutorial's prime field #875

Merged
merged 5 commits into from
Oct 1, 2024
Merged

Conversation

erhant
Copy link
Contributor

@erhant erhant commented Jun 19, 2024

Add Stark101 Prime Field

Description

I have been implementing the Stark101 tutorial using LambdaWorks (see here), and I had implemented the field used within the tutorial.

The prime field order is 3 * 2^30 + 1, which is FFT-friendly, however I cant implement the IsFFTFriendly trait for this custom field because the custom field is constructed as shown below:

#[derive(Clone, Debug, Hash, Copy, Serialize, Deserialize)]
pub struct MontgomeryConfigStark101PrimeField;
impl IsModulus<U64> for MontgomeryConfigStark101PrimeField {
    const MODULUS: U64 = U64::from_hex_unchecked("c0000001");
}

pub type Stark101PrimeField = U64PrimeField<MontgomeryConfigStark101PrimeField>;

which means that Stark101PrimeField is an alias of the U64PrimeField which does not belong to my crate, therefore I cant implement IsFFTFriendly (which also does not belong to my crate) to it.

The solution is therefore to add the field directly to LambdaWorks itself, and use it.

Note

Although it is ok to use the non-FFT interpolation for the tutorial, which is used for interpolating over 1024 elements, I think its nice that we have the opportunity to use FFT as well. If not, one can complete the tutorial by implementing the field themselves.

Type of change

  • New feature: Added Stark101 prime field

Checklist

  • Linked to Github Issue
  • Unit tests added
  • This change requires new documentation.
    • Documentation has been added/updated.
  • This change is an Optimization
    • Benchmarks added/run

@erhant erhant requested a review from a team as a code owner June 19, 2024 22:07
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 83.63636% with 9 lines in your changes missing coverage. Please review.

Project coverage is 73.23%. Comparing base (eb14150) to head (b22b619).

Files with missing lines Patch % Lines
...field/fields/fft_friendly/stark_101_prime_field.rs 83.63% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #875      +/-   ##
==========================================
+ Coverage   73.22%   73.23%   +0.01%     
==========================================
  Files         154      155       +1     
  Lines       35165    35220      +55     
==========================================
+ Hits        25750    25795      +45     
- Misses       9415     9425      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@diegokingston diegokingston added this pull request to the merge queue Oct 1, 2024
Merged via the queue into lambdaclass:main with commit 9617e52 Oct 1, 2024
7 of 8 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.

4 participants