Remove the service, replacing it with a struct of individual chain components (#6352)

* WIP

* Making progress

* Almost ready

* Get service tests compiling

* Fix node screenshot

* Line widths

* Fix node cli tests

* Fix node cli warning

* ChainComponents -> ServiceComponents, fix tests

* make spawn_handle public

* Remove spawnnamed impl for taskmanager

* Move the keep alive stuff to the task manager

* Move the telemetry, base path, rpc keep_alive to the service builder

* Make the task manager keep alive an internal detail

* Rewrite the browser start_client future

* Remove run_node etc

* Revert my personal changes to browser-demo/build.sh

* use |config|

* Add a runtime_version function to SubstrateCli

* Reexport role and runtime version from sc cli

* Update Cargo.lock

* runtime_version -> native_runtime_version

* Pass chain spec to native_runtime_version for polkadot

* Fix line widths

* Traitify ServiceComponents Client
This commit is contained in:
Ashley
2020-06-30 12:00:42 +02:00
committed by GitHub
parent 493d5d8591
commit b832e35c5e
19 changed files with 646 additions and 782 deletions
+9 -6
View File
@@ -19,7 +19,7 @@
use crate::{chain_spec, service, Cli, Subcommand};
use node_executor::Executor;
use node_runtime::{Block, RuntimeApi};
use sc_cli::{Result, SubstrateCli};
use sc_cli::{Result, SubstrateCli, RuntimeVersion, Role, ChainSpec};
impl SubstrateCli for Cli {
fn impl_name() -> &'static str {
@@ -61,6 +61,10 @@ impl SubstrateCli for Cli {
)?),
})
}
fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
&node_runtime::VERSION
}
}
/// Parse command line arguments into service configuration.
@@ -70,11 +74,10 @@ pub fn run() -> Result<()> {
match &cli.subcommand {
None => {
let runner = cli.create_runner(&cli.run)?;
runner.run_node(
service::new_light,
service::new_full,
node_runtime::VERSION
)
runner.run_node_until_exit(|config| match config.role {
Role::Light => service::new_light(config),
_ => service::new_full(config),
})
}
Some(Subcommand::Inspect(cmd)) => {
let runner = cli.create_runner(cmd)?;