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

CLI: refactoring: remove Options from sc_service::Configuration's fields #5271

Merged
merged 258 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from 126 commits
Commits
Show all changes
258 commits
Select commit Hold shift + click to select a range
32cf27d
WIP
cecton Mar 13, 2020
b455e22
Rename IntoConfiguration to CliConfiguration
cecton Mar 13, 2020
71ccb0f
Renamed into_configuration to create_configuration
cecton Mar 13, 2020
5c723ea
WIP
cecton Mar 13, 2020
94ac935
WIP
cecton Mar 13, 2020
ff7b3ff
Move keystore params to its own module
cecton Mar 13, 2020
88c3171
Use in-memory keystore even for build-spec
cecton Mar 13, 2020
5f3ec11
Enforce proper value for node name
cecton Mar 13, 2020
41a7e80
dev_key_seed
cecton Mar 13, 2020
541a6f2
Telemetry endpoints
cecton Mar 13, 2020
b055b38
rustfmt
cecton Mar 13, 2020
fe59624
Converted all RunCmd
cecton Mar 13, 2020
07e9bb5
rustfmt
cecton Mar 13, 2020
5794bb4
Added export-blocks
cecton Mar 13, 2020
1bcc01d
Missed something
cecton Mar 13, 2020
0e24aab
Removed config_path in NetworkConfiguration (not used)
cecton Mar 16, 2020
01e37fa
Fixed warnings
cecton Mar 16, 2020
2b973ba
public_addresses is used but never set, keeping it
cecton Mar 16, 2020
f22007c
Merge Configuration.node and NetworkConfiguration.node_name
cecton Mar 16, 2020
a5acb71
Added: import-blocks
cecton Mar 16, 2020
c2ac3d3
Adding a proc_macro to help impl SubstrateCli
cecton Mar 16, 2020
7b2a46f
WIP
cecton Mar 17, 2020
5430e1a
WIP
cecton Mar 17, 2020
2405569
WIP
cecton Mar 17, 2020
7c11cde
Re-export spec_factory from sc_cli
cecton Mar 17, 2020
ae65701
Re-added all the commands
cecton Mar 17, 2020
0e58648
Refactored node_key_params
cecton Mar 17, 2020
ed60ce7
Fixed previous refucktoring
cecton Mar 17, 2020
8a106a5
Clean-up and removed full_version()
cecton Mar 17, 2020
94f1d50
Renamed get_is_dev to not confuse with Configuration field
cecton Mar 17, 2020
38d64a5
Fixed sc-cli-derive example
cecton Mar 18, 2020
983bd5d
Fixing tests
cecton Mar 18, 2020
9875eeb
Fixing tests and removing some (will re-add later)
cecton Mar 18, 2020
505296e
Fixing more tests
cecton Mar 18, 2020
052de1a
Removes the need of type parameter
cecton Mar 18, 2020
defeda3
Converting bin/node and simplifying API
cecton Mar 18, 2020
349ab93
Converting more
cecton Mar 18, 2020
957b3c5
Converting last command
cecton Mar 18, 2020
9fdffdb
WIP
cecton Mar 18, 2020
c755a4a
Fixing tests and added default for WasmExecutionMethod
cecton Mar 18, 2020
09b6450
Fixing stuff
cecton Mar 18, 2020
98545b8
Fixed something I broke oops
cecton Mar 18, 2020
72981fc
Update Cargo.lock
cecton Mar 18, 2020
e18c782
Moving things around
cecton Mar 18, 2020
3f071cf
Convert everything to Result
cecton Mar 18, 2020
da453d1
Added new macros to simplify the impl of CliConfiguration
cecton Mar 19, 2020
9c516dd
Added a macro to generate CliConfiguration automatically for subcommands
cecton Mar 20, 2020
d41a269
Revert... too many macros (this one is not really useful)
cecton Mar 20, 2020
c8b00a6
Renamed is_dev to get_is_dev
cecton Mar 20, 2020
547ed24
Fixed name roles (this is plural, not singular)
cecton Mar 20, 2020
e1d73d5
Clean-up
cecton Mar 20, 2020
08294e6
Re-export NodeKeyConfig and TelemetryEndpoints from sc_service
cecton Mar 20, 2020
fcf9882
Improve styling/formatting
cecton Mar 20, 2020
b950f73
Added copyrights
cecton Mar 20, 2020
bd72413
Added doc and fixed warnings
cecton Mar 20, 2020
a94fb8f
Added myself to code owners
cecton Mar 20, 2020
e6464c0
Yes it is needed according to the history
cecton Mar 20, 2020
e55292e
Revert formatting
cecton Mar 20, 2020
3b3cbde
Update from parent 'origin/master' (no conflict)
cecton Mar 20, 2020
aaf4b48
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
39f60e0
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
c71fa1d
Update from parent 'origin/master' (no conflict)
cecton Mar 20, 2020
5db8b05
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
bfe8a75
Update from parent 'origin/master' (no conflict)
cecton Mar 20, 2020
924ca71
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
1b456c1
Update from parent 'origin/master' (no conflict)
cecton Mar 20, 2020
679c950
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
a201a5a
Update from parent 'origin/master' (no conflict)
cecton Mar 20, 2020
f60a930
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
f6154db
Update from parent 'origin/master' (no conflict)
cecton Mar 20, 2020
42e0068
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
005a152
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
6604f06
Update from parent 'origin/master' (no conflict)
cecton Mar 20, 2020
2c3c536
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
6e9914e
Update from parent 'origin/master' (no conflict)
cecton Mar 20, 2020
925c8ce
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
d1f9754
Update from parent 'origin/master' (no conflict)
cecton Mar 20, 2020
7925233
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
78b373b
Update from parent 'origin/master' (no conflict)
cecton Mar 20, 2020
e95097b
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
66fd4bc
Fixing conflict
cecton Mar 20, 2020
7852dd7
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
50613ce
Update from parent 'origin/master' (no conflict)
cecton Mar 20, 2020
86e5d89
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
c3ad5d4
Update from parent 'origin/master' (no conflict)
cecton Mar 20, 2020
8244a74
Update from parent 'origin/master' (conflicts)
cecton Mar 20, 2020
7efc74a
Update from parent 'origin/master' (no conflict)
cecton Mar 20, 2020
153f156
Update from parent 'origin/master' (conflicts)
cecton Mar 23, 2020
c527778
Updated build.rs
cecton Mar 23, 2020
d08a9c9
Update from parent 'origin/master' (no conflict)
cecton Mar 23, 2020
240b7ac
Update from parent 'origin/master' (conflicts)
cecton Mar 23, 2020
67aa412
Update from parent 'origin/master' (no conflict)
cecton Mar 23, 2020
4123a66
Update from parent 'origin/master' (conflicts)
cecton Mar 23, 2020
4b1070c
Update from parent 'origin/master' (no conflict)
cecton Mar 23, 2020
93bbb53
Update from parent 'origin/master' (conflicts)
cecton Mar 23, 2020
113c6e2
Update from parent 'origin/master' (no conflict)
cecton Mar 23, 2020
58e0c7c
Update from parent 'origin/master' (conflicts)
cecton Mar 23, 2020
bbc7d54
Update from parent 'origin/master' (no conflict)
cecton Mar 23, 2020
5fbab29
Update from parent 'origin/master' (conflicts)
cecton Mar 23, 2020
f9a9145
Update from parent 'origin/master' (no conflict)
cecton Mar 23, 2020
1131b3a
Update from parent 'origin/master' (conflicts)
cecton Mar 23, 2020
dd1b4cd
Update from parent 'origin/master' (no conflict)
cecton Mar 23, 2020
feb4d76
Update from parent 'origin/master' (conflicts)
cecton Mar 23, 2020
bd87787
Update from parent 'origin/master' (no conflict)
cecton Mar 23, 2020
9b39164
Update from parent 'origin/master' (conflicts)
cecton Mar 23, 2020
0016aa1
Update from parent 'origin/master' (no conflict)
cecton Mar 23, 2020
a423bbb
Update from parent 'origin/master' (conflicts)
cecton Mar 23, 2020
71cbf2e
Update from parent 'origin/master' (no conflict)
cecton Mar 23, 2020
97f281e
Cargo.lock
cecton Mar 23, 2020
07eb393
Clean-up
cecton Mar 23, 2020
1c88217
Update client/cli-derive/Cargo.toml
cecton Mar 23, 2020
c0ef8cb
Fail if using proc_macro and build.rs is not set properly
cecton Mar 23, 2020
85892f6
Dropped all get_ in front of methods
cecton Mar 23, 2020
7aa8040
Update from parent 'origin/master' (no conflict)
cecton Mar 23, 2020
dc7703c
Update from parent 'origin/master' (conflicts)
cecton Mar 23, 2020
af11693
Clean-up
cecton Mar 23, 2020
89b519c
Fixing proc macro missing env var
cecton Mar 23, 2020
65349dd
Get the configuration inside the Runtime (needed for polkadot)
cecton Mar 24, 2020
6331d26
Clean-up
cecton Mar 24, 2020
ff2e47f
Get is_dev from argument like the others
cecton Mar 24, 2020
3e03f69
Get chain ID instead of chain spec from shared params
cecton Mar 24, 2020
3c68411
&self is passed to spec_factory/load_spec
cecton Mar 25, 2020
86a7adc
Wrong text
cecton Mar 25, 2020
a62448b
Fix example
cecton Mar 25, 2020
ef5a2fd
Officialize macro and made a cool doc
cecton Mar 25, 2020
ad40ed7
Renamed spec_factory to load_spec (substrate_cli_configuration)
cecton Mar 25, 2020
b7b7e1a
Removed not so useful ChainSpec
cecton Mar 25, 2020
6599e13
Renamed SubstrateCLI to SubstrateCli
cecton Mar 25, 2020
f9102a2
Added changelog for impl_version being full now
cecton Mar 25, 2020
4ddbcd1
Renamed Runtime to Runner
cecton Mar 25, 2020
14c22ee
Update from parent 'origin/master' (no conflict)
cecton Mar 25, 2020
575343c
Update from parent 'origin/master' (conflicts)
cecton Mar 25, 2020
0e23a14
Update changelog to show example
cecton Mar 25, 2020
d32defd
Removed option on database cache size
cecton Mar 26, 2020
b4580b0
WIP
cecton Mar 26, 2020
1303520
Fix on removal of option
cecton Mar 26, 2020
ffeeea7
typo
cecton Mar 26, 2020
59208c7
Clean-up imports
cecton Mar 26, 2020
2fc46d7
Added info in Cargo.toml
cecton Mar 26, 2020
fb3b7c9
typo
cecton Mar 26, 2020
cc866bb
remarks
cecton Mar 26, 2020
7241a23
Moved function for build.rs to substrate-build-script-utils
cecton Mar 26, 2020
38db0bf
Fixed example & test of cli-derive
cecton Mar 26, 2020
61ef62f
Moved function for build.rs to substrate-build-script-utils
cecton Mar 26, 2020
4f7e1bc
Renamed substrate_cli_configuration to substrate_cli oops
cecton Mar 26, 2020
0598aa3
Added documentation and wrapper macro
cecton Mar 26, 2020
de25e87
Removed option on database cache size
cecton Mar 26, 2020
0aebd52
Removed option on database cache size
cecton Mar 26, 2020
2bd04e8
Clean-up
cecton Mar 26, 2020
30353d1
Reduce risk of errors due to typos
cecton Mar 26, 2020
2105c0c
Removed option on database cache size
cecton Mar 26, 2020
0ae2794
Added NOTE as suggested
cecton Mar 26, 2020
78b5243
Added doc as suggested
cecton Mar 26, 2020
e14fbab
Fixed test
cecton Mar 26, 2020
a84557e
typo
cecton Mar 26, 2020
6e7882c
Update from parent 'origin/master' (no conflict)
cecton Mar 26, 2020
ae303e4
Update from parent 'origin/master' (conflicts)
cecton Mar 26, 2020
8a03f2e
Update from parent 'origin/master' (no conflict)
cecton Mar 26, 2020
66539c7
renamed runtime to runner
cecton Mar 26, 2020
2ffad91
Fixed weird argument
cecton Mar 27, 2020
d4ebc23
More commas
cecton Mar 27, 2020
10db8cc
Moved client/cli-derive to client/cli/derive
cecton Mar 27, 2020
730dc61
Update from parent 'origin/master' (conflicts)
cecton Mar 27, 2020
3db9864
Update from parent 'origin/master' (no conflict)
cecton Mar 27, 2020
23f7d4b
Update from parent 'origin/master' (no conflict)
cecton Mar 29, 2020
9b35ad7
Update from parent 'origin/master' (conflicts)
cecton Mar 29, 2020
ceaab33
Added 7 tests for the macros
cecton Mar 30, 2020
7640777
Update from parent 'origin/master' (conflicts)
cecton Mar 30, 2020
02e6888
Improve error message
cecton Mar 30, 2020
efeff6a
Upgrade assert_cmd
cecton Mar 30, 2020
1db040d
Update from parent 'origin/master' (no conflict)
cecton Mar 31, 2020
36dfd43
Update from parent 'origin/master' (conflicts)
cecton Mar 31, 2020
e541885
Fixing missing stuff
cecton Mar 31, 2020
643f51a
Fixed unused import
cecton Mar 31, 2020
b34e607
Update from parent 'origin/master' (no conflict)
cecton Mar 31, 2020
834f041
Update from parent 'origin/master' (conflicts)
cecton Mar 31, 2020
f8f1cdb
Improve SubstrateCli doc
cecton Mar 31, 2020
099f6b3
Applied suggestions
cecton Mar 31, 2020
8956dca
Fix and clean-up imports
cecton Apr 1, 2020
d99c601
Update from parent 'origin/master' (no conflict)
cecton Apr 1, 2020
5744513
Update from parent 'origin/master' (conflicts)
cecton Apr 2, 2020
bf706c6
Update from parent 'origin/master' (no conflict)
cecton Apr 2, 2020
1e71e46
Update from parent 'origin/master' (conflicts)
cecton Apr 2, 2020
ec13b54
Update from parent 'origin/master' (no conflict)
cecton Apr 2, 2020
d45601a
Update from parent 'origin/master' (conflicts)
cecton Apr 2, 2020
71216f4
Update from parent 'origin/master' (no conflict)
cecton Apr 2, 2020
743ff72
Started replacing macros WIP
cecton Apr 2, 2020
e553696
WIP
cecton Apr 2, 2020
c559485
WIP
cecton Apr 2, 2020
deec407
WIP
cecton Apr 3, 2020
02d3b54
Started removing substrate_cli
cecton Apr 3, 2020
6db9ff4
WIP
cecton Apr 3, 2020
da487d1
WIP
cecton Apr 3, 2020
a7a57c1
WIP
cecton Apr 3, 2020
b6e9a91
fixed bug introduced while refactoring
cecton Apr 3, 2020
26e4d4a
Update from parent 'origin/master' (no conflict)
cecton Apr 3, 2020
2ad3b76
Update from parent 'origin/master' (conflicts)
cecton Apr 3, 2020
db7c9ca
Update from parent 'origin/master' (conflicts)
cecton Apr 3, 2020
41295e6
Update from parent 'origin/master' (no conflict)
cecton Apr 3, 2020
53e8ec2
Renamed NetworkConfigurationParams to NetworkParams for consistency sake
cecton Apr 3, 2020
2e72f3d
Fixed test
cecton Apr 3, 2020
93e74cf
Update client/cli/src/commands/runcmd.rs
cecton Apr 4, 2020
11d527b
Update client/cli/src/commands/runcmd.rs
cecton Apr 4, 2020
8d57c05
Update client/cli/src/commands/export_blocks_cmd.rs
cecton Apr 4, 2020
f705f42
Update client/cli/src/commands/check_block_cmd.rs
cecton Apr 4, 2020
5c30229
Update bin/node/cli/src/command.rs
cecton Apr 4, 2020
3351723
Update bin/node/cli/src/command.rs
cecton Apr 4, 2020
5906776
Update client/cli/src/commands/export_blocks_cmd.rs
cecton Apr 4, 2020
319f249
Revert "Update client/cli/src/commands/export_blocks_cmd.rs"
cecton Apr 4, 2020
489ab74
Revert "Update client/cli/src/commands/check_block_cmd.rs"
cecton Apr 4, 2020
6c3698f
Revert "Update client/cli/src/commands/export_blocks_cmd.rs"
cecton Apr 4, 2020
b675a90
Revert "Update client/cli/src/commands/runcmd.rs"
cecton Apr 4, 2020
a2f4c94
Revert "Update client/cli/src/commands/runcmd.rs"
cecton Apr 4, 2020
9ec0673
Update client/cli/src/commands/export_blocks_cmd.rs
cecton Apr 4, 2020
84e6eba
Update client/cli/src/commands/import_blocks_cmd.rs
cecton Apr 4, 2020
4546a72
Update client/cli/src/commands/purge_chain_cmd.rs
cecton Apr 4, 2020
c5f7973
Update from parent 'origin/master' (no conflict)
cecton Apr 4, 2020
2a53d03
Update from parent 'origin/master' (conflicts)
cecton Apr 4, 2020
4b6b39c
Changed ::sc_cli to $crate in the macro
cecton Apr 4, 2020
f7f8a4d
fixed tests
cecton Apr 4, 2020
b8f56b2
Update from parent 'origin/master' (no conflict)
cecton Apr 4, 2020
ca83720
Update from parent 'origin/master' (conflicts)
cecton Apr 4, 2020
c760c01
fixed conflicts
cecton Apr 6, 2020
03ac706
Update from parent 'origin/master' (no conflict)
cecton Apr 6, 2020
40367eb
Update from parent 'origin/master' (conflicts)
cecton Apr 6, 2020
24160a7
Fixing test
cecton Apr 6, 2020
f27416c
Merge commit f1d7d1d4d4f648536eefce6eefda6d0d2d1abb63 (no conflict)
cecton Apr 6, 2020
1215407
Update client/cli/src/commands/purge_chain_cmd.rs
cecton Apr 6, 2020
9ea4bf1
Update client/cli/src/params/pruning_params.rs
cecton Apr 6, 2020
d36910d
Remove comment as suggested
cecton Apr 6, 2020
925a378
Apply suggestion
cecton Apr 6, 2020
210eda0
Update client/cli/src/commands/purge_chain_cmd.rs
cecton Apr 6, 2020
7801a1e
Update client/cli/src/commands/purge_chain_cmd.rs
cecton Apr 6, 2020
1ad4b0f
Update client/cli/src/commands/purge_chain_cmd.rs
cecton Apr 6, 2020
242f1c9
Update utils/frame/benchmarking-cli/src/command.rs
cecton Apr 6, 2020
2d976c6
Update client/cli/src/runner.rs
cecton Apr 6, 2020
75d7dd7
Update client/cli/src/runner.rs
cecton Apr 6, 2020
d8e765b
Update client/cli/src/runner.rs
cecton Apr 6, 2020
0574d06
Update client/cli/src/params/pruning_params.rs
cecton Apr 6, 2020
68689b7
Update client/cli/src/params/node_key_params.rs
cecton Apr 6, 2020
8ff0472
Update client/cli/src/params/network_params.rs
cecton Apr 6, 2020
ef5af47
Update client/cli/src/lib.rs
cecton Apr 6, 2020
70d1df3
Update client/cli/src/config.rs
cecton Apr 6, 2020
aa73acf
Added doc
cecton Apr 6, 2020
3bc37fe
Fixed error introduced after applying suggestion
cecton Apr 6, 2020
387f6f4
Revert "Update client/cli/src/params/pruning_params.rs"
cecton Apr 6, 2020
993b86c
Print error
cecton Apr 6, 2020
be5960b
Apply suggestions from code review
bkchr Apr 6, 2020
526029f
Remove useless Results
cecton Apr 6, 2020
4b07043
Fixed CI failing on polkadot approval
cecton Apr 7, 2020
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
36 changes: 25 additions & 11 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ members = [
"client/chain-spec",
"client/chain-spec/derive",
"client/cli",
"client/cli-derive",
cecton marked this conversation as resolved.
Show resolved Hide resolved
"client/consensus/aura",
"client/consensus/babe",
"client/consensus/babe/rpc",
Expand Down
4 changes: 2 additions & 2 deletions bin/node-template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "node-template"
version = "2.0.0-alpha.4"
authors = ["Anonymous"]
description = "Substrate Node template"
edition = "2018"
license = "Unlicense"
build = "build.rs"
Expand Down Expand Up @@ -37,5 +38,4 @@ sc-basic-authorship = { path = "../../../client/basic-authorship", version = "0.
node-template-runtime = { version = "2.0.0-alpha.4", path = "../runtime" }

[build-dependencies]
vergen = "3.0.4"
build-script-utils = { version = "2.0.0-alpha.4", package = "substrate-build-script-utils", path = "../../../utils/build-script-utils" }
sc-cli = { version = "0.8.0-alpha.4", path = "../../../client/cli" }
gnunicorn marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 3 additions & 5 deletions bin/node-template/node/build.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use vergen::{ConstantsFlags, generate_cargo_keys};

const ERROR_MSG: &str = "Failed to generate metadata files";
use sc_cli;

fn main() {
generate_cargo_keys(ConstantsFlags::SHA_SHORT).expect(ERROR_MSG);
sc_cli::generate_cargo_keys();

build_script_utils::rerun_if_git_head_changed();
sc_cli::rerun_if_git_head_changed();
gnunicorn marked this conversation as resolved.
Show resolved Hide resolved
}
7 changes: 0 additions & 7 deletions bin/node-template/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,3 @@ fn testnet_genesis(initial_authorities: Vec<(AuraId, GrandpaId)>,
}),
}
}

