Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Drop sc-client #1037

Merged
merged 17 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
366 changes: 168 additions & 198 deletions Cargo.lock

Large diffs are not rendered by default.

17 changes: 8 additions & 9 deletions availability-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ futures = "0.3.4"
tokio = { version = "0.2.13", features = ["rt-core"] }
exit-future = "0.2.0"
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" }
keystore = { package = "sc-keystore", git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
consensus_common = { package = "sp-consensus", git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
client = { package = "sc-client-api", git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
keystore = { package = "sc-keystore", git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
seunlanlege marked this conversation as resolved.
Show resolved Hide resolved
kvdb = "0.5.0"
kvdb-memorydb = "0.5.0"

Expand Down
23 changes: 11 additions & 12 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,25 @@ crate-type = ["cdylib", "rlib"]
log = "0.4.8"
futures = { version = "0.3.4", features = ["compat"] }
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" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sc-client-db = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
service = { package = "polkadot-service", path = "../service", default-features = false }

tokio = { version = "0.2.13", features = ["rt-threaded"], optional = true }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor", optional = true }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor", optional = true }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor", optional = true }

wasm-bindgen = { version = "0.2.57", optional = true }
wasm-bindgen-futures = { version = "0.4.7", optional = true }
browser-utils = { package = "substrate-browser-utils", git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
browser-utils = { package = "substrate-browser-utils", git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor", optional = true }

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }

[features]
default = [ "wasmtime", "db", "cli" ]
Expand Down
120 changes: 50 additions & 70 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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)) => {
Expand Down Expand Up @@ -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
>;
21 changes: 11 additions & 10 deletions collator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ edition = "2018"

[dependencies]
futures = "0.3.4"
sc-client = { 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" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
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" }
consensus_common = { package = "sp-consensus", git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
consensus_common = { package = "sp-consensus", git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
polkadot-primitives = { path = "../primitives" }
polkadot-cli = { path = "../cli" }
polkadot-network = { path = "../network" }
Expand All @@ -27,4 +28,4 @@ futures-timer = "2.0"
codec = { package = "parity-scale-codec", version = "1.3.0" }

[dev-dependencies]
keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "master" }
keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "seun-the-great-client-refactor" }
Loading