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

Compression for bls12381 #904

Merged
merged 10 commits into from
Sep 4, 2024
Merged

Compression for bls12381 #904

merged 10 commits into from
Sep 4, 2024

Conversation

lazcanoluca
Copy link
Contributor

@lazcanoluca lazcanoluca commented Sep 3, 2024

Port compression for BLS12381

Note: replaces #902

Description

Port compression for BLS12381 from lambdaworks_kzg.

The motivation for this PR is to introduce missing compression functionality for the BLS12381Curve, specifically, decompression for G1 and G2 points.

The changes included are:

  • Introduce the Compress trait, which defines compression and decompression for G1, and decompression for G2.
  • Implement the Compress trait for BLS12381Curve.
  • Adapt tests and benches that used the previous implementation for G1 compression.

Type of change

  • New feature
  • Refactor

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

@lazcanoluca lazcanoluca mentioned this pull request Sep 3, 2024
8 tasks
@codecov-commenter
Copy link

codecov-commenter commented Sep 3, 2024

Codecov Report

Attention: Patch coverage is 65.30612% with 34 lines in your changes missing coverage. Please review.

Project coverage is 72.75%. Comparing base (0c23464) to head (cb30ce3).

Files with missing lines Patch % Lines
.../short_weierstrass/curves/bls12_381/compression.rs 65.30% 34 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #904      +/-   ##
==========================================
- Coverage   72.83%   72.75%   -0.09%     
==========================================
  Files         150      150              
  Lines       34158    34196      +38     
==========================================
  Hits        24880    24880              
- Misses       9278     9316      +38     

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

@lazcanoluca lazcanoluca marked this pull request as ready for review September 3, 2024 15:21
@lazcanoluca lazcanoluca requested a review from a team as a code owner September 3, 2024 15:21
Copy link
Contributor

@pablodeymo pablodeymo left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -18,3 +19,16 @@ pub trait IsShortWeierstrass: IsEllipticCurve + Clone + Debug {
y.pow(2_u16) - x.pow(3_u16) - Self::a() * x - Self::b()
}
}

pub trait Compress {
Copy link
Contributor

@pablodeymo pablodeymo Sep 4, 2024

Choose a reason for hiding this comment

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

You could add some docs here explaining what is the purpose of this trait.

@diegokingston diegokingston added this pull request to the merge queue Sep 4, 2024
Merged via the queue into main with commit 3795dbc Sep 4, 2024
6 of 7 checks passed
@diegokingston diegokingston deleted the compression-bls12381 branch September 4, 2024 16:27
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