[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:
Tomasz Drwięga
2019-12-16 13:36:49 +01:00
committed by Gavin Wood
parent f14d98a439
commit 8778ca7dc8
485 changed files with 4023 additions and 4005 deletions
+4 -4
View File
@@ -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),
+15 -15
View File
@@ -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,
+10 -10
View File
@@ -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);