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 jsonrpc_pubsub::{typed::Subscriber, SubscriptionId};
use log::warn; use log::warn;
use codec::{Encode, Decode}; use codec::{Encode, Decode};
use primitives::{ use primitives::{Bytes, Blake2Hasher, H256, traits::BareCryptoStorePtr};
Bytes, Blake2Hasher, H256, ed25519, sr25519, crypto::{Pair, Public, key_types},
traits::BareCryptoStorePtr,
};
use sr_primitives::{generic, traits::{self, ProvideRuntimeApi}}; use sr_primitives::{generic, traits::{self, ProvideRuntimeApi}};
use transaction_pool::{ use transaction_pool::{
txpool::{ txpool::{
@@ -98,7 +95,6 @@ impl<B, E, P, RA> AuthorApi<ExHash<P>, BlockHash<P>> for Author<B, E, P, RA> whe
) -> Result<()> { ) -> Result<()> {
let key_type = key_type.as_str().try_into().map_err(|_| Error::BadKeyType)?; let key_type = key_type.as_str().try_into().map_err(|_| Error::BadKeyType)?;
let mut keystore = self.keystore.write(); let mut keystore = self.keystore.write();
let maybe_password = keystore.password();
keystore.insert_unknown(key_type, &suri, &public[..]) keystore.insert_unknown(key_type, &suri, &public[..])
.map_err(|_| Error::KeyStoreUnavailable)?; .map_err(|_| Error::KeyStoreUnavailable)?;
Ok(()) Ok(())
+1 -1
View File
@@ -26,7 +26,7 @@ use transaction_pool::{
use futures::Stream; use futures::Stream;
use primitives::{ use primitives::{
H256, blake2_256, hexdisplay::HexDisplay, traits::BareCryptoStore, testing::KeyStore, H256, blake2_256, hexdisplay::HexDisplay, traits::BareCryptoStore, testing::KeyStore,
ed25519, crypto::key_types, ed25519, crypto::{key_types, Pair},
}; };
use test_client::{ use test_client::{
self, AccountKeyring, runtime::{Extrinsic, Transfer, SessionKeys}, DefaultTestClientBuilderExt, self, AccountKeyring, runtime::{Extrinsic, Transfer, SessionKeys}, DefaultTestClientBuilderExt,
+5 -3
View File
@@ -36,7 +36,7 @@ fn should_return_storage() {
const STORAGE_KEY: &[u8] = b":child_storage:default:child"; const STORAGE_KEY: &[u8] = b":child_storage:default:child";
const CHILD_VALUE: &[u8] = b"hello world !"; 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() let client = TestClientBuilder::new()
.add_extra_storage(KEY.to_vec(), VALUE.to_vec()) .add_extra_storage(KEY.to_vec(), VALUE.to_vec())
.add_extra_child_storage(STORAGE_KEY.to_vec(), KEY.to_vec(), CHILD_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(), VALUE.len(),
); );
assert_eq!( assert_eq!(
client.child_storage(storage_key, key, Some(genesis_hash).into()) core.block_on(
.map(|x| x.map(|x| x.0.len())).unwrap().unwrap() as usize, 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(), CHILD_VALUE.len(),
); );