mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 03:01:07 +00:00
[big refactor] Remove crate aliasing. (#4395)
* Rename: Phase 1. * Unify codec. * Fixing: Phase 2 * Fixing: Phase 3. * Fixing: Phase 4. * Fixing: Phase 5. * Fixing: Phase 6. * Fixing: Phase 7. * Fixing: Phase 8. Tests * Fixing: Phase 9. Tests!!! * Fixing: Phase 10. Moar tests! * Finally done! * More fixes. * Rename primitives:: to sp_core:: * Apply renames in finality-grandpa. * Fix benches. * Fix benches 2. * Revert node-template. * Fix frame-system in our modules.
This commit is contained in:
committed by
Gavin Wood
parent
f14d98a439
commit
8778ca7dc8
@@ -22,7 +22,7 @@ mod tests;
|
||||
use std::{sync::Arc, convert::TryInto};
|
||||
use log::warn;
|
||||
|
||||
use client::Client;
|
||||
use sc_client::Client;
|
||||
use sp_blockchain::Error as ClientError;
|
||||
|
||||
use rpc::futures::{
|
||||
@@ -31,20 +31,20 @@ use rpc::futures::{
|
||||
};
|
||||
use futures::{StreamExt as _, compat::Compat};
|
||||
use futures::future::{ready, FutureExt, TryFutureExt};
|
||||
use api::Subscriptions;
|
||||
use sc_rpc_api::Subscriptions;
|
||||
use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId};
|
||||
use codec::{Encode, Decode};
|
||||
use primitives::{Bytes, Blake2Hasher, H256, traits::BareCryptoStorePtr};
|
||||
use sp_core::{Bytes, Blake2Hasher, H256, traits::BareCryptoStorePtr};
|
||||
use sp_api::ConstructRuntimeApi;
|
||||
use sp_runtime::{generic, traits::{self, ProvideRuntimeApi}};
|
||||
use txpool_api::{
|
||||
use sp_transaction_pool::{
|
||||
TransactionPool, InPoolTransaction, TransactionStatus,
|
||||
BlockHash, TxHash, TransactionFor, error::IntoPoolError,
|
||||
};
|
||||
use session::SessionKeys;
|
||||
use sp_session::SessionKeys;
|
||||
|
||||
/// Re-export the API for backward compatibility.
|
||||
pub use api::author::*;
|
||||
pub use sc_rpc_api::author::*;
|
||||
use self::error::{Error, FutureResult, Result};
|
||||
|
||||
/// Authoring API
|
||||
@@ -78,8 +78,8 @@ impl<B, E, P, Block: traits::Block, RA> Author<B, E, P, Block, RA> {
|
||||
|
||||
impl<B, E, P, Block, RA> AuthorApi<Block::Hash, Block::Hash> for Author<B, E, P, Block, RA> where
|
||||
Block: traits::Block<Hash=H256>,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: client_api::CallExecutor<Block, Blake2Hasher> + Clone + Send + Sync + 'static,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: sc_client_api::CallExecutor<Block, Blake2Hasher> + Clone + Send + Sync + 'static,
|
||||
P: TransactionPool<Block=Block, Hash=Block::Hash> + Sync + Send + 'static,
|
||||
RA: ConstructRuntimeApi<Block, Client<B, E, Block, RA>> + Send + Sync + 'static,
|
||||
Client<B, E, Block, RA>: ProvideRuntimeApi,
|
||||
|
||||
@@ -19,16 +19,16 @@ use super::*;
|
||||
use std::sync::Arc;
|
||||
use assert_matches::assert_matches;
|
||||
use codec::Encode;
|
||||
use primitives::{
|
||||
use sp_core::{
|
||||
H256, blake2_256, hexdisplay::HexDisplay, testing::{ED25519, SR25519, KeyStore}, traits::BareCryptoStorePtr, ed25519,
|
||||
crypto::Pair,
|
||||
};
|
||||
use rpc::futures::Stream as _;
|
||||
use test_client::{
|
||||
use substrate_test_runtime_client::{
|
||||
self, AccountKeyring, runtime::{Extrinsic, Transfer, SessionKeys, RuntimeApi, Block},
|
||||
DefaultTestClientBuilderExt, TestClientBuilderExt, Backend, Client, Executor,
|
||||
};
|
||||
use txpool::{BasicPool, FullChainApi};
|
||||
use sc_transaction_pool::{BasicPool, FullChainApi};
|
||||
use tokio::runtime;
|
||||
|
||||
fn uxt(sender: AccountKeyring, nonce: u64) -> Extrinsic {
|
||||
@@ -56,7 +56,7 @@ struct TestSetup {
|
||||
impl Default for TestSetup {
|
||||
fn default() -> Self {
|
||||
let keystore = KeyStore::new();
|
||||
let client = Arc::new(test_client::TestClientBuilder::new().set_keystore(keystore.clone()).build());
|
||||
let client = Arc::new(substrate_test_runtime_client::TestClientBuilder::new().set_keystore(keystore.clone()).build());
|
||||
let pool = Arc::new(BasicPool::new(Default::default(), FullChainApi::new(client.clone())));
|
||||
TestSetup {
|
||||
runtime: runtime::Runtime::new().expect("Failed to create runtime in test setup"),
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
use std::sync::Arc;
|
||||
use rpc::futures::future::result;
|
||||
|
||||
use api::Subscriptions;
|
||||
use client_api::{CallExecutor, backend::Backend};
|
||||
use client::Client;
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
use sc_rpc_api::Subscriptions;
|
||||
use sc_client_api::{CallExecutor, backend::Backend};
|
||||
use sc_client::Client;
|
||||
use sp_core::{H256, Blake2Hasher};
|
||||
use sp_runtime::{
|
||||
generic::{BlockId, SignedBlock},
|
||||
traits::{Block as BlockT},
|
||||
|
||||
@@ -20,15 +20,15 @@ use std::sync::Arc;
|
||||
use futures::{future::ready, FutureExt, TryFutureExt};
|
||||
use rpc::futures::future::{result, Future, Either};
|
||||
|
||||
use api::Subscriptions;
|
||||
use client::{
|
||||
use sc_rpc_api::Subscriptions;
|
||||
use sc_client::{
|
||||
self, Client,
|
||||
light::{
|
||||
fetcher::{Fetcher, RemoteBodyRequest},
|
||||
blockchain::RemoteBlockchain,
|
||||
},
|
||||
};
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
use sp_core::{H256, Blake2Hasher};
|
||||
use sp_runtime::{
|
||||
generic::{BlockId, SignedBlock},
|
||||
traits::{Block as BlockT},
|
||||
@@ -68,8 +68,8 @@ impl<B, E, Block: BlockT, RA, F: Fetcher<Block>> LightChain<B, E, Block, RA, F>
|
||||
|
||||
impl<B, E, Block, RA, F> ChainBackend<B, E, Block, RA> for LightChain<B, E, Block, RA, F> where
|
||||
Block: BlockT<Hash=H256> + 'static,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: sc_client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
RA: Send + Sync + 'static,
|
||||
F: Fetcher<Block> + Send + Sync + 'static,
|
||||
{
|
||||
@@ -85,7 +85,7 @@ impl<B, E, Block, RA, F> ChainBackend<B, E, Block, RA> for LightChain<B, E, Bloc
|
||||
let hash = self.unwrap_or_best(hash);
|
||||
|
||||
let fetcher = self.fetcher.clone();
|
||||
let maybe_header = client::light::blockchain::future_header(
|
||||
let maybe_header = sc_client::light::blockchain::future_header(
|
||||
&*self.remote_blockchain,
|
||||
&*fetcher,
|
||||
BlockId::Hash(hash),
|
||||
|
||||
@@ -30,14 +30,14 @@ use rpc::{
|
||||
futures::{stream, Future, Sink, Stream},
|
||||
};
|
||||
|
||||
use api::Subscriptions;
|
||||
use client::{
|
||||
use sc_rpc_api::Subscriptions;
|
||||
use sc_client::{
|
||||
self, Client, BlockchainEvents,
|
||||
light::{fetcher::Fetcher, blockchain::RemoteBlockchain},
|
||||
};
|
||||
use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId};
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
use rpc_primitives::{number::NumberOrHex, list::ListOrValue};
|
||||
use sp_core::{H256, Blake2Hasher};
|
||||
use sp_rpc::{number::NumberOrHex, list::ListOrValue};
|
||||
use sp_runtime::{
|
||||
generic::{BlockId, SignedBlock},
|
||||
traits::{Block as BlockT, Header, NumberFor},
|
||||
@@ -45,14 +45,14 @@ use sp_runtime::{
|
||||
|
||||
use self::error::{Result, Error, FutureResult};
|
||||
|
||||
pub use api::chain::*;
|
||||
pub use sc_rpc_api::chain::*;
|
||||
|
||||
/// Blockchain backend API
|
||||
trait ChainBackend<B, E, Block: BlockT, RA>: Send + Sync + 'static
|
||||
where
|
||||
Block: BlockT<Hash=H256> + 'static,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: sc_client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
{
|
||||
/// Get client reference.
|
||||
fn client(&self) -> &Arc<Client<B, E, Block, RA>>;
|
||||
@@ -156,8 +156,8 @@ pub fn new_full<B, E, Block: BlockT, RA>(
|
||||
) -> Chain<B, E, Block, RA>
|
||||
where
|
||||
Block: BlockT<Hash=H256> + 'static,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static + Clone,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: sc_client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static + Clone,
|
||||
RA: Send + Sync + 'static,
|
||||
{
|
||||
Chain {
|
||||
@@ -174,8 +174,8 @@ pub fn new_light<B, E, Block: BlockT, RA, F: Fetcher<Block>>(
|
||||
) -> Chain<B, E, Block, RA>
|
||||
where
|
||||
Block: BlockT<Hash=H256> + 'static,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static + Clone,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: sc_client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static + Clone,
|
||||
RA: Send + Sync + 'static,
|
||||
F: Send + Sync + 'static,
|
||||
{
|
||||
@@ -196,8 +196,8 @@ pub struct Chain<B, E, Block: BlockT, RA> {
|
||||
|
||||
impl<B, E, Block, RA> ChainApi<NumberFor<Block>, Block::Hash, Block::Header, SignedBlock<Block>> for Chain<B, E, Block, RA> where
|
||||
Block: BlockT<Hash=H256> + 'static,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: sc_client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
RA: Send + Sync + 'static
|
||||
{
|
||||
type Metadata = crate::metadata::Metadata;
|
||||
@@ -256,8 +256,8 @@ fn subscribe_headers<B, E, Block, RA, F, G, S, ERR>(
|
||||
stream: F,
|
||||
) where
|
||||
Block: BlockT<Hash=H256> + 'static,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: sc_client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
F: FnOnce() -> S,
|
||||
G: FnOnce() -> Block::Hash,
|
||||
ERR: ::std::fmt::Debug,
|
||||
|
||||
@@ -16,19 +16,19 @@
|
||||
|
||||
use super::*;
|
||||
use assert_matches::assert_matches;
|
||||
use test_client::{
|
||||
use substrate_test_runtime_client::{
|
||||
prelude::*,
|
||||
consensus::BlockOrigin,
|
||||
sp_consensus::BlockOrigin,
|
||||
runtime::{H256, Block, Header},
|
||||
};
|
||||
use rpc_primitives::list::ListOrValue;
|
||||
use sp_rpc::list::ListOrValue;
|
||||
|
||||
#[test]
|
||||
fn should_return_header() {
|
||||
let core = ::tokio::runtime::Runtime::new().unwrap();
|
||||
let remote = core.executor();
|
||||
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let api = new_full(client.clone(), Subscriptions::new(Arc::new(remote)));
|
||||
|
||||
assert_matches!(
|
||||
@@ -64,7 +64,7 @@ fn should_return_a_block() {
|
||||
let core = ::tokio::runtime::Runtime::new().unwrap();
|
||||
let remote = core.executor();
|
||||
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let api = new_full(client.clone(), Subscriptions::new(Arc::new(remote)));
|
||||
|
||||
let block = client.new_block(Default::default()).unwrap().bake().unwrap();
|
||||
@@ -116,7 +116,7 @@ fn should_return_block_hash() {
|
||||
let core = ::tokio::runtime::Runtime::new().unwrap();
|
||||
let remote = core.executor();
|
||||
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let api = new_full(client.clone(), Subscriptions::new(Arc::new(remote)));
|
||||
|
||||
assert_matches!(
|
||||
@@ -147,7 +147,7 @@ fn should_return_block_hash() {
|
||||
Ok(ListOrValue::Value(Some(ref x))) if x == &block.hash()
|
||||
);
|
||||
assert_matches!(
|
||||
api.block_hash(Some(ListOrValue::Value(primitives::U256::from(1u64).into())).into()),
|
||||
api.block_hash(Some(ListOrValue::Value(sp_core::U256::from(1u64).into())).into()),
|
||||
Ok(ListOrValue::Value(Some(ref x))) if x == &block.hash()
|
||||
);
|
||||
|
||||
@@ -163,7 +163,7 @@ fn should_return_finalized_hash() {
|
||||
let core = ::tokio::runtime::Runtime::new().unwrap();
|
||||
let remote = core.executor();
|
||||
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let api = new_full(client.clone(), Subscriptions::new(Arc::new(remote)));
|
||||
|
||||
assert_matches!(
|
||||
@@ -195,7 +195,7 @@ fn should_notify_about_latest_block() {
|
||||
let (subscriber, id, transport) = Subscriber::new_test("test");
|
||||
|
||||
{
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let api = new_full(client.clone(), Subscriptions::new(Arc::new(remote)));
|
||||
|
||||
api.subscribe_new_heads(Default::default(), subscriber);
|
||||
@@ -224,7 +224,7 @@ fn should_notify_about_finalized_block() {
|
||||
let (subscriber, id, transport) = Subscriber::new_test("test");
|
||||
|
||||
{
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let api = new_full(client.clone(), Subscriptions::new(Arc::new(remote)));
|
||||
|
||||
api.subscribe_finalized_heads(Default::default(), subscriber);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
mod metadata;
|
||||
|
||||
pub use api::Subscriptions;
|
||||
pub use sc_rpc_api::Subscriptions;
|
||||
pub use self::metadata::Metadata;
|
||||
pub use rpc::IoHandlerExtension as RpcExtension;
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ use std::sync::Arc;
|
||||
use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId};
|
||||
use rpc::{Result as RpcResult, futures::Future};
|
||||
|
||||
use api::Subscriptions;
|
||||
use client::{Client, CallExecutor, light::{blockchain::RemoteBlockchain, fetcher::Fetcher}};
|
||||
use primitives::{
|
||||
use sc_rpc_api::Subscriptions;
|
||||
use sc_client::{Client, CallExecutor, light::{blockchain::RemoteBlockchain, fetcher::Fetcher}};
|
||||
use sp_core::{
|
||||
Blake2Hasher, Bytes, H256,
|
||||
storage::{StorageKey, StorageData, StorageChangeSet},
|
||||
};
|
||||
use runtime_version::RuntimeVersion;
|
||||
use sp_version::RuntimeVersion;
|
||||
use sp_runtime::{
|
||||
traits::{Block as BlockT, ProvideRuntimeApi},
|
||||
};
|
||||
@@ -41,14 +41,14 @@ use sp_api::Metadata;
|
||||
|
||||
use self::error::{Error, FutureResult};
|
||||
|
||||
pub use api::state::*;
|
||||
pub use sc_rpc_api::state::*;
|
||||
|
||||
/// State backend API.
|
||||
pub trait StateBackend<B, E, Block: BlockT, RA>: Send + Sync + 'static
|
||||
where
|
||||
Block: BlockT<Hash=H256> + 'static,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: sc_client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
RA: Send + Sync + 'static,
|
||||
{
|
||||
/// Call runtime method at given block.
|
||||
@@ -187,7 +187,7 @@ pub fn new_full<B, E, Block: BlockT, RA>(
|
||||
) -> State<B, E, Block, RA>
|
||||
where
|
||||
Block: BlockT<Hash=H256> + 'static,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static + Clone,
|
||||
RA: Send + Sync + 'static,
|
||||
Client<B, E, Block, RA>: ProvideRuntimeApi,
|
||||
@@ -208,7 +208,7 @@ pub fn new_light<B, E, Block: BlockT, RA, F: Fetcher<Block>>(
|
||||
) -> State<B, E, Block, RA>
|
||||
where
|
||||
Block: BlockT<Hash=H256> + 'static,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static + Clone,
|
||||
RA: Send + Sync + 'static,
|
||||
F: Send + Sync + 'static,
|
||||
@@ -231,7 +231,7 @@ pub struct State<B, E, Block, RA> {
|
||||
impl<B, E, Block, RA> StateApi<Block::Hash> for State<B, E, Block, RA>
|
||||
where
|
||||
Block: BlockT<Hash=H256> + 'static,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static + Clone,
|
||||
RA: Send + Sync + 'static,
|
||||
{
|
||||
|
||||
@@ -27,20 +27,20 @@ use rpc::{
|
||||
futures::{stream, Future, Sink, Stream, future::result},
|
||||
};
|
||||
|
||||
use api::Subscriptions;
|
||||
use client_api::backend::Backend;
|
||||
use sc_rpc_api::Subscriptions;
|
||||
use sc_client_api::backend::Backend;
|
||||
use sp_blockchain::{
|
||||
Result as ClientResult, Error as ClientError, HeaderMetadata, CachedHeaderMetadata
|
||||
};
|
||||
use client::{
|
||||
Client, CallExecutor, BlockchainEvents,
|
||||
use sc_client::{
|
||||
Client, CallExecutor, BlockchainEvents,
|
||||
};
|
||||
use primitives::{
|
||||
use sp_core::{
|
||||
H256, Blake2Hasher, Bytes,
|
||||
storage::{well_known_keys, StorageKey, StorageData, StorageChangeSet, ChildInfo},
|
||||
};
|
||||
use runtime_version::RuntimeVersion;
|
||||
use state_machine::ExecutionStrategy;
|
||||
use sp_version::RuntimeVersion;
|
||||
use sp_state_machine::ExecutionStrategy;
|
||||
use sp_runtime::{
|
||||
generic::BlockId,
|
||||
traits::{Block as BlockT, NumberFor, ProvideRuntimeApi, SaturatedConversion},
|
||||
|
||||
@@ -38,21 +38,21 @@ use rpc::{
|
||||
futures::stream::Stream,
|
||||
};
|
||||
|
||||
use api::Subscriptions;
|
||||
use client_api::backend::Backend;
|
||||
use sc_rpc_api::Subscriptions;
|
||||
use sc_client_api::backend::Backend;
|
||||
use sp_blockchain::Error as ClientError;
|
||||
use client::{
|
||||
use sc_client::{
|
||||
BlockchainEvents, Client, CallExecutor,
|
||||
light::{
|
||||
blockchain::{future_header, RemoteBlockchain},
|
||||
fetcher::{Fetcher, RemoteCallRequest, RemoteReadRequest, RemoteReadChildRequest},
|
||||
},
|
||||
};
|
||||
use primitives::{
|
||||
use sp_core::{
|
||||
H256, Blake2Hasher, Bytes, OpaqueMetadata,
|
||||
storage::{StorageKey, StorageData, StorageChangeSet},
|
||||
};
|
||||
use runtime_version::RuntimeVersion;
|
||||
use sp_version::RuntimeVersion;
|
||||
use sp_runtime::{
|
||||
generic::BlockId,
|
||||
traits::Block as BlockT,
|
||||
@@ -711,7 +711,7 @@ fn ignore_error<F, T>(future: F) -> impl std::future::Future<Output=Result<Optio
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use rpc::futures::stream::futures_ordered;
|
||||
use test_client::runtime::Block;
|
||||
use substrate_test_runtime_client::runtime::Block;
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -21,12 +21,12 @@ use self::error::Error;
|
||||
use std::sync::Arc;
|
||||
use assert_matches::assert_matches;
|
||||
use futures01::stream::Stream;
|
||||
use primitives::storage::{well_known_keys, ChildInfo};
|
||||
use primitives::hash::H256;
|
||||
use sp_core::storage::{well_known_keys, ChildInfo};
|
||||
use sp_core::hash::H256;
|
||||
use sp_io::hashing::blake2_256;
|
||||
use test_client::{
|
||||
use substrate_test_runtime_client::{
|
||||
prelude::*,
|
||||
consensus::BlockOrigin,
|
||||
sp_consensus::BlockOrigin,
|
||||
runtime,
|
||||
};
|
||||
|
||||
@@ -80,7 +80,7 @@ fn should_return_child_storage() {
|
||||
let (child_info, child_type) = CHILD_INFO.info();
|
||||
let child_info = StorageKey(child_info.to_vec());
|
||||
let core = tokio::runtime::Runtime::new().unwrap();
|
||||
let client = Arc::new(test_client::TestClientBuilder::new()
|
||||
let client = Arc::new(substrate_test_runtime_client::TestClientBuilder::new()
|
||||
.add_child_storage("test", "key", CHILD_INFO, vec![42_u8])
|
||||
.build());
|
||||
let genesis_hash = client.genesis_hash();
|
||||
@@ -126,7 +126,7 @@ fn should_return_child_storage() {
|
||||
#[test]
|
||||
fn should_call_contract() {
|
||||
let core = tokio::runtime::Runtime::new().unwrap();
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let genesis_hash = client.genesis_hash();
|
||||
let client = new_full(client, Subscriptions::new(Arc::new(core.executor())));
|
||||
|
||||
@@ -143,7 +143,7 @@ fn should_notify_about_storage_changes() {
|
||||
let (subscriber, id, transport) = Subscriber::new_test("test");
|
||||
|
||||
{
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let api = new_full(client.clone(), Subscriptions::new(Arc::new(remote)));
|
||||
|
||||
api.subscribe_storage(Default::default(), subscriber, None.into());
|
||||
@@ -175,7 +175,7 @@ fn should_send_initial_storage_changes_and_notifications() {
|
||||
let (subscriber, id, transport) = Subscriber::new_test("test");
|
||||
|
||||
{
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let api = new_full(client.clone(), Subscriptions::new(Arc::new(remote)));
|
||||
|
||||
let alice_balance_key = blake2_256(&runtime::system::balance_of_key(AccountKeyring::Alice.into()));
|
||||
@@ -360,7 +360,7 @@ fn should_query_storage() {
|
||||
|
||||
// Both hashes invalid.
|
||||
let result = api.query_storage(
|
||||
keys.clone(),
|
||||
keys.clone(),
|
||||
random_hash1,
|
||||
Some(random_hash2),
|
||||
);
|
||||
@@ -375,7 +375,7 @@ fn should_query_storage() {
|
||||
);
|
||||
}
|
||||
|
||||
run_tests(Arc::new(test_client::new()));
|
||||
run_tests(Arc::new(substrate_test_runtime_client::new()));
|
||||
run_tests(Arc::new(TestClientBuilder::new().set_support_changes_trie(true).build()));
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ fn should_split_ranges() {
|
||||
fn should_return_runtime_version() {
|
||||
let core = tokio::runtime::Runtime::new().unwrap();
|
||||
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let api = new_full(client.clone(), Subscriptions::new(Arc::new(core.executor())));
|
||||
|
||||
let result = "{\"specName\":\"test\",\"implName\":\"parity-test\",\"authoringVersion\":1,\
|
||||
@@ -416,7 +416,7 @@ fn should_notify_on_runtime_version_initially() {
|
||||
let (subscriber, id, transport) = Subscriber::new_test("test");
|
||||
|
||||
{
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let api = new_full(client.clone(), Subscriptions::new(Arc::new(core.executor())));
|
||||
|
||||
api.subscribe_runtime_version(Default::default(), subscriber);
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
mod tests;
|
||||
|
||||
use futures::{channel::{mpsc, oneshot}, compat::Compat};
|
||||
use api::Receiver;
|
||||
use sc_rpc_api::Receiver;
|
||||
use sp_runtime::traits::{self, Header as HeaderT};
|
||||
use self::error::Result;
|
||||
|
||||
pub use api::system::*;
|
||||
pub use sc_rpc_api::system::*;
|
||||
pub use self::helpers::{Properties, SystemInfo, Health, PeerInfo, NodeRole};
|
||||
pub use self::gen_client::Client as SystemClient;
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
use super::*;
|
||||
|
||||
use network::{self, PeerId};
|
||||
use network::config::Roles;
|
||||
use test_client::runtime::Block;
|
||||
use sc_network::{self, PeerId};
|
||||
use sc_network::config::Roles;
|
||||
use substrate_test_runtime_client::runtime::Block;
|
||||
use assert_matches::assert_matches;
|
||||
use futures::{prelude::*, channel::mpsc};
|
||||
use std::thread;
|
||||
@@ -69,7 +69,7 @@ fn api<T: Into<Option<Status>>>(sync: T) -> System<Block> {
|
||||
let _ = sender.send(peers);
|
||||
}
|
||||
Request::NetworkState(sender) => {
|
||||
let _ = sender.send(serde_json::to_value(&network::NetworkState {
|
||||
let _ = sender.send(serde_json::to_value(&sc_network::NetworkState {
|
||||
peer_id: String::new(),
|
||||
listened_addresses: Default::default(),
|
||||
external_addresses: Default::default(),
|
||||
@@ -211,8 +211,8 @@ fn system_peers() {
|
||||
fn system_network_state() {
|
||||
let res = wait_receiver(api(None).system_network_state());
|
||||
assert_eq!(
|
||||
serde_json::from_value::<network::NetworkState>(res).unwrap(),
|
||||
network::NetworkState {
|
||||
serde_json::from_value::<sc_network::NetworkState>(res).unwrap(),
|
||||
sc_network::NetworkState {
|
||||
peer_id: String::new(),
|
||||
listened_addresses: Default::default(),
|
||||
external_addresses: Default::default(),
|
||||
|
||||
Reference in New Issue
Block a user