2017-01-25 18:51:41 +01:00
|
|
|
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
2016-09-10 11:37:14 +02:00
|
|
|
// This file is part of Parity.
|
|
|
|
|
|
|
|
// Parity 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.
|
|
|
|
|
|
|
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
mod usage;
|
2017-01-05 14:12:54 +01:00
|
|
|
use dir;
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
usage! {
|
|
|
|
{
|
|
|
|
// Commands
|
|
|
|
cmd_daemon: bool,
|
|
|
|
cmd_wallet: bool,
|
|
|
|
cmd_account: bool,
|
|
|
|
cmd_new: bool,
|
|
|
|
cmd_list: bool,
|
|
|
|
cmd_export: bool,
|
2016-11-27 11:11:56 +01:00
|
|
|
cmd_blocks: bool,
|
|
|
|
cmd_state: bool,
|
2016-09-10 11:37:14 +02:00
|
|
|
cmd_import: bool,
|
|
|
|
cmd_signer: bool,
|
|
|
|
cmd_new_token: bool,
|
2016-09-20 12:19:07 +02:00
|
|
|
cmd_sign: bool,
|
|
|
|
cmd_reject: bool,
|
2016-09-10 11:37:14 +02:00
|
|
|
cmd_snapshot: bool,
|
|
|
|
cmd_restore: bool,
|
|
|
|
cmd_ui: bool,
|
2017-01-06 16:05:58 +01:00
|
|
|
cmd_dapp: bool,
|
2016-09-23 15:28:09 +02:00
|
|
|
cmd_tools: bool,
|
|
|
|
cmd_hash: bool,
|
2016-12-12 17:19:41 +01:00
|
|
|
cmd_kill: bool,
|
|
|
|
cmd_db: bool,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// Arguments
|
|
|
|
arg_pid_file: String,
|
|
|
|
arg_file: Option<String>,
|
|
|
|
arg_path: Vec<String>,
|
2016-09-20 12:19:07 +02:00
|
|
|
arg_id: Option<usize>,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// Flags
|
|
|
|
// -- Legacy Options
|
|
|
|
flag_geth: bool,
|
|
|
|
flag_testnet: bool,
|
|
|
|
flag_import_geth_keys: bool,
|
|
|
|
flag_datadir: Option<String>,
|
2016-12-05 15:54:31 +01:00
|
|
|
flag_networkid: Option<u64>,
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_peers: Option<u16>,
|
|
|
|
flag_nodekey: Option<String>,
|
|
|
|
flag_nodiscover: bool,
|
|
|
|
flag_jsonrpc: bool,
|
|
|
|
flag_jsonrpc_off: bool,
|
|
|
|
flag_webapp: bool,
|
|
|
|
flag_dapps_off: bool,
|
|
|
|
flag_rpc: bool,
|
|
|
|
flag_rpcaddr: Option<String>,
|
|
|
|
flag_rpcport: Option<u16>,
|
|
|
|
flag_rpcapi: Option<String>,
|
|
|
|
flag_rpccorsdomain: Option<String>,
|
|
|
|
flag_ipcdisable: bool,
|
|
|
|
flag_ipc_off: bool,
|
|
|
|
flag_ipcapi: Option<String>,
|
|
|
|
flag_ipcpath: Option<String>,
|
|
|
|
flag_gasprice: Option<String>,
|
|
|
|
flag_etherbase: Option<String>,
|
|
|
|
flag_extradata: Option<String>,
|
|
|
|
flag_cache: Option<u32>,
|
|
|
|
|
|
|
|
// -- Miscellaneous Options
|
|
|
|
flag_version: bool,
|
2016-09-12 08:42:22 +02:00
|
|
|
flag_no_config: bool,
|
2016-09-10 11:37:14 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
// -- Operating Options
|
2016-11-05 10:38:00 +01:00
|
|
|
flag_mode: String = "last", or |c: &Config| otry!(c.parity).mode.clone(),
|
2016-09-11 11:52:12 +02:00
|
|
|
flag_mode_timeout: u64 = 300u64, or |c: &Config| otry!(c.parity).mode_timeout.clone(),
|
|
|
|
flag_mode_alarm: u64 = 3600u64, or |c: &Config| otry!(c.parity).mode_alarm.clone(),
|
2016-11-24 17:19:48 +01:00
|
|
|
flag_auto_update: String = "critical", or |c: &Config| otry!(c.parity).auto_update.clone(),
|
2016-12-15 19:23:25 +01:00
|
|
|
flag_release_track: String = "current", or |c: &Config| otry!(c.parity).release_track.clone(),
|
2017-03-29 17:07:58 +02:00
|
|
|
flag_public_node: bool = false, or |c: &Config| otry!(c.parity).public_node.clone(),
|
2016-11-23 20:35:21 +01:00
|
|
|
flag_no_download: bool = false, or |c: &Config| otry!(c.parity).no_download.clone(),
|
|
|
|
flag_no_consensus: bool = false, or |c: &Config| otry!(c.parity).no_consensus.clone(),
|
2017-03-13 12:10:53 +01:00
|
|
|
flag_chain: String = "foundation", or |c: &Config| otry!(c.parity).chain.clone(),
|
2016-12-15 21:56:45 +01:00
|
|
|
flag_keys_path: String = "$BASE/keys", or |c: &Config| otry!(c.parity).keys_path.clone(),
|
2016-09-11 11:52:12 +02:00
|
|
|
flag_identity: String = "", or |c: &Config| otry!(c.parity).identity.clone(),
|
2017-03-22 16:45:50 +01:00
|
|
|
flag_light: bool = false, or |c: &Config| otry!(c.parity).light,
|
2017-05-04 12:13:50 +02:00
|
|
|
flag_no_persistent_txqueue: bool = false,
|
|
|
|
or |c: &Config| otry!(c.parity).no_persistent_txqueue,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
2017-05-23 12:24:32 +02:00
|
|
|
// -- Convenience Options
|
|
|
|
flag_config: String = "$BASE/config.toml", or |_| None,
|
|
|
|
flag_ports_shift: u16 = 0u16,
|
|
|
|
or |c: &Config| otry!(c.misc).ports_shift,
|
|
|
|
flag_unsafe_expose: bool = false,
|
|
|
|
or |c: &Config| otry!(c.misc).unsafe_expose,
|
|
|
|
|
2016-09-10 11:37:14 +02:00
|
|
|
// -- Account Options
|
|
|
|
flag_unlock: Option<String> = None,
|
2017-02-24 10:32:42 +01:00
|
|
|
or |c: &Config| otry!(c.account).unlock.as_ref().map(|vec| Some(vec.join(","))),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_password: Vec<String> = Vec::new(),
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.account).password.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_keys_iterations: u32 = 10240u32,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.account).keys_iterations.clone(),
|
2017-02-10 01:07:06 +01:00
|
|
|
flag_no_hardware_wallets: bool = false,
|
|
|
|
or |c: &Config| otry!(c.account).disable_hardware.clone(),
|
2017-06-06 18:06:40 +02:00
|
|
|
flag_fast_unlock: bool = false,
|
|
|
|
or |c: &Config| otry!(c.account).fast_unlock.clone(),
|
2017-02-10 01:07:06 +01:00
|
|
|
|
2016-09-10 11:37:14 +02:00
|
|
|
|
2016-11-07 17:40:53 +01:00
|
|
|
flag_force_ui: bool = false,
|
|
|
|
or |c: &Config| otry!(c.ui).force.clone(),
|
|
|
|
flag_no_ui: bool = false,
|
|
|
|
or |c: &Config| otry!(c.ui).disable.clone(),
|
|
|
|
flag_ui_port: u16 = 8180u16,
|
|
|
|
or |c: &Config| otry!(c.ui).port.clone(),
|
|
|
|
flag_ui_interface: String = "local",
|
|
|
|
or |c: &Config| otry!(c.ui).interface.clone(),
|
2017-05-24 12:24:07 +02:00
|
|
|
flag_ui_hosts: String = "none",
|
|
|
|
or |c: &Config| otry!(c.ui).hosts.as_ref().map(|vec| vec.join(",")),
|
2016-12-15 21:56:45 +01:00
|
|
|
flag_ui_path: String = "$BASE/signer",
|
2016-11-07 17:40:53 +01:00
|
|
|
or |c: &Config| otry!(c.ui).path.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
// NOTE [todr] For security reasons don't put this to config files
|
2016-11-07 17:40:53 +01:00
|
|
|
flag_ui_no_validation: bool = false, or |_| None,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// -- Networking Options
|
2017-03-02 20:04:17 +01:00
|
|
|
flag_no_warp: bool = false,
|
|
|
|
or |c: &Config| otry!(c.network).warp.clone().map(|w| !w),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_port: u16 = 30303u16,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.network).port.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_min_peers: u16 = 25u16,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.network).min_peers.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_max_peers: u16 = 50u16,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.network).max_peers.clone(),
|
2016-10-24 18:25:27 +02:00
|
|
|
flag_max_pending_peers: u16 = 64u16,
|
|
|
|
or |c: &Config| otry!(c.network).max_pending_peers.clone(),
|
|
|
|
flag_snapshot_peers: u16 = 0u16,
|
|
|
|
or |c: &Config| otry!(c.network).snapshot_peers.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_nat: String = "any",
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.network).nat.clone(),
|
2016-10-24 18:25:27 +02:00
|
|
|
flag_allow_ips: String = "all",
|
|
|
|
or |c: &Config| otry!(c.network).allow_ips.clone(),
|
2016-12-05 15:54:31 +01:00
|
|
|
flag_network_id: Option<u64> = None,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.network).id.clone().map(Some),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_bootnodes: Option<String> = None,
|
2017-02-24 10:32:42 +01:00
|
|
|
or |c: &Config| otry!(c.network).bootnodes.as_ref().map(|vec| Some(vec.join(","))),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_no_discovery: bool = false,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.network).discovery.map(|d| !d).clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_node_key: Option<String> = None,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.network).node_key.clone().map(Some),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_reserved_peers: Option<String> = None,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.network).reserved_peers.clone().map(Some),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_reserved_only: bool = false,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.network).reserved_only.clone(),
|
2016-11-22 18:03:35 +01:00
|
|
|
flag_no_ancient_blocks: bool = false, or |_| None,
|
2017-03-22 16:45:50 +01:00
|
|
|
flag_no_serve_light: bool = false,
|
|
|
|
or |c: &Config| otry!(c.network).no_serve_light.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// -- API and Console Options
|
|
|
|
// RPC
|
|
|
|
flag_no_jsonrpc: bool = false,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.rpc).disable.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_jsonrpc_port: u16 = 8545u16,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.rpc).port.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_jsonrpc_interface: String = "local",
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.rpc).interface.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_jsonrpc_cors: Option<String> = None,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.rpc).cors.clone().map(Some),
|
2017-05-23 18:05:17 +02:00
|
|
|
flag_jsonrpc_apis: String = "web3,eth,pubsub,net,parity,parity_pubsub,traces,rpc,secretstore",
|
2017-02-24 10:32:42 +01:00
|
|
|
or |c: &Config| otry!(c.rpc).apis.as_ref().map(|vec| vec.join(",")),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_jsonrpc_hosts: String = "none",
|
2017-02-24 10:32:42 +01:00
|
|
|
or |c: &Config| otry!(c.rpc).hosts.as_ref().map(|vec| vec.join(",")),
|
2017-04-03 10:27:37 +02:00
|
|
|
flag_jsonrpc_threads: Option<usize> = None,
|
|
|
|
or |c: &Config| otry!(c.rpc).threads.map(Some),
|
2016-09-10 11:37:14 +02:00
|
|
|
|
2017-04-13 16:32:07 +02:00
|
|
|
// WS
|
|
|
|
flag_no_ws: bool = false,
|
|
|
|
or |c: &Config| otry!(c.websockets).disable.clone(),
|
|
|
|
flag_ws_port: u16 = 8546u16,
|
|
|
|
or |c: &Config| otry!(c.websockets).port.clone(),
|
|
|
|
flag_ws_interface: String = "local",
|
|
|
|
or |c: &Config| otry!(c.websockets).interface.clone(),
|
2017-05-23 18:05:17 +02:00
|
|
|
flag_ws_apis: String = "web3,eth,pubsub,net,parity,parity_pubsub,traces,rpc,secretstore",
|
2017-04-13 16:32:07 +02:00
|
|
|
or |c: &Config| otry!(c.websockets).apis.as_ref().map(|vec| vec.join(",")),
|
2017-05-24 12:24:07 +02:00
|
|
|
flag_ws_origins: String = "chrome-extension://*",
|
2017-04-13 16:32:07 +02:00
|
|
|
or |c: &Config| otry!(c.websockets).origins.as_ref().map(|vec| vec.join(",")),
|
|
|
|
flag_ws_hosts: String = "none",
|
|
|
|
or |c: &Config| otry!(c.websockets).hosts.as_ref().map(|vec| vec.join(",")),
|
|
|
|
|
2016-09-10 11:37:14 +02:00
|
|
|
// IPC
|
|
|
|
flag_no_ipc: bool = false,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.ipc).disable.clone(),
|
2017-05-23 12:24:32 +02:00
|
|
|
flag_ipc_path: String = if cfg!(windows) { r"\\.\pipe\jsonrpc.ipc" } else { "$BASE/jsonrpc.ipc" },
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.ipc).path.clone(),
|
2017-05-23 18:05:17 +02:00
|
|
|
flag_ipc_apis: String = "web3,eth,pubsub,net,parity,parity_pubsub,parity_accounts,traces,rpc,secretstore",
|
2017-02-24 10:32:42 +01:00
|
|
|
or |c: &Config| otry!(c.ipc).apis.as_ref().map(|vec| vec.join(",")),
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// DAPPS
|
|
|
|
flag_no_dapps: bool = false,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.dapps).disable.clone(),
|
2016-12-15 21:56:45 +01:00
|
|
|
flag_dapps_path: String = "$BASE/dapps",
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.dapps).path.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
|
2017-02-20 16:13:21 +01:00
|
|
|
// Secret Store
|
|
|
|
flag_no_secretstore: bool = false,
|
|
|
|
or |c: &Config| otry!(c.secretstore).disable.clone(),
|
2017-04-08 11:26:16 +02:00
|
|
|
flag_secretstore_secret: Option<String> = None,
|
|
|
|
or |c: &Config| otry!(c.secretstore).self_secret.clone().map(Some),
|
|
|
|
flag_secretstore_nodes: String = "",
|
|
|
|
or |c: &Config| otry!(c.secretstore).nodes.as_ref().map(|vec| vec.join(",")),
|
2017-02-20 16:13:21 +01:00
|
|
|
flag_secretstore_interface: String = "local",
|
|
|
|
or |c: &Config| otry!(c.secretstore).interface.clone(),
|
2017-04-08 11:26:16 +02:00
|
|
|
flag_secretstore_port: u16 = 8083u16,
|
|
|
|
or |c: &Config| otry!(c.secretstore).port.clone(),
|
|
|
|
flag_secretstore_http_interface: String = "local",
|
|
|
|
or |c: &Config| otry!(c.secretstore).http_interface.clone(),
|
|
|
|
flag_secretstore_http_port: u16 = 8082u16,
|
|
|
|
or |c: &Config| otry!(c.secretstore).http_port.clone(),
|
2017-02-20 16:13:21 +01:00
|
|
|
flag_secretstore_path: String = "$BASE/secretstore",
|
|
|
|
or |c: &Config| otry!(c.secretstore).path.clone(),
|
|
|
|
|
2017-02-15 20:29:29 +01:00
|
|
|
// IPFS
|
2017-02-16 14:41:33 +01:00
|
|
|
flag_ipfs_api: bool = false,
|
|
|
|
or |c: &Config| otry!(c.ipfs).enable.clone(),
|
|
|
|
flag_ipfs_api_port: u16 = 5001u16,
|
2017-02-15 20:29:29 +01:00
|
|
|
or |c: &Config| otry!(c.ipfs).port.clone(),
|
2017-02-24 10:32:42 +01:00
|
|
|
flag_ipfs_api_interface: String = "local",
|
|
|
|
or |c: &Config| otry!(c.ipfs).interface.clone(),
|
|
|
|
flag_ipfs_api_cors: Option<String> = None,
|
|
|
|
or |c: &Config| otry!(c.ipfs).cors.clone().map(Some),
|
|
|
|
flag_ipfs_api_hosts: String = "none",
|
|
|
|
or |c: &Config| otry!(c.ipfs).hosts.as_ref().map(|vec| vec.join(",")),
|
2017-02-15 20:29:29 +01:00
|
|
|
|
2016-09-10 11:37:14 +02:00
|
|
|
// -- Sealing/Mining Options
|
|
|
|
flag_author: Option<String> = None,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).author.clone().map(Some),
|
2016-12-05 20:23:03 +01:00
|
|
|
flag_engine_signer: Option<String> = None,
|
2016-12-05 22:31:38 +01:00
|
|
|
or |c: &Config| otry!(c.mining).engine_signer.clone().map(Some),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_force_sealing: bool = false,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).force_sealing.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_reseal_on_txs: String = "own",
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).reseal_on_txs.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_reseal_min_period: u64 = 2000u64,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).reseal_min_period.clone(),
|
2017-03-15 14:04:42 +01:00
|
|
|
flag_reseal_max_period: u64 = 120000u64,
|
|
|
|
or |c: &Config| otry!(c.mining).reseal_max_period.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_work_queue_size: usize = 20usize,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).work_queue_size.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_tx_gas_limit: Option<String> = None,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).tx_gas_limit.clone().map(Some),
|
2016-10-27 19:28:34 +02:00
|
|
|
flag_tx_time_limit: Option<u64> = None,
|
|
|
|
or |c: &Config| otry!(c.mining).tx_time_limit.clone().map(Some),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_relay_set: String = "cheap",
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).relay_set.clone(),
|
2016-11-25 15:12:57 +01:00
|
|
|
flag_usd_per_tx: String = "0.0025",
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).usd_per_tx.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_usd_per_eth: String = "auto",
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).usd_per_eth.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_price_update_period: String = "hourly",
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).price_update_period.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_gas_floor_target: String = "4700000",
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).gas_floor_target.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_gas_cap: String = "6283184",
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).gas_cap.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_extra_data: Option<String> = None,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).extra_data.clone().map(Some),
|
2016-10-15 14:46:33 +02:00
|
|
|
flag_tx_queue_size: usize = 1024usize,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).tx_queue_size.clone(),
|
2016-10-10 23:04:43 +02:00
|
|
|
flag_tx_queue_gas: String = "auto",
|
|
|
|
or |c: &Config| otry!(c.mining).tx_queue_gas.clone(),
|
2016-10-27 19:27:08 +02:00
|
|
|
flag_tx_queue_strategy: String = "gas_price",
|
2016-10-15 14:46:33 +02:00
|
|
|
or |c: &Config| otry!(c.mining).tx_queue_strategy.clone(),
|
2016-10-27 19:28:34 +02:00
|
|
|
flag_tx_queue_ban_count: u16 = 1u16,
|
|
|
|
or |c: &Config| otry!(c.mining).tx_queue_ban_count.clone(),
|
|
|
|
flag_tx_queue_ban_time: u16 = 180u16,
|
|
|
|
or |c: &Config| otry!(c.mining).tx_queue_ban_time.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_remove_solved: bool = false,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.mining).remove_solved.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_notify_work: Option<String> = None,
|
2017-02-24 10:32:42 +01:00
|
|
|
or |c: &Config| otry!(c.mining).notify_work.as_ref().map(|vec| Some(vec.join(","))),
|
2017-01-22 16:15:22 +01:00
|
|
|
flag_refuse_service_transactions: bool = false,
|
|
|
|
or |c: &Config| otry!(c.mining).refuse_service_transactions.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
|
2017-01-25 11:03:36 +01:00
|
|
|
flag_stratum: bool = false,
|
|
|
|
or |c: &Config| Some(c.stratum.is_some()),
|
|
|
|
flag_stratum_interface: String = "local",
|
|
|
|
or |c: &Config| otry!(c.stratum).interface.clone(),
|
|
|
|
flag_stratum_port: u16 = 8008u16,
|
|
|
|
or |c: &Config| otry!(c.stratum).port.clone(),
|
|
|
|
flag_stratum_secret: Option<String> = None,
|
|
|
|
or |c: &Config| otry!(c.stratum).secret.clone().map(Some),
|
|
|
|
|
2016-09-10 11:37:14 +02:00
|
|
|
// -- Footprint Options
|
|
|
|
flag_tracing: String = "auto",
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.footprint).tracing.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_pruning: String = "auto",
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.footprint).pruning.clone(),
|
2017-02-13 17:15:25 +01:00
|
|
|
flag_pruning_history: u64 = 64u64,
|
2016-10-14 14:44:56 +02:00
|
|
|
or |c: &Config| otry!(c.footprint).pruning_history.clone(),
|
2017-05-02 11:40:03 +02:00
|
|
|
flag_pruning_memory: usize = 32usize,
|
2017-01-20 13:25:53 +01:00
|
|
|
or |c: &Config| otry!(c.footprint).pruning_memory.clone(),
|
2017-05-02 11:40:03 +02:00
|
|
|
flag_cache_size_db: u32 = 32u32,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.footprint).cache_size_db.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_cache_size_blocks: u32 = 8u32,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.footprint).cache_size_blocks.clone(),
|
2017-05-02 11:40:03 +02:00
|
|
|
flag_cache_size_queue: u32 = 40u32,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.footprint).cache_size_queue.clone(),
|
2016-10-07 00:28:42 +02:00
|
|
|
flag_cache_size_state: u32 = 25u32,
|
|
|
|
or |c: &Config| otry!(c.footprint).cache_size_state.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_cache_size: Option<u32> = None,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.footprint).cache_size.clone().map(Some),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_fast_and_loose: bool = false,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.footprint).fast_and_loose.clone(),
|
2016-10-21 23:21:57 +02:00
|
|
|
flag_db_compaction: String = "auto",
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.footprint).db_compaction.clone(),
|
2016-10-03 11:13:10 +02:00
|
|
|
flag_fat_db: String = "auto",
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.footprint).fat_db.clone(),
|
2016-12-02 18:36:00 +01:00
|
|
|
flag_scale_verifiers: bool = false,
|
|
|
|
or |c: &Config| otry!(c.footprint).scale_verifiers.clone(),
|
2016-12-15 23:50:16 +01:00
|
|
|
flag_num_verifiers: Option<usize> = None,
|
2016-12-02 18:36:00 +01:00
|
|
|
or |c: &Config| otry!(c.footprint).num_verifiers.clone().map(Some),
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// -- Import/Export Options
|
|
|
|
flag_from: String = "1", or |_| None,
|
|
|
|
flag_to: String = "latest", or |_| None,
|
|
|
|
flag_format: Option<String> = None, or |_| None,
|
2016-10-24 15:09:13 +02:00
|
|
|
flag_no_seal_check: bool = false, or |_| None,
|
2016-11-27 11:11:56 +01:00
|
|
|
flag_no_storage: bool = false, or |_| None,
|
|
|
|
flag_no_code: bool = false, or |_| None,
|
2016-11-27 18:16:43 +01:00
|
|
|
flag_min_balance: Option<String> = None, or |_| None,
|
|
|
|
flag_max_balance: Option<String> = None, or |_| None,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// -- Snapshot Optons
|
|
|
|
flag_at: String = "latest", or |_| None,
|
|
|
|
flag_no_periodic_snapshot: bool = false,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.snapshots).disable_periodic.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// -- Virtual Machine Options
|
|
|
|
flag_jitvm: bool = false,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.vm).jit.clone(),
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// -- Miscellaneous Options
|
|
|
|
flag_logging: Option<String> = None,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.misc).logging.clone().map(Some),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_log_file: Option<String> = None,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.misc).log_file.clone().map(Some),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_no_color: bool = false,
|
2016-09-11 11:52:12 +02:00
|
|
|
or |c: &Config| otry!(c.misc).color.map(|c| !c).clone(),
|
2017-04-03 10:27:37 +02:00
|
|
|
|
|
|
|
// -- Legacy Options supported in configs
|
|
|
|
flag_dapps_port: Option<u16> = None,
|
|
|
|
or |c: &Config| otry!(c.dapps).port.clone().map(Some),
|
|
|
|
flag_dapps_interface: Option<String> = None,
|
|
|
|
or |c: &Config| otry!(c.dapps).interface.clone().map(Some),
|
|
|
|
flag_dapps_hosts: Option<String> = None,
|
|
|
|
or |c: &Config| otry!(c.dapps).hosts.as_ref().map(|vec| Some(vec.join(","))),
|
|
|
|
flag_dapps_cors: Option<String> = None,
|
|
|
|
or |c: &Config| otry!(c.dapps).cors.clone().map(Some),
|
|
|
|
flag_dapps_user: Option<String> = None,
|
|
|
|
or |c: &Config| otry!(c.dapps).user.clone().map(Some),
|
|
|
|
flag_dapps_pass: Option<String> = None,
|
|
|
|
or |c: &Config| otry!(c.dapps).pass.clone().map(Some),
|
|
|
|
flag_dapps_apis_all: Option<bool> = None, or |_| None,
|
2016-09-10 11:37:14 +02:00
|
|
|
}
|
2017-01-18 18:45:30 +01:00
|
|
|
{
|
|
|
|
// Values with optional default value.
|
|
|
|
flag_base_path: Option<String>, display dir::default_data_path(), or |c: &Config| otry!(c.parity).base_path.clone().map(Some),
|
|
|
|
flag_db_path: Option<String>, display dir::CHAINS_PATH, or |c: &Config| otry!(c.parity).db_path.clone().map(Some),
|
2017-03-02 20:04:17 +01:00
|
|
|
flag_warp: Option<bool>, display true, or |c: &Config| Some(otry!(c.network).warp.clone()),
|
2017-01-18 18:45:30 +01:00
|
|
|
}
|
2016-09-10 11:37:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct Config {
|
2016-09-11 11:52:12 +02:00
|
|
|
parity: Option<Operating>,
|
|
|
|
account: Option<Account>,
|
2016-11-07 17:40:53 +01:00
|
|
|
ui: Option<Ui>,
|
2016-09-11 11:52:12 +02:00
|
|
|
network: Option<Network>,
|
|
|
|
rpc: Option<Rpc>,
|
2017-04-13 16:32:07 +02:00
|
|
|
websockets: Option<Ws>,
|
2016-09-11 11:52:12 +02:00
|
|
|
ipc: Option<Ipc>,
|
|
|
|
dapps: Option<Dapps>,
|
2017-02-20 16:13:21 +01:00
|
|
|
secretstore: Option<SecretStore>,
|
2017-02-15 20:29:29 +01:00
|
|
|
ipfs: Option<Ipfs>,
|
2016-09-11 11:52:12 +02:00
|
|
|
mining: Option<Mining>,
|
|
|
|
footprint: Option<Footprint>,
|
|
|
|
snapshots: Option<Snapshots>,
|
|
|
|
vm: Option<VM>,
|
|
|
|
misc: Option<Misc>,
|
2017-01-25 11:03:36 +01:00
|
|
|
stratum: Option<Stratum>,
|
2016-09-10 11:37:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct Operating {
|
|
|
|
mode: Option<String>,
|
|
|
|
mode_timeout: Option<u64>,
|
|
|
|
mode_alarm: Option<u64>,
|
2016-11-23 20:35:21 +01:00
|
|
|
auto_update: Option<String>,
|
2016-12-15 19:23:25 +01:00
|
|
|
release_track: Option<String>,
|
2017-03-29 17:07:58 +02:00
|
|
|
public_node: Option<bool>,
|
2016-11-23 20:35:21 +01:00
|
|
|
no_download: Option<bool>,
|
|
|
|
no_consensus: Option<bool>,
|
2016-09-10 11:37:14 +02:00
|
|
|
chain: Option<String>,
|
2016-12-15 21:56:45 +01:00
|
|
|
base_path: Option<String>,
|
2016-09-10 11:37:14 +02:00
|
|
|
db_path: Option<String>,
|
|
|
|
keys_path: Option<String>,
|
|
|
|
identity: Option<String>,
|
2017-03-22 16:45:50 +01:00
|
|
|
light: Option<bool>,
|
2017-05-04 12:13:50 +02:00
|
|
|
no_persistent_txqueue: Option<bool>,
|
2016-09-10 11:37:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct Account {
|
|
|
|
unlock: Option<Vec<String>>,
|
|
|
|
password: Option<Vec<String>>,
|
|
|
|
keys_iterations: Option<u32>,
|
2017-02-10 01:07:06 +01:00
|
|
|
disable_hardware: Option<bool>,
|
2017-06-06 18:06:40 +02:00
|
|
|
fast_unlock: Option<bool>,
|
2016-09-10 11:37:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
2016-11-07 17:40:53 +01:00
|
|
|
struct Ui {
|
2016-09-10 11:37:14 +02:00
|
|
|
force: Option<bool>,
|
|
|
|
disable: Option<bool>,
|
|
|
|
port: Option<u16>,
|
|
|
|
interface: Option<String>,
|
2017-05-24 12:24:07 +02:00
|
|
|
hosts: Option<Vec<String>>,
|
2016-09-10 11:37:14 +02:00
|
|
|
path: Option<String>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct Network {
|
2016-10-18 18:16:00 +02:00
|
|
|
warp: Option<bool>,
|
2016-09-10 11:37:14 +02:00
|
|
|
port: Option<u16>,
|
|
|
|
min_peers: Option<u16>,
|
|
|
|
max_peers: Option<u16>,
|
2016-10-24 18:25:27 +02:00
|
|
|
snapshot_peers: Option<u16>,
|
|
|
|
max_pending_peers: Option<u16>,
|
2016-09-10 11:37:14 +02:00
|
|
|
nat: Option<String>,
|
2016-10-24 18:25:27 +02:00
|
|
|
allow_ips: Option<String>,
|
2016-12-05 15:54:31 +01:00
|
|
|
id: Option<u64>,
|
2016-09-10 11:37:14 +02:00
|
|
|
bootnodes: Option<Vec<String>>,
|
|
|
|
discovery: Option<bool>,
|
|
|
|
node_key: Option<String>,
|
|
|
|
reserved_peers: Option<String>,
|
|
|
|
reserved_only: Option<bool>,
|
2017-03-22 16:45:50 +01:00
|
|
|
no_serve_light: Option<bool>,
|
2016-09-10 11:37:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct Rpc {
|
|
|
|
disable: Option<bool>,
|
|
|
|
port: Option<u16>,
|
|
|
|
interface: Option<String>,
|
|
|
|
cors: Option<String>,
|
|
|
|
apis: Option<Vec<String>>,
|
|
|
|
hosts: Option<Vec<String>>,
|
2017-04-03 10:27:37 +02:00
|
|
|
threads: Option<usize>,
|
2016-09-10 11:37:14 +02:00
|
|
|
}
|
|
|
|
|
2017-04-13 16:32:07 +02:00
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct Ws {
|
|
|
|
disable: Option<bool>,
|
|
|
|
port: Option<u16>,
|
|
|
|
interface: Option<String>,
|
|
|
|
apis: Option<Vec<String>>,
|
|
|
|
origins: Option<Vec<String>>,
|
|
|
|
hosts: Option<Vec<String>>,
|
|
|
|
}
|
|
|
|
|
2016-09-10 11:37:14 +02:00
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct Ipc {
|
|
|
|
disable: Option<bool>,
|
|
|
|
path: Option<String>,
|
|
|
|
apis: Option<Vec<String>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct Dapps {
|
|
|
|
disable: Option<bool>,
|
|
|
|
port: Option<u16>,
|
|
|
|
interface: Option<String>,
|
|
|
|
hosts: Option<Vec<String>>,
|
2017-03-07 17:33:28 +01:00
|
|
|
cors: Option<String>,
|
2016-09-10 11:37:14 +02:00
|
|
|
path: Option<String>,
|
|
|
|
user: Option<String>,
|
|
|
|
pass: Option<String>,
|
|
|
|
}
|
|
|
|
|
2017-02-20 16:13:21 +01:00
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct SecretStore {
|
|
|
|
disable: Option<bool>,
|
2017-04-08 11:26:16 +02:00
|
|
|
self_secret: Option<String>,
|
|
|
|
nodes: Option<Vec<String>>,
|
2017-02-20 16:13:21 +01:00
|
|
|
interface: Option<String>,
|
2017-04-08 11:26:16 +02:00
|
|
|
port: Option<u16>,
|
|
|
|
http_interface: Option<String>,
|
|
|
|
http_port: Option<u16>,
|
2017-02-20 16:13:21 +01:00
|
|
|
path: Option<String>,
|
|
|
|
}
|
|
|
|
|
2017-02-15 20:29:29 +01:00
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct Ipfs {
|
2017-02-16 14:41:33 +01:00
|
|
|
enable: Option<bool>,
|
2017-02-15 20:29:29 +01:00
|
|
|
port: Option<u16>,
|
2017-02-24 10:32:42 +01:00
|
|
|
interface: Option<String>,
|
|
|
|
cors: Option<String>,
|
|
|
|
hosts: Option<Vec<String>>,
|
2017-02-15 20:29:29 +01:00
|
|
|
}
|
|
|
|
|
2016-09-10 11:37:14 +02:00
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct Mining {
|
|
|
|
author: Option<String>,
|
2016-12-05 22:31:38 +01:00
|
|
|
engine_signer: Option<String>,
|
2016-09-10 11:37:14 +02:00
|
|
|
force_sealing: Option<bool>,
|
|
|
|
reseal_on_txs: Option<String>,
|
|
|
|
reseal_min_period: Option<u64>,
|
2017-03-15 14:04:42 +01:00
|
|
|
reseal_max_period: Option<u64>,
|
2016-09-10 11:37:14 +02:00
|
|
|
work_queue_size: Option<usize>,
|
|
|
|
tx_gas_limit: Option<String>,
|
2016-10-27 19:28:34 +02:00
|
|
|
tx_time_limit: Option<u64>,
|
2016-09-10 11:37:14 +02:00
|
|
|
relay_set: Option<String>,
|
|
|
|
usd_per_tx: Option<String>,
|
|
|
|
usd_per_eth: Option<String>,
|
|
|
|
price_update_period: Option<String>,
|
|
|
|
gas_floor_target: Option<String>,
|
|
|
|
gas_cap: Option<String>,
|
|
|
|
extra_data: Option<String>,
|
|
|
|
tx_queue_size: Option<usize>,
|
2016-10-10 23:04:43 +02:00
|
|
|
tx_queue_gas: Option<String>,
|
2016-10-15 14:46:33 +02:00
|
|
|
tx_queue_strategy: Option<String>,
|
2016-10-27 19:28:34 +02:00
|
|
|
tx_queue_ban_count: Option<u16>,
|
|
|
|
tx_queue_ban_time: Option<u16>,
|
2016-09-10 11:37:14 +02:00
|
|
|
remove_solved: Option<bool>,
|
|
|
|
notify_work: Option<Vec<String>>,
|
2017-01-22 16:15:22 +01:00
|
|
|
refuse_service_transactions: Option<bool>,
|
2016-09-10 11:37:14 +02:00
|
|
|
}
|
|
|
|
|
2017-01-25 11:03:36 +01:00
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct Stratum {
|
|
|
|
interface: Option<String>,
|
|
|
|
port: Option<u16>,
|
|
|
|
secret: Option<String>,
|
|
|
|
}
|
|
|
|
|
2016-09-10 11:37:14 +02:00
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct Footprint {
|
|
|
|
tracing: Option<String>,
|
|
|
|
pruning: Option<String>,
|
2016-10-14 14:44:56 +02:00
|
|
|
pruning_history: Option<u64>,
|
2017-01-20 13:25:53 +01:00
|
|
|
pruning_memory: Option<usize>,
|
2016-09-10 11:37:14 +02:00
|
|
|
fast_and_loose: Option<bool>,
|
|
|
|
cache_size: Option<u32>,
|
|
|
|
cache_size_db: Option<u32>,
|
|
|
|
cache_size_blocks: Option<u32>,
|
|
|
|
cache_size_queue: Option<u32>,
|
2016-10-07 00:28:42 +02:00
|
|
|
cache_size_state: Option<u32>,
|
2016-09-10 11:37:14 +02:00
|
|
|
db_compaction: Option<String>,
|
2016-10-03 11:13:10 +02:00
|
|
|
fat_db: Option<String>,
|
2016-12-02 18:36:00 +01:00
|
|
|
scale_verifiers: Option<bool>,
|
|
|
|
num_verifiers: Option<usize>,
|
2016-09-10 11:37:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct Snapshots {
|
|
|
|
disable_periodic: Option<bool>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct VM {
|
|
|
|
jit: Option<bool>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
|
|
|
struct Misc {
|
|
|
|
logging: Option<String>,
|
|
|
|
log_file: Option<String>,
|
2016-09-11 11:52:12 +02:00
|
|
|
color: Option<bool>,
|
2017-05-23 12:24:32 +02:00
|
|
|
ports_shift: Option<u16>,
|
|
|
|
unsafe_expose: Option<bool>,
|
2016-09-10 11:37:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
use super::{
|
2016-09-11 11:52:12 +02:00
|
|
|
Args, ArgsError,
|
2017-04-13 16:32:07 +02:00
|
|
|
Config, Operating, Account, Ui, Network, Ws, Rpc, Ipc, Dapps, Ipfs, Mining, Footprint,
|
2017-02-20 16:13:21 +01:00
|
|
|
Snapshots, VM, Misc, SecretStore,
|
2016-09-10 11:37:14 +02:00
|
|
|
};
|
|
|
|
use toml;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_parse_args_and_include_config() {
|
|
|
|
// given
|
|
|
|
let mut config = Config::default();
|
|
|
|
let mut operating = Operating::default();
|
|
|
|
operating.chain = Some("morden".into());
|
2016-09-11 11:52:12 +02:00
|
|
|
config.parity = Some(operating);
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// when
|
|
|
|
let args = Args::parse_with_config(&["parity"], config).unwrap();
|
|
|
|
|
|
|
|
// then
|
|
|
|
assert_eq!(args.flag_chain, "morden".to_owned());
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_not_use_config_if_cli_is_provided() {
|
|
|
|
// given
|
|
|
|
let mut config = Config::default();
|
|
|
|
let mut operating = Operating::default();
|
|
|
|
operating.chain = Some("morden".into());
|
2016-09-11 11:52:12 +02:00
|
|
|
config.parity = Some(operating);
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// when
|
|
|
|
let args = Args::parse_with_config(&["parity", "--chain", "xyz"], config).unwrap();
|
|
|
|
|
|
|
|
// then
|
|
|
|
assert_eq!(args.flag_chain, "xyz".to_owned());
|
|
|
|
}
|
|
|
|
|
2016-10-27 16:56:18 +02:00
|
|
|
#[test]
|
|
|
|
fn should_use_config_if_cli_is_missing() {
|
|
|
|
let mut config = Config::default();
|
|
|
|
let mut footprint = Footprint::default();
|
|
|
|
footprint.pruning_history = Some(128);
|
|
|
|
config.footprint = Some(footprint);
|
|
|
|
|
|
|
|
// when
|
|
|
|
let args = Args::parse_with_config(&["parity"], config).unwrap();
|
|
|
|
|
|
|
|
// then
|
|
|
|
assert_eq!(args.flag_pruning_history, 128);
|
|
|
|
}
|
|
|
|
|
2016-09-10 11:37:14 +02:00
|
|
|
#[test]
|
|
|
|
fn should_parse_full_config() {
|
|
|
|
// given
|
|
|
|
let config = toml::decode_str(include_str!("./config.full.toml")).unwrap();
|
|
|
|
|
|
|
|
// when
|
|
|
|
let args = Args::parse_with_config(&["parity", "--chain", "xyz"], config).unwrap();
|
|
|
|
|
|
|
|
// then
|
|
|
|
assert_eq!(args, Args {
|
|
|
|
// Commands
|
|
|
|
cmd_daemon: false,
|
|
|
|
cmd_wallet: false,
|
|
|
|
cmd_account: false,
|
|
|
|
cmd_new: false,
|
|
|
|
cmd_list: false,
|
|
|
|
cmd_export: false,
|
2016-11-27 11:11:56 +01:00
|
|
|
cmd_state: false,
|
|
|
|
cmd_blocks: false,
|
2016-09-10 11:37:14 +02:00
|
|
|
cmd_import: false,
|
|
|
|
cmd_signer: false,
|
2016-09-29 14:48:44 +02:00
|
|
|
cmd_sign: false,
|
|
|
|
cmd_reject: false,
|
2016-09-10 11:37:14 +02:00
|
|
|
cmd_new_token: false,
|
|
|
|
cmd_snapshot: false,
|
|
|
|
cmd_restore: false,
|
|
|
|
cmd_ui: false,
|
2017-01-06 16:05:58 +01:00
|
|
|
cmd_dapp: false,
|
2016-09-23 15:28:09 +02:00
|
|
|
cmd_tools: false,
|
|
|
|
cmd_hash: false,
|
2016-12-12 17:19:41 +01:00
|
|
|
cmd_db: false,
|
|
|
|
cmd_kill: false,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// Arguments
|
|
|
|
arg_pid_file: "".into(),
|
|
|
|
arg_file: None,
|
2016-09-29 14:48:44 +02:00
|
|
|
arg_id: None,
|
2016-09-10 11:37:14 +02:00
|
|
|
arg_path: vec![],
|
|
|
|
|
|
|
|
// -- Operating Options
|
2016-11-05 10:38:00 +01:00
|
|
|
flag_mode: "last".into(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_mode_timeout: 300u64,
|
|
|
|
flag_mode_alarm: 3600u64,
|
2017-01-09 18:33:53 +01:00
|
|
|
flag_auto_update: "none".into(),
|
2016-12-15 19:23:25 +01:00
|
|
|
flag_release_track: "current".into(),
|
2017-03-29 17:07:58 +02:00
|
|
|
flag_public_node: false,
|
2016-11-23 20:35:21 +01:00
|
|
|
flag_no_download: false,
|
|
|
|
flag_no_consensus: false,
|
2016-09-11 11:52:12 +02:00
|
|
|
flag_chain: "xyz".into(),
|
2017-01-18 18:45:30 +01:00
|
|
|
flag_base_path: Some("$HOME/.parity".into()),
|
|
|
|
flag_db_path: Some("$HOME/.parity/chains".into()),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_keys_path: "$HOME/.parity/keys".into(),
|
|
|
|
flag_identity: "".into(),
|
2017-03-22 16:45:50 +01:00
|
|
|
flag_light: false,
|
2017-05-04 12:13:50 +02:00
|
|
|
flag_no_persistent_txqueue: false,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
2017-05-23 12:24:32 +02:00
|
|
|
// -- Convenience Options
|
|
|
|
flag_config: "$BASE/config.toml".into(),
|
|
|
|
flag_ports_shift: 0,
|
|
|
|
flag_unsafe_expose: false,
|
|
|
|
|
2016-09-10 11:37:14 +02:00
|
|
|
// -- Account Options
|
2016-09-11 11:52:12 +02:00
|
|
|
flag_unlock: Some("0xdeadbeefcafe0000000000000000000000000000".into()),
|
|
|
|
flag_password: vec!["~/.safe/password.file".into()],
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_keys_iterations: 10240u32,
|
2017-02-10 01:07:06 +01:00
|
|
|
flag_no_hardware_wallets: false,
|
2017-06-08 09:20:50 +02:00
|
|
|
flag_fast_unlock: false,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
2016-11-07 17:40:53 +01:00
|
|
|
flag_force_ui: false,
|
|
|
|
flag_no_ui: false,
|
|
|
|
flag_ui_port: 8180u16,
|
|
|
|
flag_ui_interface: "127.0.0.1".into(),
|
2017-05-24 12:24:07 +02:00
|
|
|
flag_ui_hosts: "none".into(),
|
2016-11-07 17:40:53 +01:00
|
|
|
flag_ui_path: "$HOME/.parity/signer".into(),
|
|
|
|
flag_ui_no_validation: false,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// -- Networking Options
|
2017-03-02 20:04:17 +01:00
|
|
|
flag_no_warp: false,
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_port: 30303u16,
|
|
|
|
flag_min_peers: 25u16,
|
|
|
|
flag_max_peers: 50u16,
|
2016-10-24 18:25:27 +02:00
|
|
|
flag_max_pending_peers: 64u16,
|
|
|
|
flag_snapshot_peers: 0u16,
|
|
|
|
flag_allow_ips: "all".into(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_nat: "any".into(),
|
2016-11-03 22:22:25 +01:00
|
|
|
flag_network_id: Some(1),
|
2016-09-11 11:52:12 +02:00
|
|
|
flag_bootnodes: Some("".into()),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_no_discovery: false,
|
|
|
|
flag_node_key: None,
|
2016-09-11 11:52:12 +02:00
|
|
|
flag_reserved_peers: Some("./path_to_file".into()),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_reserved_only: false,
|
2016-11-22 18:03:35 +01:00
|
|
|
flag_no_ancient_blocks: false,
|
2017-03-22 16:45:50 +01:00
|
|
|
flag_no_serve_light: false,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// -- API and Console Options
|
|
|
|
// RPC
|
|
|
|
flag_no_jsonrpc: false,
|
|
|
|
flag_jsonrpc_port: 8545u16,
|
|
|
|
flag_jsonrpc_interface: "local".into(),
|
2016-09-11 11:52:12 +02:00
|
|
|
flag_jsonrpc_cors: Some("null".into()),
|
2017-05-05 15:57:29 +02:00
|
|
|
flag_jsonrpc_apis: "web3,eth,net,parity,traces,rpc,secretstore".into(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_jsonrpc_hosts: "none".into(),
|
2017-04-03 10:27:37 +02:00
|
|
|
flag_jsonrpc_threads: None,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
2017-04-13 16:32:07 +02:00
|
|
|
// WS
|
|
|
|
flag_no_ws: false,
|
|
|
|
flag_ws_port: 8546u16,
|
|
|
|
flag_ws_interface: "local".into(),
|
2017-05-05 15:57:29 +02:00
|
|
|
flag_ws_apis: "web3,eth,net,parity,traces,rpc,secretstore".into(),
|
2017-04-13 16:32:07 +02:00
|
|
|
flag_ws_origins: "none".into(),
|
|
|
|
flag_ws_hosts: "none".into(),
|
|
|
|
|
2016-09-10 11:37:14 +02:00
|
|
|
// IPC
|
|
|
|
flag_no_ipc: false,
|
|
|
|
flag_ipc_path: "$HOME/.parity/jsonrpc.ipc".into(),
|
2017-05-05 15:57:29 +02:00
|
|
|
flag_ipc_apis: "web3,eth,net,parity,parity_accounts,personal,traces,rpc,secretstore".into(),
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// DAPPS
|
|
|
|
flag_dapps_path: "$HOME/.parity/dapps".into(),
|
2017-04-03 10:27:37 +02:00
|
|
|
flag_no_dapps: false,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
2017-02-20 16:13:21 +01:00
|
|
|
flag_no_secretstore: false,
|
2017-04-08 11:26:16 +02:00
|
|
|
flag_secretstore_secret: None,
|
|
|
|
flag_secretstore_nodes: "".into(),
|
2017-02-20 16:13:21 +01:00
|
|
|
flag_secretstore_interface: "local".into(),
|
2017-04-08 11:26:16 +02:00
|
|
|
flag_secretstore_port: 8083u16,
|
|
|
|
flag_secretstore_http_interface: "local".into(),
|
|
|
|
flag_secretstore_http_port: 8082u16,
|
2017-02-20 16:13:21 +01:00
|
|
|
flag_secretstore_path: "$HOME/.parity/secretstore".into(),
|
|
|
|
|
2017-02-15 20:29:29 +01:00
|
|
|
// IPFS
|
2017-02-16 14:41:33 +01:00
|
|
|
flag_ipfs_api: false,
|
|
|
|
flag_ipfs_api_port: 5001u16,
|
2017-02-24 10:32:42 +01:00
|
|
|
flag_ipfs_api_interface: "local".into(),
|
|
|
|
flag_ipfs_api_cors: Some("null".into()),
|
|
|
|
flag_ipfs_api_hosts: "none".into(),
|
2017-02-15 20:29:29 +01:00
|
|
|
|
2016-09-10 11:37:14 +02:00
|
|
|
// -- Sealing/Mining Options
|
2016-09-11 11:52:12 +02:00
|
|
|
flag_author: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
|
2016-12-05 20:23:03 +01:00
|
|
|
flag_engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
|
2016-09-11 11:52:12 +02:00
|
|
|
flag_force_sealing: true,
|
|
|
|
flag_reseal_on_txs: "all".into(),
|
|
|
|
flag_reseal_min_period: 4000u64,
|
2017-03-15 14:04:42 +01:00
|
|
|
flag_reseal_max_period: 60000u64,
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_work_queue_size: 20usize,
|
2016-09-11 11:52:12 +02:00
|
|
|
flag_tx_gas_limit: Some("6283184".into()),
|
2016-10-27 19:28:34 +02:00
|
|
|
flag_tx_time_limit: Some(100u64),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_relay_set: "cheap".into(),
|
2016-11-25 15:12:57 +01:00
|
|
|
flag_usd_per_tx: "0.0025".into(),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_usd_per_eth: "auto".into(),
|
|
|
|
flag_price_update_period: "hourly".into(),
|
|
|
|
flag_gas_floor_target: "4700000".into(),
|
|
|
|
flag_gas_cap: "6283184".into(),
|
2016-09-11 11:52:12 +02:00
|
|
|
flag_extra_data: Some("Parity".into()),
|
2016-10-15 14:46:33 +02:00
|
|
|
flag_tx_queue_size: 1024usize,
|
2016-10-10 23:04:43 +02:00
|
|
|
flag_tx_queue_gas: "auto".into(),
|
2016-10-15 14:46:33 +02:00
|
|
|
flag_tx_queue_strategy: "gas_factor".into(),
|
2016-10-27 19:28:34 +02:00
|
|
|
flag_tx_queue_ban_count: 1u16,
|
|
|
|
flag_tx_queue_ban_time: 180u16,
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_remove_solved: false,
|
2016-09-11 11:52:12 +02:00
|
|
|
flag_notify_work: Some("http://localhost:3001".into()),
|
2017-01-22 16:15:22 +01:00
|
|
|
flag_refuse_service_transactions: false,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
2017-01-25 11:03:36 +01:00
|
|
|
flag_stratum: false,
|
|
|
|
flag_stratum_interface: "local".to_owned(),
|
|
|
|
flag_stratum_port: 8008u16,
|
|
|
|
flag_stratum_secret: None,
|
|
|
|
|
2016-09-10 11:37:14 +02:00
|
|
|
// -- Footprint Options
|
|
|
|
flag_tracing: "auto".into(),
|
|
|
|
flag_pruning: "auto".into(),
|
2017-02-13 17:15:25 +01:00
|
|
|
flag_pruning_history: 64u64,
|
2017-01-20 13:25:53 +01:00
|
|
|
flag_pruning_memory: 500usize,
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_cache_size_db: 64u32,
|
|
|
|
flag_cache_size_blocks: 8u32,
|
|
|
|
flag_cache_size_queue: 50u32,
|
2016-10-07 00:28:42 +02:00
|
|
|
flag_cache_size_state: 25u32,
|
2016-09-11 11:52:12 +02:00
|
|
|
flag_cache_size: Some(128),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_fast_and_loose: false,
|
|
|
|
flag_db_compaction: "ssd".into(),
|
2016-10-03 11:13:10 +02:00
|
|
|
flag_fat_db: "auto".into(),
|
2016-12-02 18:36:00 +01:00
|
|
|
flag_scale_verifiers: true,
|
|
|
|
flag_num_verifiers: Some(6),
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// -- Import/Export Options
|
|
|
|
flag_from: "1".into(),
|
|
|
|
flag_to: "latest".into(),
|
|
|
|
flag_format: None,
|
2016-10-24 15:09:13 +02:00
|
|
|
flag_no_seal_check: false,
|
2016-11-27 18:16:43 +01:00
|
|
|
flag_no_code: false,
|
|
|
|
flag_no_storage: false,
|
|
|
|
flag_min_balance: None,
|
|
|
|
flag_max_balance: None,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// -- Snapshot Optons
|
|
|
|
flag_at: "latest".into(),
|
|
|
|
flag_no_periodic_snapshot: false,
|
|
|
|
|
|
|
|
// -- Virtual Machine Options
|
|
|
|
flag_jitvm: false,
|
|
|
|
|
|
|
|
// -- Legacy Options
|
|
|
|
flag_geth: false,
|
|
|
|
flag_testnet: false,
|
|
|
|
flag_import_geth_keys: false,
|
|
|
|
flag_datadir: None,
|
|
|
|
flag_networkid: None,
|
|
|
|
flag_peers: None,
|
|
|
|
flag_nodekey: None,
|
|
|
|
flag_nodiscover: false,
|
|
|
|
flag_jsonrpc: false,
|
|
|
|
flag_jsonrpc_off: false,
|
|
|
|
flag_webapp: false,
|
|
|
|
flag_dapps_off: false,
|
|
|
|
flag_rpc: false,
|
|
|
|
flag_rpcaddr: None,
|
|
|
|
flag_rpcport: None,
|
|
|
|
flag_rpcapi: None,
|
|
|
|
flag_rpccorsdomain: None,
|
|
|
|
flag_ipcdisable: false,
|
|
|
|
flag_ipc_off: false,
|
|
|
|
flag_ipcapi: None,
|
|
|
|
flag_ipcpath: None,
|
|
|
|
flag_gasprice: None,
|
|
|
|
flag_etherbase: None,
|
|
|
|
flag_extradata: None,
|
|
|
|
flag_cache: None,
|
2017-03-02 20:04:17 +01:00
|
|
|
flag_warp: Some(true),
|
2017-04-03 10:27:37 +02:00
|
|
|
// Legacy-Dapps
|
|
|
|
flag_dapps_port: Some(8080),
|
|
|
|
flag_dapps_interface: Some("local".into()),
|
|
|
|
flag_dapps_hosts: Some("none".into()),
|
|
|
|
flag_dapps_cors: None,
|
|
|
|
flag_dapps_user: Some("test_user".into()),
|
|
|
|
flag_dapps_pass: Some("test_pass".into()),
|
|
|
|
flag_dapps_apis_all: None,
|
2016-09-10 11:37:14 +02:00
|
|
|
|
|
|
|
// -- Miscellaneous Options
|
|
|
|
flag_version: false,
|
2016-09-11 11:52:12 +02:00
|
|
|
flag_logging: Some("own_tx=trace".into()),
|
|
|
|
flag_log_file: Some("/var/log/parity.log".into()),
|
2016-09-10 11:37:14 +02:00
|
|
|
flag_no_color: false,
|
2016-09-12 14:11:30 +02:00
|
|
|
flag_no_config: false,
|
2016-09-10 11:37:14 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-09-11 11:52:12 +02:00
|
|
|
#[test]
|
|
|
|
fn should_parse_config_and_return_errors() {
|
|
|
|
let config1 = Args::parse_config(include_str!("./config.invalid1.toml"));
|
|
|
|
let config2 = Args::parse_config(include_str!("./config.invalid2.toml"));
|
2016-11-29 13:23:28 +01:00
|
|
|
let config3 = Args::parse_config(include_str!("./config.invalid3.toml"));
|
2016-09-11 11:52:12 +02:00
|
|
|
|
2016-11-29 13:23:28 +01:00
|
|
|
match (config1, config2, config3) {
|
|
|
|
(Err(ArgsError::Parsing(_)), Err(ArgsError::Decode(_)), Err(ArgsError::UnknownFields(_))) => {},
|
|
|
|
(a, b, c) => {
|
|
|
|
assert!(false, "Got invalid error types: {:?}, {:?}, {:?}", a, b, c);
|
2016-09-11 11:52:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-10 11:37:14 +02:00
|
|
|
#[test]
|
|
|
|
fn should_deserialize_toml_file() {
|
|
|
|
let config: Config = toml::decode_str(include_str!("./config.toml")).unwrap();
|
|
|
|
|
|
|
|
assert_eq!(config, Config {
|
2016-09-11 11:52:12 +02:00
|
|
|
parity: Some(Operating {
|
2016-09-10 11:37:14 +02:00
|
|
|
mode: Some("dark".into()),
|
|
|
|
mode_timeout: Some(15u64),
|
|
|
|
mode_alarm: Some(10u64),
|
2016-12-04 19:47:05 +01:00
|
|
|
auto_update: None,
|
2016-12-15 19:23:25 +01:00
|
|
|
release_track: None,
|
2017-03-29 17:07:58 +02:00
|
|
|
public_node: None,
|
2016-12-04 19:47:05 +01:00
|
|
|
no_download: None,
|
|
|
|
no_consensus: None,
|
2016-09-10 11:37:14 +02:00
|
|
|
chain: Some("./chain.json".into()),
|
2016-12-15 21:56:45 +01:00
|
|
|
base_path: None,
|
2016-09-10 11:37:14 +02:00
|
|
|
db_path: None,
|
|
|
|
keys_path: None,
|
|
|
|
identity: None,
|
2017-03-22 16:45:50 +01:00
|
|
|
light: None,
|
2017-05-04 12:13:50 +02:00
|
|
|
no_persistent_txqueue: None,
|
2016-09-11 11:52:12 +02:00
|
|
|
}),
|
|
|
|
account: Some(Account {
|
2016-09-10 11:37:14 +02:00
|
|
|
unlock: Some(vec!["0x1".into(), "0x2".into(), "0x3".into()]),
|
|
|
|
password: Some(vec!["passwdfile path".into()]),
|
|
|
|
keys_iterations: None,
|
2017-02-10 01:07:06 +01:00
|
|
|
disable_hardware: None,
|
2017-06-06 18:06:40 +02:00
|
|
|
fast_unlock: None,
|
2016-09-11 11:52:12 +02:00
|
|
|
}),
|
2016-11-07 17:40:53 +01:00
|
|
|
ui: Some(Ui {
|
2016-09-10 11:37:14 +02:00
|
|
|
force: None,
|
|
|
|
disable: Some(true),
|
|
|
|
port: None,
|
|
|
|
interface: None,
|
2017-05-24 12:24:07 +02:00
|
|
|
hosts: None,
|
2016-09-10 11:37:14 +02:00
|
|
|
path: None,
|
2016-09-11 11:52:12 +02:00
|
|
|
}),
|
|
|
|
network: Some(Network {
|
2016-10-18 18:16:00 +02:00
|
|
|
warp: Some(false),
|
2016-09-10 11:37:14 +02:00
|
|
|
port: None,
|
|
|
|
min_peers: Some(10),
|
|
|
|
max_peers: Some(20),
|
2016-10-24 18:25:27 +02:00
|
|
|
max_pending_peers: Some(30),
|
|
|
|
snapshot_peers: Some(40),
|
|
|
|
allow_ips: Some("public".into()),
|
2016-09-10 11:37:14 +02:00
|
|
|
nat: Some("any".into()),
|
|
|
|
id: None,
|
|
|
|
bootnodes: None,
|
|
|
|
discovery: Some(true),
|
|
|
|
node_key: None,
|
|
|
|
reserved_peers: Some("./path/to/reserved_peers".into()),
|
|
|
|
reserved_only: Some(true),
|
2017-03-22 16:45:50 +01:00
|
|
|
no_serve_light: None,
|
2016-09-11 11:52:12 +02:00
|
|
|
}),
|
2017-04-13 16:32:07 +02:00
|
|
|
websockets: Some(Ws {
|
|
|
|
disable: Some(true),
|
|
|
|
port: None,
|
|
|
|
interface: None,
|
|
|
|
apis: None,
|
|
|
|
origins: Some(vec!["none".into()]),
|
|
|
|
hosts: None,
|
|
|
|
}),
|
2016-09-11 11:52:12 +02:00
|
|
|
rpc: Some(Rpc {
|
2016-09-10 11:37:14 +02:00
|
|
|
disable: Some(true),
|
|
|
|
port: Some(8180),
|
|
|
|
interface: None,
|
|
|
|
cors: None,
|
|
|
|
apis: None,
|
|
|
|
hosts: None,
|
2017-04-03 10:27:37 +02:00
|
|
|
threads: None,
|
2016-09-11 11:52:12 +02:00
|
|
|
}),
|
|
|
|
ipc: Some(Ipc {
|
2016-09-10 11:37:14 +02:00
|
|
|
disable: None,
|
|
|
|
path: None,
|
|
|
|
apis: Some(vec!["rpc".into(), "eth".into()]),
|
2016-09-11 11:52:12 +02:00
|
|
|
}),
|
|
|
|
dapps: Some(Dapps {
|
2016-09-10 11:37:14 +02:00
|
|
|
disable: None,
|
|
|
|
port: Some(8080),
|
|
|
|
path: None,
|
|
|
|
interface: None,
|
|
|
|
hosts: None,
|
2017-03-07 17:33:28 +01:00
|
|
|
cors: None,
|
2016-09-10 11:37:14 +02:00
|
|
|
user: Some("username".into()),
|
|
|
|
pass: Some("password".into())
|
2016-09-11 11:52:12 +02:00
|
|
|
}),
|
2017-02-20 16:13:21 +01:00
|
|
|
secretstore: Some(SecretStore {
|
|
|
|
disable: None,
|
2017-04-08 11:26:16 +02:00
|
|
|
self_secret: None,
|
|
|
|
nodes: None,
|
2017-02-20 16:13:21 +01:00
|
|
|
interface: None,
|
2017-04-08 11:26:16 +02:00
|
|
|
port: Some(8083),
|
|
|
|
http_interface: None,
|
|
|
|
http_port: Some(8082),
|
2017-02-20 16:13:21 +01:00
|
|
|
path: None,
|
|
|
|
}),
|
2017-02-15 20:29:29 +01:00
|
|
|
ipfs: Some(Ipfs {
|
2017-02-16 14:41:33 +01:00
|
|
|
enable: Some(false),
|
2017-02-24 10:32:42 +01:00
|
|
|
port: Some(5001),
|
|
|
|
interface: None,
|
|
|
|
cors: None,
|
|
|
|
hosts: None,
|
2017-02-15 20:29:29 +01:00
|
|
|
}),
|
2016-09-11 11:52:12 +02:00
|
|
|
mining: Some(Mining {
|
2016-09-10 11:37:14 +02:00
|
|
|
author: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
|
2016-12-05 22:31:38 +01:00
|
|
|
engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
|
2016-09-10 11:37:14 +02:00
|
|
|
force_sealing: Some(true),
|
|
|
|
reseal_on_txs: Some("all".into()),
|
|
|
|
reseal_min_period: Some(4000),
|
2017-03-15 14:04:42 +01:00
|
|
|
reseal_max_period: Some(60000),
|
2016-09-10 11:37:14 +02:00
|
|
|
work_queue_size: None,
|
|
|
|
relay_set: None,
|
|
|
|
usd_per_tx: None,
|
|
|
|
usd_per_eth: None,
|
|
|
|
price_update_period: Some("hourly".into()),
|
|
|
|
gas_floor_target: None,
|
|
|
|
gas_cap: None,
|
2016-10-15 14:46:33 +02:00
|
|
|
tx_queue_size: Some(1024),
|
2016-10-10 23:04:43 +02:00
|
|
|
tx_queue_gas: Some("auto".into()),
|
2016-10-15 14:46:33 +02:00
|
|
|
tx_queue_strategy: None,
|
2016-10-27 19:28:34 +02:00
|
|
|
tx_queue_ban_count: None,
|
|
|
|
tx_queue_ban_time: None,
|
2016-09-10 11:37:14 +02:00
|
|
|
tx_gas_limit: None,
|
2016-10-27 19:28:34 +02:00
|
|
|
tx_time_limit: None,
|
2016-09-10 11:37:14 +02:00
|
|
|
extra_data: None,
|
|
|
|
remove_solved: None,
|
|
|
|
notify_work: None,
|
2017-01-22 16:15:22 +01:00
|
|
|
refuse_service_transactions: None,
|
2016-09-11 11:52:12 +02:00
|
|
|
}),
|
|
|
|
footprint: Some(Footprint {
|
2016-09-10 11:37:14 +02:00
|
|
|
tracing: Some("on".into()),
|
|
|
|
pruning: Some("fast".into()),
|
2016-10-14 14:44:56 +02:00
|
|
|
pruning_history: Some(64),
|
2017-01-20 13:25:53 +01:00
|
|
|
pruning_memory: None,
|
2016-09-10 11:37:14 +02:00
|
|
|
fast_and_loose: None,
|
|
|
|
cache_size: None,
|
|
|
|
cache_size_db: Some(128),
|
|
|
|
cache_size_blocks: Some(16),
|
|
|
|
cache_size_queue: Some(100),
|
2016-10-07 00:28:42 +02:00
|
|
|
cache_size_state: Some(25),
|
2016-09-10 11:37:14 +02:00
|
|
|
db_compaction: Some("ssd".into()),
|
2016-10-03 11:13:10 +02:00
|
|
|
fat_db: Some("off".into()),
|
2016-12-02 18:36:00 +01:00
|
|
|
scale_verifiers: Some(false),
|
|
|
|
num_verifiers: None,
|
2016-09-11 11:52:12 +02:00
|
|
|
}),
|
|
|
|
snapshots: Some(Snapshots {
|
2016-09-10 11:37:14 +02:00
|
|
|
disable_periodic: Some(true),
|
2016-09-11 11:52:12 +02:00
|
|
|
}),
|
|
|
|
vm: Some(VM {
|
2016-09-10 11:37:14 +02:00
|
|
|
jit: Some(false),
|
2016-09-11 11:52:12 +02:00
|
|
|
}),
|
|
|
|
misc: Some(Misc {
|
2016-09-10 11:37:14 +02:00
|
|
|
logging: Some("own_tx=trace".into()),
|
|
|
|
log_file: Some("/var/log/parity.log".into()),
|
2016-09-11 11:52:12 +02:00
|
|
|
color: Some(true),
|
2017-05-23 12:24:32 +02:00
|
|
|
ports_shift: Some(0),
|
|
|
|
unsafe_expose: Some(false),
|
2017-01-25 11:03:36 +01:00
|
|
|
}),
|
|
|
|
stratum: None,
|
2016-09-10 11:37:14 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|