-
Notifications
You must be signed in to change notification settings - Fork 49
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
Remove field traits from behind std
feature flag
#26
Conversation
This enables the crate to be compiled without the tables, instead using a simple fallback for `SqrtRatio::sqrt_ratio`.
Now that we have a default implementation of `SqrtRatio::sqrt_ratio`, we can use it and `FieldExt` in no-std environments. We introduce an `alloc` feature flag to form a common feature dependency between `std` and `sqrt-table`. It is currently unused directly, but will be used after `CurveAffine` is refactored to remove the `std` dependency. Closes #25.
Codecov Report
@@ Coverage Diff @@
## main #26 +/- ##
==========================================
- Coverage 67.04% 66.29% -0.76%
==========================================
Files 10 11 +1
Lines 1408 1424 +16
==========================================
Hits 944 944
- Misses 464 480 +16
Continue to review full report at Codecov.
|
This removes a dependency on the `getrandom` crate in no-std mode, which doesn't work on some no-std targets that `getrandom` doesn't support.
@@ -21,6 +21,7 @@ and this project adheres to Rust's notion of | |||
- `FieldExt::from_u64` (use `From<u64> for ff::PrimeField` instead). | |||
- `FieldExt::{from_bytes, read, to_bytes, write}` | |||
(use `ff::PrimeField::{from_repr, to_repr}` instead). | |||
- `FieldExt::rand` (use `ff::Field::random` instead). | |||
|
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.
Document the changes to std
gating (also taking into account #28), and that the sqrt-table
feature controls whether the table-based sqrt implementation is used.
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.
We've not released a crate version with the std
feature flag, so to crate users they'll see the addition of no-std support. Agreed on documenting the new flags, but I'll do that in a separate PR once everything is stable.
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
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Closes #25.