-
Notifications
You must be signed in to change notification settings - Fork 256
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
Implement group and pairing traits for bls12_381 and jubjub crates #245
Conversation
dc2acd8
to
2e062a7
Compare
Codecov Report
@@ Coverage Diff @@
## master #245 +/- ##
==========================================
- Coverage 66.73% 65.03% -1.70%
==========================================
Files 117 117
Lines 16192 16623 +431
==========================================
+ Hits 10805 10811 +6
- Misses 5387 5812 +425
Continue to review full report at Codecov.
|
79d95bf
to
1c4faf9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking style comments/questions; I don't know how to verify the correctness of the actual group operations, but they look like what I'd expect.
bls12_381/src/g2.rs
Outdated
} | ||
} | ||
|
||
impl Sum for G2Subgroup { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having seen this implementation duplicated a few times now, could it just be done via a blanket trait with constraints on Add and Identity? Or, is there a Monoid trait that combines the two? In Haskell we have this in the standard library:
Prelude> :t Data.Foldable.fold
Data.Foldable.fold :: (Foldable t, Monoid m) => t m -> m
jubjub/src/lib.rs
Outdated
} | ||
} | ||
|
||
impl<'r> Sum<&'r ExtendedPoint> for ExtendedPoint { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can't use a blanket trait for these, we should at least make a macro for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already a set of common macros that are planned to be extracted out; we can do this at the same time.
1c4faf9
to
f39f8d1
Compare
Okay, I think that (aside from specifying the full-group generators for G1 and G2) this is ready for review. Best reviewed by-commit. |
f39f8d1
to
b1e6f8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to check a few things, otherwise utACK.
0x0000_0000_0000_0000, | ||
0x0000_0000_0000_0000, | ||
0x0000_0000_0000_0000, | ||
]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daira should check that this is the canonical point as defined that generates the whole group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed find_curve_generator()
and it looks correct to me. This doesn't check that the point arithmetic or Montgomery conversion is done correctly, but it's enough to satisfy me.
b1e6f8a
to
3a72f08
Compare
Force-pushed to address some of @daira's comments. Per my responses above, I think they are all addressed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
Closes #163. Closes #167. Closes #169.