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

Merge node, node-cli, node-executor, node-rpc-client into one #3192

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
122 changes: 47 additions & 75 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 63 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -10,13 +14,70 @@ build = "build.rs"
edition = "2018"

[dependencies]
cli = { package = "node-cli", path = "node/cli" }
log = "0.4"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, don't we maybe want to clean this up and just keep the members in the root Cargo.toml.

The following should help for cargo run:
rust-lang/cargo#7032

(I'm not sure if this already included in stable or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not in stable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just wait and postpone until this is in stable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean around 2022

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already stabilized, so I would assume that it is released with the next rust release? rust-lang/cargo#7056

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",
Expand Down Expand Up @@ -86,8 +147,6 @@ members = [
"srml/system",
"srml/timestamp",
"srml/treasury",
"node/cli",
"node/executor",
"node/primitives",
"node/runtime",
"node/rpc-client",
Expand Down
29 changes: 29 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,40 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

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";

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::<NoCustom, NoCustom>::clap().gen_completions("substrate-node", *shell, &path);
}
2 changes: 1 addition & 1 deletion core/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion core/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self>
/// { |config, client| Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client))) },
/// LightTransactionPoolApi = LightChainApi<Self>
Expand Down
52 changes: 0 additions & 52 deletions node/cli/Cargo.toml

This file was deleted.

Loading