Move sc-client into sc-service (#5502)

* Drop client from sc-network and sc-client-db, move LongestChain to sc-client-api

* move leaves, cht, in_mem to sc-client-api, drop client from sc-finality-grandpa

* drop sc-service from sc-rpc

* drop sc-service from sc-consensus-aura

* drop sc-client from manual-seal and babe

* drop sc-client from utils/frame/rpc/system and utils/frame/benchmarking-cli

* drop sc-client from bin/node and bin/node-template

* drop sc-client

* fix tests

* remove check -p sc-client from gitlab.yml

* fix warnings

* fixes ui test

* fix light client tests

* adds associated Client type to AbstractService

* adds UsageProvider to Client

* fixed ui test, again

* tried and failed to get node-cli to compile for wasm

* thanks to tomaka for helping me get node-cli to compile for wasmm

* ui test pls pas 🙏🏾

* all tests passing 🪄

* no_run documentation code

* rm -f documentation code

* ClientProvider

* fix mega trait

* move LongestChain to sc-consensus, use adds minimal bounds to AbstractService::Client

* adds license to sc-consensus

Co-authored-by: Benjamin Kampmann <ben@parity.io>
This commit is contained in:
Seun Lanlege
2020-04-28 12:59:31 +01:00
committed by GitHub
parent 7784bdeffe
commit 4fa5941f44
87 changed files with 3937 additions and 3575 deletions
@@ -16,7 +16,7 @@
//! Client extension for tests.
use sc_client::{self, Client};
use sc_service::client::Client;
use sc_client_api::backend::Finalizer;
use sp_consensus::{
BlockImportParams, BlockImport, BlockOrigin, Error as ConsensusError,
@@ -64,7 +64,7 @@ pub trait ClientBlockImportExt<Block: BlockT>: Sized {
impl<B, E, RA, Block> ClientExt<Block> for Client<B, E, Block, RA>
where
B: sc_client_api::backend::Backend<Block>,
E: sc_client::CallExecutor<Block> + 'static,
E: sc_client_api::CallExecutor<Block> + 'static,
Self: BlockImport<Block, Error = ConsensusError>,
Block: BlockT,
{
+13 -13
View File
@@ -20,7 +20,6 @@
pub mod client_ext;
pub use sc_client::{blockchain, self};
pub use sc_client_api::{
execution_extensions::{ExecutionStrategies, ExecutionExtensions},
ForkBlocks, BadBlocks, CloneableSpawn,
@@ -36,16 +35,17 @@ pub use sp_keyring::{
pub use sp_core::{traits::BareCryptoStorePtr, tasks::executor as tasks_executor};
pub use sp_runtime::{Storage, StorageChild};
pub use sp_state_machine::ExecutionStrategy;
pub use sc_service::client;
pub use self::client_ext::{ClientExt, ClientBlockImportExt};
use std::sync::Arc;
use std::collections::HashMap;
use sp_core::storage::ChildInfo;
use sp_runtime::traits::{Block as BlockT, BlakeTwo256};
use sc_client::LocalCallExecutor;
use sc_service::client::{LocalCallExecutor, ClientConfig};
/// Test client light database backend.
pub type LightBackend<Block> = sc_client::light::backend::Backend<
pub type LightBackend<Block> = client::light::backend::Backend<
sc_client_db::light::LightStorage<Block>,
BlakeTwo256,
>;
@@ -175,15 +175,15 @@ impl<Block: BlockT, Executor, Backend, G: GenesisInit> TestClientBuilder<Block,
self,
executor: Executor,
) -> (
sc_client::Client<
client::Client<
Backend,
Executor,
Block,
RuntimeApi,
>,
sc_client::LongestChain<Backend, Block>,
sc_consensus::LongestChain<Backend, Block>,
) where
Executor: sc_client::CallExecutor<Block> + 'static,
Executor: sc_client_api::CallExecutor<Block> + 'static,
Backend: sc_client_api::backend::Backend<Block>,
{
let storage = {
@@ -203,7 +203,7 @@ impl<Block: BlockT, Executor, Backend, G: GenesisInit> TestClientBuilder<Block,
storage
};
let client = sc_client::Client::new(
let client = client::Client::new(
self.backend.clone(),
executor,
&storage,
@@ -214,10 +214,10 @@ impl<Block: BlockT, Executor, Backend, G: GenesisInit> TestClientBuilder<Block,
self.keystore.clone(),
),
None,
sc_client::ClientConfig::default(),
ClientConfig::default(),
).expect("Creates new client");
let longest_chain = sc_client::LongestChain::new(self.backend);
let longest_chain = sc_consensus::LongestChain::new(self.backend);
(client, longest_chain)
}
@@ -225,7 +225,7 @@ impl<Block: BlockT, Executor, Backend, G: GenesisInit> TestClientBuilder<Block,
impl<Block: BlockT, E, Backend, G: GenesisInit> TestClientBuilder<
Block,
sc_client::LocalCallExecutor<Backend, NativeExecutor<E>>,
client::LocalCallExecutor<Backend, NativeExecutor<E>>,
Backend,
G,
> {
@@ -234,13 +234,13 @@ impl<Block: BlockT, E, Backend, G: GenesisInit> TestClientBuilder<
self,
executor: I,
) -> (
sc_client::Client<
client::Client<
Backend,
sc_client::LocalCallExecutor<Backend, NativeExecutor<E>>,
client::LocalCallExecutor<Backend, NativeExecutor<E>>,
Block,
RuntimeApi
>,
sc_client::LongestChain<Backend, Block>,
sc_consensus::LongestChain<Backend, Block>,
) where
I: Into<Option<NativeExecutor<E>>>,
E: sc_executor::NativeExecutionDispatch + 'static,