Implement ff traits for bls12_381 and jubjub crates#227
Conversation
Codecov Report
@@ Coverage Diff @@
## master #227 +/- ##
===========================================
- Coverage 65.43% 35.09% -30.35%
===========================================
Files 105 94 -11
Lines 14936 11325 -3611
===========================================
- Hits 9774 3974 -5800
- Misses 5162 7351 +2189
Continue to review full report at Codecov.
|
|
I've addressed most comments in #228. Once that PR has been reviewed and merged, I'll rebase this PR to remove the now-unnecessary parts, and implement |
|
Rebased on master after merging #228. |
|
The first commit in this PR is also in #230; I'll rebase whichever PR is not merged first. |
|
Rebased on master now that #230 has been merged. |
|
Rebased the PR; it now only implements the |
| 0x73ed_a753_299d_7d48, | ||
| ]); | ||
|
|
||
| const MODULUS_BYTES: [u8; 32] = [ |
There was a problem hiding this comment.
Say what byte order this is in (maybe include it in the name).
There was a problem hiding this comment.
Also consider renaming Scalar::from_bytes to from_le_bytes.
There was a problem hiding this comment.
Note that this value is only used later in the PrimeField impl, where the constant is defined to be little endian by the implementation, so this property is documented and accounted for.
| /// Attempts to convert a little-endian byte representation of | ||
| /// Attempts to convert a big-endian byte representation of | ||
| /// a scalar into an `Fp`, failing if the input is not canonical. | ||
| pub fn from_bytes(bytes: &[u8; 48]) -> CtOption<Fp> { |
There was a problem hiding this comment.
Consider naming this from_be_bytes.
There was a problem hiding this comment.
I'd personally rather not; it implies a little-endian scalar encoding would also be correct and supported (rather than big-endian being canonical for Fp), and that way lies madness.
| 0x0e7d_b4ea_6533_afa9, | ||
| ]); | ||
|
|
||
| const MODULUS_BYTES: [u8; 32] = [ |
There was a problem hiding this comment.
Say what byte order this is in (maybe include it in the name).
There was a problem hiding this comment.
Also consider renaming Fr::from_bytes to from_le_bytes.
There was a problem hiding this comment.
See the other comment; the same holds here.
…-randomness Derive vote share randomness deterministically via Blake2b PRF, bound to VAN (ZCA-41)
Closes #160 and #166.