use clap3 instead of structopt (#10632)

* use clap3 instead of structopt

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* format

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* update ss58-registry and revert some nits

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Fix clippy and doc

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* update clap to 3.0.7

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Apply review suggestions

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* remove useless option long name

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* cargo fmt

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
This commit is contained in:
Qinxuan Chen
2022-01-25 00:28:46 +08:00
committed by GitHub
parent d1ff02d31e
commit e327b734bc
66 changed files with 660 additions and 768 deletions
@@ -17,24 +17,24 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::arg_enums::Database;
use clap::Args;
use sc_service::TransactionStorageMode;
use structopt::StructOpt;
/// Parameters for block import.
#[derive(Debug, StructOpt, Clone)]
#[derive(Debug, Clone, Args)]
pub struct DatabaseParams {
/// Select database backend to use.
#[structopt(
#[clap(
long,
alias = "db",
value_name = "DB",
case_insensitive = true,
possible_values = &Database::variants(),
ignore_case = true,
possible_values = Database::variants(),
)]
pub database: Option<Database>,
/// Limit the memory the database cache can use.
#[structopt(long = "db-cache", value_name = "MiB")]
#[clap(long = "db-cache", value_name = "MiB")]
pub database_cache_size: Option<usize>,
/// Enable storage chain mode
@@ -43,7 +43,7 @@ pub struct DatabaseParams {
/// If this is enabled, each transaction is stored separately in the
/// transaction database column and is only referenced by hash
/// in the block body column.
#[structopt(long)]
#[clap(long)]
pub storage_chain: bool,
}
@@ -24,9 +24,9 @@ use crate::{
},
params::{DatabaseParams, PruningParams},
};
use clap::Args;
use sc_client_api::execution_extensions::ExecutionStrategies;
use std::path::PathBuf;
use structopt::StructOpt;
#[cfg(feature = "wasmtime")]
const WASM_METHOD_DEFAULT: &str = "Compiled";
@@ -35,14 +35,14 @@ const WASM_METHOD_DEFAULT: &str = "Compiled";
const WASM_METHOD_DEFAULT: &str = "interpreted-i-know-what-i-do";
/// Parameters for block import.
#[derive(Debug, StructOpt, Clone)]
#[derive(Debug, Clone, Args)]
pub struct ImportParams {
#[allow(missing_docs)]
#[structopt(flatten)]
#[clap(flatten)]
pub pruning_params: PruningParams,
#[allow(missing_docs)]
#[structopt(flatten)]
#[clap(flatten)]
pub database_params: DatabaseParams,
/// Force start with unsafe pruning settings.
@@ -50,15 +50,15 @@ pub struct ImportParams {
/// When running as a validator it is highly recommended to disable state
/// pruning (i.e. 'archive') which is the default. The node will refuse to
/// start as a validator if pruning is enabled unless this option is set.
#[structopt(long = "unsafe-pruning")]
#[clap(long)]
pub unsafe_pruning: bool,
/// Method for executing Wasm runtime code.
#[structopt(
#[clap(
long = "wasm-execution",
value_name = "METHOD",
possible_values = &WasmExecutionMethod::variants(),
case_insensitive = true,
possible_values = WasmExecutionMethod::variants(),
ignore_case = true,
default_value = WASM_METHOD_DEFAULT
)]
pub wasm_method: WasmExecutionMethod,
@@ -66,15 +66,15 @@ pub struct ImportParams {
/// Specify the path where local WASM runtimes are stored.
///
/// These runtimes will override on-chain runtimes when the version matches.
#[structopt(long, value_name = "PATH", parse(from_os_str))]
#[clap(long, value_name = "PATH", parse(from_os_str))]
pub wasm_runtime_overrides: Option<PathBuf>,
#[allow(missing_docs)]
#[structopt(flatten)]
#[clap(flatten)]
pub execution_strategies: ExecutionStrategiesParams,
/// Specify the state cache size.
#[structopt(long = "state-cache-size", value_name = "Bytes", default_value = "67108864")]
#[clap(long, value_name = "Bytes", default_value = "67108864")]
pub state_cache_size: usize,
}
@@ -127,62 +127,37 @@ impl ImportParams {
}
/// Execution strategies parameters.
#[derive(Debug, StructOpt, Clone)]
#[derive(Debug, Clone, Args)]
pub struct ExecutionStrategiesParams {
/// The means of execution used when calling into the runtime for importing blocks as
/// part of an initial sync.
#[structopt(
long = "execution-syncing",
value_name = "STRATEGY",
possible_values = &ExecutionStrategy::variants(),
case_insensitive = true,
)]
#[clap(long, value_name = "STRATEGY", arg_enum, ignore_case = true)]
pub execution_syncing: Option<ExecutionStrategy>,
/// The means of execution used when calling into the runtime for general block import
/// (including locally authored blocks).
#[structopt(
long = "execution-import-block",
value_name = "STRATEGY",
possible_values = &ExecutionStrategy::variants(),
case_insensitive = true,
)]
#[clap(long, value_name = "STRATEGY", arg_enum, ignore_case = true)]
pub execution_import_block: Option<ExecutionStrategy>,
/// The means of execution used when calling into the runtime while constructing blocks.
#[structopt(
long = "execution-block-construction",
value_name = "STRATEGY",
possible_values = &ExecutionStrategy::variants(),
case_insensitive = true,
)]
#[clap(long, value_name = "STRATEGY", arg_enum, ignore_case = true)]
pub execution_block_construction: Option<ExecutionStrategy>,
/// The means of execution used when calling into the runtime while using an off-chain worker.
#[structopt(
long = "execution-offchain-worker",
value_name = "STRATEGY",
possible_values = &ExecutionStrategy::variants(),
case_insensitive = true,
)]
#[clap(long, value_name = "STRATEGY", arg_enum, ignore_case = true)]
pub execution_offchain_worker: Option<ExecutionStrategy>,
/// The means of execution used when calling into the runtime while not syncing, importing or
/// constructing blocks.
#[structopt(
long = "execution-other",
value_name = "STRATEGY",
possible_values = &ExecutionStrategy::variants(),
case_insensitive = true,
)]
#[clap(long, value_name = "STRATEGY", arg_enum, ignore_case = true)]
pub execution_other: Option<ExecutionStrategy>,
/// The execution strategy that should be used by all execution contexts.
#[structopt(
long = "execution",
#[clap(
long,
value_name = "STRATEGY",
possible_values = &ExecutionStrategy::variants(),
case_insensitive = true,
arg_enum,
ignore_case = true,
conflicts_with_all = &[
"execution-other",
"execution-offchain-worker",
@@ -17,50 +17,47 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::{error, error::Result};
use clap::Args;
use sc_service::config::KeystoreConfig;
use sp_core::crypto::SecretString;
use std::{
fs,
path::{Path, PathBuf},
};
use structopt::StructOpt;
/// default sub directory for the key store
const DEFAULT_KEYSTORE_CONFIG_PATH: &'static str = "keystore";
/// Parameters of the keystore
#[derive(Debug, StructOpt, Clone)]
#[derive(Debug, Clone, Args)]
pub struct KeystoreParams {
/// Specify custom URIs to connect to for keystore-services
#[structopt(long = "keystore-uri")]
#[clap(long)]
pub keystore_uri: Option<String>,
/// Specify custom keystore path.
#[structopt(long = "keystore-path", value_name = "PATH", parse(from_os_str))]
#[clap(long, value_name = "PATH", parse(from_os_str))]
pub keystore_path: Option<PathBuf>,
/// Use interactive shell for entering the password used by the keystore.
#[structopt(
long = "password-interactive",
conflicts_with_all = &[ "password", "password-filename" ]
)]
#[clap(long, conflicts_with_all = &["password", "password-filename"])]
pub password_interactive: bool,
/// Password used by the keystore. This allows appending an extra user-defined secret to the
/// seed.
#[structopt(
long = "password",
#[clap(
long,
parse(try_from_str = secret_string_from_str),
conflicts_with_all = &[ "password-interactive", "password-filename" ]
conflicts_with_all = &["password-interactive", "password-filename"]
)]
pub password: Option<SecretString>,
/// File that contains the password used by the keystore.
#[structopt(
long = "password-filename",
#[clap(
long,
value_name = "PATH",
parse(from_os_str),
conflicts_with_all = &[ "password-interactive", "password" ]
conflicts_with_all = &["password-interactive", "password"]
)]
pub password_filename: Option<PathBuf>,
}
+9 -21
View File
@@ -26,13 +26,13 @@ mod shared_params;
mod transaction_pool_params;
use crate::arg_enums::{CryptoScheme, OutputType};
use clap::Args;
use sp_core::crypto::Ss58AddressFormat;
use sp_runtime::{
generic::BlockId,
traits::{Block as BlockT, NumberFor},
};
use std::{convert::TryFrom, fmt::Debug, str::FromStr};
use structopt::StructOpt;
pub use crate::params::{
database_params::*, import_params::*, keystore_params::*, network_params::*,
@@ -115,44 +115,32 @@ impl BlockNumberOrHash {
}
/// Optional flag for specifying crypto algorithm
#[derive(Debug, StructOpt, Clone)]
#[derive(Debug, Clone, Args)]
pub struct CryptoSchemeFlag {
/// cryptography scheme
#[structopt(
long,
value_name = "SCHEME",
possible_values = &CryptoScheme::variants(),
case_insensitive = true,
default_value = "Sr25519"
)]
#[clap(long, value_name = "SCHEME", arg_enum, ignore_case = true, default_value = "Sr25519")]
pub scheme: CryptoScheme,
}
/// Optional flag for specifying output type
#[derive(Debug, StructOpt, Clone)]
#[derive(Debug, Clone, Args)]
pub struct OutputTypeFlag {
/// output format
#[structopt(
long,
value_name = "FORMAT",
possible_values = &OutputType::variants(),
case_insensitive = true,
default_value = "Text"
)]
#[clap(long, value_name = "FORMAT", arg_enum, ignore_case = true, default_value = "Text")]
pub output_type: OutputType,
}
/// Optional flag for specifying network scheme
#[derive(Debug, StructOpt, Clone)]
#[derive(Debug, Clone, Args)]
pub struct NetworkSchemeFlag {
/// network address format
#[structopt(
#[clap(
short = 'n',
long,
value_name = "NETWORK",
short = "n",
possible_values = &Ss58AddressFormat::all_names()[..],
ignore_case = true,
parse(try_from_str = Ss58AddressFormat::try_from),
case_insensitive = true,
)]
pub network: Option<Ss58AddressFormat>,
}
@@ -17,6 +17,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::{arg_enums::SyncMode, params::node_key_params::NodeKeyParams};
use clap::Args;
use sc_network::{
config::{
NetworkConfiguration, NodeKeyConfig, NonReservedPeerMode, SetConfig, TransportConfig,
@@ -28,17 +29,16 @@ use sc_service::{
ChainSpec, ChainType,
};
use std::{borrow::Cow, path::PathBuf};
use structopt::StructOpt;
/// Parameters used to create the network configuration.
#[derive(Debug, StructOpt, Clone)]
#[derive(Debug, Clone, Args)]
pub struct NetworkParams {
/// Specify a list of bootnodes.
#[structopt(long = "bootnodes", value_name = "ADDR")]
#[clap(long, value_name = "ADDR")]
pub bootnodes: Vec<MultiaddrWithPeerId>,
/// Specify a list of reserved node addresses.
#[structopt(long = "reserved-nodes", value_name = "ADDR")]
#[clap(long, value_name = "ADDR")]
pub reserved_nodes: Vec<MultiaddrWithPeerId>,
/// Whether to only synchronize the chain with reserved nodes.
@@ -49,12 +49,12 @@ pub struct NetworkParams {
/// In particular, if you are a validator your node might still connect to other
/// validator nodes and collator nodes regardless of whether they are defined as
/// reserved nodes.
#[structopt(long = "reserved-only")]
#[clap(long)]
pub reserved_only: bool,
/// The public address that other nodes will use to connect to it.
/// This can be used if there's a proxy in front of this node.
#[structopt(long, value_name = "PUBLIC_ADDR")]
#[clap(long, value_name = "PUBLIC_ADDR")]
pub public_addr: Vec<Multiaddr>,
/// Listen on this multiaddress.
@@ -62,60 +62,60 @@ pub struct NetworkParams {
/// By default:
/// If `--validator` is passed: `/ip4/0.0.0.0/tcp/<port>` and `/ip6/[::]/tcp/<port>`.
/// Otherwise: `/ip4/0.0.0.0/tcp/<port>/ws` and `/ip6/[::]/tcp/<port>/ws`.
#[structopt(long = "listen-addr", value_name = "LISTEN_ADDR")]
#[clap(long, value_name = "LISTEN_ADDR")]
pub listen_addr: Vec<Multiaddr>,
/// Specify p2p protocol TCP port.
#[structopt(long = "port", value_name = "PORT", conflicts_with_all = &[ "listen-addr" ])]
#[clap(long, value_name = "PORT", conflicts_with_all = &[ "listen-addr" ])]
pub port: Option<u16>,
/// Always forbid connecting to private IPv4 addresses (as specified in
/// [RFC1918](https://tools.ietf.org/html/rfc1918)), unless the address was passed with
/// `--reserved-nodes` or `--bootnodes`. Enabled by default for chains marked as "live" in
/// their chain specifications.
#[structopt(long = "no-private-ipv4", conflicts_with_all = &["allow-private-ipv4"])]
#[clap(long, conflicts_with_all = &["allow-private-ipv4"])]
pub no_private_ipv4: bool,
/// Always accept connecting to private IPv4 addresses (as specified in
/// [RFC1918](https://tools.ietf.org/html/rfc1918)). Enabled by default for chains marked as
/// "local" in their chain specifications, or when `--dev` is passed.
#[structopt(long = "allow-private-ipv4", conflicts_with_all = &["no-private-ipv4"])]
#[clap(long, conflicts_with_all = &["no-private-ipv4"])]
pub allow_private_ipv4: bool,
/// Specify the number of outgoing connections we're trying to maintain.
#[structopt(long = "out-peers", value_name = "COUNT", default_value = "25")]
#[clap(long, value_name = "COUNT", default_value = "25")]
pub out_peers: u32,
/// Maximum number of inbound full nodes peers.
#[structopt(long = "in-peers", value_name = "COUNT", default_value = "25")]
#[clap(long, value_name = "COUNT", default_value = "25")]
pub in_peers: u32,
/// Maximum number of inbound light nodes peers.
#[structopt(long = "in-peers-light", value_name = "COUNT", default_value = "100")]
#[clap(long, value_name = "COUNT", default_value = "100")]
pub in_peers_light: u32,
/// Disable mDNS discovery.
///
/// By default, the network will use mDNS to discover other nodes on the
/// local network. This disables it. Automatically implied when using --dev.
#[structopt(long = "no-mdns")]
#[clap(long)]
pub no_mdns: bool,
/// Maximum number of peers from which to ask for the same blocks in parallel.
///
/// This allows downloading announced blocks from multiple peers. Decrease to save
/// traffic and risk increased latency.
#[structopt(long = "max-parallel-downloads", value_name = "COUNT", default_value = "5")]
#[clap(long, value_name = "COUNT", default_value = "5")]
pub max_parallel_downloads: u32,
#[allow(missing_docs)]
#[structopt(flatten)]
#[clap(flatten)]
pub node_key_params: NodeKeyParams,
/// Enable peer discovery on local networks.
///
/// By default this option is `true` for `--dev` or when the chain type is
/// `Local`/`Development` and false otherwise.
#[structopt(long)]
#[clap(long)]
pub discover_local: bool,
/// Require iterative Kademlia DHT queries to use disjoint paths for increased resiliency in
@@ -123,11 +123,11 @@ pub struct NetworkParams {
///
/// See the S/Kademlia paper for more information on the high level design as well as its
/// security improvements.
#[structopt(long)]
#[clap(long)]
pub kademlia_disjoint_query_paths: bool,
/// Join the IPFS network and serve transactions over bitswap protocol.
#[structopt(long)]
#[clap(long)]
pub ipfs_server: bool,
/// Blockchain syncing mode.
@@ -137,7 +137,7 @@ pub struct NetworkParams {
/// - `Fast`: Download blocks and the latest state only.
///
/// - `FastUnsafe`: Same as `Fast`, but skip downloading state proofs.
#[structopt(long, value_name = "SYNC_MODE", default_value = "Full")]
#[clap(long, arg_enum, value_name = "SYNC_MODE", default_value = "Full")]
pub sync: SyncMode,
}
@@ -16,10 +16,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use clap::Args;
use sc_network::config::{identity::ed25519, NodeKeyConfig};
use sp_core::H256;
use std::{path::PathBuf, str::FromStr};
use structopt::StructOpt;
use crate::{arg_enums::NodeKeyType, error};
@@ -30,7 +30,7 @@ const NODE_KEY_ED25519_FILE: &str = "secret_ed25519";
/// Parameters used to create the `NodeKeyConfig`, which determines the keypair
/// used for libp2p networking.
#[derive(Debug, StructOpt, Clone)]
#[derive(Debug, Clone, Args)]
pub struct NodeKeyParams {
/// The secret key to use for libp2p networking.
///
@@ -46,7 +46,7 @@ pub struct NodeKeyParams {
/// WARNING: Secrets provided as command-line arguments are easily exposed.
/// Use of this option should be limited to development and testing. To use
/// an externally managed secret key, use `--node-key-file` instead.
#[structopt(long = "node-key", value_name = "KEY")]
#[clap(long, value_name = "KEY")]
pub node_key: Option<String>,
/// The type of secret key to use for libp2p networking.
@@ -66,13 +66,7 @@ pub struct NodeKeyParams {
///
/// The node's secret key determines the corresponding public key and hence the
/// node's peer ID in the context of libp2p.
#[structopt(
long = "node-key-type",
value_name = "TYPE",
possible_values = &NodeKeyType::variants(),
case_insensitive = true,
default_value = "Ed25519"
)]
#[clap(long, value_name = "TYPE", arg_enum, ignore_case = true, default_value = "Ed25519")]
pub node_key_type: NodeKeyType,
/// The file from which to read the node's secret key to use for libp2p networking.
@@ -85,7 +79,7 @@ pub struct NodeKeyParams {
///
/// If the file does not exist, it is created with a newly generated secret key of
/// the chosen type.
#[structopt(long = "node-key-file", value_name = "FILE")]
#[clap(long, value_name = "FILE")]
pub node_key_file: Option<PathBuf>,
}
@@ -128,14 +122,15 @@ fn parse_ed25519_secret(hex: &str) -> error::Result<sc_network::config::Ed25519S
#[cfg(test)]
mod tests {
use super::*;
use clap::ArgEnum;
use sc_network::config::identity::{ed25519, Keypair};
use std::fs;
#[test]
fn test_node_key_config_input() {
fn secret_input(net_config_dir: &PathBuf) -> error::Result<()> {
NodeKeyType::variants().iter().try_for_each(|t| {
let node_key_type = NodeKeyType::from_str(t).unwrap();
NodeKeyType::value_variants().iter().try_for_each(|t| {
let node_key_type = *t;
let sk = match node_key_type {
NodeKeyType::Ed25519 => ed25519::SecretKey::generate().as_ref().to_vec(),
};
@@ -194,8 +189,8 @@ mod tests {
where
F: Fn(NodeKeyParams) -> error::Result<()>,
{
NodeKeyType::variants().iter().try_for_each(|t| {
let node_key_type = NodeKeyType::from_str(t).unwrap();
NodeKeyType::value_variants().iter().try_for_each(|t| {
let node_key_type = *t;
f(NodeKeyParams { node_key_type, node_key: None, node_key_file: None })
})
}
@@ -23,23 +23,23 @@
//! targeted at handling input parameter parsing providing
//! a reasonable abstraction.
use clap::Args;
use sc_network::config::Role;
use sc_service::config::OffchainWorkerConfig;
use structopt::StructOpt;
use crate::{error, OffchainWorkerEnabled};
/// Offchain worker related parameters.
#[derive(Debug, StructOpt, Clone)]
#[derive(Debug, Clone, Args)]
pub struct OffchainWorkerParams {
/// Should execute offchain workers on every block.
///
/// By default it's only enabled for nodes that are authoring new blocks.
#[structopt(
#[clap(
long = "offchain-worker",
value_name = "ENABLED",
possible_values = &OffchainWorkerEnabled::variants(),
case_insensitive = true,
arg_enum,
ignore_case = true,
default_value = "WhenValidating"
)]
pub enabled: OffchainWorkerEnabled,
@@ -48,7 +48,7 @@ pub struct OffchainWorkerParams {
///
/// Enables a runtime to write directly to a offchain workers
/// DB during block import.
#[structopt(long = "enable-offchain-indexing", value_name = "ENABLE_OFFCHAIN_INDEXING")]
#[clap(long = "enable-offchain-indexing", value_name = "ENABLE_OFFCHAIN_INDEXING")]
pub indexing_enabled: bool,
}
@@ -17,23 +17,23 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::error;
use clap::Args;
use sc_service::{KeepBlocks, PruningMode, Role};
use structopt::StructOpt;
/// Parameters to define the pruning mode
#[derive(Debug, StructOpt, Clone)]
#[derive(Debug, Clone, Args)]
pub struct PruningParams {
/// Specify the state pruning mode, a number of blocks to keep or 'archive'.
///
/// Default is to keep all block states if the node is running as a
/// validator (i.e. 'archive'), otherwise state is only kept for the last
/// 256 blocks.
#[structopt(long = "pruning", value_name = "PRUNING_MODE")]
#[clap(long, value_name = "PRUNING_MODE")]
pub pruning: Option<String>,
/// Specify the number of finalized blocks to keep in the database.
///
/// Default is to keep all blocks.
#[structopt(long, value_name = "COUNT")]
#[clap(long, value_name = "COUNT")]
pub keep_blocks: Option<u32>,
}
@@ -17,36 +17,36 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::arg_enums::TracingReceiver;
use clap::Args;
use sc_service::config::BasePath;
use std::path::PathBuf;
use structopt::StructOpt;
/// Shared parameters used by all `CoreParams`.
#[derive(Debug, StructOpt, Clone)]
#[derive(Debug, Clone, Args)]
pub struct SharedParams {
/// Specify the chain specification.
///
/// It can be one of the predefined ones (dev, local, or staging) or it can be a path to a file
/// with the chainspec (such as one exported by the `build-spec` subcommand).
#[structopt(long, value_name = "CHAIN_SPEC")]
#[clap(long, value_name = "CHAIN_SPEC")]
pub chain: Option<String>,
/// Specify the development chain.
///
/// This flag sets `--chain=dev`, `--force-authoring`, `--rpc-cors=all`,
/// `--alice`, and `--tmp` flags, unless explicitly overridden.
#[structopt(long, conflicts_with_all = &["chain"])]
#[clap(long, conflicts_with_all = &["chain"])]
pub dev: bool,
/// Specify custom base path.
#[structopt(long, short = "d", value_name = "PATH", parse(from_os_str))]
#[clap(long, short = 'd', value_name = "PATH", parse(from_os_str))]
pub base_path: Option<PathBuf>,
/// Sets a custom logging filter. Syntax is <target>=<level>, e.g. -lsync=debug.
///
/// Log levels (least to most verbose) are error, warn, info, debug, and trace.
/// By default, all targets log `info`. The global log level can be set with -l<level>.
#[structopt(short = "l", long, value_name = "LOG_PATTERN")]
#[clap(short = 'l', long, value_name = "LOG_PATTERN")]
pub log: Vec<String>,
/// Enable detailed log output.
@@ -54,11 +54,11 @@ pub struct SharedParams {
/// This includes displaying the log target, log level and thread name.
///
/// This is automatically enabled when something is logged with any higher level than `info`.
#[structopt(long)]
#[clap(long)]
pub detailed_log_output: bool,
/// Disable log color output.
#[structopt(long)]
#[clap(long)]
pub disable_log_color: bool,
/// Enable feature to dynamically update and reload the log filter.
@@ -68,21 +68,15 @@ pub struct SharedParams {
///
/// The `system_addLogFilter` and `system_resetLogFilter` RPCs will have no effect with this
/// option not being set.
#[structopt(long)]
#[clap(long)]
pub enable_log_reloading: bool,
/// Sets a custom profiling filter. Syntax is the same as for logging: <target>=<level>
#[structopt(long = "tracing-targets", value_name = "TARGETS")]
#[clap(long, value_name = "TARGETS")]
pub tracing_targets: Option<String>,
/// Receiver to process tracing messages.
#[structopt(
long = "tracing-receiver",
value_name = "RECEIVER",
possible_values = &TracingReceiver::variants(),
case_insensitive = true,
default_value = "Log"
)]
#[clap(long, value_name = "RECEIVER", arg_enum, ignore_case = true, default_value = "Log")]
pub tracing_receiver: TracingReceiver,
}
@@ -16,18 +16,18 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use clap::Args;
use sc_service::config::TransactionPoolOptions;
use structopt::StructOpt;
/// Parameters used to create the pool configuration.
#[derive(Debug, StructOpt, Clone)]
#[derive(Debug, Clone, Args)]
pub struct TransactionPoolParams {
/// Maximum number of transactions in the transaction pool.
#[structopt(long = "pool-limit", value_name = "COUNT", default_value = "8192")]
#[clap(long, value_name = "COUNT", default_value = "8192")]
pub pool_limit: usize,
/// Maximum number of kilobytes of all transactions stored in the pool.
#[structopt(long = "pool-kbytes", value_name = "COUNT", default_value = "20480")]
#[clap(long, value_name = "COUNT", default_value = "20480")]
pub pool_kbytes: usize,
}