pub fn load_spec(id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
Ok(match Alternative::from(id) {
Some(spec) => Box::new(spec.load()?),
None => Box::new(ChainSpec::from_json_file(std::path::PathBuf::from(id))?),
})
}
48 changes: 24 additions & 24 deletions bin/node-template/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,36 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair};
use sc_cli::VersionInfo;
use crate::service;
use crate::chain_spec;
use crate::chain_spec::{Alternative, ChainSpec};
use crate::cli::Cli;
use crate::service;
use sc_cli::{spec_factory, SubstrateCLI};
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;

/// Parse and run command line arguments
pub fn run(version: VersionInfo) -> sc_cli::Result<()> {
let opt = sc_cli::from_args::<Cli>(&version);
#[spec_factory(
impl_name = "Substrate Node",
support_url = "support.anonymous.an",
copyright_start_year = 2017
cecton marked this conversation as resolved.
Show resolved Hide resolved
)]
fn spec_factory(id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
Ok(match Alternative::from(id) {
Some(spec) => Box::new(spec.load()?),
None => Box::new(ChainSpec::from_json_file(std::path::PathBuf::from(id))?),
})
}

let mut config = sc_service::Configuration::from_version(&version);
/// Parse and run command line arguments
pub fn run() -> sc_cli::Result<()> {
let opt = Cli::from_args();

match opt.subcommand {
Some(subcommand) => {
subcommand.init(&version)?;
subcommand.update_config(&mut config, chain_spec::load_spec, &version)?;
subcommand.run(
config,
|config: _| Ok(new_full_start!(config).0),
)
},
let runtime = Cli::create_runtime(&subcommand)?;
runtime.run_subcommand(subcommand, |config| Ok(new_full_start!(config).0))
}
None => {
opt.run.init(&version)?;
opt.run.update_config(&mut config, chain_spec::load_spec, &version)?;
opt.run.run(
config,
service::new_light,
service::new_full,
&version,
)
},
let runtime = Cli::create_runtime(&opt.run)?;
runtime.run_node(service::new_light, service::new_full)
}
}
}
13 changes: 1 addition & 12 deletions bin/node-template/node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,5 @@ mod cli;
mod command;

