[WIP] Split CLI commands into node-related and auxiliary
Description
See: https://github.com/paritytech/substrate/issues/12156
New CLI interface
Help output of the main binary:
node-template 4.0.0-dev-unknown
Substrate DevHub <https://github.com/substrate-developer-hub>
A fresh FRAME-based Substrate node, ready for hacking.
USAGE:
node-template
node-template <SUBCOMMAND>
OPTIONS:
-h, --help Print help information
-V, --version Print version information
SUBCOMMANDS:
help Print this message or the help of the given subcommand(s)
key Key utilities for the cli
node Commands related to the node itself
try-runtime Try some command against runtime state
Help output from try-runtime subcommand:
node-template-try-runtime 4.0.0-dev-unknown
Try some command against runtime state
USAGE:
node-template try-runtime [OPTIONS] <SUBCOMMAND>
OPTIONS:
--execution <STRATEGY>
The execution strategy that should be used [default: wasm] [possible values: native,
wasm, both, native-else-wasm]
-h, --help
Print help information
--heap-pages <HEAP_PAGES>
The number of 64KB pages to allocate for Wasm execution. Defaults to
[`sc_service::Configuration.default_heap_pages`]
--no-spec-name-check
When enabled, the spec name check will not panic, and instead only show a warning
--state-version <STATE_VERSION>
State version that is used by the chain [default: 1]
-V, --version
Print version information
--wasm-execution <METHOD>
Type of wasm execution used [default: compiled] [possible values:
interpreted-i-know-what-i-do, compiled]
--wasm-instantiation-strategy <STRATEGY>
The WASM instantiation method to use [default: pooling-copy-on-write] [possible values:
pooling-copy-on-write, recreate-instance-copy-on-write, pooling, recreate-instance,
legacy-instance-reuse]
SUBCOMMANDS:
execute-block Executes the given block against some state
follow-chain Follow the given chain's finalized blocks and apply all of its
extrinsics
help Print this message or the help of the given subcommand(s)
offchain-worker Executes *the offchain worker hooks* of a given block against some
state
on-runtime-upgrade Execute the migrations of the "local runtime"
Notes
I haven't added all the required commands to try-runtime command, in particular there is no way of passing any runtime, but this should be now at most easy.
Where will the benchmarking commands live?
Where will the benchmarking commands live?
I suppose that the current split is not final. Tbh, I'm counting on the feedback here to come up with a reasonable and robust design. Initially, I have just separated Key and TryRuntime since both seemed to me as auxiliary tools that do not have to be accompanied by a ton of unnecessary configuration.
The changes so far are most about the general CLI structure and less of try-runtime, so I will leave it to someone from @paritytech/sdk-node team to give an initial approval on the direction.
To me the outcome seems reasonable, but I am not very familiar with this code and haven't looked very closely yet.
The entire structure of having the node as implicit default sub-command is, so that you don't need to pass this extra.
Could we not just make the SharedParams optional? Wouldn't that solve your problem?
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.