-
Notifications
You must be signed in to change notification settings - Fork 66
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(frost-core): simplify trait bounds, don't use the allocator in some places #810
base: main
Are you sure you want to change the base?
feat(frost-core): simplify trait bounds, don't use the allocator in some places #810
Conversation
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.
This looks good, but since it's a breaking change (in the SemVer sense, any Ciphersuite implementor will need to implement the additional traits) it will have to wait until we're ready to release 3.0.0.
I think the Copy
bounds are not needed?
@@ -37,7 +37,7 @@ pub trait Field: Copy + Clone { | |||
+ Sub<Output = Self::Scalar>; | |||
|
|||
/// A unique byte array buf of fixed length N. | |||
type Serialization: AsRef<[u8]> + Debug + TryFrom<Vec<u8>>; | |||
type Serialization: Copy + AsRef<[u8]> + AsMut<[u8]> + for<'a> TryFrom<&'a [u8]> + Debug; |
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.
type Serialization: Copy + AsRef<[u8]> + AsMut<[u8]> + for<'a> TryFrom<&'a [u8]> + Debug; | |
type Serialization: AsRef<[u8]> + AsMut<[u8]> + for<'a> TryFrom<&'a [u8]> + Debug; |
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 also need Copy
for my DKG implementation with encryption. Maybe we could reduce it to Clone
instead of Copy
(to also be compatible with types like Vec<u8>
)?
@@ -102,7 +102,7 @@ pub trait Group: Copy + Clone + PartialEq { | |||
/// A unique byte array buf of fixed length N. | |||
/// | |||
/// Little-endian! | |||
type Serialization: AsRef<[u8]> + Debug + TryFrom<Vec<u8>>; | |||
type Serialization: Copy + AsRef<[u8]> + AsMut<[u8]> + for<'a> TryFrom<&'a [u8]> + Debug; |
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.
type Serialization: Copy + AsRef<[u8]> + AsMut<[u8]> + for<'a> TryFrom<&'a [u8]> + Debug; | |
type Serialization: AsRef<[u8]> + AsMut<[u8]> + for<'a> TryFrom<&'a [u8]> + Debug; |
type SignatureSerialization: Copy | ||
+ AsRef<[u8]> | ||
+ AsMut<[u8]> | ||
+ for<'a> TryFrom<&'a [u8]> | ||
+ Debug; |
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.
type SignatureSerialization: Copy | |
+ AsRef<[u8]> | |
+ AsMut<[u8]> | |
+ for<'a> TryFrom<&'a [u8]> | |
+ Debug; | |
type SignatureSerialization: AsRef<[u8]> | |
+ AsMut<[u8]> | |
+ for<'a> TryFrom<&'a [u8]> | |
+ Debug; |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #810 +/- ##
==========================================
+ Coverage 82.18% 82.45% +0.26%
==========================================
Files 31 41 +10
Lines 3188 4331 +1143
==========================================
+ Hits 2620 3571 +951
- Misses 568 760 +192 ☔ View full report in Codecov by Sentry. |
@conradoplg I disagree, since implementations of |
@conradoplg After some reseach about SemVer, I was only able to find 1 place where my PR breaks it: https://github.com/penumbra-zone/penumbra/blob/0e3d7966e3ff34bf74d7721a97848567f345e364/crates/crypto/decaf377-frost/src/traits.rs#L87. |
Resolves #807
@conradoplg We discussed this earlier. This will also allow to encrypt
Serialization
for the 2nd round of DKG (without allocation). I haven't added+ Default
yet as that would break the API, but I think even this implementation will be enough.