Minimal switch of substrate-node to GRANDPA /Aura (#1128)

* add beginnings of SRML grandpa library

* get srml-grandpa compiling

* tests for srml-grandpa

* add optional session integration to grandpa SRML

* start integration into node runtime

* Allow extracting pending change from header digest

* Make it compile on wasm

* make tests compile again

* Move Authority Key fetching into service, simplify service factory construction

* Generalize Authority Consensus Setup system

* Add Authority Setup Docs

* Allow CLI params to be extensible

 - move params to structopts
 - split parsing and default command execution
 - add custom config to node
 - extended parsing of custom config
 - extending params via structop's flatten

* Minor fixes on cli extension params:
 - added docs
 - re-add actual app name, rather than node-name
 - make strategy and subcommand optional

* better cli params

* synchronize GRANDPA and normal node authorities

* Implement grandpa::network for gossip consensus

* run_grandpa in Node

* Fix missed merge error

* Integrate grandpa import queue

* more specific type def

* link up linkhalf and import block

* make grandpa future send

* get compiling

* Fix new params convention and license header

* get it running

* rebuild node runtime WASM

* change logging level

* Update node/cli/src/params.rs

Co-Authored-By: rphmeier <rphmeier@gmail.com>

* Update node/cli/src/params.rs

Co-Authored-By: rphmeier <rphmeier@gmail.com>

* Update node/cli/src/lib.rs

Co-Authored-By: rphmeier <rphmeier@gmail.com>

* Update node/runtime/src/lib.rs

Co-Authored-By: rphmeier <rphmeier@gmail.com>

* Update node/cli/src/lib.rs

Co-Authored-By: rphmeier <rphmeier@gmail.com>

* Clean up and Fixme for mutable config

* Move GrandpaService Integration into grandpa, feature gated but on per default

* Fixing grandpa runtime module test

* Update wasm runtime hashes for tests

* GRANDPA: use post-header hash when logging scheduled changes

* add an extra bit of logging to authorities

* fixing missing constrain

* remove old code

* move `NewAuthorities` to an event in srml-grandpa

* fix node-executor tests to use grandpa log

* Remove GossipConsensus from tests, use newly provided sync-feature, fixes tests

* Update to latest wasm runtimes

* address grumbles

* address grumbles

* only derive deserialize when using std

* Clean up use of Deserialize
This commit is contained in:
Robert Habermeier
2018-11-21 18:42:50 +01:00
committed by GitHub
parent 84da9d4a02
commit 11fe84a742
59 changed files with 1694 additions and 696 deletions
-253
View File
@@ -1,253 +0,0 @@
name: {name}
author: {author}
about: {description}
args:
- log:
short: l
long: log
value_name: LOG_PATTERN
help: Sets a custom logging filter
takes_value: true
- base-path:
long: base-path
short: d
value_name: PATH
help: Specify custom base path
takes_value: true
- keystore-path:
long: keystore-path
value_name: PATH
help: Specify custom keystore path
takes_value: true
- key:
long: key
value_name: STRING
help: Specify additional key seed
takes_value: true
- node-key:
long: node-key
value_name: KEY
help: Specify node secret key (64-character hex string)
takes_value: true
- validator:
long: validator
help: Enable validator mode
takes_value: false
- light:
long: light
help: Run in light client mode
takes_value: false
- dev:
long: dev
help: Run in development mode; implies --chain=dev --validator --key Alice
takes_value: false
- listen-addr:
long: listen-addr
value_name: LISTEN_ADDR
help: Listen on this multiaddress
takes_value: true
multiple: true
- port:
long: port
value_name: PORT
help: Specify p2p protocol TCP port. Only used if --listen-addr is not specified.
takes_value: true
- rpc-external:
long: rpc-external
help: Listen to all RPC interfaces (default is local)
takes_value: false
- ws-external:
long: ws-external
help: Listen to all Websocket interfaces (default is local)
takes_value: false
- rpc-port:
long: rpc-port
value_name: PORT
help: Specify HTTP RPC server TCP port
takes_value: true
- ws-port:
long: ws-port
value_name: PORT
help: Specify WebSockets RPC server TCP port
takes_value: true
- bootnodes:
long: bootnodes
value_name: URL
help: Specify a list of bootnodes
takes_value: true
multiple: true
- reserved-nodes:
long: reserved-nodes
value_name: URL
help: Specify a list of reserved node addresses
takes_value: true
multiple: true
- out-peers:
long: out-peers
value_name: OUT_PEERS
help: Specify the number of outgoing connections we're trying to maintain
takes_value: true
- in-peers:
long: in-peers
value_name: IN_PEERS
help: Specify the maximum number of incoming connections we're accepting
takes_value: true
- chain:
long: chain
value_name: CHAIN_SPEC
help: Specify the chain specification (one of dev, local or staging)
takes_value: true
- pruning:
long: pruning
value_name: PRUNING_MODE
help: Specify the pruning mode, a number of blocks to keep or "archive". Default is 256.
takes_value: true
- name:
long: name
value_name: NAME
help: The human-readable name for this node, as reported to the telemetry server, if enabled
takes_value: true
- telemetry:
short: t
long: telemetry
help: Should connect to the Substrate telemetry server (telemetry is off by default on local chains)
takes_value: false
- no-telemetry:
long: no-telemetry
help: Should not connect to the Substrate telemetry server (telemetry is on by default on global chains)
takes_value: false
- telemetry-url:
long: telemetry-url
value_name: TELEMETRY_URL
help: The URL of the telemetry server. Implies --telemetry
takes_value: true
- execution:
long: execution
value_name: STRATEGY
help: The means of execution used when calling into the runtime. Can be either wasm, native or both.
subcommands:
- build-spec:
about: Build a spec.json file, outputing to stdout
args:
- raw:
long: raw
help: Force raw genesis storage output.
takes_value: false
- chain:
long: chain
value_name: CHAIN_SPEC
help: Specify the chain specification (one of dev, local or staging)
takes_value: true
- dev:
long: dev
help: Specify the development chain
takes_value: false
- export-blocks:
about: Export blocks to a file
args:
- OUTPUT:
index: 1
help: Output file name or stdout if unspecified.
required: false
- chain:
long: chain
value_name: CHAIN_SPEC
help: Specify the chain specification.
takes_value: true
- dev:
long: dev
help: Specify the development chain
takes_value: false
- base-path:
long: base-path
short: d
value_name: PATH
help: Specify custom base path.
takes_value: true
- from:
long: from
value_name: BLOCK
help: Specify starting block number. 1 by default.
takes_value: true
- to:
long: to
value_name: BLOCK
help: Specify last block number. Best block by default.
takes_value: true
- json:
long: json
help: Use JSON output rather than binary.
takes_value: false
- import-blocks:
about: Import blocks from file.
args:
- INPUT:
index: 1
help: Input file or stdin if unspecified.
required: false
- chain:
long: chain
value_name: CHAIN_SPEC
help: Specify the chain specification.
takes_value: true
- dev:
long: dev
help: Specify the development chain
takes_value: false
- base-path:
long: base-path
short: d
value_name: PATH
help: Specify custom base path.
takes_value: true
- execution:
long: execution
value_name: STRATEGY
help: The means of execution used when executing blocks. Can be either wasm, native or both.
- api-execution:
long: api-execution
value_name: STRATEGY
help: The means of execution used when calling into the runtime. Can be either wasm, native or both.
- max-heap-pages:
long: max-heap-pages
value_name: COUNT
help: The maximum number of 64KB pages to ever allocate for Wasm execution. Don't alter this unless you know what you're doing.
- revert:
about: Revert chain to the previous state
args:
- NUM:
index: 1
help: Number of blocks to revert. Default is 256.
- chain:
long: chain
value_name: CHAIN_SPEC
help: Specify the chain specification.
takes_value: true
- dev:
long: dev
help: Specify the development chain
takes_value: false
- base-path:
long: base-path
short: d
value_name: PATH
help: Specify custom base path.
takes_value: true
- purge-chain:
about: Remove the whole chain data.
args:
- chain:
long: chain
value_name: CHAIN_SPEC
help: Specify the chain specification.
takes_value: true
- dev:
long: dev
help: Specify the development chain
takes_value: false
- base-path:
long: base-path
short: d
value_name: PATH
help: Specify custom base path.
takes_value: true
+93 -77
View File
@@ -50,7 +50,10 @@ extern crate clap;
extern crate error_chain;
#[macro_use]
extern crate log;
#[macro_use]
extern crate structopt;
mod params;
pub mod error;
pub mod informant;
mod panic_hook;
@@ -72,6 +75,8 @@ use std::path::{Path, PathBuf};
use std::str::FromStr;
use names::{Generator, Name};
use regex::Regex;
use structopt::StructOpt;
pub use params::{CoreParams, CoreCommands, ExecutionStrategy};
use futures::Future;
@@ -90,11 +95,11 @@ pub struct VersionInfo {
}
/// CLI Action
pub enum Action<F: ServiceFactory, E: IntoExit> {
pub enum Action<E> {
/// Substrate handled the command. No need to do anything.
ExecutedInternally,
/// Service mode requested. Caller should start the service.
RunService((FactoryFullConfiguration<F>, E)),
RunService(E),
}
/// Something that can be converted into an exit signal.
@@ -117,7 +122,7 @@ fn load_spec<F, G>(matches: &clap::ArgMatches, factory: F) -> Result<ChainSpec<G
}
fn base_path(matches: &clap::ArgMatches) -> PathBuf {
matches.value_of("base-path")
matches.value_of("base_path")
.map(|x| Path::new(x).to_owned())
.unwrap_or_else(default_base_path)
}
@@ -145,84 +150,42 @@ fn is_node_name_valid(_name: &str) -> Result<(), &str> {
Ok(())
}
/// Parse command line arguments and execute commands or return service configuration.
///
/// IANA unassigned port ranges that we could use:
/// 6717-6766 Unassigned
/// 8504-8553 Unassigned
/// 9556-9591 Unassigned
/// 9803-9874 Unassigned
/// 9926-9949 Unassigned
pub fn prepare_execution<F, I, T, E, S>(
args: I,
exit: E,
version: VersionInfo,
spec_factory: S,
impl_name: &'static str,
) -> error::Result<Action<F, E>>
/// Parse command line arguments
pub fn parse_args_default<'a, I, T>(args: I, version: VersionInfo) -> clap::ArgMatches<'a>
where
I: IntoIterator<Item = T>,
T: Into<std::ffi::OsString> + Clone,
E: IntoExit,
F: ServiceFactory,
S: FnOnce(&str) -> Result<Option<ChainSpec<FactoryGenesis<F>>>, String>,
{
panic_hook::set();
let full_version = service::config::full_version_from_strs(
version.version,
version.commit
);
let yaml = format!(include_str!("./cli.yml"),
name = version.executable_name,
description = version.description,
author = version.author,
);
let yaml = &clap::YamlLoader::load_from_str(&yaml).expect("Invalid yml file")[0];
let matches = match clap::App::from_yaml(yaml)
match CoreParams::clap()
.name(version.executable_name)
.author(version.author)
.about(version.description)
.version(&(full_version + "\n")[..])
.get_matches_from_safe(args) {
Ok(m) => m,
Err(e) => e.exit(),
};
// TODO [ToDr] Split parameters parsing from actual execution.
let log_pattern = matches.value_of("log").unwrap_or("");
init_logger(log_pattern);
fdlimit::raise_fd_limit();
if let Some(matches) = matches.subcommand_matches("build-spec") {
let spec = load_spec(&matches, spec_factory)?;
build_spec::<F>(matches, spec)?;
return Ok(Action::ExecutedInternally);
}
}
if let Some(matches) = matches.subcommand_matches("export-blocks") {
let spec = load_spec(&matches, spec_factory)?;
export_blocks::<F, _>(matches, spec, exit.into_exit())?;
return Ok(Action::ExecutedInternally);
}
if let Some(matches) = matches.subcommand_matches("import-blocks") {
let spec = load_spec(&matches, spec_factory)?;
import_blocks::<F, _>(matches, spec, exit.into_exit())?;
return Ok(Action::ExecutedInternally);
}
if let Some(matches) = matches.subcommand_matches("revert") {
let spec = load_spec(&matches, spec_factory)?;
revert_chain::<F>(matches, spec)?;
return Ok(Action::ExecutedInternally);
}
if let Some(matches) = matches.subcommand_matches("purge-chain") {
let spec = load_spec(&matches, spec_factory)?;
purge_chain::<F>(matches, spec)?;
return Ok(Action::ExecutedInternally);
}
/// Parse clap::Matches into config and chain specification
pub fn parse_matches<'a, F, S>(
spec_factory: S,
version: VersionInfo,
impl_name: &'static str,
matches: &clap::ArgMatches<'a>
) -> error::Result<(ChainSpec<<F as service::ServiceFactory>::Genesis>, FactoryFullConfiguration<F>)>
where
F: ServiceFactory,
S: FnOnce(&str) -> Result<Option<ChainSpec<FactoryGenesis<F>>>, String>,
{
let spec = load_spec(&matches, spec_factory)?;
let mut config = service::Configuration::default_with_spec(spec);
let mut config = service::Configuration::default_with_spec(spec.clone());
config.impl_name = impl_name;
config.impl_commit = version.commit;
@@ -284,14 +247,14 @@ where
config.network.config_path = Some(network_path(&base_path, config.chain_spec.id()).to_string_lossy().into());
config.network.net_config_path = config.network.config_path.clone();
config.network.reserved_nodes.extend(matches
.values_of("reserved-nodes")
.values_of("reserved_nodes")
.map_or(Default::default(), |v| v.map(|n| n.to_owned()).collect::<Vec<_>>()));
if !config.network.reserved_nodes.is_empty() {
config.network.non_reserved_mode = NonReservedPeerMode::Deny;
}
config.network.listen_addresses = Vec::new();
for addr in matches.values_of("listen-addr").unwrap_or_default() {
for addr in matches.values_of("listen_addr").unwrap_or_default() {
let addr = addr.parse().map_err(|_| "Invalid listen multiaddress")?;
config.network.listen_addresses.push(addr);
}
@@ -310,17 +273,17 @@ where
config.network.public_addresses = Vec::new();
config.network.client_version = config.client_id();
config.network.use_secret = match matches.value_of("node-key").map(H256::from_str) {
config.network.use_secret = match matches.value_of("node_key").map(H256::from_str) {
Some(Ok(secret)) => Some(secret.into()),
Some(Err(err)) => return Err(format!("Error parsing node key: {}", err).into()),
None => None,
};
let in_peers = match matches.value_of("in-peers") {
let in_peers = match matches.value_of("in_peers") {
Some(in_peers) => in_peers.parse().map_err(|_| "Invalid in-peers value specified.")?,
None => 25,
};
let out_peers = match matches.value_of("out-peers") {
let out_peers = match matches.value_of("out_peers") {
Some(out_peers) => out_peers.parse().map_err(|_| "Invalid out-peers value specified.")?,
None => 25,
};
@@ -334,20 +297,73 @@ where
config.keys.push("Alice".into());
}
let rpc_interface: &str = if matches.is_present("rpc-external") { "0.0.0.0" } else { "127.0.0.1" };
let ws_interface: &str = if matches.is_present("ws-external") { "0.0.0.0" } else { "127.0.0.1" };
let rpc_interface: &str = if matches.is_present("rpc_external") { "0.0.0.0" } else { "127.0.0.1" };
let ws_interface: &str = if matches.is_present("ws_external") { "0.0.0.0" } else { "127.0.0.1" };
config.rpc_http = Some(parse_address(&format!("{}:{}", rpc_interface, 9933), "rpc-port", &matches)?);
config.rpc_ws = Some(parse_address(&format!("{}:{}", ws_interface, 9944), "ws-port", &matches)?);
config.rpc_http = Some(parse_address(&format!("{}:{}", rpc_interface, 9933), "rpc_port", &matches)?);
config.rpc_ws = Some(parse_address(&format!("{}:{}", ws_interface, 9944), "ws_port", &matches)?);
// Override telemetry
if matches.is_present("no-telemetry") {
if matches.is_present("no_telemetry") {
config.telemetry_url = None;
} else if let Some(url) = matches.value_of("telemetry-url") {
} else if let Some(url) = matches.value_of("telemetry_url") {
config.telemetry_url = Some(url.to_owned());
}
Ok(Action::RunService((config, exit)))
Ok((spec, config))
}
//
// IANA unassigned port ranges that we could use:
// 6717-6766 Unassigned
// 8504-8553 Unassigned
// 9556-9591 Unassigned
// 9803-9874 Unassigned
// 9926-9949 Unassigned
/// execute default commands or return service configuration
pub fn execute_default<'a, F, E>(
spec: ChainSpec<FactoryGenesis<F>>,
exit: E,
matches: &clap::ArgMatches<'a>
) -> error::Result<Action<E>>
where
E: IntoExit,
F: ServiceFactory,
{
panic_hook::set();
let log_pattern = matches.value_of("log").unwrap_or("");
init_logger(log_pattern);
fdlimit::raise_fd_limit();
if let Some(matches) = matches.subcommand_matches("build_spec") {
build_spec::<F>(matches, spec)?;
return Ok(Action::ExecutedInternally);
}
if let Some(matches) = matches.subcommand_matches("export_blocks") {
export_blocks::<F, _>(matches, spec, exit.into_exit())?;
return Ok(Action::ExecutedInternally);
}
if let Some(matches) = matches.subcommand_matches("import_blocks") {
import_blocks::<F, _>(matches, spec, exit.into_exit())?;
return Ok(Action::ExecutedInternally);
}
if let Some(matches) = matches.subcommand_matches("revert") {
revert_chain::<F>(matches, spec)?;
return Ok(Action::ExecutedInternally);
}
if let Some(matches) = matches.subcommand_matches("purge_chain") {
purge_chain::<F>(matches, spec)?;
return Ok(Action::ExecutedInternally);
}
Ok(Action::RunService(exit))
}
fn build_spec<F>(matches: &clap::ArgMatches, spec: ChainSpec<FactoryGenesis<F>>) -> error::Result<()>
+216
View File
@@ -0,0 +1,216 @@
// Copyright 2018 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 <http://www.gnu.org/licenses/>.
use std::path::PathBuf;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(name = "Substrate")]
pub struct CoreParams {
#[structopt(short = "l", long = "log", value_name = "LOG_PATTERN", help = "Sets a custom logging filter")]
log: Option<String>,
#[structopt(long = "base-path", short = "d", value_name = "PATH", help = "Specify custom base path", parse(from_os_str))]
base_path: Option<PathBuf>,
#[structopt(long = "keystore-path", value_name = "PATH", help = "Specify custom keystore path", parse(from_os_str))]
keystore_path: Option<PathBuf>,
#[structopt(long = "key", value_name = "STRING", help = "Specify additional key seed")]
key: Option<String>,
#[structopt(long = "node-key", value_name = "KEY", help = "Specify node secret key (64-character hex string)")]
node_key: Option<String>,
#[structopt(long = "validator",help = "Enable validator mode")]
validator: bool,
#[structopt(long = "light", help = "Run in light client mode")]
light: bool,
#[structopt(long = "dev", help = "Run in development mode; implies --chain=dev --validator --key Alice")]
dev: bool,
#[structopt(long = "listen-addr", value_name = "LISTEN_ADDR", help = "Listen on this multiaddress")]
listen_addr: Vec<String>,
#[structopt(long = "port", value_name = "PORT", help = "Specify p2p protocol TCP port. Only used if --listen-addr is not specified.")]
port: Option<u32>,
#[structopt(long = "rpc-external", help = "Listen to all RPC interfaces (default is local)")]
rpc_external: bool,
#[structopt(long = "ws-external", help = "Listen to all Websocket interfaces (default is local)")]
ws_external: bool,
#[structopt(long = "rpc-port", value_name = "PORT", help = "Specify HTTP RPC server TCP port")]
rpc_port: Option<u32>,
#[structopt(long = "ws-port", value_name = "PORT", help = "Specify WebSockets RPC server TCP port")]
ws_port: Option<u32>,
#[structopt(long = "bootnodes", value_name = "URL", help = "Specify a list of bootnodes")]
bootnodes: Vec<String>,
#[structopt(long = "reserved-nodes", value_name = "URL", help = "Specify a list of reserved node addresses")]
reserved_nodes: Vec<String>,
#[structopt(long = "out-peers", value_name = "OUT_PEERS", help = "Specify the number of outgoing connections we're trying to maintain")]
out_peers: Option<u8>,
#[structopt(long = "in-peers", value_name = "IN_PEERS", help = "Specify the maximum number of incoming connections we're accepting")]
in_peers: Option<u8>,
#[structopt(long = "chain", value_name = "CHAIN_SPEC", help = "Specify the chain specification (one of dev, local or staging)")]
chain: Option<String>,
#[structopt(long = "pruning", value_name = "PRUNING_MODE", help = "Specify the pruning mode, a number of blocks to keep or 'archive'. Default is 256.")]
pruning: Option<u32>,
#[structopt(long = "name", value_name = "NAME", help = "The human-readable name for this node, as reported to the telemetry server, if enabled")]
name: Option<String>,
#[structopt(short = "t", long = "telemetry", help = "Should connect to the Substrate telemetry server (telemetry is off by default on local chains)")]
telemetry: bool,
#[structopt(long = "no-telemetry", help = "Should not connect to the Substrate telemetry server (telemetry is on by default on global chains)")]
no_telemetry: bool,
#[structopt(long = "telemetry-url", value_name = "TELEMETRY_URL", help = "The URL of the telemetry server. Implies --telemetry")]
telemetry_url: Option<String>,
#[structopt(long = "execution", value_name = "STRATEGY", help = "The means of execution used when calling into the runtime. Can be either wasm, native or both.")]
execution: Option<ExecutionStrategy>,
#[structopt(subcommand)]
cmds: Option<CoreCommands>,
}
#[derive(Debug, StructOpt)]
pub enum ExecutionStrategy {
Native,
Wasm,
Both,
}
impl Default for ExecutionStrategy {
fn default() -> Self {
ExecutionStrategy::Both
}
}
impl std::str::FromStr for ExecutionStrategy {
type Err = String;
fn from_str(input: &str) -> Result<Self, Self::Err> {
match input {
"native" => Ok(ExecutionStrategy::Native),
"wasm" | "webassembly" => Ok(ExecutionStrategy::Wasm),
"both" => Ok(ExecutionStrategy::Both),
_ => Err("Please specify either 'native', 'wasm' or 'both".to_owned())
}
}
}
#[derive(Debug, StructOpt)]
pub enum CoreCommands {
#[structopt(name = "build-spec", about = "Build a spec.json file, outputing to stdout")]
BuildSpec {
#[structopt(long = "raw", help = "Force raw genesis storage output.")]
raw: bool,
#[structopt(long = "chain", value_name = "CHAIN_SPEC", help = "Specify the chain specification (one of dev, local or staging)")]
chain: Option<String>,
#[structopt(long = "dev", help = "Specify the development chain")]
dev: bool,
},
#[structopt(name = "export-blocks", about = "Export blocks to a file")]
ExportBlocks {
#[structopt(help = "Output file name or stdout if unspecified.", parse(from_os_str))]
OUTPUT: Option<PathBuf>,
#[structopt(long = "chain", value_name = "CHAIN_SPEC", help = "Specify the chain specification.")]
chain: Option<String>,
#[structopt(long = "dev", help = "Specify the development chain")]
dev: bool,
#[structopt(long = "base-path", short = "d", value_name = "PATH", help = "Specify custom base path.")]
base_path: Option<String>,
#[structopt(long = "from", value_name = "BLOCK", help = "Specify starting block number. 1 by default.")]
from: Option<u128>,
#[structopt(long = "to", value_name = "BLOCK", help = "Specify last block number. Best block by default.")]
to: Option<u128>,
#[structopt(long = "json", help = "Use JSON output rather than binary.")]
json: bool,
},
#[structopt(name = "import-blocks", about = "Import blocks from file.")]
ImportBlocks {
#[structopt(help = "Input file or stdin if unspecified.", parse(from_os_str))]
INPUT: Option<PathBuf>,
#[structopt(long = "chain", value_name = "CHAIN_SPEC", help = "Specify the chain specification.")]
chain: Option<String>,
#[structopt(long = "dev", help = "Specify the development chain")]
dev: bool,
#[structopt(long = "base-path", short = "d", value_name = "PATH", help = "Specify custom base path.", parse(from_os_str))]
base_path: Option<PathBuf>,
#[structopt(long = "execution", value_name = "STRATEGY", help = "The means of execution used when executing blocks. Can be either wasm, native or both.")]
execution: ExecutionStrategy,
#[structopt(long = "api-execution", value_name = "STRATEGY", help = "The means of execution used when calling into the runtime. Can be either wasm, native or both.")]
api_execution: ExecutionStrategy,
#[structopt(long = "max-heap-pages", value_name = "COUNT", help = "The maximum number of 64KB pages to ever allocate for Wasm execution. Don't alter this unless you know what you're doing.")]
max_heap_pages: Option<u32>,
},
#[structopt(name = "revert", about = "Revert chain to the previous state")]
Revert {
#[structopt(help = "Number of blocks to revert. Default is 256.")]
NUM: Option<u32>,
#[structopt(long = "chain", value_name = "CHAIN_SPEC", help = "Specify the chain specification.")]
chain: Option<String>,
#[structopt(long = "dev", help = "Specify the development chain")]
dev: bool,
#[structopt(long = "base-path", short = "d", value_name = "PATH", help = "Specify custom base path.", parse(from_os_str))]
base_path: Option<PathBuf>,
},
#[structopt(name = "purge-chain", about = "Remove the whole chain data.")]
PurgeChain {
#[structopt(long = "chain", value_name = "CHAIN_SPEC", help = "Specify the chain specification.")]
chain: Option<String>,
#[structopt(long = "dev", help = "Specify the development chain")]
dev: bool,
#[structopt(long = "base-path", short = "d", value_name = "PATH", help = "Specify custom base path.", parse(from_os_str))]
base_path: Option<PathBuf>
}
}