diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 832b7541625a9..5c1a3b2ebd4e6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -161,7 +161,7 @@ test-linux-stable-int:
- echo "___Logs will be partly shown at the end in case of failure.___"
- echo "___Full log will be saved to the job artifacts only in case of failure.___"
- RUST_LOG=sync=trace,consensus=trace,client=trace,state-db=trace,db=trace,forks=trace,state_db=trace,storage_cache=trace
- time cargo test -p node-cli --release --verbose --locked -- --ignored --test-threads=1
+ time cargo test -p substrate --release --verbose --locked -- --ignored --test-threads=1
&> ${CI_COMMIT_SHORT_SHA}_int_failure.log
- sccache -s
after_script:
diff --git a/Cargo.lock b/Cargo.lock
index 48edf4fa283ef..689358c6910d2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -385,7 +385,7 @@ name = "chain-spec-builder"
version = "2.0.0"
dependencies = [
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "node-cli 2.0.0",
+ "substrate 2.0.0",
"substrate-primitives 2.0.0",
"substrate-service 2.0.0",
]
@@ -2241,78 +2241,6 @@ dependencies = [
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
-[[package]]
-name = "node-cli"
-version = "2.0.0"
-dependencies = [
- "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
- "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "node-executor 2.0.0",
- "node-primitives 2.0.0",
- "node-runtime 2.0.0",
- "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "sr-io 2.0.0",
- "sr-primitives 2.0.0",
- "srml-balances 2.0.0",
- "srml-contracts 2.0.0",
- "srml-finality-tracker 2.0.0",
- "srml-indices 2.0.0",
- "srml-system 2.0.0",
- "srml-timestamp 2.0.0",
- "structopt 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
- "substrate-basic-authorship 2.0.0",
- "substrate-cli 2.0.0",
- "substrate-client 2.0.0",
- "substrate-consensus-aura 2.0.0",
- "substrate-consensus-aura-primitives 2.0.0",
- "substrate-consensus-common 2.0.0",
- "substrate-finality-grandpa 2.0.0",
- "substrate-finality-grandpa-primitives 2.0.0",
- "substrate-inherents 2.0.0",
- "substrate-keyring 2.0.0",
- "substrate-keystore 2.0.0",
- "substrate-network 2.0.0",
- "substrate-primitives 2.0.0",
- "substrate-service 2.0.0",
- "substrate-service-test 2.0.0",
- "substrate-telemetry 2.0.0",
- "substrate-transaction-pool 2.0.0",
- "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
- "transaction-factory 0.0.1",
-]
-
-[[package]]
-name = "node-executor"
-version = "2.0.0"
-dependencies = [
- "node-primitives 2.0.0",
- "node-runtime 2.0.0",
- "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "sr-io 2.0.0",
- "sr-primitives 2.0.0",
- "srml-balances 2.0.0",
- "srml-contracts 2.0.0",
- "srml-grandpa 2.0.0",
- "srml-indices 2.0.0",
- "srml-session 2.0.0",
- "srml-staking 2.0.0",
- "srml-support 2.0.0",
- "srml-system 2.0.0",
- "srml-timestamp 2.0.0",
- "srml-treasury 2.0.0",
- "substrate-executor 2.0.0",
- "substrate-keyring 2.0.0",
- "substrate-primitives 2.0.0",
- "substrate-state-machine 2.0.0",
- "substrate-test-client 2.0.0",
- "substrate-trie 2.0.0",
- "trie-root 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
[[package]]
name = "node-primitives"
version = "2.0.0"
@@ -4150,9 +4078,53 @@ name = "substrate"
version = "2.0.0"
dependencies = [
"ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
- "node-cli 2.0.0",
+ "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "node-primitives 2.0.0",
+ "node-runtime 2.0.0",
+ "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "sr-io 2.0.0",
+ "sr-primitives 2.0.0",
+ "srml-balances 2.0.0",
+ "srml-contracts 2.0.0",
+ "srml-finality-tracker 2.0.0",
+ "srml-indices 2.0.0",
+ "srml-session 2.0.0",
+ "srml-staking 2.0.0",
+ "srml-support 2.0.0",
+ "srml-system 2.0.0",
+ "srml-timestamp 2.0.0",
+ "srml-treasury 2.0.0",
+ "structopt 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
+ "substrate-basic-authorship 2.0.0",
+ "substrate-cli 2.0.0",
+ "substrate-client 2.0.0",
+ "substrate-consensus-aura 2.0.0",
+ "substrate-consensus-aura-primitives 2.0.0",
+ "substrate-consensus-common 2.0.0",
+ "substrate-executor 2.0.0",
+ "substrate-finality-grandpa 2.0.0",
+ "substrate-finality-grandpa-primitives 2.0.0",
+ "substrate-inherents 2.0.0",
+ "substrate-keyring 2.0.0",
+ "substrate-keystore 2.0.0",
+ "substrate-network 2.0.0",
+ "substrate-primitives 2.0.0",
+ "substrate-service 2.0.0",
+ "substrate-service-test 2.0.0",
+ "substrate-state-machine 2.0.0",
+ "substrate-telemetry 2.0.0",
+ "substrate-test-client 2.0.0",
+ "substrate-transaction-pool 2.0.0",
+ "substrate-trie 2.0.0",
+ "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
+ "transaction-factory 0.0.1",
+ "trie-root 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
"vergen 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -4732,7 +4704,6 @@ dependencies = [
"futures-preview 0.3.0-alpha.17 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "node-executor 2.0.0",
"node-primitives 2.0.0",
"node-runtime 2.0.0",
"parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -4743,6 +4714,7 @@ dependencies = [
"slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 2.0.0",
"sr-primitives 2.0.0",
+ "substrate 2.0.0",
"substrate-client 2.0.0",
"substrate-client-db 2.0.0",
"substrate-consensus-common 2.0.0",
diff --git a/Cargo.toml b/Cargo.toml
index a6a7b8d17ba35..f49bb93c27deb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,10 @@
[[bin]]
name = "substrate"
-path = "node/src/main.rs"
+path = "node/src/bin/main.rs"
+
+[lib]
+name = "substrate_node_cli"
+path = "node/src/lib.rs"
[package]
name = "substrate"
@@ -10,13 +14,70 @@ build = "build.rs"
edition = "2018"
[dependencies]
-cli = { package = "node-cli", path = "node/cli" }
+log = "0.4"
+tokio = "0.1.7"
futures = "0.1"
ctrlc = { version = "3.0", features = ["termination"] }
+exit-future = "0.1"
+cli = { package = "substrate-cli", path = "core/cli" }
+parity-codec = { version = "4.1.1" }
+sr-io = { path = "core/sr-io" }
+client = { package = "substrate-client", path = "core/client" }
+primitives = { package = "substrate-primitives", path = "core/primitives" }
+inherents = { package = "substrate-inherents", path = "core/inherents" }
+node-runtime = { path = "node/runtime" }
+node-primitives = { path = "node/primitives" }
+hex-literal = "0.2"
+substrate-basic-authorship = { path = "core/basic-authorship" }
+substrate-service = { path = "core/service" }
+transaction_pool = { package = "substrate-transaction-pool", path = "core/transaction-pool" }
+network = { package = "substrate-network", path = "core/network" }
+aura = { package = "substrate-consensus-aura", path = "core/consensus/aura" }
+aura_primitives = { package = "substrate-consensus-aura-primitives", path = "core/consensus/aura/primitives" }
+grandpa = { package = "substrate-finality-grandpa", path = "core/finality-grandpa" }
+grandpa_primitives = { package = "substrate-finality-grandpa-primitives", path = "core/finality-grandpa/primitives" }
+sr-primitives = { path = "core/sr-primitives" }
+substrate-keystore = { path = "core/keystore" }
+substrate-telemetry = { package = "substrate-telemetry", path = "core/telemetry" }
+structopt = "0.2"
+transaction-factory = { path = "test-utils/transaction-factory" }
+keyring = { package = "substrate-keyring", path = "core/keyring" }
+indices = { package = "srml-indices", path = "srml/indices" }
+timestamp = { package = "srml-timestamp", path = "srml/timestamp", default-features = false }
+rand = "0.6"
+finality_tracker = { package = "srml-finality-tracker", path = "srml/finality-tracker", default-features = false }
+contracts = { package = "srml-contracts", path = "srml/contracts" }
+system = { package = "srml-system", path = "srml/system" }
+balances = { package = "srml-balances", path = "srml/balances" }
+trie-root = "0.14.0"
+state_machine = { package = "substrate-state-machine", path = "core/state-machine" }
+substrate-executor = { path = "core/executor" }
+trie = { package = "substrate-trie", path = "core/trie" }
+
+[dev-dependencies]
+consensus-common = { package = "substrate-consensus-common", path = "core/consensus/common" }
+service-test = { package = "substrate-service-test", path = "core/service/test" }
+test-client = { package = "substrate-test-client", path = "core/test-client" }
+keyring = { package = "substrate-keyring", path = "core/keyring" }
+runtime_support = { package = "srml-support", path = "srml/support" }
+balances = { package = "srml-balances", path = "srml/balances" }
+session = { package = "srml-session", path = "srml/session" }
+staking = { package = "srml-staking", path = "srml/staking" }
+system = { package = "srml-system", path = "srml/system" }
+timestamp = { package = "srml-timestamp", path = "srml/timestamp" }
+treasury = { package = "srml-treasury", path = "srml/treasury" }
+contracts = { package = "srml-contracts", path = "srml/contracts" }
+indices = { package = "srml-indices", path = "srml/indices" }
+wabt = "~0.7.4"
[build-dependencies]
+cli = { package = "substrate-cli", path = "core/cli" }
+structopt = "0.2"
vergen = "3"
+[features]
+benchmarks = []
+
[workspace]
members = [
"core/cli",
@@ -86,8 +147,6 @@ members = [
"srml/system",
"srml/timestamp",
"srml/treasury",
- "node/cli",
- "node/executor",
"node/primitives",
"node/runtime",
"node/rpc-client",
diff --git a/build.rs b/build.rs
index 273700c525c88..303a4c0f770eb 100644
--- a/build.rs
+++ b/build.rs
@@ -14,6 +14,9 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see .
+use cli::{NoCustom, CoreParams};
+use std::{fs, env, path::Path};
+use structopt::{StructOpt, clap::Shell};
use vergen::{ConstantsFlags, generate_cargo_keys};
const ERROR_MSG: &str = "Failed to generate metadata files";
@@ -21,4 +24,30 @@ const ERROR_MSG: &str = "Failed to generate metadata files";
fn main() {
generate_cargo_keys(ConstantsFlags::all()).expect(ERROR_MSG);
println!("cargo:rerun-if-changed=.git/HEAD");
+ build_shell_completion();
+}
+
+/// Build shell completion scripts for all known shells
+/// Full list in https://github.com/kbknapp/clap-rs/blob/e9d0562a1dc5dfe731ed7c767e6cee0af08f0cf9/src/app/parser.rs#L123
+fn build_shell_completion() {
+ for shell in &[Shell::Bash, Shell::Fish, Shell::Zsh, Shell::Elvish, Shell::PowerShell] {
+ build_completion(shell);
+ }
+}
+
+/// Build the shell auto-completion for a given Shell
+fn build_completion(shell: &Shell) {
+ let outdir = match env::var_os("OUT_DIR") {
+ None => return,
+ Some(dir) => dir,
+ };
+ let path = Path::new(&outdir)
+ .parent().unwrap()
+ .parent().unwrap()
+ .parent().unwrap()
+ .join("completion-scripts");
+
+ fs::create_dir(&path).ok();
+
+ CoreParams::::clap().gen_completions("substrate-node", *shell, &path);
}
diff --git a/core/service/Cargo.toml b/core/service/Cargo.toml
index 6a15e2eeb6c31..1cda77623c6ae 100644
--- a/core/service/Cargo.toml
+++ b/core/service/Cargo.toml
@@ -37,7 +37,7 @@ parity-multiaddr = { package = "parity-multiaddr", version = "0.5.0" }
[dev-dependencies]
substrate-test-runtime-client = { path = "../test-runtime/client" }
-node-executor = { path = "../../node/executor" }
+substrate = { path = "../.." }
node-primitives = { path = "../../node/primitives" }
node-runtime = { path = "../../node/runtime" }
grandpa = { package = "substrate-finality-grandpa", path = "../../core/finality-grandpa" }
diff --git a/core/service/src/lib.rs b/core/service/src/lib.rs
index a38009120f9e7..daeeafc3f9e95 100644
--- a/core/service/src/lib.rs
+++ b/core/service/src/lib.rs
@@ -1022,7 +1022,7 @@ where
/// RuntimeApi = RuntimeApi,
/// // Declare the network protocol and give an initializer.
/// NetworkProtocol = NodeProtocol { |config| Ok(NodeProtocol::new()) },
-/// RuntimeDispatch = node_executor::Executor,
+/// RuntimeDispatch = substrate_node_cli::executor::Executor,
/// FullTransactionPoolApi = FullChainApi
/// { |config, client| Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client))) },
/// LightTransactionPoolApi = LightChainApi
diff --git a/node/cli/Cargo.toml b/node/cli/Cargo.toml
deleted file mode 100644
index 17efcc400f35b..0000000000000
--- a/node/cli/Cargo.toml
+++ /dev/null
@@ -1,52 +0,0 @@
-[package]
-name = "node-cli"
-version = "2.0.0"
-authors = ["Parity Technologies "]
-description = "Substrate node implementation in Rust."
-build = "build.rs"
-edition = "2018"
-
-[dependencies]
-log = "0.4"
-tokio = "0.1.7"
-futures = "0.1"
-exit-future = "0.1"
-cli = { package = "substrate-cli", path = "../../core/cli" }
-parity-codec = { version = "4.1.1" }
-sr-io = { path = "../../core/sr-io" }
-client = { package = "substrate-client", path = "../../core/client" }
-primitives = { package = "substrate-primitives", path = "../../core/primitives" }
-inherents = { package = "substrate-inherents", path = "../../core/inherents" }
-node-runtime = { path = "../runtime" }
-node-primitives = { path = "../primitives" }
-hex-literal = "0.2"
-substrate-basic-authorship = { path = "../../core/basic-authorship" }
-substrate-service = { path = "../../core/service" }
-transaction_pool = { package = "substrate-transaction-pool", path = "../../core/transaction-pool" }
-network = { package = "substrate-network", path = "../../core/network" }
-aura = { package = "substrate-consensus-aura", path = "../../core/consensus/aura" }
-aura_primitives = { package = "substrate-consensus-aura-primitives", path = "../../core/consensus/aura/primitives" }
-grandpa = { package = "substrate-finality-grandpa", path = "../../core/finality-grandpa" }
-grandpa_primitives = { package = "substrate-finality-grandpa-primitives", path = "../../core/finality-grandpa/primitives" }
-sr-primitives = { path = "../../core/sr-primitives" }
-node-executor = { path = "../executor" }
-substrate-keystore = { path = "../../core/keystore" }
-substrate-telemetry = { package = "substrate-telemetry", path = "../../core/telemetry" }
-structopt = "0.2"
-transaction-factory = { path = "../../test-utils/transaction-factory" }
-keyring = { package = "substrate-keyring", path = "../../core/keyring" }
-indices = { package = "srml-indices", path = "../../srml/indices" }
-timestamp = { package = "srml-timestamp", path = "../../srml/timestamp", default-features = false }
-rand = "0.6"
-finality_tracker = { package = "srml-finality-tracker", path = "../../srml/finality-tracker", default-features = false }
-contracts = { package = "srml-contracts", path = "../../srml/contracts" }
-system = { package = "srml-system", path = "../../srml/system" }
-balances = { package = "srml-balances", path = "../../srml/balances" }
-
-[dev-dependencies]
-consensus-common = { package = "substrate-consensus-common", path = "../../core/consensus/common" }
-service-test = { package = "substrate-service-test", path = "../../core/service/test" }
-
-[build-dependencies]
-cli = { package = "substrate-cli", path = "../../core/cli" }
-structopt = "0.2"
diff --git a/node/cli/build.rs b/node/cli/build.rs
deleted file mode 100644
index e7a7b271f1503..0000000000000
--- a/node/cli/build.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2017-2019 Parity Technologies (UK) Ltd.
-// This file is part of Substrate.
-
-// Substrate 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.
-
-// Substrate 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 Substrate. If not, see .
-
-use cli::{NoCustom, CoreParams};
-
-use std::{fs, env, path::Path};
-
-use structopt::{StructOpt, clap::Shell};
-
-fn main() {
- build_shell_completion();
-}
-
-/// Build shell completion scripts for all known shells
-/// Full list in https://github.com/kbknapp/clap-rs/blob/e9d0562a1dc5dfe731ed7c767e6cee0af08f0cf9/src/app/parser.rs#L123
-fn build_shell_completion() {
- for shell in &[Shell::Bash, Shell::Fish, Shell::Zsh, Shell::Elvish, Shell::PowerShell] {
- build_completion(shell);
- }
-}
-
-/// Build the shell auto-completion for a given Shell
-fn build_completion(shell: &Shell) {
- let outdir = match env::var_os("OUT_DIR") {
- None => return,
- Some(dir) => dir,
- };
- let path = Path::new(&outdir)
- .parent().unwrap()
- .parent().unwrap()
- .parent().unwrap()
- .join("completion-scripts");
-
- fs::create_dir(&path).ok();
-
- CoreParams::::clap().gen_completions("substrate-node", *shell, &path);
-}
diff --git a/node/cli/doc/shell-completion.adoc b/node/doc/shell-completion.adoc
similarity index 100%
rename from node/cli/doc/shell-completion.adoc
rename to node/doc/shell-completion.adoc
diff --git a/node/executor/Cargo.toml b/node/executor/Cargo.toml
deleted file mode 100644
index 345401141913c..0000000000000
--- a/node/executor/Cargo.toml
+++ /dev/null
@@ -1,36 +0,0 @@
-[package]
-name = "node-executor"
-version = "2.0.0"
-authors = ["Parity Technologies "]
-description = "Substrate node implementation in Rust."
-edition = "2018"
-
-[dependencies]
-trie-root = "0.14.0"
-parity-codec = "4.1.1"
-runtime_io = { package = "sr-io", path = "../../core/sr-io" }
-state_machine = { package = "substrate-state-machine", path = "../../core/state-machine" }
-substrate-executor = { path = "../../core/executor" }
-primitives = { package = "substrate-primitives", path = "../../core/primitives" }
-trie = { package = "substrate-trie", path = "../../core/trie" }
-node-primitives = { path = "../primitives" }
-node-runtime = { path = "../runtime" }
-
-[dev-dependencies]
-test-client = { package = "substrate-test-client", path = "../../core/test-client" }
-keyring = { package = "substrate-keyring", path = "../../core/keyring" }
-runtime_primitives = { package = "sr-primitives", path = "../../core/sr-primitives" }
-runtime_support = { package = "srml-support", path = "../../srml/support" }
-balances = { package = "srml-balances", path = "../../srml/balances" }
-session = { package = "srml-session", path = "../../srml/session" }
-staking = { package = "srml-staking", path = "../../srml/staking" }
-system = { package = "srml-system", path = "../../srml/system" }
-timestamp = { package = "srml-timestamp", path = "../../srml/timestamp" }
-treasury = { package = "srml-treasury", path = "../../srml/treasury" }
-contracts = { package = "srml-contracts", path = "../../srml/contracts" }
-grandpa = { package = "srml-grandpa", path = "../../srml/grandpa" }
-indices = { package = "srml-indices", path = "../../srml/indices" }
-wabt = "~0.7.4"
-
-[features]
-benchmarks = []
diff --git a/node/cli/res/flaming-fir.json b/node/res/flaming-fir.json
similarity index 100%
rename from node/cli/res/flaming-fir.json
rename to node/res/flaming-fir.json
diff --git a/node/src/main.rs b/node/src/bin/main.rs
similarity index 92%
rename from node/src/main.rs
rename to node/src/bin/main.rs
index 15b603e7a2706..2e402e542829b 100644
--- a/node/src/main.rs
+++ b/node/src/bin/main.rs
@@ -18,7 +18,7 @@
#![warn(missing_docs)]
-use cli::VersionInfo;
+use substrate_node_cli::VersionInfo;
use futures::sync::oneshot;
use futures::{future, Future};
@@ -26,7 +26,7 @@ use std::cell::RefCell;
// handles ctrl-c
struct Exit;
-impl cli::IntoExit for Exit {
+impl substrate_node_cli::IntoExit for Exit {
type Exit = future::MapErr, fn(oneshot::Canceled) -> ()>;
fn into_exit(self) -> Self::Exit {
// can't use signal directly here because CtrlC takes only `Fn`.
@@ -54,7 +54,7 @@ fn main() {
support_url: "https://github.com/paritytech/substrate/issues/new",
};
- if let Err(e) = cli::run(::std::env::args(), Exit, version) {
+ if let Err(e) = substrate_node_cli::run(::std::env::args(), Exit, version) {
eprintln!("Error starting the node: {}\n\n{:?}", e, e);
std::process::exit(1)
}
diff --git a/node/cli/src/chain_spec.rs b/node/src/chain_spec.rs
similarity index 100%
rename from node/cli/src/chain_spec.rs
rename to node/src/chain_spec.rs
diff --git a/node/executor/src/lib.rs b/node/src/executor.rs
similarity index 97%
rename from node/executor/src/lib.rs
rename to node/src/executor.rs
index b55461492625d..82d6b23538f3c 100644
--- a/node/executor/src/lib.rs
+++ b/node/src/executor.rs
@@ -35,7 +35,6 @@ native_executor_instance!(
#[cfg(test)]
mod tests {
- use runtime_io;
use super::Executor;
use substrate_executor::{WasmExecutor, NativeExecutionDispatch};
use parity_codec::{Encode, Decode, Joiner};
@@ -47,9 +46,9 @@ mod tests {
NativeOrEncoded
};
use node_primitives::{Hash, BlockNumber, AccountId, Balance, Index};
- use runtime_primitives::traits::{Header as HeaderT, Hash as HashT};
- use runtime_primitives::{generic::Era, ApplyOutcome, ApplyError, ApplyResult, Perbill};
- use runtime_primitives::weights::{WeightMultiplier, SimpleDispatchInfo, WeighData};
+ use sr_primitives::traits::{Header as HeaderT, Hash as HashT};
+ use sr_primitives::{generic::Era, ApplyOutcome, ApplyError, ApplyResult, Perbill};
+ use sr_primitives::weights::{WeightMultiplier, SimpleDispatchInfo, WeighData};
use {balances, contracts, indices, staking, system, timestamp};
use contracts::ContractAddressFor;
use system::{EventRecord, Phase};
@@ -129,7 +128,7 @@ mod tests {
let key = AccountKeyring::from_public(&signed).unwrap();
let signature = payload.using_encoded(|b| {
if b.len() > 256 {
- key.sign(&runtime_io::blake2_256(b))
+ key.sign(&sr_io::blake2_256(b))
} else {
key.sign(b)
}
@@ -272,7 +271,7 @@ mod tests {
).0;
assert!(r.is_ok());
- runtime_io::with_externalities(&mut t, || {
+ sr_io::with_externalities(&mut t, || {
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - transfer_fee(&xt()) - creation_fee());
assert_eq!(Balances::total_balance(&bob()), 69 * DOLLARS);
});
@@ -308,7 +307,7 @@ mod tests {
).0;
assert!(r.is_ok());
- runtime_io::with_externalities(&mut t, || {
+ sr_io::with_externalities(&mut t, || {
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - transfer_fee(&xt()) - creation_fee());
assert_eq!(Balances::total_balance(&bob()), 69 * DOLLARS);
});
@@ -540,7 +539,7 @@ mod tests {
None,
).0.unwrap();
- runtime_io::with_externalities(&mut t, || {
+ sr_io::with_externalities(&mut t, || {
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - transfer_fee(&xt()) - creation_fee());
assert_eq!(Balances::total_balance(&bob()), 169 * DOLLARS);
let events = vec![
@@ -575,7 +574,7 @@ mod tests {
None,
).0.unwrap();
- runtime_io::with_externalities(&mut t, || {
+ sr_io::with_externalities(&mut t, || {
// TODO TODO: this needs investigating: why are we deducting creation fee twice here? and why bob also pays it?
assert_eq!(Balances::total_balance(&alice()), 32 * DOLLARS - 2 * transfer_fee(&xt()) - 2 * creation_fee());
assert_eq!(Balances::total_balance(&bob()), 179 * DOLLARS - transfer_fee(&xt()) - creation_fee());
@@ -632,14 +631,14 @@ mod tests {
WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "Core_execute_block", &block1.0).unwrap();
- runtime_io::with_externalities(&mut t, || {
+ sr_io::with_externalities(&mut t, || {
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - transfer_fee(&xt()) - creation_fee());
assert_eq!(Balances::total_balance(&bob()), 169 * DOLLARS);
});
WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "Core_execute_block", &block2.0).unwrap();
- runtime_io::with_externalities(&mut t, || {
+ sr_io::with_externalities(&mut t, || {
assert_eq!(Balances::total_balance(&alice()), 32 * DOLLARS - 2 * transfer_fee(&xt()) - 2 * creation_fee());
assert_eq!(Balances::total_balance(&bob()), 179 * DOLLARS - 1 * transfer_fee(&xt()) - creation_fee());
});
@@ -787,7 +786,7 @@ mod tests {
WasmExecutor::new().call(&mut t, 8, COMPACT_CODE,"Core_execute_block", &b.0).unwrap();
- runtime_io::with_externalities(&mut t, || {
+ sr_io::with_externalities(&mut t, || {
// Verify that the contract constructor worked well and code of TRANSFER contract is actually deployed.
assert_eq!(
&contracts::ContractInfoOf::::get(addr)
@@ -885,7 +884,7 @@ mod tests {
let r = ApplyResult::decode(&mut &r[..]).unwrap();
assert_eq!(r, Ok(ApplyOutcome::Success));
- runtime_io::with_externalities(&mut t, || {
+ sr_io::with_externalities(&mut t, || {
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - 1 * transfer_fee(&xt()) - creation_fee());
assert_eq!(Balances::total_balance(&bob()), 69 * DOLLARS);
});
@@ -942,7 +941,7 @@ mod tests {
let mut prev_multiplier = WeightMultiplier::default();
- runtime_io::with_externalities(&mut t, || {
+ sr_io::with_externalities(&mut t, || {
assert_eq!(System::next_weight_multiplier(), prev_multiplier);
});
@@ -995,7 +994,7 @@ mod tests {
).0.unwrap();
// weight multiplier is increased for next block.
- runtime_io::with_externalities(&mut t, || {
+ sr_io::with_externalities(&mut t, || {
let fm = System::next_weight_multiplier();
println!("After a big block: {:?} -> {:?}", prev_multiplier, fm);
assert!(fm > prev_multiplier);
@@ -1012,7 +1011,7 @@ mod tests {
).0.unwrap();
// weight multiplier is increased for next block.
- runtime_io::with_externalities(&mut t, || {
+ sr_io::with_externalities(&mut t, || {
let fm = System::next_weight_multiplier();
println!("After a small block: {:?} -> {:?}", prev_multiplier, fm);
assert!(fm < prev_multiplier);
diff --git a/node/cli/src/factory_impl.rs b/node/src/factory_impl.rs
similarity index 100%
rename from node/cli/src/factory_impl.rs
rename to node/src/factory_impl.rs
diff --git a/node/cli/src/lib.rs b/node/src/lib.rs
similarity index 99%
rename from node/cli/src/lib.rs
rename to node/src/lib.rs
index b18fa57411ce5..08ca20fb89eb3 100644
--- a/node/cli/src/lib.rs
+++ b/node/src/lib.rs
@@ -21,6 +21,7 @@
pub use cli::error;
pub mod chain_spec;
+pub mod executor;
mod service;
mod factory_impl;
diff --git a/node/cli/src/service.rs b/node/src/service.rs
similarity index 95%
rename from node/cli/src/service.rs
rename to node/src/service.rs
index 53d6f927b485b..1aef21e64bb6a 100644
--- a/node/cli/src/service.rs
+++ b/node/src/service.rs
@@ -21,10 +21,10 @@
use std::sync::Arc;
use std::time::Duration;
+use crate::executor;
use aura::{import_queue, start_aura, AuraImportQueue, SlotDuration};
use client::{self, LongestChain};
use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider};
-use node_executor;
use primitives::Pair;
use grandpa_primitives::AuthorityPair as GrandpaPair;
use futures::prelude::*;
@@ -71,11 +71,13 @@ construct_service_factory! {
FinalityPair = GrandpaPair,
RuntimeApi = RuntimeApi,
NetworkProtocol = NodeProtocol { |config| Ok(NodeProtocol::new()) },
- RuntimeDispatch = node_executor::Executor,
- FullTransactionPoolApi = transaction_pool::ChainApi, FullExecutor, Block, RuntimeApi>, Block>
- { |config, client| Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client))) },
- LightTransactionPoolApi = transaction_pool::ChainApi, LightExecutor, Block, RuntimeApi>, Block>
- { |config, client| Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client))) },
+ RuntimeDispatch = executor::Executor,
+ FullTransactionPoolApi = transaction_pool::ChainApi<
+ client::Client, FullExecutor, Block, RuntimeApi>, Block
+ > { |config, client| Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client))) },
+ LightTransactionPoolApi = transaction_pool::ChainApi<
+ client::Client, LightExecutor, Block, RuntimeApi>, Block
+ > { |config, client| Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client))) },
Genesis = GenesisConfig,
Configuration = NodeConfig,
FullService = FullComponents
@@ -159,7 +161,9 @@ construct_service_factory! {
LightService = LightComponents
{ |config| >::new(config) },
FullImportQueue = AuraImportQueue
- { |config: &mut FactoryFullConfiguration , client: Arc>, select_chain: Self::SelectChain| {
+ { |config: &mut FactoryFullConfiguration,
+ client: Arc>,
+ select_chain: Self::SelectChain| {
let slot_duration = SlotDuration::get_or_compute(&*client)?;
let (block_import, link_half) =
grandpa::block_import::<_, _, _, RuntimeApi, FullClient, _>(
diff --git a/test-utils/chain-spec-builder/Cargo.toml b/test-utils/chain-spec-builder/Cargo.toml
index a54094d8c7920..dcdca9cf34105 100644
--- a/test-utils/chain-spec-builder/Cargo.toml
+++ b/test-utils/chain-spec-builder/Cargo.toml
@@ -6,6 +6,6 @@ edition = "2018"
[dependencies]
clap = { version = "~2.32", features = ["yaml"] }
-node-cli = { path = "../../node/cli" }
+substrate = { path = "../.." }
substrate-primitives = { path = "../../core/primitives" }
substrate-service = { path = "../../core/service" }
diff --git a/test-utils/chain-spec-builder/src/main.rs b/test-utils/chain-spec-builder/src/main.rs
index 211e8321e3fd1..b0b08a18942d6 100644
--- a/test-utils/chain-spec-builder/src/main.rs
+++ b/test-utils/chain-spec-builder/src/main.rs
@@ -1,6 +1,6 @@
use clap::{App, load_yaml};
-use node_cli::chain_spec;
+use substrate_node_cli::chain_spec;
use substrate_service::chain_ops::build_spec;
fn genesis_constructor() -> chain_spec::GenesisConfig {