mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 09:51:10 +00:00
new crate sc-light (#6235)
* sc-light * remove unused deps * fix line width * move more fns to sc_light
This commit is contained in:
Generated
+22
@@ -6337,6 +6337,24 @@ dependencies = [
|
|||||||
"tempfile",
|
"tempfile",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sc-light"
|
||||||
|
version = "2.0.0-rc3"
|
||||||
|
dependencies = [
|
||||||
|
"hash-db",
|
||||||
|
"lazy_static",
|
||||||
|
"parity-scale-codec",
|
||||||
|
"parking_lot 0.10.2",
|
||||||
|
"sc-client-api",
|
||||||
|
"sc-executor",
|
||||||
|
"sp-api",
|
||||||
|
"sp-blockchain",
|
||||||
|
"sp-core",
|
||||||
|
"sp-externalities",
|
||||||
|
"sp-runtime",
|
||||||
|
"sp-state-machine",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sc-network"
|
name = "sc-network"
|
||||||
version = "0.8.0-rc3"
|
version = "0.8.0-rc3"
|
||||||
@@ -6613,6 +6631,7 @@ dependencies = [
|
|||||||
"sc-finality-grandpa",
|
"sc-finality-grandpa",
|
||||||
"sc-informant",
|
"sc-informant",
|
||||||
"sc-keystore",
|
"sc-keystore",
|
||||||
|
"sc-light",
|
||||||
"sc-network",
|
"sc-network",
|
||||||
"sc-offchain",
|
"sc-offchain",
|
||||||
"sc-rpc",
|
"sc-rpc",
|
||||||
@@ -6663,6 +6682,7 @@ dependencies = [
|
|||||||
"sc-client-api",
|
"sc-client-api",
|
||||||
"sc-client-db",
|
"sc-client-db",
|
||||||
"sc-executor",
|
"sc-executor",
|
||||||
|
"sc-light",
|
||||||
"sc-network",
|
"sc-network",
|
||||||
"sc-service",
|
"sc-service",
|
||||||
"sp-api",
|
"sp-api",
|
||||||
@@ -8069,6 +8089,7 @@ dependencies = [
|
|||||||
"sc-client-db",
|
"sc-client-db",
|
||||||
"sc-consensus",
|
"sc-consensus",
|
||||||
"sc-executor",
|
"sc-executor",
|
||||||
|
"sc-light",
|
||||||
"sc-service",
|
"sc-service",
|
||||||
"sp-blockchain",
|
"sp-blockchain",
|
||||||
"sp-consensus",
|
"sp-consensus",
|
||||||
@@ -8130,6 +8151,7 @@ dependencies = [
|
|||||||
"sc-block-builder",
|
"sc-block-builder",
|
||||||
"sc-client-api",
|
"sc-client-api",
|
||||||
"sc-consensus",
|
"sc-consensus",
|
||||||
|
"sc-light",
|
||||||
"sc-service",
|
"sc-service",
|
||||||
"sp-api",
|
"sp-api",
|
||||||
"sp-blockchain",
|
"sp-blockchain",
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ members = [
|
|||||||
"client/executor/runtime-test",
|
"client/executor/runtime-test",
|
||||||
"client/finality-grandpa",
|
"client/finality-grandpa",
|
||||||
"client/informant",
|
"client/informant",
|
||||||
|
"client/light",
|
||||||
"client/tracing",
|
"client/tracing",
|
||||||
"client/keystore",
|
"client/keystore",
|
||||||
"client/network",
|
"client/network",
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
[package]
|
||||||
|
description = "components for a light client"
|
||||||
|
name = "sc-light"
|
||||||
|
version = "2.0.0-rc3"
|
||||||
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
edition = "2018"
|
||||||
|
homepage = "https://substrate.dev"
|
||||||
|
repository = "https://github.com/paritytech/substrate/"
|
||||||
|
documentation = "https://docs.rs/sc-light"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
parking_lot = "0.10.0"
|
||||||
|
lazy_static = "1.4.0"
|
||||||
|
hash-db = "0.15.2"
|
||||||
|
sp-runtime = { version = "2.0.0-rc2", path = "../../primitives/runtime" }
|
||||||
|
sp-externalities = { version = "0.8.0-rc2", path = "../../primitives/externalities" }
|
||||||
|
sp-blockchain = { version = "2.0.0-rc2", path = "../../primitives/blockchain" }
|
||||||
|
sp-core = { version = "2.0.0-rc2", path = "../../primitives/core" }
|
||||||
|
sp-state-machine = { version = "0.8.0-rc2", path = "../../primitives/state-machine" }
|
||||||
|
sc-client-api = { version = "2.0.0-rc2", path = "../api" }
|
||||||
|
sp-api = { version = "2.0.0-rc2", path = "../../primitives/api" }
|
||||||
|
codec = { package = "parity-scale-codec", version = "1.3.0" }
|
||||||
|
sc-executor = { version = "0.8.0-rc2", path = "../executor" }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = []
|
||||||
+2
-3
@@ -25,8 +25,7 @@ use sp_runtime::{Justification, generic::BlockId};
|
|||||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero};
|
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero};
|
||||||
|
|
||||||
use sp_blockchain::{
|
use sp_blockchain::{
|
||||||
HeaderMetadata, CachedHeaderMetadata,
|
HeaderMetadata, CachedHeaderMetadata, Error as ClientError, Result as ClientResult,
|
||||||
Error as ClientError, Result as ClientResult,
|
|
||||||
};
|
};
|
||||||
pub use sc_client_api::{
|
pub use sc_client_api::{
|
||||||
backend::{
|
backend::{
|
||||||
@@ -42,7 +41,7 @@ pub use sc_client_api::{
|
|||||||
},
|
},
|
||||||
cht,
|
cht,
|
||||||
};
|
};
|
||||||
use super::fetcher::RemoteHeaderRequest;
|
use crate::fetcher::RemoteHeaderRequest;
|
||||||
|
|
||||||
/// Light client blockchain.
|
/// Light client blockchain.
|
||||||
pub struct Blockchain<S> {
|
pub struct Blockchain<S> {
|
||||||
+2
-2
@@ -46,8 +46,8 @@ pub use sc_client_api::{
|
|||||||
},
|
},
|
||||||
cht,
|
cht,
|
||||||
};
|
};
|
||||||
use super::blockchain::{Blockchain};
|
use crate::blockchain::Blockchain;
|
||||||
use super::call_executor::check_execution_proof;
|
use crate::call_executor::check_execution_proof;
|
||||||
|
|
||||||
/// Remote data checker.
|
/// Remote data checker.
|
||||||
pub struct LightDataChecker<E, H, B: BlockT, S: BlockchainStorage<B>> {
|
pub struct LightDataChecker<E, H, B: BlockT, S: BlockchainStorage<B>> {
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
||||||
|
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Light client components.
|
||||||
|
|
||||||
|
use sp_runtime::traits::{Block as BlockT, HashFor};
|
||||||
|
use sc_client_api::CloneableSpawn;
|
||||||
|
use std::sync::Arc;
|
||||||
|
use sp_core::traits::CodeExecutor;
|
||||||
|
|
||||||
|
pub mod backend;
|
||||||
|
pub mod blockchain;
|
||||||
|
pub mod call_executor;
|
||||||
|
pub mod fetcher;
|
||||||
|
|
||||||
|
pub use {backend::*, blockchain::*, call_executor::*, fetcher::*};
|
||||||
|
|
||||||
|
/// Create an instance of fetch data checker.
|
||||||
|
pub fn new_fetch_checker<E, B: BlockT, S: BlockchainStorage<B>>(
|
||||||
|
blockchain: Arc<Blockchain<S>>,
|
||||||
|
executor: E,
|
||||||
|
spawn_handle: Box<dyn CloneableSpawn>,
|
||||||
|
) -> LightDataChecker<E, HashFor<B>, B, S>
|
||||||
|
where
|
||||||
|
E: CodeExecutor,
|
||||||
|
{
|
||||||
|
LightDataChecker::new(blockchain, executor, spawn_handle)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create an instance of light client blockchain backend.
|
||||||
|
pub fn new_light_blockchain<B: BlockT, S: BlockchainStorage<B>>(storage: S) -> Arc<Blockchain<S>> {
|
||||||
|
Arc::new(Blockchain::new(storage))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create an instance of light client backend.
|
||||||
|
pub fn new_light_backend<B, S>(blockchain: Arc<Blockchain<S>>) -> Arc<Backend<S, HashFor<B>>>
|
||||||
|
where
|
||||||
|
B: BlockT,
|
||||||
|
S: BlockchainStorage<B>,
|
||||||
|
{
|
||||||
|
Arc::new(Backend::new(blockchain))
|
||||||
|
}
|
||||||
@@ -55,6 +55,7 @@ sp-application-crypto = { version = "2.0.0-rc3", path = "../../primitives/applic
|
|||||||
sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" }
|
sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" }
|
||||||
sc-network = { version = "0.8.0-rc3", path = "../network" }
|
sc-network = { version = "0.8.0-rc3", path = "../network" }
|
||||||
sc-chain-spec = { version = "2.0.0-rc3", path = "../chain-spec" }
|
sc-chain-spec = { version = "2.0.0-rc3", path = "../chain-spec" }
|
||||||
|
sc-light = { version = "2.0.0-rc3", path = "../light" }
|
||||||
sc-client-api = { version = "2.0.0-rc3", path = "../api" }
|
sc-client-api = { version = "2.0.0-rc3", path = "../api" }
|
||||||
sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" }
|
sp-api = { version = "2.0.0-rc3", path = "../../primitives/api" }
|
||||||
sc-client-db = { version = "0.8.0-rc3", default-features = false, path = "../db" }
|
sc-client-db = { version = "0.8.0-rc3", default-features = false, path = "../db" }
|
||||||
|
|||||||
@@ -19,13 +19,14 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
Service, NetworkStatus, NetworkState, error::Error, DEFAULT_PROTOCOL_ID, MallocSizeOfWasm,
|
Service, NetworkStatus, NetworkState, error::Error, DEFAULT_PROTOCOL_ID, MallocSizeOfWasm,
|
||||||
start_rpc_servers, build_network_future, TransactionPoolAdapter, TaskManager, SpawnTaskHandle,
|
start_rpc_servers, build_network_future, TransactionPoolAdapter, TaskManager, SpawnTaskHandle,
|
||||||
status_sinks, metrics::MetricsService, client::{Client, ClientConfig},
|
status_sinks, metrics::MetricsService,
|
||||||
|
client::{light, Client, ClientConfig},
|
||||||
config::{Configuration, KeystoreConfig, PrometheusConfig, OffchainWorkerConfig},
|
config::{Configuration, KeystoreConfig, PrometheusConfig, OffchainWorkerConfig},
|
||||||
};
|
};
|
||||||
use sc_client_api::{
|
use sc_client_api::{
|
||||||
BlockchainEvents, backend::RemoteBackend, light::RemoteBlockchain,
|
self, BlockchainEvents, light::RemoteBlockchain, execution_extensions::ExtensionsFactory,
|
||||||
execution_extensions::ExtensionsFactory, ExecutorProvider, CallExecutor, ForkBlocks, BadBlocks,
|
ExecutorProvider, CallExecutor, ForkBlocks, BadBlocks, CloneableSpawn, UsageProvider,
|
||||||
CloneableSpawn, UsageProvider,
|
backend::RemoteBackend,
|
||||||
};
|
};
|
||||||
use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedSender};
|
use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedSender};
|
||||||
use sc_chain_spec::get_extension;
|
use sc_chain_spec::get_extension;
|
||||||
@@ -179,19 +180,19 @@ pub type TLightClient<TBl, TRtApi, TExecDisp> = Client<
|
|||||||
>;
|
>;
|
||||||
|
|
||||||
/// Light client backend type.
|
/// Light client backend type.
|
||||||
pub type TLightBackend<TBl> = crate::client::light::backend::Backend<
|
pub type TLightBackend<TBl> = sc_light::Backend<
|
||||||
sc_client_db::light::LightStorage<TBl>,
|
sc_client_db::light::LightStorage<TBl>,
|
||||||
HashFor<TBl>,
|
HashFor<TBl>,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
/// Light call executor type.
|
/// Light call executor type.
|
||||||
pub type TLightCallExecutor<TBl, TExecDisp> = crate::client::light::call_executor::GenesisCallExecutor<
|
pub type TLightCallExecutor<TBl, TExecDisp> = sc_light::GenesisCallExecutor<
|
||||||
crate::client::light::backend::Backend<
|
sc_light::Backend<
|
||||||
sc_client_db::light::LightStorage<TBl>,
|
sc_client_db::light::LightStorage<TBl>,
|
||||||
HashFor<TBl>
|
HashFor<TBl>
|
||||||
>,
|
>,
|
||||||
crate::client::LocalCallExecutor<
|
crate::client::LocalCallExecutor<
|
||||||
crate::client::light::backend::Backend<
|
sc_light::Backend<
|
||||||
sc_client_db::light::LightStorage<TBl>,
|
sc_client_db::light::LightStorage<TBl>,
|
||||||
HashFor<TBl>
|
HashFor<TBl>
|
||||||
>,
|
>,
|
||||||
@@ -415,18 +416,18 @@ impl ServiceBuilder<(), (), (), (), (), (), (), (), (), (), ()> {
|
|||||||
};
|
};
|
||||||
sc_client_db::light::LightStorage::new(db_settings)?
|
sc_client_db::light::LightStorage::new(db_settings)?
|
||||||
};
|
};
|
||||||
let light_blockchain = crate::client::light::new_light_blockchain(db_storage);
|
let light_blockchain = sc_light::new_light_blockchain(db_storage);
|
||||||
let fetch_checker = Arc::new(
|
let fetch_checker = Arc::new(
|
||||||
crate::client::light::new_fetch_checker::<_, TBl, _>(
|
sc_light::new_fetch_checker::<_, TBl, _>(
|
||||||
light_blockchain.clone(),
|
light_blockchain.clone(),
|
||||||
executor.clone(),
|
executor.clone(),
|
||||||
Box::new(task_manager.spawn_handle()),
|
Box::new(task_manager.spawn_handle()),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
let fetcher = Arc::new(sc_network::config::OnDemand::new(fetch_checker));
|
let fetcher = Arc::new(sc_network::config::OnDemand::new(fetch_checker));
|
||||||
let backend = crate::client::light::new_light_backend(light_blockchain);
|
let backend = sc_light::new_light_backend(light_blockchain);
|
||||||
let remote_blockchain = backend.remote_blockchain();
|
let remote_blockchain = backend.remote_blockchain();
|
||||||
let client = Arc::new(crate::client::light::new_light(
|
let client = Arc::new(light::new_light(
|
||||||
backend.clone(),
|
backend.clone(),
|
||||||
config.chain_spec.as_storage_builder(),
|
config.chain_spec.as_storage_builder(),
|
||||||
executor,
|
executor,
|
||||||
|
|||||||
@@ -84,10 +84,9 @@ use sp_utils::mpsc::{TracingUnboundedSender, tracing_unbounded};
|
|||||||
use sp_blockchain::Error;
|
use sp_blockchain::Error;
|
||||||
use prometheus_endpoint::Registry;
|
use prometheus_endpoint::Registry;
|
||||||
use super::{
|
use super::{
|
||||||
genesis,
|
genesis, block_rules::{BlockRules, LookupResult as BlockLookupResult},
|
||||||
light::{call_executor::prove_execution, fetcher::ChangesProof},
|
|
||||||
block_rules::{BlockRules, LookupResult as BlockLookupResult},
|
|
||||||
};
|
};
|
||||||
|
use sc_light::{call_executor::prove_execution, fetcher::ChangesProof};
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
|
||||||
#[cfg(feature="test-helpers")]
|
#[cfg(feature="test-helpers")]
|
||||||
|
|||||||
+8
-36
@@ -16,12 +16,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Light client components.
|
//! Light client utilities.
|
||||||
|
|
||||||
pub mod backend;
|
|
||||||
pub mod blockchain;
|
|
||||||
pub mod call_executor;
|
|
||||||
pub mod fetcher;
|
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
@@ -37,24 +32,8 @@ use super::client::{Client,ClientConfig};
|
|||||||
use sc_client_api::{
|
use sc_client_api::{
|
||||||
light::Storage as BlockchainStorage, CloneableSpawn,
|
light::Storage as BlockchainStorage, CloneableSpawn,
|
||||||
};
|
};
|
||||||
use self::backend::Backend;
|
use sc_light::{Backend, GenesisCallExecutor};
|
||||||
use self::blockchain::Blockchain;
|
|
||||||
use self::call_executor::GenesisCallExecutor;
|
|
||||||
use self::fetcher::LightDataChecker;
|
|
||||||
|
|
||||||
/// Create an instance of light client blockchain backend.
|
|
||||||
pub fn new_light_blockchain<B: BlockT, S: BlockchainStorage<B>>(storage: S) -> Arc<Blockchain<S>> {
|
|
||||||
Arc::new(Blockchain::new(storage))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create an instance of light client backend.
|
|
||||||
pub fn new_light_backend<B, S>(blockchain: Arc<Blockchain<S>>) -> Arc<Backend<S, HashFor<B>>>
|
|
||||||
where
|
|
||||||
B: BlockT,
|
|
||||||
S: BlockchainStorage<B>,
|
|
||||||
{
|
|
||||||
Arc::new(Backend::new(blockchain))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create an instance of light client.
|
/// Create an instance of light client.
|
||||||
pub fn new_light<B, S, RA, E>(
|
pub fn new_light<B, S, RA, E>(
|
||||||
@@ -79,7 +58,12 @@ pub fn new_light<B, S, RA, E>(
|
|||||||
S: BlockchainStorage<B> + 'static,
|
S: BlockchainStorage<B> + 'static,
|
||||||
E: CodeExecutor + RuntimeInfo + Clone + 'static,
|
E: CodeExecutor + RuntimeInfo + Clone + 'static,
|
||||||
{
|
{
|
||||||
let local_executor = LocalCallExecutor::new(backend.clone(), code_executor, spawn_handle.clone(), ClientConfig::default());
|
let local_executor = LocalCallExecutor::new(
|
||||||
|
backend.clone(),
|
||||||
|
code_executor,
|
||||||
|
spawn_handle.clone(),
|
||||||
|
ClientConfig::default()
|
||||||
|
);
|
||||||
let executor = GenesisCallExecutor::new(backend.clone(), local_executor);
|
let executor = GenesisCallExecutor::new(backend.clone(), local_executor);
|
||||||
Client::new(
|
Client::new(
|
||||||
backend,
|
backend,
|
||||||
@@ -92,15 +76,3 @@ pub fn new_light<B, S, RA, E>(
|
|||||||
ClientConfig::default(),
|
ClientConfig::default(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create an instance of fetch data checker.
|
|
||||||
pub fn new_fetch_checker<E, B: BlockT, S: BlockchainStorage<B>>(
|
|
||||||
blockchain: Arc<Blockchain<S>>,
|
|
||||||
executor: E,
|
|
||||||
spawn_handle: Box<dyn CloneableSpawn>,
|
|
||||||
) -> LightDataChecker<E, HashFor<B>, B, S>
|
|
||||||
where
|
|
||||||
E: CodeExecutor,
|
|
||||||
{
|
|
||||||
LightDataChecker::new(blockchain, executor, spawn_handle)
|
|
||||||
}
|
|
||||||
@@ -20,6 +20,7 @@ log = "0.4.8"
|
|||||||
env_logger = "0.7.0"
|
env_logger = "0.7.0"
|
||||||
fdlimit = "0.1.4"
|
fdlimit = "0.1.4"
|
||||||
parking_lot = "0.10.0"
|
parking_lot = "0.10.0"
|
||||||
|
sc-light = { version = "2.0.0-rc3", path = "../../light" }
|
||||||
sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" }
|
sp-blockchain = { version = "2.0.0-rc3", path = "../../../primitives/blockchain" }
|
||||||
sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" }
|
sp-api = { version = "2.0.0-rc3", path = "../../../primitives/api" }
|
||||||
sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" }
|
sp-state-machine = { version = "0.8.0-rc3", path = "../../../primitives/state-machine" }
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use sc_service::client::light::{
|
use sc_light::{
|
||||||
call_executor::{
|
call_executor::{
|
||||||
GenesisCallExecutor,
|
GenesisCallExecutor,
|
||||||
check_execution_proof,
|
check_execution_proof,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
sc-client-api = { version = "2.0.0-rc3", path = "../../client/api" }
|
sc-client-api = { version = "2.0.0-rc3", path = "../../client/api" }
|
||||||
|
sc-light = { version = "2.0.0-rc3", path = "../../client/light" }
|
||||||
sc-client-db = { version = "0.8.0-rc3", features = ["test-helpers"], path = "../../client/db" }
|
sc-client-db = { version = "0.8.0-rc3", features = ["test-helpers"], path = "../../client/db" }
|
||||||
sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" }
|
sp-consensus = { version = "0.8.0-rc3", path = "../../primitives/consensus/common" }
|
||||||
sc-executor = { version = "0.8.0-rc3", path = "../../client/executor" }
|
sc-executor = { version = "0.8.0-rc3", path = "../../client/executor" }
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ use sp_runtime::traits::{Block as BlockT, BlakeTwo256};
|
|||||||
use sc_service::client::{LocalCallExecutor, ClientConfig};
|
use sc_service::client::{LocalCallExecutor, ClientConfig};
|
||||||
|
|
||||||
/// Test client light database backend.
|
/// Test client light database backend.
|
||||||
pub type LightBackend<Block> = client::light::backend::Backend<
|
pub type LightBackend<Block> = sc_light::Backend<
|
||||||
sc_client_db::light::LightStorage<Block>,
|
sc_client_db::light::LightStorage<Block>,
|
||||||
BlakeTwo256,
|
BlakeTwo256,
|
||||||
>;
|
>;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ publish = false
|
|||||||
targets = ["x86_64-unknown-linux-gnu"]
|
targets = ["x86_64-unknown-linux-gnu"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
sc-light = { version = "2.0.0-rc3", path = "../../../client/light" }
|
||||||
sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" }
|
sp-consensus = { version = "0.8.0-rc3", path = "../../../primitives/consensus/common" }
|
||||||
sc-block-builder = { version = "0.8.0-rc3", path = "../../../client/block-builder" }
|
sc-block-builder = { version = "0.8.0-rc3", path = "../../../client/block-builder" }
|
||||||
substrate-test-client = { version = "2.0.0-rc3", path = "../../client" }
|
substrate-test-client = { version = "2.0.0-rc3", path = "../../client" }
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ use sp_core::{sr25519, ChangesTrieConfiguration};
|
|||||||
use sp_core::storage::{ChildInfo, Storage, StorageChild};
|
use sp_core::storage::{ChildInfo, Storage, StorageChild};
|
||||||
use substrate_test_runtime::genesismap::{GenesisConfig, additional_storage_with_genesis};
|
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 sp_runtime::traits::{Block as BlockT, Header as HeaderT, Hash as HashT, NumberFor, HashFor};
|
||||||
use sc_service::client::light::fetcher::{
|
use sc_client_api::light::{
|
||||||
Fetcher, RemoteHeaderRequest, RemoteReadRequest, RemoteReadChildRequest,
|
|
||||||
RemoteCallRequest, RemoteChangesRequest, RemoteBodyRequest,
|
RemoteCallRequest, RemoteChangesRequest, RemoteBodyRequest,
|
||||||
|
Fetcher, RemoteHeaderRequest, RemoteReadRequest, RemoteReadChildRequest,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A prelude to import in tests.
|
/// A prelude to import in tests.
|
||||||
@@ -75,10 +75,10 @@ pub type Executor = client::LocalCallExecutor<
|
|||||||
pub type LightBackend = substrate_test_client::LightBackend<substrate_test_runtime::Block>;
|
pub type LightBackend = substrate_test_client::LightBackend<substrate_test_runtime::Block>;
|
||||||
|
|
||||||
/// Test client light executor.
|
/// Test client light executor.
|
||||||
pub type LightExecutor = client::light::call_executor::GenesisCallExecutor<
|
pub type LightExecutor = sc_light::GenesisCallExecutor<
|
||||||
LightBackend,
|
LightBackend,
|
||||||
client::LocalCallExecutor<
|
client::LocalCallExecutor<
|
||||||
client::light::backend::Backend<
|
sc_light::Backend<
|
||||||
sc_client_db::light::LightStorage<substrate_test_runtime::Block>,
|
sc_client_db::light::LightStorage<substrate_test_runtime::Block>,
|
||||||
HashFor<substrate_test_runtime::Block>
|
HashFor<substrate_test_runtime::Block>
|
||||||
>,
|
>,
|
||||||
@@ -347,7 +347,7 @@ pub fn new_light() -> (
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
let storage = sc_client_db::light::LightStorage::new_test();
|
let storage = sc_client_db::light::LightStorage::new_test();
|
||||||
let blockchain = Arc::new(client::light::blockchain::Blockchain::new(storage));
|
let blockchain = Arc::new(sc_light::Blockchain::new(storage));
|
||||||
let backend = Arc::new(LightBackend::new(blockchain.clone()));
|
let backend = Arc::new(LightBackend::new(blockchain.clone()));
|
||||||
let executor = new_native_executor();
|
let executor = new_native_executor();
|
||||||
let local_call_executor = 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());
|
||||||
|
|||||||
Reference in New Issue
Block a user