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
+2 -2
View File
@@ -51,9 +51,9 @@ const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
#[serde(rename_all = "camelCase")]
pub struct Extensions {
/// Block numbers with known hashes.
pub fork_blocks: sc_client::ForkBlocks<Block>,
pub fork_blocks: sc_client_api::ForkBlocks<Block>,
/// Known bad block hashes.
pub bad_blocks: sc_client::BadBlocks<Block>,
pub bad_blocks: sc_client_api::BadBlocks<Block>,
}
/// Specialized `ChainSpec`.
+4 -41
View File
@@ -21,7 +21,6 @@
use std::sync::Arc;
use sc_consensus_babe;
use sc_client::{self, LongestChain};
use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider};
use node_executor;
use node_primitives::Block;
@@ -30,14 +29,7 @@ use sc_service::{
AbstractService, ServiceBuilder, config::Configuration, error::{Error as ServiceError},
};
use sp_inherents::InherentDataProviders;
use sc_service::{Service, NetworkStatus};
use sc_client::{Client, LocalCallExecutor};
use sc_client_db::Backend;
use sp_runtime::traits::Block as BlockT;
use node_executor::NativeExecutor;
use sc_network::NetworkService;
use sc_offchain::OffchainWorkers;
use sc_consensus::LongestChain;
/// Starts a `ServiceBuilder` for a full service.
///
@@ -54,7 +46,7 @@ macro_rules! new_full_start {
node_primitives::Block, node_runtime::RuntimeApi, node_executor::Executor
>($config)?
.with_select_chain(|_config, backend| {
Ok(sc_client::LongestChain::new(backend.clone()))
Ok(sc_consensus::LongestChain::new(backend.clone()))
})?
.with_transaction_pool(|config, client, _fetcher, prometheus_registry| {
let pool_api = sc_transaction_pool::FullChainApi::new(client.clone());
@@ -266,38 +258,9 @@ macro_rules! new_full {
}}
}
type ConcreteBlock = node_primitives::Block;
type ConcreteClient =
Client<
Backend<ConcreteBlock>,
LocalCallExecutor<Backend<ConcreteBlock>, NativeExecutor<node_executor::Executor>>,
ConcreteBlock,
node_runtime::RuntimeApi
>;
type ConcreteBackend = Backend<ConcreteBlock>;
type ConcreteTransactionPool = sc_transaction_pool::BasicPool<
sc_transaction_pool::FullChainApi<ConcreteClient, ConcreteBlock>,
ConcreteBlock
>;
/// Builds a new service for a full client.
pub fn new_full(config: Configuration)
-> Result<
Service<
ConcreteBlock,
ConcreteClient,
LongestChain<ConcreteBackend, ConcreteBlock>,
NetworkStatus<ConcreteBlock>,
NetworkService<ConcreteBlock, <ConcreteBlock as BlockT>::Hash>,
ConcreteTransactionPool,
OffchainWorkers<
ConcreteClient,
<ConcreteBackend as sc_client_api::backend::Backend<Block>>::OffchainStorage,
ConcreteBlock,
>
>,
ServiceError,
>
-> Result<impl AbstractService, ServiceError>
{
new_full!(config).map(|(service, _)| service)
}
@@ -416,7 +379,7 @@ mod tests {
use sp_core::ed25519::Pair;
use {service_test, Factory};
use sc_client::{BlockImportParams, BlockOrigin};
use sp_consensus::{BlockImportParams, BlockOrigin};
let alice: Arc<ed25519::Pair> = Arc::new(Keyring::Alice.into());
let bob: Arc<ed25519::Pair> = Arc::new(Keyring::Bob.into());