Unverified Commit d7d5ac5c authored by Seun Lanlege's avatar Seun Lanlege Committed by GitHub
Browse files

Drop sc-client (#1037)



* WIP

* collator

* fix missing reference

* Make collator builder more generic

* all clear

* revert start colator fn

* fix return type of start_collator

* sc-consensus

* bump back to master

* Update collator/src/lib.rs

Co-Authored-By: default avatarBenjamin Kampmann <ben@gnunicorn.org>

* Update collator/src/lib.rs

Co-Authored-By: Pierre Krieger's avatarPierre Krieger <pierre.krieger1708@gmail.com>

* uncomment type MaxIterations

* reactivate append storage feature

Co-authored-by: default avatarBenjamin Kampmann <ben@gnunicorn.org>
Co-authored-by: Pierre Krieger's avatarPierre Krieger <pierre.krieger1708@gmail.com>
parent d94cd1cb
Pipeline #90131 failed with stages
in 7 minutes and 53 seconds
This diff is collapsed.
......@@ -18,7 +18,6 @@ codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
consensus_common = { package = "sp-consensus", git = "https://github.com/paritytech/substrate", branch = "master" }
client = { package = "sc-client-api", git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
......
......@@ -20,7 +20,6 @@ structopt = "0.3.8"
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-db = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
......
......@@ -15,9 +15,8 @@
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
use log::info;
use sp_runtime::traits::BlakeTwo256;
use service::{IdentifyVariant, Block, self, RuntimeApiCollection, TFullClient};
use sp_api::ConstructRuntimeApi;
use service::{IdentifyVariant, self};
use sc_executor::NativeExecutionDispatch;
use sc_cli::{SubstrateCli, Result};
use crate::cli::{Cli, Subcommand};
......@@ -82,23 +81,56 @@ pub fn run() -> Result<()> {
info!(" KUSAMA FOUNDATION ");
info!("----------------------------");
run_node::<
service::kusama_runtime::RuntimeApi,
service::KusamaExecutor,
service::kusama_runtime::UncheckedExtrinsic,
>(runtime, authority_discovery_enabled, grandpa_pause)
runtime.run_node(
|config| {
service::kusama_new_light(config)
},
|config| {
service::kusama_new_full(
config,
None,
None,
authority_discovery_enabled,
6000,
grandpa_pause
).map(|(s, _, _)| s)
},
service::KusamaExecutor::native_version().runtime_version
)
} else if config.chain_spec.is_westend() {
run_node::<
service::westend_runtime::RuntimeApi,
service::WestendExecutor,
service::westend_runtime::UncheckedExtrinsic,
>(runtime, authority_discovery_enabled, grandpa_pause)
runtime.run_node(
|config| {
service::westend_new_light(config)
},
|config| {
service::westend_new_full(
config,
None,
None,
authority_discovery_enabled,
6000,
grandpa_pause
).map(|(s, _, _)| s)
},
service::WestendExecutor::native_version().runtime_version
)
} else {
run_node::<
service::polkadot_runtime::RuntimeApi,
service::PolkadotExecutor,
service::polkadot_runtime::UncheckedExtrinsic,
>(runtime, authority_discovery_enabled, grandpa_pause)
runtime.run_node(
|config| {
service::polkadot_new_light(config)
},
|config| {
service::polkadot_new_full(
config,
None,
None,
authority_discovery_enabled,
6000,
grandpa_pause
).map(|(s, _, _)| s)
},
service::PolkadotExecutor::native_version().runtime_version
)
}
},
Some(Subcommand::Base(subcommand)) => {
......@@ -160,55 +192,3 @@ pub fn run() -> Result<()> {
},
}
}
fn run_node<R, D, E>(
runtime: sc_cli::Runner<Cli>,
authority_discovery_enabled: bool,
grandpa_pause: Option<(u32, u32)>,
) -> sc_cli::Result<()>
where
R: ConstructRuntimeApi<Block, service::TFullClient<Block, R, D>>
+ Send + Sync + 'static,
<R as ConstructRuntimeApi<Block, service::TFullClient<Block, R, D>>>::RuntimeApi:
RuntimeApiCollection<E, StateBackend = sc_client_api::StateBackendFor<service::TFullBackend<Block>, Block>>,
<R as ConstructRuntimeApi<Block, service::TLightClient<Block, R, D>>>::RuntimeApi:
RuntimeApiCollection<E, StateBackend = sc_client_api::StateBackendFor<service::TLightBackend<Block>, Block>>,
E: service::Codec + Send + Sync + 'static,
D: service::NativeExecutionDispatch + 'static,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
<<R as ConstructRuntimeApi<Block, TFullClient<Block, R, D>>>::RuntimeApi as sp_api::ApiExt<Block>>::StateBackend:
sp_api::StateBackend<BlakeTwo256>,
// Rust bug: https://github.com/rust-lang/rust/issues/43580
R: ConstructRuntimeApi<
Block,
TLightClient<R, D>
>,
{
runtime.run_node(
|config| service::new_light::<R, D, E>(config),
|config| service::new_full::<R, D, E>(
config,
None,
None,
authority_discovery_enabled,
6000,
grandpa_pause,
).map(|(s, _)| s),
D::native_version().runtime_version,
)
}
// We can't simply use `service::TLightClient` due to a
// Rust bug: https://github.com/rust-lang/rust/issues/43580
type TLightClient<Runtime, Dispatch> = sc_client::Client<
sc_client::light::backend::Backend<sc_client_db::light::LightStorage<Block>, BlakeTwo256>,
sc_client::light::call_executor::GenesisCallExecutor<
sc_client::light::backend::Backend<sc_client_db::light::LightStorage<Block>, BlakeTwo256>,
sc_client::LocalCallExecutor<
sc_client::light::backend::Backend<sc_client_db::light::LightStorage<Block>, BlakeTwo256>,
sc_executor::NativeExecutor<Dispatch>
>
>,
Block,
Runtime
>;
......@@ -7,7 +7,8 @@ edition = "2018"
[dependencies]
futures = "0.3.4"
sc-client = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
......
......@@ -52,9 +52,8 @@ use std::pin::Pin;
use futures::{future, Future, Stream, FutureExt, TryFutureExt, StreamExt, task::Spawn};
use log::warn;
use sc_client::BlockchainEvents;
use sc_client_api::StateBackend;
use sp_core::Pair;
use sp_runtime::traits::BlakeTwo256;
use polkadot_primitives::{
BlockId, Hash, Block,
parachain::{
......@@ -72,7 +71,9 @@ pub use polkadot_validation::SignedStatement;
pub use polkadot_primitives::parachain::CollatorId;
pub use sc_network::PeerId;
pub use service::RuntimeApiCollection;
use sc_service::ClientProvider;
pub use sc_cli::SubstrateCli;
use sp_api::{ConstructRuntimeApi, ApiExt, HashFor};
const COLLATION_TIMEOUT: Duration = Duration::from_secs(30);
......@@ -114,34 +115,24 @@ impl fmt::Display for Error {
}
}
/// The Polkadot client type.
pub type PolkadotClient<B, E, R> = sc_client::Client<B, E, Block, R>;
/// Something that can build a `ParachainContext`.
pub trait BuildParachainContext {
/// The parachain context produced by the `build` function.
type ParachainContext: self::ParachainContext;
/// Build the `ParachainContext`.
fn build<B, E, R, SP, Extrinsic>(
fn build<Client, SP, Extrinsic>(
self,
client: Arc<PolkadotClient<B, E, R>>,
client: Arc<Client>,
spawner: SP,
network: impl Network + Clone + 'static,
) -> Result<Self::ParachainContext, ()>
where
PolkadotClient<B, E, R>: ProvideRuntimeApi<Block>,
<PolkadotClient<B, E, R> as ProvideRuntimeApi<Block>>::Api: RuntimeApiCollection<Extrinsic>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
<<PolkadotClient<B, E, R> as ProvideRuntimeApi<Block>>::Api as sp_api::ApiExt<Block>>::StateBackend:
sp_api::StateBackend<BlakeTwo256>,
Client: ProvideRuntimeApi<Block>,
Client::Api: RuntimeApiCollection<Extrinsic>,
<Client::Api as ApiExt<Block>>::StateBackend: StateBackend<HashFor<Block>>,
Extrinsic: codec::Codec + Send + Sync + 'static,
E: sc_client::CallExecutor<Block> + Clone + Send + Sync + 'static,
SP: Spawn + Clone + Send + Sync + 'static,
R: Send + Sync + 'static,
B: sc_client_api::Backend<Block> + 'static,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
B::State: sp_api::StateBackend<BlakeTwo256>;
SP: Spawn + Clone + Send + Sync + 'static;
}
/// Parachain context needed for collation.
......@@ -209,38 +200,40 @@ pub async fn collate<P>(
Ok(collation)
}
fn build_collator_service<S, P, Extrinsic>(
service: (S, polkadot_service::FullNodeHandles),
fn build_collator_service<SP, P, C, E, R, Extrinsic>(
spawner: SP,
handles: polkadot_service::FullNodeHandles,
client: Arc<C>,
para_id: ParaId,
key: Arc<CollatorPair>,
build_parachain_context: P,
) -> Result<S, polkadot_service::Error>
) -> Result<impl Future<Output = ()> + Send + 'static, polkadot_service::Error>
where
S: AbstractService<Block = service::Block>,
sc_client::Client<S::Backend, S::CallExecutor, service::Block, S::RuntimeApi>: ProvideRuntimeApi<Block>,
<sc_client::Client<S::Backend, S::CallExecutor, service::Block, S::RuntimeApi> as ProvideRuntimeApi<Block>>::Api:
RuntimeApiCollection<
C: ClientProvider<
service::Block,
service::TFullBackend<service::Block>,
service::TFullCallExecutor<service::Block, E>,
R
> + 'static,
R: ConstructRuntimeApi<service::Block, C> + Sync + Send,
<R as ConstructRuntimeApi<service::Block, C>>::RuntimeApi:
sp_api::ApiExt<
service::Block,
StateBackend = <service::TFullBackend<service::Block> as service::Backend<service::Block>>::State,
>
+ RuntimeApiCollection<
Extrinsic,
Error = sp_blockchain::Error,
StateBackend = sc_client_api::StateBackendFor<S::Backend, Block>
>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
S::Backend: service::Backend<service::Block>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
<S::Backend as service::Backend<service::Block>>::State:
sp_api::StateBackend<sp_runtime::traits::HashFor<Block>>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
S::CallExecutor: service::CallExecutor<service::Block>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
S::SelectChain: service::SelectChain<service::Block>,
StateBackend = <service::TFullBackend<service::Block> as service::Backend<service::Block>>::State,
>
+ Sync + Send,
E: sc_executor::NativeExecutionDispatch + 'static,
P: BuildParachainContext,
P::ParachainContext: Send + 'static,
<P::ParachainContext as ParachainContext>::ProduceCandidate: Send,
Extrinsic: service::Codec + Send + Sync + 'static,
SP: Spawn + Clone + Send + Sync + 'static,
{
let (service, handles) = service;
let spawner = service.spawn_task_handle();
let polkadot_network = handles.polkadot_network
.ok_or_else(|| "Collator cannot run when Polkadot-specific networking has not been started")?;
......@@ -250,8 +243,6 @@ fn build_collator_service<S, P, Extrinsic>(
handles.validation_service_handle
.ok_or_else(|| "Collator cannot run when validation networking has not been started")?;
let client = service.client();
let parachain_context = match build_parachain_context.build(
client.clone(),
spawner,
......@@ -334,9 +325,7 @@ fn build_collator_service<S, P, Extrinsic>(
}
}.boxed();
service.spawn_essential_task("collation", work);
Ok(service)
Ok(work)
}
/// Async function that will run the collator node with the given `RelayChainContext` and `ParachainContext`
......@@ -348,29 +337,55 @@ pub async fn start_collator<P>(
config: Configuration,
) -> Result<(), polkadot_service::Error>
where
P: BuildParachainContext,
P: 'static + BuildParachainContext,
P::ParachainContext: Send + 'static,
<P::ParachainContext as ParachainContext>::ProduceCandidate: Send,
{
let is_kusama = config.chain_spec.is_kusama();
match (is_kusama, &config.role) {
(_, Role::Light) => return Err(
(_, Role::Light) => Err(
polkadot_service::Error::Other("light nodes are unsupported as collator".into())
).into(),
(true, _) =>
(true, _) => {
let (service, client, handlers) = service::kusama_new_full(
config,
Some((key.public(), para_id)),
None,
false,
6000,
None
)?;
let spawn_handle = service.spawn_task_handle();
build_collator_service(
service::kusama_new_full(config, Some((key.public(), para_id)), None, false, 6000, None)?,
spawn_handle,
handlers,
client,
para_id,
key,
build_parachain_context,
)?.await,
(false, _) =>
build_parachain_context
)?.await;
Ok(())
},
(false, _) => {
let (service, client, handles) = service::polkadot_new_full(
config,
Some((key.public(), para_id)),
None,
false,
6000,
None
)?;
let spawn_handle = service.spawn_task_handle();
build_collator_service(
service::polkadot_new_full(config, Some((key.public(), para_id)), None, false, 6000, None)?,
spawn_handle,
handles,
client,
para_id,
key,
build_parachain_context,
)?.await,
)?.await;
Ok(())
}
}
}
......@@ -413,9 +428,9 @@ mod tests {
impl BuildParachainContext for BuildDummyParachainContext {
type ParachainContext = DummyParachainContext;
fn build<B, E, R, SP, Extrinsic>(
fn build<C, SP, Extrinsic>(
self,
_: Arc<PolkadotClient<B, E, R>>,
_: Arc<C>,
_: SP,
_: impl Network + Clone + 'static,
) -> Result<Self::ParachainContext, ()> {
......
......@@ -23,7 +23,6 @@ futures = "0.3.4"
log = "0.4.8"
exit-future = "0.2.0"
futures-timer = "2.0"
sc-client = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
wasm-timer = "0.2.4"
......
......@@ -10,10 +10,11 @@ log = "0.4.8"
parking_lot = "0.10.0"
futures = "0.3.1"
rand = "0.7.2"
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", features = ["test-helpers"], branch = "master" }
sc-network-test = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
......
......@@ -34,8 +34,8 @@ use sc_client_api::{
client::BlockBackend,
backend::{TransactionFor, AuxStore, Backend, Finalizer},
};
use sc_consensus::LongestChain;
use sc_block_builder::{BlockBuilder, BlockBuilderProvider};
use sc_client::LongestChain;
use sp_consensus::block_validation::DefaultBlockAnnounceValidator;
use sp_consensus::import_queue::{
BasicQueue, BoxJustificationImport, Verifier, BoxFinalityProofImport,
......@@ -53,14 +53,23 @@ use sp_runtime::generic::BlockId;
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor};
use sp_runtime::Justification;
pub use sc_network_test::PassThroughVerifier;
use sc_service::client::Client;
pub use polkadot_test_runtime_client::runtime::{Block, Extrinsic, Hash};
pub use polkadot_test_runtime_client::{TestClient, TestClientBuilder, TestClientBuilderExt};
pub type PeersFullClient =
sc_client::Client<polkadot_test_runtime_client::Backend, polkadot_test_runtime_client::Executor, Block, polkadot_test_runtime_client::runtime::RuntimeApi>;
pub type PeersLightClient =
sc_client::Client<polkadot_test_runtime_client::LightBackend, polkadot_test_runtime_client::LightExecutor, Block, polkadot_test_runtime_client::runtime::RuntimeApi>;
pub type PeersFullClient = Client<
polkadot_test_runtime_client::Backend,
polkadot_test_runtime_client::Executor,
Block,
polkadot_test_runtime_client::runtime::RuntimeApi
>;
pub type PeersLightClient = Client<
polkadot_test_runtime_client::LightBackend,
polkadot_test_runtime_client::LightExecutor,
Block,
polkadot_test_runtime_client::runtime::RuntimeApi
>;
#[derive(Clone)]
pub enum PeersClient {
......
......@@ -10,7 +10,6 @@ parachain = { package = "polkadot-parachain", path = "../../.." }
collator = { package = "polkadot-collator", path = "../../../../collator" }
primitives = { package = "polkadot-primitives", path = "../../../../primitives" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
client = { package = "sc-client", git = "https://github.com/paritytech/substrate", branch = "master" }
client-api = { package = "sc-client-api", git = "https://github.com/paritytech/substrate", branch = "master" }
parking_lot = "0.10.0"
codec = { package = "parity-scale-codec", version = "1.2.0" }
......
......@@ -101,9 +101,9 @@ impl ParachainContext for AdderContext {
impl BuildParachainContext for AdderContext {
type ParachainContext = Self;
fn build<B, E, R, SP, Extrinsic>(
fn build<Client, SP, Extrinsic>(
self,
_: Arc<collator::PolkadotClient<B, E, R>>,
_: Arc<Client>,
_: SP,
network: impl Network + Clone + 'static,
) -> Result<Self::ParachainContext, ()> {
......
......@@ -5,9 +5,10 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
client = { package = "sc-client", git = "https://github.com/paritytech/substrate", branch = "master" }
jsonrpc-core = "14.0.3"
polkadot-primitives = { path = "../primitives" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
......
......@@ -23,6 +23,8 @@ use std::sync::Arc;
use polkadot_primitives::{Block, AccountId, Nonce, Balance};
use sp_api::ProvideRuntimeApi;
use txpool_api::TransactionPool;
use sp_blockchain::HeaderBackend;
use sc_client_api::light::{Fetcher, RemoteBlockchain};
/// A type representing all RPC extensions.
pub type RpcExtension = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
......@@ -30,7 +32,7 @@ pub type RpcExtension = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
/// Instantiate all RPC extensions.
pub fn create_full<C, P, UE>(client: Arc<C>, pool: Arc<P>) -> RpcExtension where
C: ProvideRuntimeApi<Block>,
C: client::blockchain::HeaderBackend<Block>,
C: HeaderBackend<Block>,
C: Send + Sync + 'static,
C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance, UE>,
......@@ -53,18 +55,18 @@ pub fn create_full<C, P, UE>(client: Arc<C>, pool: Arc<P>) -> RpcExtension where
/// Instantiate all RPC extensions for light node.
pub fn create_light<C, P, F, UE>(
client: Arc<C>,
remote_blockchain: Arc<dyn client::light::blockchain::RemoteBlockchain<Block>>,
remote_blockchain: Arc<dyn RemoteBlockchain<Block>>,
fetcher: Arc<F>,
pool: Arc<P>,
) -> RpcExtension
where
C: ProvideRuntimeApi<Block>,
C: client::blockchain::HeaderBackend<Block>,
C: HeaderBackend<Block>,
C: Send + Sync + 'static,
C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance, UE>,
P: TransactionPool + Sync + Send + 'static,
F: client::light::fetcher::Fetcher<Block> + 'static,
F: Fetcher<Block> + 'static,
UE: codec::Codec + Send + Sync + 'static,
{
use frame_rpc_system::{LightSystem, SystemApi};
......
......@@ -7,6 +7,8 @@ license = "GPL-3.0"
[dependencies]
sc-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", features = ["test-helpers"], default-features = false }
substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
polkadot-test-runtime = { path = ".." }
......@@ -17,6 +19,5 @@ sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
codec = { package = "parity-scale-codec", version = "1.0.0" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" }
futures = "0.3.1"
......@@ -22,16 +22,19 @@ use std::sync::Arc;
use std::collections::BTreeMap;
pub use substrate_test_client::*;
pub use polkadot_test_runtime as runtime;
pub use sc_client::LongestChain;
use sp_core::{sr25519, ChangesTrieConfiguration, map, twox_128};
use sp_core::storage::{ChildInfo, Storage, StorageChild};
use polkadot_test_runtime::genesismap::GenesisConfig;
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Hash as HashT, HashFor};
use sc_client::{
light::fetcher::{
RemoteCallRequest, RemoteBodyRequest,
use sc_consensus::LongestChain;
use sc_client_api::light::{RemoteCallRequest, RemoteBodyRequest};
use sc_service::client::{
light::{
call_executor::GenesisCallExecutor, backend as light_backend,
new_light_blockchain, new_light_backend,
},
genesis, Client as SubstrateClient, LocalCallExecutor
};
/// A prelude to import in tests.
......@@ -57,7 +60,7 @@ sc_executor::native_executor_instance! {
pub type Backend = substrate_test_client::Backend<polkadot_test_runtime::Block>;
/// Test client executor.
pub type Executor = sc_client::LocalCallExecutor<
pub type Executor = LocalCallExecutor<
Backend,
NativeExecutor<LocalExecutor>,
>;
......@@ -66,10 +69,10 @@ pub type Executor = sc_client::LocalCallExecutor<
pub type LightBackend = substrate_test_client::LightBackend<polkadot_test_runtime::Block>;
/// Test client light executor.
pub type LightExecutor = sc_client::light::call_executor::GenesisCallExecutor<
pub type LightExecutor = GenesisCallExecutor<
LightBackend,
sc_client::LocalCallExecutor<
sc_client::light::backend::Backend<
LocalCallExecutor<
light_backend::Backend<
sc_client_db::light::LightStorage<polkadot_test_runtime::Block>,
HashFor<polkadot_test_runtime::Block>
>,
......@@ -120,7 +123,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 = genesis::construct_genesis_block(state_root);