mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 05:17:58 +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:
@@ -26,7 +26,7 @@ use std::sync::Arc;
|
||||
use std::collections::HashMap;
|
||||
pub use substrate_test_client::*;
|
||||
pub use substrate_test_runtime as runtime;
|
||||
pub use sc_client::LongestChain;
|
||||
pub use sc_consensus::LongestChain;
|
||||
|
||||
pub use self::block_builder_ext::BlockBuilderExt;
|
||||
|
||||
@@ -34,7 +34,7 @@ use sp_core::{sr25519, ChangesTrieConfiguration};
|
||||
use sp_core::storage::{ChildInfo, Storage, StorageChild};
|
||||
use substrate_test_runtime::genesismap::{GenesisConfig, additional_storage_with_genesis};
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Hash as HashT, NumberFor, HashFor};
|
||||
use sc_client::{
|
||||
use sc_service::client::{
|
||||
light::fetcher::{
|
||||
Fetcher,
|
||||
RemoteHeaderRequest, RemoteReadRequest, RemoteReadChildRequest,
|
||||
@@ -68,7 +68,7 @@ sc_executor::native_executor_instance! {
|
||||
pub type Backend = substrate_test_client::Backend<substrate_test_runtime::Block>;
|
||||
|
||||
/// Test client executor.
|
||||
pub type Executor = sc_client::LocalCallExecutor<
|
||||
pub type Executor = client::LocalCallExecutor<
|
||||
Backend,
|
||||
NativeExecutor<LocalExecutor>,
|
||||
>;
|
||||
@@ -77,10 +77,10 @@ pub type Executor = sc_client::LocalCallExecutor<
|
||||
pub type LightBackend = substrate_test_client::LightBackend<substrate_test_runtime::Block>;
|
||||
|
||||
/// Test client light executor.
|
||||
pub type LightExecutor = sc_client::light::call_executor::GenesisCallExecutor<
|
||||
pub type LightExecutor = client::light::call_executor::GenesisCallExecutor<
|
||||
LightBackend,
|
||||
sc_client::LocalCallExecutor<
|
||||
sc_client::light::backend::Backend<
|
||||
client::LocalCallExecutor<
|
||||
client::light::backend::Backend<
|
||||
sc_client_db::light::LightStorage<substrate_test_runtime::Block>,
|
||||
HashFor<substrate_test_runtime::Block>
|
||||
>,
|
||||
@@ -133,7 +133,7 @@ impl substrate_test_client::GenesisInit for GenesisParameters {
|
||||
let state_root = <<<runtime::Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(
|
||||
storage.top.clone().into_iter().chain(child_roots).collect()
|
||||
);
|
||||
let block: runtime::Block = sc_client::genesis::construct_genesis_block(state_root);
|
||||
let block: runtime::Block = client::genesis::construct_genesis_block(state_root);
|
||||
storage.top.extend(additional_storage_with_genesis(&block));
|
||||
|
||||
storage
|
||||
@@ -149,9 +149,9 @@ pub type TestClientBuilder<E, B> = substrate_test_client::TestClientBuilder<
|
||||
>;
|
||||
|
||||
/// Test client type with `LocalExecutor` and generic Backend.
|
||||
pub type Client<B> = sc_client::Client<
|
||||
pub type Client<B> = client::Client<
|
||||
B,
|
||||
sc_client::LocalCallExecutor<B, sc_executor::NativeExecutor<LocalExecutor>>,
|
||||
client::LocalCallExecutor<B, sc_executor::NativeExecutor<LocalExecutor>>,
|
||||
substrate_test_runtime::Block,
|
||||
substrate_test_runtime::RuntimeApi,
|
||||
>;
|
||||
@@ -230,14 +230,14 @@ pub trait TestClientBuilderExt<B>: Sized {
|
||||
}
|
||||
|
||||
/// Build the test client and longest chain selector.
|
||||
fn build_with_longest_chain(self) -> (Client<B>, sc_client::LongestChain<B, substrate_test_runtime::Block>);
|
||||
fn build_with_longest_chain(self) -> (Client<B>, sc_consensus::LongestChain<B, substrate_test_runtime::Block>);
|
||||
|
||||
/// Build the test client and the backend.
|
||||
fn build_with_backend(self) -> (Client<B>, Arc<B>);
|
||||
}
|
||||
|
||||
impl<B> TestClientBuilderExt<B> for TestClientBuilder<
|
||||
sc_client::LocalCallExecutor<B, sc_executor::NativeExecutor<LocalExecutor>>,
|
||||
client::LocalCallExecutor<B, sc_executor::NativeExecutor<LocalExecutor>>,
|
||||
B
|
||||
> where
|
||||
B: sc_client_api::backend::Backend<substrate_test_runtime::Block> + 'static,
|
||||
@@ -249,7 +249,7 @@ impl<B> TestClientBuilderExt<B> for TestClientBuilder<
|
||||
Self::genesis_init_mut(self)
|
||||
}
|
||||
|
||||
fn build_with_longest_chain(self) -> (Client<B>, sc_client::LongestChain<B, substrate_test_runtime::Block>) {
|
||||
fn build_with_longest_chain(self) -> (Client<B>, sc_consensus::LongestChain<B, substrate_test_runtime::Block>) {
|
||||
self.build_with_native_executor(None)
|
||||
}
|
||||
|
||||
@@ -344,15 +344,15 @@ pub fn new() -> Client<Backend> {
|
||||
|
||||
/// Creates new light client instance used for tests.
|
||||
pub fn new_light() -> (
|
||||
sc_client::Client<LightBackend, LightExecutor, substrate_test_runtime::Block, substrate_test_runtime::RuntimeApi>,
|
||||
client::Client<LightBackend, LightExecutor, substrate_test_runtime::Block, substrate_test_runtime::RuntimeApi>,
|
||||
Arc<LightBackend>,
|
||||
) {
|
||||
|
||||
let storage = sc_client_db::light::LightStorage::new_test();
|
||||
let blockchain = Arc::new(sc_client::light::blockchain::Blockchain::new(storage));
|
||||
let blockchain = Arc::new(client::light::blockchain::Blockchain::new(storage));
|
||||
let backend = Arc::new(LightBackend::new(blockchain.clone()));
|
||||
let executor = new_native_executor();
|
||||
let local_call_executor = sc_client::LocalCallExecutor::new(backend.clone(), executor, sp_core::tasks::executor(), Default::default());
|
||||
let local_call_executor = client::LocalCallExecutor::new(backend.clone(), executor, sp_core::tasks::executor(), Default::default());
|
||||
let call_executor = LightExecutor::new(
|
||||
backend.clone(),
|
||||
local_call_executor,
|
||||
|
||||
@@ -26,7 +26,7 @@ use crate::{
|
||||
};
|
||||
use sc_client_api::backend;
|
||||
use sc_client_api::blockchain::{Backend as BlockChainBackendT, HeaderBackend};
|
||||
use substrate_test_client::sp_consensus::BlockOrigin;
|
||||
use sp_consensus::BlockOrigin;
|
||||
use substrate_test_runtime::{self, Transfer};
|
||||
use sp_runtime::generic::BlockId;
|
||||
use sp_runtime::traits::{Block as BlockT, HashFor};
|
||||
|
||||
Reference in New Issue
Block a user