fn main() -> sc_cli::Result<()> {
let version = sc_cli::VersionInfo {
name: "Substrate Node",
commit: env!("VERGEN_SHA_SHORT"),
version: env!("CARGO_PKG_VERSION"),
executable_name: "node-template",
author: "Anonymous",
description: "Template Node",
support_url: "support.anonymous.an",
copyright_start_year: 2017,
};

command::run(version)
command::run()
cecton marked this conversation as resolved.
Show resolved Hide resolved
}
2 changes: 1 addition & 1 deletion bin/node-template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn new_full(config: Configuration)
{
let is_authority = config.roles.is_authority();
let force_authoring = config.force_authoring;
let name = config.name.clone();
let name = config.network.node_name.clone();
let disable_grandpa = config.disable_grandpa;

// sentry nodes announce themselves as authorities to the network
Expand Down
8 changes: 1 addition & 7 deletions bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "node-cli"
version = "2.0.0-alpha.4"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Substrate node implementation in Rust."
description = "Generic Substrate node implementation in Rust."
build = "build.rs"
edition = "2018"
license = "GPL-3.0"
Expand Down Expand Up @@ -112,7 +112,6 @@ nix = "0.17"
serde_json = "1.0"

[build-dependencies]
build-script-utils = { version = "2.0.0-alpha.4", package = "substrate-build-script-utils", path = "../../../utils/build-script-utils" }
structopt = { version = "0.3.8", optional = true }
node-transaction-factory = { version = "0.8.0-alpha.4", optional = true, path = "../transaction-factory" }
node-inspect = { version = "0.8.0-alpha.4", optional = true, path = "../inspect" }
Expand All @@ -124,10 +123,6 @@ package = "sc-cli"
path = "../../../client/cli"
optional = true

[build-dependencies.vergen]
version = "3.0.4"
optional = true

[features]
default = ["cli", "wasmtime"]
browser = [
Expand All @@ -143,7 +138,6 @@ cli = [
"frame-benchmarking-cli",
"sc-service/rocksdb",
"structopt",
"vergen",
]
wasmtime = [
"cli",
Expand Down
13 changes: 1 addition & 12 deletions bin/node/cli/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,5 @@
#![warn(missing_docs)]

fn main() -> sc_cli::Result<()> {
let version = sc_cli::VersionInfo {
name: "Substrate Node",
commit: env!("VERGEN_SHA_SHORT"),
version: env!("CARGO_PKG_VERSION"),
executable_name: "substrate",
author: "Parity Technologies <admin@parity.io>",
description: "Generic substrate node",
support_url: "https://github.com/paritytech/substrate/issues/new",
copyright_start_year: 2017,
};

node_cli::run(std::env::args(), version)
node_cli::run()
}
7 changes: 3 additions & 4 deletions bin/node/cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ mod cli {
include!("src/cli.rs");

use std::{fs, env, path::Path};
use sc_cli::{structopt::clap::Shell};
use vergen::{ConstantsFlags, generate_cargo_keys};
use sc_cli::{structopt::clap::Shell, generate_cargo_keys, rerun_if_git_head_changed};

pub fn main() {
build_shell_completion();
generate_cargo_keys(ConstantsFlags::all()).expect("Failed to generate metadata files");
generate_cargo_keys();

build_script_utils::rerun_if_git_head_changed();
rerun_if_git_head_changed();
}

/// Build shell completion scripts for all known shells
Expand Down
6 changes: 3 additions & 3 deletions bin/node/cli/src/browser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ async fn start_inner(chain_spec: String, log_level: String) -> Result<Client, Bo
let config = browser_configuration(chain_spec).await?;

info!("Substrate browser node");
info!(" version {}", config.full_version());
info!(" version {}", config.impl_version);
info!(" by Parity Technologies, 2017-2020");
info!("Chain specification: {}", config.expect_chain_spec().name());
info!("Node name: {}", config.name);
info!("Chain specification: {}", config.chain_spec.name());
info!("Node name: {}", config.network.node_name);
info!("Roles: {:?}", config.roles);

// Create the service. This is the most heavy initialization step.
Expand Down
11 changes: 4 additions & 7 deletions bin/node/cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

use sc_cli::{SharedParams, ImportParams, RunCmd};
use sc_cli::{ImportParams, RunCmd, SharedParams};
use structopt::StructOpt;

/// An overarching CLI command definition.
Expand Down Expand Up @@ -50,10 +50,7 @@ pub enum Subcommand {
Inspect(node_inspect::cli::InspectCmd),

/// The custom benchmark subcommmand benchmarking runtime pallets.
#[structopt(
name = "benchmark",
about = "Benchmark runtime pallets."
)]
#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
}

Expand All @@ -62,11 +59,11 @@ pub enum Subcommand {
#[derive(Debug, StructOpt, Clone)]
pub struct FactoryCmd {
/// Number of blocks to generate.
#[structopt(long="blocks", default_value = "1")]
#[structopt(long = "blocks", default_value = "1")]
pub blocks: u32,

/// Number of transactions to push per block.
#[structopt(long="transactions", default_value = "8")]
#[structopt(long = "transactions", default_value = "8")]
pub transactions: u32,

#[allow(missing_docs)]
Expand Down
Loading