mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
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:
@@ -60,8 +60,8 @@ sp-transaction-pool = { version = "2.0.0-dev", path = "../../../primitives/trans
|
||||
|
||||
# client dependencies
|
||||
sc-client-api = { version = "2.0.0-dev", path = "../../../client/api" }
|
||||
sc-client = { version = "0.8.0-dev", path = "../../../client/" }
|
||||
sc-chain-spec = { version = "2.0.0-dev", path = "../../../client/chain-spec" }
|
||||
sc-consensus = { version = "0.8.0-dev", path = "../../../client/consensus/common" }
|
||||
sc-transaction-pool = { version = "2.0.0-dev", path = "../../../client/transaction-pool" }
|
||||
sc-network = { version = "0.8.0-dev", path = "../../../client/network" }
|
||||
sc-consensus-babe = { version = "0.8.0-dev", path = "../../../client/consensus/babe" }
|
||||
@@ -111,6 +111,7 @@ sc-service = { version = "0.8.0-dev", default-features = false, path = "../../..
|
||||
|
||||
[dev-dependencies]
|
||||
sc-keystore = { version = "2.0.0-dev", path = "../../../client/keystore" }
|
||||
sc-consensus = { version = "0.8.0-dev", path = "../../../client/consensus/common" }
|
||||
sc-consensus-babe = { version = "0.8.0-dev", features = ["test-helpers"], path = "../../../client/consensus/babe" }
|
||||
sc-consensus-epochs = { version = "0.8.0-dev", path = "../../../client/consensus/epochs" }
|
||||
sc-service-test = { version = "2.0.0-dev", path = "../../../client/service/test" }
|
||||
|
||||
@@ -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`.
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -11,7 +11,7 @@ repository = "https://github.com/paritytech/substrate/"
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
sc-client = { version = "0.8.0-dev", path = "../../../client/" }
|
||||
sc-client-api = { version = "2.0.0-dev", path = "../../../client/api" }
|
||||
jsonrpc-core = "14.0.3"
|
||||
node-primitives = { version = "2.0.0-dev", path = "../primitives" }
|
||||
node-runtime = { version = "2.0.0-dev", path = "../runtime" }
|
||||
|
||||
@@ -50,7 +50,7 @@ pub struct LightDeps<C, F, P> {
|
||||
/// Transaction pool instance.
|
||||
pub pool: Arc<P>,
|
||||
/// Remote access to the blockchain (async).
|
||||
pub remote_blockchain: Arc<dyn sc_client::light::blockchain::RemoteBlockchain<Block>>,
|
||||
pub remote_blockchain: Arc<dyn sc_client_api::light::RemoteBlockchain<Block>>,
|
||||
/// Fetcher instance.
|
||||
pub fetcher: Arc<F>,
|
||||
}
|
||||
@@ -135,9 +135,9 @@ pub fn create_full<C, P, M, SC>(
|
||||
pub fn create_light<C, P, M, F>(
|
||||
deps: LightDeps<C, F, P>,
|
||||
) -> jsonrpc_core::IoHandler<M> where
|
||||
C: sc_client::blockchain::HeaderBackend<Block>,
|
||||
C: sp_blockchain::HeaderBackend<Block>,
|
||||
C: Send + Sync + 'static,
|
||||
F: sc_client::light::fetcher::Fetcher<Block> + 'static,
|
||||
F: sc_client_api::light::Fetcher<Block> + 'static,
|
||||
P: TransactionPool + 'static,
|
||||
M: jsonrpc_core::Metadata + Default,
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
pallet-balances = { version = "2.0.0-dev", path = "../../../frame/balances" }
|
||||
sc-client = { version = "0.8.0-dev", path = "../../../client/" }
|
||||
sc-service = { version = "0.8.0-dev", features = ["test-helpers", "db"], path = "../../../client/service" }
|
||||
sc-client-db = { version = "0.8.0-dev", path = "../../../client/db/", features = ["kvdb-rocksdb", "parity-db"] }
|
||||
sc-client-api = { version = "2.0.0-dev", path = "../../../client/api/" }
|
||||
codec = { package = "parity-scale-codec", version = "1.3.0" }
|
||||
@@ -55,4 +55,3 @@ futures = "0.3.1"
|
||||
[dev-dependencies]
|
||||
criterion = "0.3.0"
|
||||
sc-cli = { version = "0.8.0-dev", path = "../../../client/cli" }
|
||||
sc-service = { version = "0.8.0-dev", path = "../../../client/service", features = ["db"] }
|
||||
|
||||
@@ -221,7 +221,7 @@ impl BenchDb {
|
||||
},
|
||||
};
|
||||
|
||||
let (client, backend) = sc_client_db::new_client(
|
||||
let (client, backend) = sc_service::new_client(
|
||||
db_config,
|
||||
NativeExecutor::new(WasmExecutionMethod::Compiled, None, 8),
|
||||
&keyring.generate_genesis(),
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! Utilities to build a `TestClient` for `node-runtime`.
|
||||
|
||||
use sp_runtime::BuildStorage;
|
||||
|
||||
use sc_service::client;
|
||||
/// Re-export test-client utilities.
|
||||
pub use substrate_test_client::*;
|
||||
|
||||
@@ -28,9 +28,9 @@ pub type Executor = sc_executor::NativeExecutor<node_executor::Executor>;
|
||||
pub type Backend = sc_client_db::Backend<node_primitives::Block>;
|
||||
|
||||
/// Test client type.
|
||||
pub type Client = sc_client::Client<
|
||||
pub type Client = client::Client<
|
||||
Backend,
|
||||
sc_client::LocalCallExecutor<Backend, Executor>,
|
||||
client::LocalCallExecutor<Backend, Executor>,
|
||||
node_primitives::Block,
|
||||
node_runtime::RuntimeApi,
|
||||
>;
|
||||
@@ -61,7 +61,7 @@ pub trait TestClientBuilderExt: Sized {
|
||||
|
||||
impl TestClientBuilderExt for substrate_test_client::TestClientBuilder<
|
||||
node_primitives::Block,
|
||||
sc_client::LocalCallExecutor<Backend, Executor>,
|
||||
client::LocalCallExecutor<Backend, Executor>,
|
||||
Backend,
|
||||
GenesisParameters,
|
||||
> {
|
||||
|
||||
@@ -15,7 +15,6 @@ sp-block-builder = { version = "2.0.0-dev", path = "../../../primitives/block-bu
|
||||
sc-cli = { version = "0.8.0-dev", path = "../../../client/cli" }
|
||||
sc-client-api = { version = "2.0.0-dev", path = "../../../client/api" }
|
||||
sc-block-builder = { version = "0.8.0-dev", path = "../../../client/block-builder" }
|
||||
sc-client = { version = "0.8.0-dev", path = "../../../client" }
|
||||
codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] }
|
||||
sp-consensus = { version = "0.8.0-dev", path = "../../../primitives/consensus/common" }
|
||||
log = "0.4.8"
|
||||
|
||||
Reference in New Issue
Block a user