mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 18:15:48 +00:00
Fix tests compilation on master and remove warnings (#3525)
This commit is contained in:
@@ -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(())
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -238,4 +238,4 @@ fn should_rotate_keys() {
|
|||||||
|
|
||||||
assert_eq!(session_keys.ed25519, ed25519_key_pair.public().into());
|
assert_eq!(session_keys.ed25519, ed25519_key_pair.public().into());
|
||||||
assert_eq!(session_keys.sr25519, sr25519_key_pair.public().into());
|
assert_eq!(session_keys.sr25519, sr25519_key_pair.public().into());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user