-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[types, consensus, crypto] Converting validator_(verifier|signer) and…
… dependencies to the new API ## This diff modifies this behaviour: - **Makes `ValidatorSigner`, `ValidatorVerifier` and their dependencies use the new API,** + most of the changes are in `types/validator_(signer|verifier).rs`, the rest is propagation - Hides terms that should only be used in tests from our binaries, through conditional compilation + those are mostly `Clone` of `PrivateKey`s and `Arbitrary` impls, plus proptest strategies + this uses a `#[cfg(any(test, feature="testing")]` flag. `cfg(test)` works within-crate, `cfg(feature="testing")` helps transfer out-of-crate dependencies. + Introduces corresponding `"testing"` feature flag on a couple of lower crates (nextgen_crypto, types) so that you can import crates under a test context. - `Validator(Verifier|Signer)::random()`, and `ValidatorSigner::new()` constructor now take [optional arguments](http://xion.io/post/code/rust-optional-args.html) reflecting a default value. - creating a `ValidatorSigner` does not need the public key any more and deduces it from the private key at constructor call (and then stores it). - there's a compatibility `generate_keypair` for tests that has an optional pluggable rng argument with safe default, ## Why this is better: - **`Validator(Verifier|Signer)` are safer, cryptographically agile, and expose one single true signing API which implementation is managed in the crypto module, irrespective of scheme.** - random tests based on cryptographic material are deterministic (customizable rng with safe, set default) - Cloning of Private Keys now can't happen outside of tests - proptest-related terms and strategies do not bloat our binaries any more ## Why this is worse: - temporarily this reintroduces a bincode dependency (end of `ed25519::compat`) - there are ugly Legacy <-> Nextgen key material conversions, esp in `libra_node`, (parts of) `config`, `network` ## Future improvements: - pull `libra_node`, `config`, `network` into this brave `nextgen_crypto` new world - in this temporary state, Cloning of Private Keys still happen in tests — much can be removed ## TODO in next diffs: - make a few more structures generic in a private / public Key parameter, esp. NodeConfig
- Loading branch information
1 parent
23e8bb6
commit 44764e5
Showing
53 changed files
with
710 additions
and
452 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.