Remove unused key types sr25 and ed25 (#3659)

* Remove unused key types sr25 and ed25.

* Restore in specific files to fix build.

* Fix runtime tests

* Fix keystore test

* Revert typo

* Move keytypes to primitives/src/testing.rs

* More missed items.

* Getting close now.

* Fix example in documentation.

* Update core/application-crypto/src/ed25519.rs

* Update core/application-crypto/src/sr25519.rs

* Bump impl version.
This commit is contained in:
Joshy Orndorff
2019-09-20 20:48:03 -08:00
committed by Gavin Wood
parent c25d7386cf
commit 210290f8ca
9 changed files with 60 additions and 33 deletions
@@ -21,7 +21,7 @@ use crate::{RuntimePublic, KeyTypeId};
pub use primitives::ed25519::*;
mod app {
use crate::key_types::ED25519;
use primitives::testing::ED25519;
crate::app_crypto!(super, ED25519);
}
@@ -53,7 +53,14 @@ impl RuntimePublic for Public {
#[cfg(test)]
mod tests {
use sr_primitives::{generic::BlockId, traits::ProvideRuntimeApi};
use primitives::{testing::KeyStore, crypto::Pair, traits::BareCryptoStore as _};
use primitives::{
testing::{
KeyStore,
ED25519,
},
crypto::Pair,
traits::BareCryptoStore as _,
};
use test_client::{
TestClientBuilder, DefaultTestClientBuilderExt, TestClientBuilderExt,
runtime::{TestAPI, app_crypto::ed25519::{AppPair, AppPublic}},
@@ -67,7 +74,7 @@ mod tests {
.test_ed25519_crypto(&BlockId::Number(0))
.expect("Tests `ed25519` crypto.");
let key_pair = keystore.read().ed25519_key_pair(crate::key_types::ED25519, &public.as_ref())
let key_pair = keystore.read().ed25519_key_pair(ED25519, &public.as_ref())
.expect("There should be at a `ed25519` key in the keystore for the given public key.");
assert!(AppPair::verify(&signature, "ed25519", &AppPublic::from(key_pair.public())));
@@ -21,7 +21,7 @@ use crate::{RuntimePublic, KeyTypeId};
pub use primitives::sr25519::*;
mod app {
use crate::key_types::SR25519;
use primitives::testing::SR25519;
crate::app_crypto!(super, SR25519);
}
@@ -53,7 +53,14 @@ impl RuntimePublic for Public {
#[cfg(test)]
mod tests {
use sr_primitives::{generic::BlockId, traits::ProvideRuntimeApi};
use primitives::{testing::KeyStore, crypto::Pair, traits::BareCryptoStore as _};
use primitives::{
testing::{
KeyStore,
SR25519,
},
crypto::Pair,
traits::BareCryptoStore as _,
};
use test_client::{
TestClientBuilder, DefaultTestClientBuilderExt, TestClientBuilderExt,
runtime::{TestAPI, app_crypto::sr25519::{AppPair, AppPublic}},
@@ -67,7 +74,7 @@ mod tests {
.test_sr25519_crypto(&BlockId::Number(0))
.expect("Tests `sr25519` crypto.");
let key_pair = keystore.read().sr25519_key_pair(crate::key_types::SR25519, public.as_ref())
let key_pair = keystore.read().sr25519_key_pair(SR25519, public.as_ref())
.expect("There should be at a `sr25519` key in the keystore for the given public key.");
assert!(AppPair::verify(&signature, "sr25519", &AppPublic::from(key_pair.public())));