Fix tests compilation on master and remove warnings (#3525)

This commit is contained in:
Bastian Köcher
2019-09-01 15:17:17 +02:00
committed by GitHub
parent 607ee0a4e4
commit 06658e0c3c
3 changed files with 8 additions and 10 deletions
+1 -5
View File
@@ -28,10 +28,7 @@ use api::Subscriptions;
use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId};
use log::warn;
use codec::{Encode, Decode};
use primitives::{
Bytes, Blake2Hasher, H256, ed25519, sr25519, crypto::{Pair, Public, key_types},
traits::BareCryptoStorePtr,
};
use primitives::{Bytes, Blake2Hasher, H256, traits::BareCryptoStorePtr};
use sr_primitives::{generic, traits::{self, ProvideRuntimeApi}};
use transaction_pool::{
txpool::{
@@ -98,7 +95,6 @@ impl<B, E, P, RA> AuthorApi<ExHash<P>, BlockHash<P>> for Author<B, E, P, RA> whe
) -> Result<()> {
let key_type = key_type.as_str().try_into().map_err(|_| Error::BadKeyType)?;
let mut keystore = self.keystore.write();
let maybe_password = keystore.password();
keystore.insert_unknown(key_type, &suri, &public[..])
.map_err(|_| Error::KeyStoreUnavailable)?;
Ok(())
+2 -2
View File
@@ -26,7 +26,7 @@ use transaction_pool::{
use futures::Stream;
use primitives::{
H256, blake2_256, hexdisplay::HexDisplay, traits::BareCryptoStore, testing::KeyStore,
ed25519, crypto::key_types,
ed25519, crypto::{key_types, Pair},
};
use test_client::{
self, AccountKeyring, runtime::{Extrinsic, Transfer, SessionKeys}, DefaultTestClientBuilderExt,
@@ -238,4 +238,4 @@ fn should_rotate_keys() {
assert_eq!(session_keys.ed25519, ed25519_key_pair.public().into());
assert_eq!(session_keys.sr25519, sr25519_key_pair.public().into());
}
}
+5 -3
View File
@@ -36,7 +36,7 @@ fn should_return_storage() {
const STORAGE_KEY: &[u8] = b":child_storage:default:child";
const CHILD_VALUE: &[u8] = b"hello world !";
let core = tokio::runtime::Runtime::new().unwrap();
let mut core = tokio::runtime::Runtime::new().unwrap();
let client = TestClientBuilder::new()
.add_extra_storage(KEY.to_vec(), VALUE.to_vec())
.add_extra_child_storage(STORAGE_KEY.to_vec(), KEY.to_vec(), CHILD_VALUE.to_vec())
@@ -61,8 +61,10 @@ fn should_return_storage() {
VALUE.len(),
);
assert_eq!(
client.child_storage(storage_key, key, Some(genesis_hash).into())
.map(|x| x.map(|x| x.0.len())).unwrap().unwrap() as usize,
core.block_on(
client.child_storage(storage_key, key, Some(genesis_hash).into())
.map(|x| x.map(|x| x.0.len()))
).unwrap().unwrap() as usize,
CHILD_VALUE.len(),
);