diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index 6fa642deece..6b1635e07f2 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -235,41 +235,10 @@ usage! { { "Print the hashed light clients headers of the given --chain (default: mainnet) in a JSON format. To be used as hardcoded headers in a genesis file.", } - - // CMD removed in 2.0 - - CMD cmd_dapp - { - "Manage dapps", - - ARG arg_dapp_path: (Option) = None, - "", - "Path to the dapps", - } } { // Global flags and arguments ["Operating Options"] - FLAG flag_no_download: (bool) = false, or |c: &Config| c.parity.as_ref()?.no_download.clone(), - "--no-download", - "Normally new releases will be downloaded ready for updating. This disables it. Not recommended.", - - FLAG flag_no_consensus: (bool) = false, or |c: &Config| c.parity.as_ref()?.no_consensus.clone(), - "--no-consensus", - "Force the binary to run even if there are known issues regarding consensus. Not recommended.", - - FLAG flag_light: (bool) = false, or |c: &Config| c.parity.as_ref()?.light, - "--light", - "Experimental: run in light client mode. Light clients synchronize a bare minimum of data and fetch necessary data on-demand from the network. Much lower in storage, potentially higher in bandwidth. Has no effect with subcommands.", - - FLAG flag_no_hardcoded_sync: (bool) = false, or |c: &Config| c.parity.as_ref()?.no_hardcoded_sync, - "--no-hardcoded-sync", - "By default, if there is no existing database the light client will automatically jump to a block hardcoded in the chain's specifications. This disables this feature.", - - FLAG flag_force_direct: (bool) = false, or |_| None, - "--force-direct", - "Run the originally installed version of Parity, ignoring any updates that have since been installed.", - ARG arg_mode: (String) = "last", or |c: &Config| c.parity.as_ref()?.mode.clone(), "--mode=[MODE]", "Set the operating mode. MODE can be one of: last - Uses the last-used mode, active if none; active - Parity continuously syncs the chain; passive - Parity syncs initially, then sleeps and wakes regularly to resync; dark - Parity syncs only when the JSON-RPC is active; offline - Parity doesn't sync.", @@ -282,22 +251,6 @@ usage! { "--mode-alarm=[SECS]", "Specify the number of seconds before auto sleep reawake timeout occurs when mode is passive", - ARG arg_auto_update: (String) = "critical", or |c: &Config| c.parity.as_ref()?.auto_update.clone(), - "--auto-update=[SET]", - "Set a releases set to automatically update and install. SET can be one of: all - All updates in the our release track; critical - Only consensus/security updates; none - No updates will be auto-installed.", - - ARG arg_auto_update_delay: (u16) = 100u16, or |c: &Config| c.parity.as_ref()?.auto_update_delay.clone(), - "--auto-update-delay=[NUM]", - "Specify the maximum number of blocks used for randomly delaying updates.", - - ARG arg_auto_update_check_frequency: (u16) = 20u16, or |c: &Config| c.parity.as_ref()?.auto_update_check_frequency.clone(), - "--auto-update-check-frequency=[NUM]", - "Specify the number of blocks between each auto-update check.", - - ARG arg_release_track: (String) = "current", or |c: &Config| c.parity.as_ref()?.release_track.clone(), - "--release-track=[TRACK]", - "Set which release track we should use for updates. TRACK can be one of: stable - Stable releases; nightly - Nightly releases (unstable); testing - Testing releases (do not use); current - Whatever track this executable was released on.", - ARG arg_chain: (String) = "foundation", or |c: &Config| c.parity.as_ref()?.chain.clone(), "--chain=[CHAIN]", "Specify the blockchain type. CHAIN may be either a JSON chain specification file or ethereum, classic, classic-no-phoenix, poacore, xdai, volta, ewc, musicoin, ellaism, mix, callisto, ethercore, mordor, ropsten, kovan, rinkeby, goerli, kotti, poasokol, testnet, evantestcore, evancore or dev.", @@ -360,44 +313,6 @@ usage! { "--password=[FILE]...", "Provide a file containing a password for unlocking an account. Leading and trailing whitespace is trimmed.", - ["Private Transactions Options"] - FLAG flag_private_enabled: (bool) = false, or |c: &Config| c.private_tx.as_ref()?.enabled, - "--private-tx-enabled", - "Enable private transactions.", - - FLAG flag_private_state_offchain: (bool) = false, or |c: &Config| c.private_tx.as_ref()?.state_offchain, - "--private-state-offchain", - "Store private state offchain (in the local DB).", - - ARG arg_private_signer: (Option) = None, or |c: &Config| c.private_tx.as_ref()?.signer.clone(), - "--private-signer=[ACCOUNT]", - "Specify the account for signing public transaction created upon verified private transaction.", - - ARG arg_private_validators: (Option) = None, or |c: &Config| c.private_tx.as_ref()?.validators.as_ref().map(|vec| vec.join(",")), - "--private-validators=[ACCOUNTS]", - "Specify the accounts for validating private transactions. ACCOUNTS is a comma-delimited list of addresses.", - - ARG arg_private_account: (Option) = None, or |c: &Config| c.private_tx.as_ref()?.account.clone(), - "--private-account=[ACCOUNT]", - "Specify the account for signing requests to secret store.", - - ARG arg_private_sstore_url: (Option) = None, or |c: &Config| c.private_tx.as_ref()?.sstore_url.clone(), - "--private-sstore-url=[URL]", - "Specify secret store URL used for encrypting private transactions.", - - ARG arg_private_sstore_threshold: (Option) = None, or |c: &Config| c.private_tx.as_ref()?.sstore_threshold.clone(), - "--private-sstore-threshold=[NUM]", - "Specify secret store threshold used for encrypting private transactions.", - - ARG arg_private_passwords: (Option) = None, or |c: &Config| c.private_tx.as_ref()?.passwords.clone(), - "--private-passwords=[FILE]...", - "Provide a file containing passwords for unlocking accounts (signer, private account, validators).", - - ["UI Options"] - ARG arg_ui_path: (String) = "$BASE/signer", or |c: &Config| c.ui.as_ref()?.path.clone(), - "--ui-path=[PATH]", - "Specify directory where Trusted UIs tokens should be stored.", - ["Networking Options"] FLAG flag_no_warp: (bool) = false, or |c: &Config| c.network.as_ref()?.warp.clone().map(|w| !w), "--no-warp", @@ -415,10 +330,6 @@ usage! { "--no-ancient-blocks", "Disable downloading old blocks after snapshot restoration or warp sync. Not recommended.", - FLAG flag_no_serve_light: (bool) = false, or |c: &Config| c.network.as_ref()?.no_serve_light.clone(), - "--no-serve-light", - "Disable serving of light peers.", - ARG arg_warp_barrier: (Option) = None, or |c: &Config| c.network.as_ref()?.warp_barrier.clone(), "--warp-barrier=[NUM]", "When warp enabled never attempt regular sync before warping to block NUM.", @@ -514,10 +425,6 @@ usage! { "--jsonrpc-hosts=[HOSTS]", "List of allowed Host header values. This option will validate the Host header sent by the browser, it is additional security against some attack vectors. Special options: \"all\", \"none\",.", - ARG arg_jsonrpc_threads: (Option) = None, or |_| None, - "--jsonrpc-threads=[NUM]", - "DEPRECATED, DOES NOTHING", - ARG arg_jsonrpc_server_threads: (Option) = Some(4), or |c: &Config| c.rpc.as_ref()?.server_threads, "--jsonrpc-server-threads=[NUM]", "Enables multiple threads handling incoming connections for HTTP JSON-RPC server.", @@ -580,27 +487,6 @@ usage! { "--ipc-apis=[APIS]", "Specify custom API set available via JSON-RPC over IPC using a comma-delimited list of API names. Possible names are: all, safe, web3, net, eth, pubsub, personal, signer, parity, parity_pubsub, parity_accounts, parity_set, traces, rpc, secretstore. You can also disable a specific API by putting '-' in the front, example: all,-personal. 'safe' enables the following APIs: web3, net, eth, pubsub, parity, parity_pubsub, traces, rpc", - ["Light Client Options"] - ARG arg_on_demand_response_time_window: (Option) = None, or |c: &Config| c.light.as_ref()?.on_demand_response_time_window, - "--on-demand-time-window=[S]", - "Specify the maximum time to wait for a successful response", - - ARG arg_on_demand_request_backoff_start: (Option) = None, or |c: &Config| c.light.as_ref()?.on_demand_request_backoff_start, - "--on-demand-start-backoff=[S]", - "Specify light client initial backoff time for a request", - - ARG arg_on_demand_request_backoff_max: (Option) = None, or |c: &Config| c.light.as_ref()?.on_demand_request_backoff_max, - "--on-demand-end-backoff=[S]", - "Specify light client maximum backoff time for a request", - - ARG arg_on_demand_request_backoff_rounds_max: (Option) = None, or |c: &Config| c.light.as_ref()?.on_demand_request_backoff_rounds_max, - "--on-demand-max-backoff-rounds=[TIMES]", - "Specify light client maximum number of backoff iterations for a request", - - ARG arg_on_demand_request_consecutive_failures: (Option) = None, or |c: &Config| c.light.as_ref()?.on_demand_request_consecutive_failures, - "--on-demand-consecutive-failures=[TIMES]", - "Specify light client the number of failures for a request until it gets exponentially backed off", - ["Secret Store Options"] FLAG flag_no_secretstore: (bool) = false, or |c: &Config| c.secretstore.as_ref()?.disable.clone(), "--no-secretstore", @@ -918,18 +804,8 @@ usage! { "--snapshot-threads=[NUM]", "Enables multiple threads for snapshots creation.", - ["Whisper Options"] - FLAG flag_whisper: (bool) = false, or |c: &Config| c.whisper.as_ref()?.enabled, - "--whisper", - "Does nothing. Whisper has been moved to https://github.com/paritytech/whisper", - - ARG arg_whisper_pool_size: (Option) = None, or |c: &Config| c.whisper.as_ref()?.pool_size.clone(), - "--whisper-pool-size=[MB]", - "Does nothing. Whisper has been moved to https://github.com/paritytech/whisper", - ["Legacy Options"] // Options that are hidden from config, but are still unique for its functionality. - FLAG flag_geth: (bool) = false, or |_| None, "--geth", "Run in Geth-compatibility mode. Sets the IPC path to be the same as Geth's. Overrides the --ipc-path and --ipcpath options. Alters RPCs to reflect Geth bugs. Includes the personal_ RPC by default.", @@ -938,198 +814,109 @@ usage! { "--import-geth-keys", "Attempt to import keys from Geth client.", - // Options that either do nothing, or are replaced by other options. - // FLAG Removed in 1.6 or before. - - FLAG flag_warp: (bool) = false, or |_| None, - "--warp", - "Does nothing; warp sync is enabled by default. Use --no-warp to disable.", - - FLAG flag_jsonrpc: (bool) = false, or |_| None, - "-j, --jsonrpc", - "Does nothing; HTTP JSON-RPC is on by default now.", - - FLAG flag_rpc: (bool) = false, or |_| None, - "--rpc", - "Does nothing; HTTP JSON-RPC is on by default now.", - - FLAG flag_jsonrpc_off: (bool) = false, or |_| None, - "--jsonrpc-off", - "Equivalent to --no-jsonrpc.", - - FLAG flag_webapp: (bool) = false, or |_| None, - "-w, --webapp", - "Does nothing; dapps server has been removed.", - - FLAG flag_dapps_off: (bool) = false, or |_| None, - "--dapps-off", - "Equivalent to --no-dapps.", - - FLAG flag_ipcdisable: (bool) = false, or |_| None, - "--ipcdisable", - "Equivalent to --no-ipc.", - - FLAG flag_ipc_off: (bool) = false, or |_| None, - "--ipc-off", - "Equivalent to --no-ipc.", - FLAG flag_testnet: (bool) = false, or |_| None, "--testnet", "Testnet mode. Equivalent to --chain testnet. Overrides the --keys-path option.", - FLAG flag_nodiscover: (bool) = false, or |_| None, - "--nodiscover", - "Equivalent to --no-discovery.", - - // FLAG Removed in 1.7. - - FLAG flag_dapps_apis_all: (bool) = false, or |_| None, - "--dapps-apis-all", - "Dapps server is merged with HTTP JSON-RPC server. Use --jsonrpc-apis.", - - // FLAG Removed in 1.11. - - FLAG flag_public_node: (bool) = false, or |_| None, - "--public-node", - "Does nothing; Public node is removed from Parity.", - - FLAG flag_force_ui: (bool) = false, or |_| None, - "--force-ui", - "Does nothing; UI is now a separate project.", - - FLAG flag_no_ui: (bool) = false, or |_| None, - "--no-ui", - "Does nothing; UI is now a separate project.", - - FLAG flag_ui_no_validation: (bool) = false, or |_| None, - "--ui-no-validation", - "Does nothing; UI is now a separate project.", - - // FLAG Removed in 2.0. - - FLAG flag_fast_and_loose: (bool) = false, or |_| None, - "--fast-and-loose", - "Does nothing; DB WAL is always activated.", - - FLAG flag_no_dapps: (bool) = false, or |c: &Config| c.dapps.as_ref()?._legacy_disable.clone(), - "--no-dapps", - "Disable the Dapps server (e.g. status page).", - - // ARG Removed in 1.6 or before. - - ARG arg_etherbase: (Option) = None, or |_| None, - "--etherbase=[ADDRESS]", - "Equivalent to --author ADDRESS.", - - ARG arg_extradata: (Option) = None, or |_| None, - "--extradata=[STRING]", - "Equivalent to --extra-data STRING.", - - ARG arg_datadir: (Option) = None, or |_| None, - "--datadir=[PATH]", - "Equivalent to --base-path PATH.", - - ARG arg_networkid: (Option) = None, or |_| None, - "--networkid=[INDEX]", - "Equivalent to --network-id INDEX.", - - ARG arg_peers: (Option) = None, or |_| None, - "--peers=[NUM]", - "Equivalent to --min-peers NUM.", - - ARG arg_nodekey: (Option) = None, or |_| None, - "--nodekey=[KEY]", - "Equivalent to --node-key KEY.", - - ARG arg_rpcaddr: (Option) = None, or |_| None, - "--rpcaddr=[IP]", - "Equivalent to --jsonrpc-interface IP.", + // Light client functionality was deprecated in 3.0. + FLAG flag_light: (bool) = false, or |c: &Config| c.parity.as_ref()?.light, + "--light", + "Experimental: run in light client mode. Light clients synchronize a bare minimum of data and fetch necessary data on-demand from the network. Much lower in storage, potentially higher in bandwidth. Has no effect with subcommands.", - ARG arg_rpcport: (Option) = None, or |_| None, - "--rpcport=[PORT]", - "Equivalent to --jsonrpc-port PORT.", + FLAG flag_no_hardcoded_sync: (bool) = false, or |c: &Config| c.parity.as_ref()?.no_hardcoded_sync, + "--no-hardcoded-sync", + "By default, if there is no existing database the light client will automatically jump to a block hardcoded in the chain's specifications. This disables this feature.", - ARG arg_rpcapi: (Option) = None, or |_| None, - "--rpcapi=[APIS]", - "Equivalent to --jsonrpc-apis APIS.", + FLAG flag_no_serve_light: (bool) = false, or |c: &Config| c.network.as_ref()?.no_serve_light.clone(), + "--no-serve-light", + "Disable serving of light peers.", - ARG arg_rpccorsdomain: (Option) = None, or |_| None, - "--rpccorsdomain=[URL]", - "Equivalent to --jsonrpc-cors URL.", + // Private transactions have been deprecated in 3.0. + FLAG flag_private_enabled: (bool) = false, or |c: &Config| c.private_tx.as_ref()?.enabled, + "--private-tx-enabled", + "Enable private transactions.", - ARG arg_ipcapi: (Option) = None, or |_| None, - "--ipcapi=[APIS]", - "Equivalent to --ipc-apis APIS.", + FLAG flag_private_state_offchain: (bool) = false, or |c: &Config| c.private_tx.as_ref()?.state_offchain, + "--private-state-offchain", + "Store private state offchain (in the local DB).", - ARG arg_ipcpath: (Option) = None, or |_| None, - "--ipcpath=[PATH]", - "Equivalent to --ipc-path PATH.", + // Auto update was deprecated in 3.0. + FLAG flag_no_download: (bool) = false, or |c: &Config| c.parity.as_ref()?.no_download.clone(), + "--no-download", + "Normally new releases will be downloaded ready for updating. This disables it. Not recommended.", - ARG arg_gasprice: (Option) = None, or |_| None, - "--gasprice=[WEI]", - "Equivalent to --min-gas-price WEI.", + FLAG flag_no_consensus: (bool) = false, or |c: &Config| c.parity.as_ref()?.no_consensus.clone(), + "--no-consensus", + "Force the binary to run even if there are known issues regarding consensus. Not recommended.", - ARG arg_cache: (Option) = None, or |_| None, - "--cache=[MB]", - "Equivalent to --cache-size MB.", + FLAG flag_force_direct: (bool) = false, or |_| None, + "--force-direct", + "Run the originally installed version of Parity, ignoring any updates that have since been installed.", - // ARG Removed in 1.7. + // Signing has been deprecated. + ARG arg_ui_path: (String) = "$BASE/signer", or |c: &Config| c.ui.as_ref()?.path.clone(), + "--ui-path=[PATH]", + "Specify directory where Trusted UIs tokens should be stored.", - ARG arg_dapps_port: (Option) = None, or |c: &Config| c.dapps.as_ref()?._legacy_port.clone(), - "--dapps-port=[PORT]", - "Does nothing; dapps server has been removed.", + ARG arg_on_demand_response_time_window: (Option) = None, or |c: &Config| c.light.as_ref()?.on_demand_response_time_window, + "--on-demand-time-window=[S]", + "Specify the maximum time to wait for a successful response", - ARG arg_dapps_interface: (Option) = None, or |c: &Config| c.dapps.as_ref()?._legacy_interface.clone(), - "--dapps-interface=[IP]", - "Does nothing; dapps server has been removed.", + ARG arg_on_demand_request_backoff_start: (Option) = None, or |c: &Config| c.light.as_ref()?.on_demand_request_backoff_start, + "--on-demand-start-backoff=[S]", + "Specify light client initial backoff time for a request", - ARG arg_dapps_hosts: (Option) = None, or |c: &Config| c.dapps.as_ref()?._legacy_hosts.as_ref().map(|vec| vec.join(",")), - "--dapps-hosts=[HOSTS]", - "Does nothing; dapps server has been removed.", + ARG arg_on_demand_request_backoff_max: (Option) = None, or |c: &Config| c.light.as_ref()?.on_demand_request_backoff_max, + "--on-demand-end-backoff=[S]", + "Specify light client maximum backoff time for a request", - ARG arg_dapps_cors: (Option) = None, or |c: &Config| c.dapps.as_ref()?._legacy_cors.clone(), - "--dapps-cors=[URL]", - "Does nothing; dapps server has been removed.", + ARG arg_on_demand_request_backoff_rounds_max: (Option) = None, or |c: &Config| c.light.as_ref()?.on_demand_request_backoff_rounds_max, + "--on-demand-max-backoff-rounds=[TIMES]", + "Specify light client maximum number of backoff iterations for a request", - ARG arg_dapps_user: (Option) = None, or |c: &Config| c.dapps.as_ref()?._legacy_user.clone(), - "--dapps-user=[USERNAME]", - "Dapps server authentication has been removed.", + ARG arg_on_demand_request_consecutive_failures: (Option) = None, or |c: &Config| c.light.as_ref()?.on_demand_request_consecutive_failures, + "--on-demand-consecutive-failures=[TIMES]", + "Specify light client the number of failures for a request until it gets exponentially backed off", - ARG arg_dapps_pass: (Option) = None, or |c: &Config| c.dapps.as_ref()?._legacy_pass.clone(), - "--dapps-pass=[PASSWORD]", - "Dapps server authentication has been removed.", + ARG arg_private_signer: (Option) = None, or |c: &Config| c.private_tx.as_ref()?.signer.clone(), + "--private-signer=[ACCOUNT]", + "Specify the account for signing public transaction created upon verified private transaction.", - // ARG removed in 1.11. + ARG arg_private_validators: (Option) = None, or |c: &Config| c.private_tx.as_ref()?.validators.as_ref().map(|vec| vec.join(",")), + "--private-validators=[ACCOUNTS]", + "Specify the accounts for validating private transactions. ACCOUNTS is a comma-delimited list of addresses.", - ARG arg_ui_interface: (Option) = None, or |_| None, - "--ui-interface=[IP]", - "Does nothing; UI is now a separate project.", + ARG arg_private_account: (Option) = None, or |c: &Config| c.private_tx.as_ref()?.account.clone(), + "--private-account=[ACCOUNT]", + "Specify the account for signing requests to secret store.", - ARG arg_ui_hosts: (Option) = None, or |_| None, - "--ui-hosts=[HOSTS]", - "Does nothing; UI is now a separate project.", + ARG arg_private_sstore_url: (Option) = None, or |c: &Config| c.private_tx.as_ref()?.sstore_url.clone(), + "--private-sstore-url=[URL]", + "Specify secret store URL used for encrypting private transactions.", - ARG arg_ui_port: (Option) = None, or |_| None, - "--ui-port=[PORT]", - "Does nothing; UI is now a separate project.", + ARG arg_private_sstore_threshold: (Option) = None, or |c: &Config| c.private_tx.as_ref()?.sstore_threshold.clone(), + "--private-sstore-threshold=[NUM]", + "Specify secret store threshold used for encrypting private transactions.", - ARG arg_tx_queue_ban_count: (Option) = None, or |c: &Config| c.mining.as_ref()?.tx_queue_ban_count.clone(), - "--tx-queue-ban-count=[C]", - "Not supported.", + ARG arg_private_passwords: (Option) = None, or |c: &Config| c.private_tx.as_ref()?.passwords.clone(), + "--private-passwords=[FILE]...", + "Provide a file containing passwords for unlocking accounts (signer, private account, validators).", - ARG arg_tx_queue_ban_time: (Option) = None, or |c: &Config| c.mining.as_ref()?.tx_queue_ban_time.clone(), - "--tx-queue-ban-time=[SEC]", - "Not supported.", + ARG arg_auto_update: (String) = "none", or |c: &Config| c.parity.as_ref()?.auto_update.clone(), + "--auto-update=[SET]", + "Set a releases set to automatically update and install. SET can be one of: all - All updates in the our release track; critical - Only consensus/security updates; none - No updates will be auto-installed.", - // ARG removed in 2.0. + ARG arg_auto_update_delay: (u16) = 100u16, or |c: &Config| c.parity.as_ref()?.auto_update_delay.clone(), + "--auto-update-delay=[NUM]", + "Specify the maximum number of blocks used for randomly delaying updates.", - ARG arg_dapps_path: (Option) = None, or |c: &Config| c.dapps.as_ref()?._legacy_path.clone(), - "--dapps-path=[PATH]", - "Specify directory where dapps should be installed.", + ARG arg_auto_update_check_frequency: (u16) = 20u16, or |c: &Config| c.parity.as_ref()?.auto_update_check_frequency.clone(), + "--auto-update-check-frequency=[NUM]", + "Specify the number of blocks between each auto-update check.", - ARG arg_ntp_servers: (Option) = None, or |_| None, - "--ntp-servers=[HOSTS]", - "Does nothing; checking if clock is sync with NTP servers is now done on the UI.", + ARG arg_release_track: (String) = "current", or |c: &Config| c.parity.as_ref()?.release_track.clone(), + "--release-track=[TRACK]", + "Set which release track we should use for updates. TRACK can be one of: stable - Stable releases; nightly - Nightly releases (unstable); testing - Testing releases (do not use); current - Whatever track this executable was released on.", } } @@ -1143,7 +930,6 @@ struct Config { rpc: Option, websockets: Option, ipc: Option, - dapps: Option, secretstore: Option, private_tx: Option, mining: Option, @@ -1151,7 +937,6 @@ struct Config { snapshots: Option, misc: Option, stratum: Option, - whisper: Option, light: Option, } @@ -1176,9 +961,6 @@ struct Operating { no_persistent_txqueue: Option, no_hardcoded_sync: Option, sync_until: Option, - - #[serde(rename = "public_node")] - _legacy_public_node: Option, } #[derive(Default, Debug, PartialEq, Deserialize)] @@ -1209,17 +991,6 @@ struct PrivateTransactions { #[serde(deny_unknown_fields)] struct Ui { path: Option, - - #[serde(rename = "force")] - _legacy_force: Option, - #[serde(rename = "disable")] - _legacy_disable: Option, - #[serde(rename = "port")] - _legacy_port: Option, - #[serde(rename = "interface")] - _legacy_interface: Option, - #[serde(rename = "hosts")] - _legacy_hosts: Option>, } #[derive(Default, Debug, PartialEq, Deserialize)] @@ -1282,27 +1053,6 @@ struct Ipc { apis: Option>, } -#[derive(Default, Debug, PartialEq, Deserialize)] -#[serde(deny_unknown_fields)] -struct Dapps { - #[serde(rename = "disable")] - _legacy_disable: Option, - #[serde(rename = "port")] - _legacy_port: Option, - #[serde(rename = "interface")] - _legacy_interface: Option, - #[serde(rename = "hosts")] - _legacy_hosts: Option>, - #[serde(rename = "cors")] - _legacy_cors: Option, - #[serde(rename = "path")] - _legacy_path: Option, - #[serde(rename = "user")] - _legacy_user: Option, - #[serde(rename = "pass")] - _legacy_pass: Option, -} - #[derive(Default, Debug, PartialEq, Deserialize)] #[serde(deny_unknown_fields)] struct SecretStore { @@ -1410,13 +1160,6 @@ struct Misc { unsafe_expose: Option, } -#[derive(Default, Debug, PartialEq, Deserialize)] -#[serde(deny_unknown_fields)] -struct Whisper { - enabled: Option, - pool_size: Option, -} - #[derive(Default, Debug, PartialEq, Deserialize)] #[serde(deny_unknown_fields)] struct Light { @@ -1431,63 +1174,54 @@ struct Light { mod tests { use super::{ Args, ArgsError, - Config, Operating, Account, Ui, Network, Ws, Rpc, Ipc, Dapps, Mining, Footprint, - Snapshots, Misc, Whisper, SecretStore, Light, + Config, Operating, Account, Ui, Network, Ws, Rpc, Ipc, Mining, Footprint, + Snapshots, Misc, SecretStore, Light, }; use toml; use clap::{ErrorKind as ClapErrorKind}; #[test] fn should_accept_any_argument_order() { - let args = Args::parse(&["parity", "--no-warp", "account", "list"]).unwrap(); + let args = Args::parse(&["openethereum", "--no-warp", "account", "list"]).unwrap(); assert_eq!(args.flag_no_warp, true); - let args = Args::parse(&["parity", "account", "list", "--no-warp"]).unwrap(); + let args = Args::parse(&["openethereum", "account", "list", "--no-warp"]).unwrap(); assert_eq!(args.flag_no_warp, true); - let args = Args::parse(&["parity", "--chain=dev", "account", "list"]).unwrap(); + let args = Args::parse(&["openethereum", "--chain=dev", "account", "list"]).unwrap(); assert_eq!(args.arg_chain, "dev"); - let args = Args::parse(&["parity", "account", "list", "--chain=dev"]).unwrap(); + let args = Args::parse(&["openethereum", "account", "list", "--chain=dev"]).unwrap(); assert_eq!(args.arg_chain, "dev"); } - #[test] - fn should_not_crash_on_warp() { - let args = Args::parse(&["parity", "--warp"]); - assert!(args.is_ok()); - - let args = Args::parse(&["parity", "account", "list", "--warp"]); - assert!(args.is_ok()); - } - #[test] fn should_reject_invalid_values() { - let args = Args::parse(&["parity", "--cache=20"]); + let args = Args::parse(&["openethereum", "--cache=20"]); assert!(args.is_ok()); - let args = Args::parse(&["parity", "--cache=asd"]); + let args = Args::parse(&["openethereum", "--cache=asd"]); assert!(args.is_err()); } #[test] fn should_parse_args_and_flags() { - let args = Args::parse(&["parity", "--no-warp"]).unwrap(); + let args = Args::parse(&["openethereum", "--no-warp"]).unwrap(); assert_eq!(args.flag_no_warp, true); - let args = Args::parse(&["parity", "--pruning", "archive"]).unwrap(); + let args = Args::parse(&["openethereum", "--pruning", "archive"]).unwrap(); assert_eq!(args.arg_pruning, "archive"); - let args = Args::parse(&["parity", "export", "state", "--no-storage"]).unwrap(); + let args = Args::parse(&["openethereum", "export", "state", "--no-storage"]).unwrap(); assert_eq!(args.flag_export_state_no_storage, true); - let args = Args::parse(&["parity", "export", "state", "--min-balance","123"]).unwrap(); + let args = Args::parse(&["openethereum", "export", "state", "--min-balance","123"]).unwrap(); assert_eq!(args.arg_export_state_min_balance, Some("123".to_string())); } #[test] fn should_exit_gracefully_on_unknown_argument() { - let result = Args::parse(&["parity", "--please-exit-gracefully"]); + let result = Args::parse(&["openethereum", "--please-exit-gracefully"]); assert!( match result { Err(ArgsError::Clap(ref clap_error)) if clap_error.kind == ClapErrorKind::UnknownArgument => true, @@ -1498,46 +1232,46 @@ mod tests { #[test] fn should_use_subcommand_arg_default() { - let args = Args::parse(&["parity", "export", "state", "--at", "123"]).unwrap(); + let args = Args::parse(&["openethereum", "export", "state", "--at", "123"]).unwrap(); assert_eq!(args.arg_export_state_at, "123"); assert_eq!(args.arg_snapshot_at, "latest"); - let args = Args::parse(&["parity", "snapshot", "--at", "123", "file.dump"]).unwrap(); + let args = Args::parse(&["openethereum", "snapshot", "--at", "123", "file.dump"]).unwrap(); assert_eq!(args.arg_snapshot_at, "123"); assert_eq!(args.arg_export_state_at, "latest"); - let args = Args::parse(&["parity", "export", "state"]).unwrap(); + let args = Args::parse(&["openethereum", "export", "state"]).unwrap(); assert_eq!(args.arg_snapshot_at, "latest"); assert_eq!(args.arg_export_state_at, "latest"); - let args = Args::parse(&["parity", "snapshot", "file.dump"]).unwrap(); + let args = Args::parse(&["openethereum", "snapshot", "file.dump"]).unwrap(); assert_eq!(args.arg_snapshot_at, "latest"); assert_eq!(args.arg_export_state_at, "latest"); } #[test] fn should_parse_multiple_values() { - let args = Args::parse(&["parity", "account", "import", "~/1", "~/2"]).unwrap(); + let args = Args::parse(&["openethereum", "account", "import", "~/1", "~/2"]).unwrap(); assert_eq!(args.arg_account_import_path, Some(vec!["~/1".to_owned(), "~/2".to_owned()])); - let args = Args::parse(&["parity", "account", "import", "~/1,ext"]).unwrap(); + let args = Args::parse(&["openethereum", "account", "import", "~/1,ext"]).unwrap(); assert_eq!(args.arg_account_import_path, Some(vec!["~/1,ext".to_owned()])); - let args = Args::parse(&["parity", "--secretstore-nodes", "abc@127.0.0.1:3333,cde@10.10.10.10:4444"]).unwrap(); + let args = Args::parse(&["openethereum", "--secretstore-nodes", "abc@127.0.0.1:3333,cde@10.10.10.10:4444"]).unwrap(); assert_eq!(args.arg_secretstore_nodes, "abc@127.0.0.1:3333,cde@10.10.10.10:4444"); - let args = Args::parse(&["parity", "--password", "~/.safe/1", "--password", "~/.safe/2", "--ui-port", "8123"]).unwrap(); + let args = Args::parse(&["openethereum", "--password", "~/.safe/1", "--password", "~/.safe/2", "--max-peers", "200"]).unwrap(); assert_eq!(args.arg_password, vec!["~/.safe/1".to_owned(), "~/.safe/2".to_owned()]); - assert_eq!(args.arg_ui_port, Some(8123)); + assert_eq!(args.arg_max_peers, Some(200)); - let args = Args::parse(&["parity", "--password", "~/.safe/1,~/.safe/2", "--ui-port", "8123"]).unwrap(); + let args = Args::parse(&["openethereum", "--password", "~/.safe/1,~/.safe/2", "--max-peers", "200"]).unwrap(); assert_eq!(args.arg_password, vec!["~/.safe/1".to_owned(), "~/.safe/2".to_owned()]); - assert_eq!(args.arg_ui_port, Some(8123)); + assert_eq!(args.arg_max_peers, Some(200)); } #[test] fn should_parse_global_args_with_subcommand() { - let args = Args::parse(&["parity", "--chain", "dev", "account", "list"]).unwrap(); + let args = Args::parse(&["openethereum", "--chain", "dev", "account", "list"]).unwrap(); assert_eq!(args.arg_chain, "dev".to_owned()); } @@ -1550,7 +1284,7 @@ mod tests { config.parity = Some(operating); // when - let args = Args::parse_with_config(&["parity"], config).unwrap(); + let args = Args::parse_with_config(&["openethereum"], config).unwrap(); // then assert_eq!(args.arg_chain, "mordor".to_owned()); @@ -1565,7 +1299,7 @@ mod tests { config.parity = Some(operating); // when - let args = Args::parse_with_config(&["parity", "--chain", "xyz"], config).unwrap(); + let args = Args::parse_with_config(&["openethereum", "--chain", "xyz"], config).unwrap(); // then assert_eq!(args.arg_chain, "xyz".to_owned()); @@ -1579,7 +1313,7 @@ mod tests { config.footprint = Some(footprint); // when - let args = Args::parse_with_config(&["parity"], config).unwrap(); + let args = Args::parse_with_config(&["openethereum"], config).unwrap(); // then assert_eq!(args.arg_pruning_history, 128); @@ -1591,7 +1325,7 @@ mod tests { let config = toml::from_str(include_str!("./tests/config.stratum_disabled.toml")).unwrap(); // when - let args = Args::parse_with_config(&["parity"], config).unwrap(); + let args = Args::parse_with_config(&["openethereum"], config).unwrap(); // then assert_eq!(args.flag_stratum, false); @@ -1606,7 +1340,7 @@ mod tests { let config = toml::from_str(include_str!("./tests/config.stratum_missing_section.toml")).unwrap(); // when - let args = Args::parse_with_config(&["parity"], config).unwrap(); + let args = Args::parse_with_config(&["openethereum"], config).unwrap(); // then assert_eq!(args.flag_stratum, false); @@ -1621,7 +1355,7 @@ mod tests { let config = toml::from_str(include_str!("./tests/config.stratum_enabled.toml")).unwrap(); // when - let args = Args::parse_with_config(&["parity"], config).unwrap(); + let args = Args::parse_with_config(&["openethereum"], config).unwrap(); // then (with custom configurations) assert_eq!(args.flag_stratum, true); @@ -1636,7 +1370,7 @@ mod tests { let config = toml::from_str(include_str!("./tests/config.full.toml")).unwrap(); // when - let args = Args::parse_with_config(&["parity", "--stratum"], config).unwrap(); + let args = Args::parse_with_config(&["openethereum", "--stratum"], config).unwrap(); // then assert_eq!(args.flag_stratum, true); @@ -1653,7 +1387,7 @@ mod tests { let config = toml::from_str(include_str!("./tests/config.stratum_missing_field.toml")).unwrap(); // when - let args = Args::parse_with_config(&["parity"], config).unwrap(); + let args = Args::parse_with_config(&["openethereum"], config).unwrap(); // then assert_eq!(args.flag_stratum, true); @@ -1668,12 +1402,11 @@ mod tests { let config = toml::from_str(include_str!("./tests/config.full.toml")).unwrap(); // when - let args = Args::parse_with_config(&["parity", "--chain", "xyz"], config).unwrap(); + let args = Args::parse_with_config(&["openethereum", "--chain", "xyz"], config).unwrap(); // then assert_eq!(args, Args { // Commands - cmd_dapp: false, cmd_daemon: false, cmd_account: false, cmd_account_new: false, @@ -1714,7 +1447,6 @@ mod tests { arg_enable_signing_queue: false, arg_signer_sign_id: None, arg_signer_reject_id: None, - arg_dapp_path: None, arg_account_import_path: None, arg_wallet_import_path: None, arg_db_reset_num: 10, @@ -1727,7 +1459,6 @@ mod tests { arg_auto_update_delay: 200u16, arg_auto_update_check_frequency: 50u16, arg_release_track: "current".into(), - flag_public_node: false, flag_no_download: false, flag_no_consensus: false, arg_chain: "xyz".into(), @@ -1763,13 +1494,9 @@ mod tests { arg_private_sstore_url: Some("http://localhost:8082".into()), arg_private_sstore_threshold: Some(0), - flag_force_ui: false, - flag_no_ui: false, - arg_ui_port: None, - arg_ui_interface: None, - arg_ui_hosts: None, arg_ui_path: "$HOME/.parity/signer".into(), - flag_ui_no_validation: false, + flag_testnet: false, + flag_import_geth_keys: false, // -- Networking Options flag_no_warp: false, @@ -1801,7 +1528,6 @@ mod tests { arg_jsonrpc_apis: "web3,eth,net,parity,traces,rpc,secretstore".into(), arg_jsonrpc_hosts: "none".into(), arg_jsonrpc_server_threads: Some(4), - arg_jsonrpc_threads: None, // DEPRECATED, does nothing arg_jsonrpc_max_payload: None, arg_poll_lifetime: 60u32, flag_jsonrpc_allow_missing_blocks: false, @@ -1820,9 +1546,6 @@ mod tests { arg_ipc_path: "$HOME/.parity/jsonrpc.ipc".into(), arg_ipc_apis: "web3,eth,net,parity,parity_accounts,personal,traces,rpc,secretstore".into(), arg_ipc_chmod: "660".into(), - // DAPPS - arg_dapps_path: Some("$HOME/.parity/dapps".into()), - flag_no_dapps: false, // SECRETSTORE flag_no_secretstore: false, @@ -1864,7 +1587,7 @@ mod tests { arg_price_update_period: "hourly".into(), arg_gas_floor_target: "8000000".into(), arg_gas_cap: "10000000".into(), - arg_extra_data: Some("Parity".into()), + arg_extra_data: Some("OpenEthereum".into()), flag_tx_queue_no_unfamiliar_locals: false, flag_tx_queue_no_early_reject: false, arg_tx_queue_size: 8192usize, @@ -1872,8 +1595,6 @@ mod tests { arg_tx_queue_mem_limit: 4u32, arg_tx_queue_locals: Some("0xdeadbeefcafe0000000000000000000000000000".into()), arg_tx_queue_strategy: "gas_factor".into(), - arg_tx_queue_ban_count: Some(1u16), - arg_tx_queue_ban_time: Some(180u16), flag_remove_solved: false, arg_notify_work: Some("http://localhost:3001".into()), flag_refuse_service_transactions: false, @@ -1895,7 +1616,6 @@ mod tests { arg_cache_size_queue: 50u32, arg_cache_size_state: 25u32, arg_cache_size: Some(128), - flag_fast_and_loose: false, arg_db_compaction: "ssd".into(), arg_fat_db: "auto".into(), flag_scale_verifiers: true, @@ -1923,52 +1643,14 @@ mod tests { arg_on_demand_request_backoff_rounds_max: Some(100), arg_on_demand_request_consecutive_failures: Some(1), - // -- Whisper options. - flag_whisper: false, - arg_whisper_pool_size: Some(20), - - // -- Legacy Options - flag_warp: false, + // -- Legacy options. flag_geth: false, - flag_testnet: false, - flag_import_geth_keys: false, arg_warp_barrier: None, - arg_datadir: None, - arg_networkid: None, - arg_peers: None, - arg_nodekey: None, - flag_nodiscover: false, - flag_jsonrpc: false, - flag_jsonrpc_off: false, - flag_webapp: false, - flag_dapps_off: false, - flag_rpc: false, - arg_rpcaddr: None, - arg_rpcport: None, - arg_rpcapi: None, - arg_rpccorsdomain: None, - flag_ipcdisable: false, - flag_ipc_off: false, - arg_ipcapi: None, - arg_ipcpath: None, - arg_gasprice: None, - arg_etherbase: None, - arg_extradata: None, - arg_cache: None, - // Legacy-Dapps - arg_dapps_port: Some(8080), - arg_dapps_interface: Some("local".into()), - arg_dapps_hosts: Some("none".into()), - arg_dapps_cors: None, - arg_dapps_user: Some("test_user".into()), - arg_dapps_pass: Some("test_pass".into()), - flag_dapps_apis_all: false, // -- Internal Options flag_can_restart: false, // -- Miscellaneous Options - arg_ntp_servers: None, flag_version: false, arg_logging: Some("own_tx=trace".into()), arg_log_file: Some("/var/log/parity.log".into()), @@ -2021,7 +1703,6 @@ mod tests { no_hardcoded_sync: None, no_persistent_txqueue: None, sync_until: Some(123), - _legacy_public_node: None, }), account: Some(Account { enable_signing_queue: None, @@ -2033,11 +1714,6 @@ mod tests { }), ui: Some(Ui { path: None, - _legacy_force: None, - _legacy_disable: Some(true), - _legacy_port: None, - _legacy_interface: None, - _legacy_hosts: None, }), network: Some(Network { warp: Some(false), @@ -2087,16 +1763,6 @@ mod tests { chmod: None, apis: Some(vec!["rpc".into(), "eth".into()]), }), - dapps: Some(Dapps { - _legacy_disable: None, - _legacy_port: Some(8080), - _legacy_path: None, - _legacy_interface: None, - _legacy_hosts: None, - _legacy_cors: None, - _legacy_user: Some("username".into()), - _legacy_pass: Some("password".into()) - }), secretstore: Some(SecretStore { disable: None, disable_http: None, @@ -2188,17 +1854,13 @@ mod tests { ports_shift: Some(0), unsafe_expose: Some(false), }), - whisper: Some(Whisper { - enabled: Some(true), - pool_size: Some(50), - }), stratum: None, }); } #[test] fn should_not_accept_min_peers_bigger_than_max_peers() { - match Args::parse(&["parity", "--max-peers=39", "--min-peers=40"]) { + match Args::parse(&["openethereum", "--max-peers=39", "--min-peers=40"]) { Err(ArgsError::PeerConfiguration) => (), _ => assert_eq!(false, true), } @@ -2206,7 +1868,7 @@ mod tests { #[test] fn should_accept_max_peers_equal_or_bigger_than_min_peers() { - Args::parse(&["parity", "--max-peers=40", "--min-peers=40"]).unwrap(); - Args::parse(&["parity", "--max-peers=100", "--min-peers=40"]).unwrap(); + Args::parse(&["openethereum", "--max-peers=40", "--min-peers=40"]).unwrap(); + Args::parse(&["openethereum", "--max-peers=100", "--min-peers=40"]).unwrap(); } } diff --git a/parity/cli/presets/config.mining.toml b/parity/cli/presets/config.mining.toml index 6d22a0f0878..2f240ad3822 100644 --- a/parity/cli/presets/config.mining.toml +++ b/parity/cli/presets/config.mining.toml @@ -1,15 +1,11 @@ [network] -# Parity will try to maintain connection to at least 50 peers. +# OpenEthereum will try to maintain connection to at least 50 peers. min_peers = 50 -# Parity will maintain at most 100 peers. +# OpenEthereum will maintain at most 100 peers. max_peers = 100 [ipc] -# You won't be able to use IPC to interact with Parity. -disable = true - -[dapps] -# You won't be able to access any web Dapps. +# You won't be able to use IPC to interact with OpenEthereum. disable = true [mining] @@ -19,7 +15,7 @@ force_sealing = true reseal_on_txs = "all" # New pending block will be created only once per 4000 milliseconds. reseal_min_period = 4000 -# Parity will keep/relay at most 8192 transactions in queue. +# OpenEthereum will keep/relay at most 8192 transactions in queue. tx_queue_size = 8192 tx_queue_per_sender = 128 diff --git a/parity/cli/presets/config.non-standard-ports.toml b/parity/cli/presets/config.non-standard-ports.toml index 5c522d86795..de44a8b6806 100644 --- a/parity/cli/presets/config.non-standard-ports.toml +++ b/parity/cli/presets/config.non-standard-ports.toml @@ -1,5 +1,5 @@ [network] -# Parity will listen for connections on port 30305. +# OpenEthereum will listen for connections on port 30305. port = 30305 [rpc] diff --git a/parity/cli/tests/config.full.toml b/parity/cli/tests/config.full.toml index f58fab3d8ad..01d3c1fb426 100644 --- a/parity/cli/tests/config.full.toml +++ b/parity/cli/tests/config.full.toml @@ -33,13 +33,6 @@ account = "0xdeadbeefcafe0000000000000000000000000000" sstore_url = "http://localhost:8082" sstore_threshold = 0 -[ui] -force = false -disable = false -port = 8180 -interface = "127.0.0.1" -path = "$HOME/.parity/signer" - [network] port = 30303 min_peers = 25 @@ -80,16 +73,6 @@ disable = false path = "$HOME/.parity/jsonrpc.ipc" apis = ["web3", "eth", "net", "parity", "parity_accounts", "personal", "traces", "rpc", "secretstore"] -[dapps] -disable = false -port = 8080 -interface = "local" -hosts = ["none"] -path = "$HOME/.parity/dapps" -# authorization: -user = "test_user" -pass = "test_pass" - [secretstore] disable = false disable_http = false @@ -132,7 +115,7 @@ tx_gas_limit = "10000000" tx_time_limit = 100 #ms tx_queue_no_unfamiliar_locals = false tx_queue_no_early_reject = false -extra_data = "Parity" +extra_data = "OpenEthereum" remove_solved = false notify_work = ["http://localhost:3001"] refuse_service_transactions = false @@ -166,7 +149,3 @@ disable_periodic = false logging = "own_tx=trace" log_file = "/var/log/parity.log" color = true - -[whisper] -enabled = false -pool_size = 20 diff --git a/parity/cli/tests/config.toml b/parity/cli/tests/config.toml index 111f09e5c2e..8875fb8b966 100644 --- a/parity/cli/tests/config.toml +++ b/parity/cli/tests/config.toml @@ -37,11 +37,6 @@ server_threads = 13 [ipc] apis = ["rpc", "eth"] -[dapps] -port = 8080 -user = "username" -pass = "password" - [secretstore] http_port = 8082 port = 8083 @@ -84,7 +79,3 @@ log_file = "/var/log/parity.log" color = true ports_shift = 0 unsafe_expose = false - -[whisper] -enabled = true -pool_size = 50 diff --git a/parity/cli/usage.rs b/parity/cli/usage.rs index 26b5fa728d8..ec0f06d17e1 100644 --- a/parity/cli/usage.rs +++ b/parity/cli/usage.rs @@ -603,7 +603,7 @@ macro_rules! usage { } )* - let matches = App::new("Parity") + let matches = App::new("OpenEthereum") .global_setting(AppSettings::VersionlessSubcommands) .global_setting(AppSettings::DisableHelpSubcommand) .max_term_width(MAX_TERM_WIDTH) diff --git a/parity/configuration.rs b/parity/configuration.rs index d04265c535e..c271d4cf362 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -440,7 +440,7 @@ impl Configuration { } fn author(&self) -> Result { - to_address(self.args.arg_etherbase.clone().or(self.args.arg_author.clone())) + to_address(self.args.arg_author.clone()) } fn engine_signer(&self) -> Result { @@ -457,7 +457,7 @@ impl Configuration { } fn cache_config(&self) -> CacheConfig { - match self.args.arg_cache_size.or(self.args.arg_cache) { + match self.args.arg_cache_size { Some(size) => CacheConfig::new_with_total_cache_size(size), None => CacheConfig::new( self.args.arg_cache_size_db, @@ -638,9 +638,7 @@ impl Configuration { U256::from_dec_str(&format!("{:.0}", wei_per_gas)).unwrap() } - if let Some(dec) = self.args.arg_gasprice.as_ref() { - return Ok(GasPricerConfig::Fixed(to_u256(dec)?)); - } else if let Some(dec) = self.args.arg_min_gas_price { + if let Some(dec) = self.args.arg_min_gas_price { return Ok(GasPricerConfig::Fixed(U256::from(dec))); } else if self.chain()? != SpecType::Foundation { return Ok(GasPricerConfig::Fixed(U256::zero())); @@ -674,7 +672,7 @@ impl Configuration { } fn extra_data(&self) -> Result { - match self.args.arg_extradata.as_ref().or(self.args.arg_extra_data.as_ref()) { + match self.args.arg_extra_data.as_ref() { Some(x) if x.len() <= 32 => Ok(x.as_bytes().to_owned()), None => Ok(version_data()), Some(_) => Err("Extra data must be at most 32 characters".into()), @@ -749,7 +747,7 @@ impl Configuration { Some(Ok(key)) => Some(key), Some(Err(err)) => return Err(err), }; - ret.discovery_enabled = !self.args.flag_no_discovery && !self.args.flag_nodiscover; + ret.discovery_enabled = !self.args.flag_no_discovery; ret.max_peers = self.max_peers(); ret.min_peers = self.min_peers(); ret.snapshot_peers = self.snapshot_peers(); @@ -773,13 +771,11 @@ impl Configuration { } fn network_id(&self) -> Option { - self.args.arg_network_id.or(self.args.arg_networkid) + self.args.arg_network_id } fn rpc_apis(&self) -> String { - let mut apis: Vec<&str> = self.args.arg_rpcapi - .as_ref() - .unwrap_or(&self.args.arg_jsonrpc_apis) + let mut apis: Vec<&str> = self.args.arg_jsonrpc_apis .split(",") .collect(); @@ -801,8 +797,7 @@ impl Configuration { } fn rpc_cors(&self) -> Option> { - let cors = self.args.arg_rpccorsdomain.clone().unwrap_or_else(|| self.args.arg_jsonrpc_cors.to_owned()); - Self::cors(&cors) + Self::cors(&self.args.arg_jsonrpc_cors) } fn hosts(&self, hosts: &str, interface: &str) -> Option> { @@ -846,10 +841,10 @@ impl Configuration { fn ipc_config(&self) -> Result { let conf = IpcConfiguration { chmod: self.args.arg_ipc_chmod.clone(), - enabled: !(self.args.flag_ipcdisable || self.args.flag_ipc_off || self.args.flag_no_ipc), + enabled: !self.args.flag_no_ipc, socket_addr: self.ipc_path(), apis: { - let mut apis = self.args.arg_ipcapi.clone().unwrap_or(self.args.arg_ipc_apis.clone()); + let mut apis = self.args.arg_ipc_apis.clone(); if self.args.flag_geth { if !apis.is_empty() { apis.push_str(","); @@ -867,7 +862,7 @@ impl Configuration { let mut conf = HttpConfiguration::default(); conf.enabled = self.rpc_enabled(); conf.interface = self.rpc_interface(); - conf.port = self.args.arg_ports_shift + self.args.arg_rpcport.unwrap_or(self.args.arg_jsonrpc_port); + conf.port = self.args.arg_ports_shift + self.args.arg_jsonrpc_port; conf.apis = self.rpc_apis().parse()?; conf.hosts = self.rpc_hosts(); conf.cors = self.rpc_cors(); @@ -974,7 +969,7 @@ impl Configuration { fn directories(&self) -> Directories { let local_path = default_local_path(); - let base_path = self.args.arg_base_path.as_ref().or_else(|| self.args.arg_datadir.as_ref()).map_or_else(|| default_data_path(), |s| s.clone()); + let base_path = self.args.arg_base_path.as_ref().map_or_else(|| default_data_path(), |s| s.clone()); let data_path = replace_home("", &base_path); let is_using_base_path = self.args.arg_base_path.is_some(); // If base_path is set and db_path is not we default to base path subdir instead of LOCAL. @@ -1013,7 +1008,7 @@ impl Configuration { } else { parity_ipc_path( &self.directories().base, - &self.args.arg_ipcpath.clone().unwrap_or(self.args.arg_ipc_path.clone()), + &self.args.arg_ipc_path, self.args.arg_ports_shift, ) } @@ -1032,8 +1027,7 @@ impl Configuration { } fn rpc_interface(&self) -> String { - let rpc_interface = self.args.arg_rpcaddr.clone().unwrap_or(self.args.arg_jsonrpc_interface.clone()); - self.interface(&rpc_interface) + self.interface(&self.args.arg_jsonrpc_interface) } fn ws_interface(&self) -> String { @@ -1100,7 +1094,7 @@ impl Configuration { } fn rpc_enabled(&self) -> bool { - !self.args.flag_jsonrpc_off && !self.args.flag_no_jsonrpc + !self.args.flag_no_jsonrpc } fn ws_enabled(&self) -> bool { @@ -1208,14 +1202,14 @@ mod tests { #[test] fn test_command_version() { - let args = vec!["parity", "--version"]; + let args = vec!["openethereum", "--version"]; let conf = parse(&args); assert_eq!(conf.into_command().unwrap().cmd, Cmd::Version); } #[test] fn test_command_account_new() { - let args = vec!["parity", "account", "new"]; + let args = vec!["openethereum", "account", "new"]; let conf = parse(&args); assert_eq!(conf.into_command().unwrap().cmd, Cmd::Account(AccountCmd::New(NewAccount { iterations: 10240, @@ -1227,7 +1221,7 @@ mod tests { #[test] fn test_command_account_list() { - let args = vec!["parity", "account", "list"]; + let args = vec!["openethereum", "account", "list"]; let conf = parse(&args); assert_eq!(conf.into_command().unwrap().cmd, Cmd::Account( AccountCmd::List(ListAccounts { @@ -1239,7 +1233,7 @@ mod tests { #[test] fn test_command_account_import() { - let args = vec!["parity", "account", "import", "my_dir", "another_dir"]; + let args = vec!["openethereum", "account", "import", "my_dir", "another_dir"]; let conf = parse(&args); assert_eq!(conf.into_command().unwrap().cmd, Cmd::Account(AccountCmd::Import(ImportAccounts { from: vec!["my_dir".into(), "another_dir".into()], @@ -1250,7 +1244,7 @@ mod tests { #[test] fn test_command_wallet_import() { - let args = vec!["parity", "wallet", "import", "my_wallet.json", "--password", "pwd"]; + let args = vec!["openethereum", "wallet", "import", "my_wallet.json", "--password", "pwd"]; let conf = parse(&args); assert_eq!(conf.into_command().unwrap().cmd, Cmd::ImportPresaleWallet(ImportWallet { iterations: 10240, @@ -1263,7 +1257,7 @@ mod tests { #[test] fn test_command_blockchain_import() { - let args = vec!["parity", "import", "blockchain.json"]; + let args = vec!["openethereum", "import", "blockchain.json"]; let conf = parse(&args); assert_eq!(conf.into_command().unwrap().cmd, Cmd::Blockchain(BlockchainCmd::Import(ImportBlockchain { spec: Default::default(), @@ -1287,7 +1281,7 @@ mod tests { #[test] fn test_command_blockchain_export() { - let args = vec!["parity", "export", "blocks", "blockchain.json"]; + let args = vec!["openethereum", "export", "blocks", "blockchain.json"]; let conf = parse(&args); assert_eq!(conf.into_command().unwrap().cmd, Cmd::Blockchain(BlockchainCmd::Export(ExportBlockchain { spec: Default::default(), @@ -1310,7 +1304,7 @@ mod tests { #[test] fn test_command_state_export() { - let args = vec!["parity", "export", "state", "state.json"]; + let args = vec!["openethereum", "export", "state", "state.json"]; let conf = parse(&args); assert_eq!(conf.into_command().unwrap().cmd, Cmd::Blockchain(BlockchainCmd::ExportState(ExportState { spec: Default::default(), @@ -1335,7 +1329,7 @@ mod tests { #[test] fn test_command_blockchain_export_with_custom_format() { - let args = vec!["parity", "export", "blocks", "--format", "hex", "blockchain.json"]; + let args = vec!["openethereum", "export", "blocks", "--format", "hex", "blockchain.json"]; let conf = parse(&args); assert_eq!(conf.into_command().unwrap().cmd, Cmd::Blockchain(BlockchainCmd::Export(ExportBlockchain { spec: Default::default(), @@ -1358,7 +1352,7 @@ mod tests { #[test] fn test_command_signer_new_token() { - let args = vec!["parity", "signer", "new-token"]; + let args = vec!["openethereum", "signer", "new-token"]; let conf = parse(&args); let expected = Directories::default().signer; assert_eq!(conf.into_command().unwrap().cmd, Cmd::SignerToken(WsConfiguration { @@ -1380,7 +1374,7 @@ mod tests { #[test] fn test_ws_max_connections() { - let args = vec!["parity", "--ws-max-connections", "1"]; + let args = vec!["openethereum", "--ws-max-connections", "1"]; let conf = parse(&args); assert_eq!(conf.ws_config().unwrap(), WsConfiguration { @@ -1391,7 +1385,7 @@ mod tests { #[test] fn test_run_cmd() { - let args = vec!["parity"]; + let args = vec!["openethereum"]; let conf = parse(&args); let mut expected = RunCmd { allow_missing_blocks: false, @@ -1419,7 +1413,7 @@ mod tests { update_policy: UpdatePolicy { enable_downloading: true, require_consensus: true, - filter: UpdateFilter::Critical, + filter: UpdateFilter::None, track: ReleaseTrack::Unknown, path: default_hypervisor_path(), max_size: 128 * 1024 * 1024, @@ -1467,8 +1461,8 @@ mod tests { let mut mining_options = MinerOptions::default(); // when - let conf0 = parse(&["parity"]); - let conf2 = parse(&["parity", "--tx-queue-strategy", "gas_price"]); + let conf0 = parse(&["openethereum"]); + let conf2 = parse(&["openethereum", "--tx-queue-strategy", "gas_price"]); // then assert_eq!(conf0.miner_options().unwrap(), mining_options); @@ -1478,7 +1472,7 @@ mod tests { #[test] fn should_fail_on_force_reseal_and_reseal_min_period() { - let conf = parse(&["parity", "--chain", "dev", "--force-sealing", "--reseal-min-period", "0"]); + let conf = parse(&["openethereum", "--chain", "dev", "--force-sealing", "--reseal-min-period", "0"]); assert!(conf.miner_options().is_err()); } @@ -1486,8 +1480,8 @@ mod tests { #[test] fn should_parse_updater_options() { // when - let conf0 = parse(&["parity", "--auto-update", "all", "--no-consensus", "--auto-update-delay", "300"]); - let conf1 = parse(&["parity", "--auto-update=xxx"]); + let conf0 = parse(&["openethereum", "--auto-update", "all", "--no-consensus", "--auto-update-delay", "300"]); + let conf1 = parse(&["openethereum", "--auto-update=xxx"]); // then assert_eq!(conf0.update_policy().unwrap(), UpdatePolicy { @@ -1508,7 +1502,7 @@ mod tests { // given // when - let conf = parse(&["parity", "--testnet", "--identity", "testname"]); + let conf = parse(&["openethereum", "--testnet", "--identity", "testname"]); // then assert_eq!(conf.network_settings(), Ok(NetworkSettings { @@ -1523,34 +1517,21 @@ mod tests { } #[test] - fn should_parse_rpc_settings_with_geth_compatiblity() { - // given - fn assert(conf: Configuration) { - let net = conf.network_settings().unwrap(); - assert_eq!(net.rpc_enabled, true); - assert_eq!(net.rpc_interface, "0.0.0.0".to_owned()); - assert_eq!(net.rpc_port, 8000); - assert_eq!(conf.rpc_cors(), None); - assert_eq!(conf.rpc_apis(), "web3,eth".to_owned()); - } - - // when - let conf1 = parse(&["parity", "-j", - "--jsonrpc-port", "8000", - "--jsonrpc-interface", "all", - "--jsonrpc-cors", "*", - "--jsonrpc-apis", "web3,eth" - ]); - let conf2 = parse(&["parity", "--rpc", - "--rpcport", "8000", - "--rpcaddr", "all", - "--rpccorsdomain", "*", - "--rpcapi", "web3,eth" - ]); + fn should_parse_rpc_settings() { + let conf = parse(&[ + "openethereum", + "--jsonrpc-port", "8000", + "--jsonrpc-interface", "all", + "--jsonrpc-cors", "*", + "--jsonrpc-apis", "web3,eth" + ]); - // then - assert(conf1); - assert(conf2); + let net = conf.network_settings().unwrap(); + assert_eq!(net.rpc_enabled, true); + assert_eq!(net.rpc_interface, "0.0.0.0".to_owned()); + assert_eq!(net.rpc_port, 8000); + assert_eq!(conf.rpc_cors(), None); + assert_eq!(conf.rpc_apis(), "web3,eth".to_owned()); } #[test] @@ -1558,10 +1539,10 @@ mod tests { // given // when - let conf0 = parse(&["parity"]); - let conf1 = parse(&["parity", "--jsonrpc-hosts", "none"]); - let conf2 = parse(&["parity", "--jsonrpc-hosts", "all"]); - let conf3 = parse(&["parity", "--jsonrpc-hosts", "parity.io,something.io"]); + let conf0 = parse(&["openethereum"]); + let conf1 = parse(&["openethereum", "--jsonrpc-hosts", "none"]); + let conf2 = parse(&["openethereum", "--jsonrpc-hosts", "all"]); + let conf3 = parse(&["openethereum", "--jsonrpc-hosts", "parity.io,something.io"]); // then assert_eq!(conf0.rpc_hosts(), Some(Vec::new())); @@ -1573,7 +1554,7 @@ mod tests { #[test] fn ensures_sane_http_settings() { // given incorrect settings - let conf = parse(&["parity", + let conf = parse(&["openethereum", "--jsonrpc-server-threads=0", "--jsonrpc-max-payload=0", ]); @@ -1586,46 +1567,18 @@ mod tests { #[test] fn jsonrpc_threading_defaults() { - let conf = parse(&["parity"]); + let conf = parse(&["openethereum"]); let http_conf = conf.http_config().unwrap(); assert_eq!(http_conf.server_threads, 4); assert_eq!(http_conf.max_payload, 5); } - #[test] - fn should_parse_ui_configuration() { - // given - - // when - let conf0 = parse(&["parity", "--ui-path=signer"]); - let conf1 = parse(&["parity", "--ui-path=signer", "--ui-no-validation"]); - let conf2 = parse(&["parity", "--ui-path=signer", "--ui-port", "3123"]); - let conf3 = parse(&["parity", "--ui-path=signer", "--ui-interface", "test"]); - let conf4 = parse(&["parity", "--ui-path=signer", "--force-ui"]); - - // then - assert_eq!(conf0.directories().signer, "signer".to_owned()); - - assert!(conf1.ws_config().unwrap().hosts.is_some()); - assert_eq!(conf1.ws_config().unwrap().origins, Some(vec!["parity://*".into(), "chrome-extension://*".into(), "moz-extension://*".into()])); - assert_eq!(conf1.directories().signer, "signer".to_owned()); - - assert!(conf2.ws_config().unwrap().hosts.is_some()); - assert_eq!(conf2.directories().signer, "signer".to_owned()); - - assert!(conf3.ws_config().unwrap().hosts.is_some()); - assert_eq!(conf3.directories().signer, "signer".to_owned()); - - assert!(conf4.ws_config().unwrap().hosts.is_some()); - assert_eq!(conf4.directories().signer, "signer".to_owned()); - } - #[test] fn should_not_bail_on_empty_line_in_reserved_peers() { let tempdir = TempDir::new().unwrap(); let filename = tempdir.path().join("peers"); File::create(&filename).unwrap().write_all(b" \n\t\n").unwrap(); - let args = vec!["parity", "--reserved-peers", filename.to_str().unwrap()]; + let args = vec!["openethereum", "--reserved-peers", filename.to_str().unwrap()]; let conf = Configuration::parse_cli(&args).unwrap(); assert!(conf.init_reserved_nodes().is_ok()); } @@ -1635,7 +1588,7 @@ mod tests { let tempdir = TempDir::new().unwrap(); let filename = tempdir.path().join("peers_comments"); File::create(&filename).unwrap().write_all(b"# Sample comment\nenode://6f8a80d14311c39f35f516fa664deaaaa13e85b2f7493f37f6144d86991ec012937307647bd3b9a82abe2974e1407241d54947bbb39763a4cac9f77166ad92a0@172.0.0.1:30303\n").unwrap(); - let args = vec!["parity", "--reserved-peers", filename.to_str().unwrap()]; + let args = vec!["openethereum", "--reserved-peers", filename.to_str().unwrap()]; let conf = Configuration::parse_cli(&args).unwrap(); let reserved_nodes = conf.init_reserved_nodes(); assert!(reserved_nodes.is_ok()); @@ -1644,7 +1597,7 @@ mod tests { #[test] fn test_dev_preset() { - let args = vec!["parity", "--config", "dev"]; + let args = vec!["openethereum", "--config", "dev"]; let conf = Configuration::parse_cli(&args).unwrap(); match conf.into_command().unwrap().cmd { Cmd::Run(c) => { @@ -1658,7 +1611,7 @@ mod tests { #[test] fn test_mining_preset() { - let args = vec!["parity", "--config", "mining"]; + let args = vec!["openethereum", "--config", "mining"]; let conf = Configuration::parse_cli(&args).unwrap(); match conf.into_command().unwrap().cmd { Cmd::Run(c) => { @@ -1679,7 +1632,7 @@ mod tests { #[test] fn test_non_standard_ports_preset() { - let args = vec!["parity", "--config", "non-standard-ports"]; + let args = vec!["openethereum", "--config", "non-standard-ports"]; let conf = Configuration::parse_cli(&args).unwrap(); match conf.into_command().unwrap().cmd { Cmd::Run(c) => { @@ -1692,7 +1645,7 @@ mod tests { #[test] fn test_insecure_preset() { - let args = vec!["parity", "--config", "insecure"]; + let args = vec!["openethereum", "--config", "insecure"]; let conf = Configuration::parse_cli(&args).unwrap(); match conf.into_command().unwrap().cmd { Cmd::Run(c) => { @@ -1711,7 +1664,7 @@ mod tests { #[test] fn test_dev_insecure_preset() { - let args = vec!["parity", "--config", "dev-insecure"]; + let args = vec!["openethereum", "--config", "dev-insecure"]; let conf = Configuration::parse_cli(&args).unwrap(); match conf.into_command().unwrap().cmd { Cmd::Run(c) => { @@ -1733,7 +1686,7 @@ mod tests { #[test] fn test_override_preset() { - let args = vec!["parity", "--config", "mining", "--min-peers=99"]; + let args = vec!["openethereum", "--config", "mining", "--min-peers=99"]; let conf = Configuration::parse_cli(&args).unwrap(); match conf.into_command().unwrap().cmd { Cmd::Run(c) => { @@ -1745,7 +1698,7 @@ mod tests { #[test] fn test_identity_arg() { - let args = vec!["parity", "--identity", "Somebody"]; + let args = vec!["openethereum", "--identity", "Somebody"]; let conf = Configuration::parse_cli(&args).unwrap(); match conf.into_command().unwrap().cmd { Cmd::Run(c) => { @@ -1761,8 +1714,8 @@ mod tests { // given // when - let conf0 = parse(&["parity", "--ports-shift", "1", "--stratum"]); - let conf1 = parse(&["parity", "--ports-shift", "1", "--jsonrpc-port", "8544"]); + let conf0 = parse(&["openethereum", "--ports-shift", "1", "--stratum"]); + let conf1 = parse(&["openethereum", "--ports-shift", "1", "--jsonrpc-port", "8544"]); // then assert_eq!(conf0.net_addresses().unwrap().0.port(), 30304); @@ -1786,27 +1739,27 @@ mod tests { #[test] fn should_resolve_external_nat_hosts() { // Ip works - let conf = parse(&["parity", "--nat", "extip:1.1.1.1"]); + let conf = parse(&["openethereum", "--nat", "extip:1.1.1.1"]); assert_eq!(conf.net_addresses().unwrap().1.unwrap().ip().to_string(), "1.1.1.1"); assert_eq!(conf.net_addresses().unwrap().1.unwrap().port(), 30303); // Ip with port works, port is discarded - let conf = parse(&["parity", "--nat", "extip:192.168.1.1:123"]); + let conf = parse(&["openethereum", "--nat", "extip:192.168.1.1:123"]); assert_eq!(conf.net_addresses().unwrap().1.unwrap().ip().to_string(), "192.168.1.1"); assert_eq!(conf.net_addresses().unwrap().1.unwrap().port(), 30303); // Hostname works - let conf = parse(&["parity", "--nat", "extip:ethereum.org"]); + let conf = parse(&["openethereum", "--nat", "extip:ethereum.org"]); assert!(conf.net_addresses().unwrap().1.is_some()); assert_eq!(conf.net_addresses().unwrap().1.unwrap().port(), 30303); // Hostname works, garbage at the end is discarded - let conf = parse(&["parity", "--nat", "extip:ethereum.org:whatever bla bla 123"]); + let conf = parse(&["openethereum", "--nat", "extip:ethereum.org:whatever bla bla 123"]); assert!(conf.net_addresses().unwrap().1.is_some()); assert_eq!(conf.net_addresses().unwrap().1.unwrap().port(), 30303); // Garbage is error - let conf = parse(&["parity", "--nat", "extip:blabla"]); + let conf = parse(&["openethereum", "--nat", "extip:blabla"]); assert!(conf.net_addresses().is_err()); } @@ -1815,7 +1768,7 @@ mod tests { // given // when - let conf0 = parse(&["parity", "--unsafe-expose"]); + let conf0 = parse(&["openethereum", "--unsafe-expose"]); // then assert_eq!(&conf0.network_settings().unwrap().rpc_interface, "0.0.0.0"); @@ -1830,12 +1783,12 @@ mod tests { #[test] fn allow_ips() { - let all = parse(&["parity", "--allow-ips", "all"]); - let private = parse(&["parity", "--allow-ips", "private"]); - let block_custom = parse(&["parity", "--allow-ips", "-10.0.0.0/8"]); - let combo = parse(&["parity", "--allow-ips", "public 10.0.0.0/8 -1.0.0.0/8"]); - let ipv6_custom_public = parse(&["parity", "--allow-ips", "public fc00::/7"]); - let ipv6_custom_private = parse(&["parity", "--allow-ips", "private -fc00::/7"]); + let all = parse(&["openethereum", "--allow-ips", "all"]); + let private = parse(&["openethereum", "--allow-ips", "private"]); + let block_custom = parse(&["openethereum", "--allow-ips", "-10.0.0.0/8"]); + let combo = parse(&["openethereum", "--allow-ips", "public 10.0.0.0/8 -1.0.0.0/8"]); + let ipv6_custom_public = parse(&["openethereum", "--allow-ips", "public fc00::/7"]); + let ipv6_custom_private = parse(&["openethereum", "--allow-ips", "private -fc00::/7"]); assert_eq!(all.ip_filter().unwrap(), IpFilter { predefined: AllowIP::All, @@ -1878,8 +1831,8 @@ mod tests { fn should_use_correct_cache_path_if_base_is_set() { use std::path; - let std = parse(&["parity"]); - let base = parse(&["parity", "--base-path", "/test"]); + let std = parse(&["openethereum"]); + let base = parse(&["openethereum", "--base-path", "/test"]); let base_path = ::dir::default_data_path(); let local_path = ::dir::default_local_path(); @@ -1889,7 +1842,7 @@ mod tests { #[test] fn should_respect_only_max_peers_and_default() { - let args = vec!["parity", "--max-peers=50"]; + let args = vec!["openethereum", "--max-peers=50"]; let conf = Configuration::parse_cli(&args).unwrap(); match conf.into_command().unwrap().cmd { Cmd::Run(c) => { @@ -1902,7 +1855,7 @@ mod tests { #[test] fn should_respect_only_max_peers_less_than_default() { - let args = vec!["parity", "--max-peers=5"]; + let args = vec!["openethereum", "--max-peers=5"]; let conf = Configuration::parse_cli(&args).unwrap(); match conf.into_command().unwrap().cmd { Cmd::Run(c) => { @@ -1915,7 +1868,7 @@ mod tests { #[test] fn should_respect_only_min_peers_and_default() { - let args = vec!["parity", "--min-peers=5"]; + let args = vec!["openethereum", "--min-peers=5"]; let conf = Configuration::parse_cli(&args).unwrap(); match conf.into_command().unwrap().cmd { Cmd::Run(c) => { @@ -1928,7 +1881,7 @@ mod tests { #[test] fn should_respect_only_min_peers_and_greater_than_default() { - let args = vec!["parity", "--min-peers=500"]; + let args = vec!["openethereum", "--min-peers=500"]; let conf = Configuration::parse_cli(&args).unwrap(); match conf.into_command().unwrap().cmd { Cmd::Run(c) => { @@ -1944,9 +1897,9 @@ mod tests { // given // when - let conf0 = parse(&["parity"]); - let conf1 = parse(&["parity", "--secretstore-http-cors", "*"]); - let conf2 = parse(&["parity", "--secretstore-http-cors", "http://parity.io,http://something.io"]); + let conf0 = parse(&["openethereum"]); + let conf1 = parse(&["openethereum", "--secretstore-http-cors", "*"]); + let conf2 = parse(&["openethereum", "--secretstore-http-cors", "http://parity.io,http://something.io"]); // then assert_eq!(conf0.secretstore_cors(), Some(vec![])); diff --git a/parity/deprecated.rs b/parity/deprecated.rs index 5ca56d57adc..0ced38fdd2c 100644 --- a/parity/deprecated.rs +++ b/parity/deprecated.rs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Open Ethereum. If not, see . +#![allow(dead_code)] + use std::fmt; use cli::Args; @@ -34,272 +36,7 @@ impl fmt::Display for Deprecated { } } -pub fn find_deprecated(args: &Args) -> Vec { - let mut result = vec![]; - - // Removed in 1.6 or before. - - if args.flag_warp { - result.push(Deprecated::DoesNothing("--warp")); - } - - if args.flag_jsonrpc { - result.push(Deprecated::DoesNothing("--jsonrpc")); - } - - if args.flag_rpc { - result.push(Deprecated::DoesNothing("--rpc")); - } - - if args.flag_jsonrpc_off { - result.push(Deprecated::Replaced("--jsonrpc-off", "--no-jsonrpc")); - } - - if args.flag_webapp { - result.push(Deprecated::DoesNothing("--webapp")); - } - - if args.flag_dapps_off { - result.push(Deprecated::Replaced("--dapps-off", "--no-dapps")); - } - - if args.flag_ipcdisable { - result.push(Deprecated::Replaced("--ipcdisable", "--no-ipc")); - } - - if args.flag_ipc_off { - result.push(Deprecated::Replaced("--ipc-off", "--no-ipc")); - } - - if args.arg_etherbase.is_some() { - result.push(Deprecated::Replaced("--etherbase", "--author")); - } - - if args.arg_extradata.is_some() { - result.push(Deprecated::Replaced("--extradata", "--extra-data")); - } - - if args.flag_testnet { - result.push(Deprecated::Replaced("--testnet", "--chain testnet")); - } - - if args.flag_nodiscover { - result.push(Deprecated::Replaced("--nodiscover", "--no-discovery")); - } - - if args.arg_datadir.is_some() { - result.push(Deprecated::Replaced("--datadir", "--base-path")); - } - - if args.arg_networkid.is_some() { - result.push(Deprecated::Replaced("--networkid", "--network-id")); - } - - if args.arg_peers.is_some() { - result.push(Deprecated::Replaced("--peers", "--min-peers")); - } - - if args.arg_nodekey.is_some() { - result.push(Deprecated::Replaced("--nodekey", "--node-key")); - } - - if args.arg_rpcaddr.is_some() { - result.push(Deprecated::Replaced("--rpcaddr", "--jsonrpc-interface")); - } - - if args.arg_rpcport.is_some() { - result.push(Deprecated::Replaced("--rpcport", "--jsonrpc-port")); - } - - if args.arg_rpcapi.is_some() { - result.push(Deprecated::Replaced("--rpcapi", "--jsonrpc-api")); - } - - if args.arg_rpccorsdomain.is_some() { - result.push(Deprecated::Replaced("--rpccorsdomain", "--jsonrpc-cors")); - } - - if args.arg_ipcapi.is_some() { - result.push(Deprecated::Replaced("--ipcapi", "--ipc-apis")); - } - - if args.arg_ipcpath.is_some() { - result.push(Deprecated::Replaced("--ipcpath", "--ipc-path")); - } - - if args.arg_gasprice.is_some() { - result.push(Deprecated::Replaced("--gasprice", "--min-gas-price")); - } - - if args.arg_cache.is_some() { - result.push(Deprecated::Replaced("--cache", "--cache-size")); - } - - // Removed in 1.7. - - if args.arg_dapps_port.is_some() { - result.push(Deprecated::Removed("--dapps-port")); - } - - if args.arg_dapps_interface.is_some() { - result.push(Deprecated::Removed("--dapps-interface")); - } - - if args.arg_dapps_hosts.is_some() { - result.push(Deprecated::Removed("--dapps-hosts")); - } - - if args.arg_dapps_cors.is_some() { - result.push(Deprecated::Removed("--dapps-cors")); - } - - if args.arg_dapps_user.is_some() { - result.push(Deprecated::Removed("--dapps-user")); - } - - if args.arg_dapps_pass.is_some() { - result.push(Deprecated::Removed("--dapps-pass")); - } - - if args.flag_dapps_apis_all { - result.push(Deprecated::Replaced("--dapps-apis-all", "--jsonrpc-apis")); - } - - // Removed in 1.11. - - if args.flag_public_node { - result.push(Deprecated::Removed("--public-node")); - } - - if args.flag_force_ui { - result.push(Deprecated::Removed("--force-ui")); - } - - if args.flag_no_ui { - result.push(Deprecated::Removed("--no-ui")); - } - - if args.flag_ui_no_validation { - result.push(Deprecated::Removed("--ui-no-validation")); - } - - if args.arg_ui_interface.is_some() { - result.push(Deprecated::Removed("--ui-interface")); - } - - if args.arg_ui_hosts.is_some() { - result.push(Deprecated::Removed("--ui-hosts")); - } - - if args.arg_ui_port.is_some() { - result.push(Deprecated::Removed("--ui-port")); - } - - if args.arg_tx_queue_ban_count.is_some() { - result.push(Deprecated::Removed("--tx-queue-ban-count")); - } - - if args.arg_tx_queue_ban_time.is_some() { - result.push(Deprecated::Removed("--tx-queue-ban-time")); - } - - // Removed in 2.0. - - if args.flag_fast_and_loose { - result.push(Deprecated::Removed("--fast-and-loose")); - } - - if args.cmd_dapp { - result.push(Deprecated::Removed("parity dapp")); - } - - if args.arg_dapp_path.is_some() { - result.push(Deprecated::Removed("--dapp-path")); - } - - if args.flag_no_dapps { - result.push(Deprecated::Removed("--no-dapps")); - } - - if args.arg_dapps_path.is_some() { - result.push(Deprecated::Removed("--dapps-path")); - } - - if args.arg_ntp_servers.is_some() { - result.push(Deprecated::Removed("--ntp-servers")); - } - - // Removed in 2.7. - - if args.flag_whisper { - result.push(Deprecated::Removed("--whisper")); - } - - if args.arg_whisper_pool_size.is_some() { - result.push(Deprecated::Removed("--whisper-pool-size")); - } - - if args.arg_jsonrpc_threads.is_some() { - result.push(Deprecated::Removed("--jsonrpc--threads (aka processing_threads)")); - } - - result -} - -#[cfg(test)] -mod tests { - use cli::Args; - use super::{Deprecated, find_deprecated}; - - #[test] - fn test_find_deprecated() { - assert_eq!(find_deprecated(&Args::default()), vec![]); - assert_eq!(find_deprecated(&{ - let mut args = Args::default(); - args.flag_warp = true; - args.flag_jsonrpc = true; - args.flag_rpc = true; - args.flag_jsonrpc_off = true; - args.flag_webapp = true; - args.flag_dapps_off = true; - args.flag_ipcdisable = true; - args.flag_ipc_off = true; - args.arg_etherbase = Some(Default::default()); - args.arg_extradata = Some(Default::default()); - args.arg_dapps_port = Some(Default::default()); - args.arg_dapps_interface = Some(Default::default()); - args.arg_dapps_hosts = Some(Default::default()); - args.arg_dapps_cors = Some(Default::default()); - args.arg_dapps_user = Some(Default::default()); - args.arg_dapps_pass = Some(Default::default()); - args.flag_dapps_apis_all = true; - args.flag_fast_and_loose = true; - args.arg_ntp_servers = Some(Default::default()); - args.flag_whisper = true; - args.arg_whisper_pool_size = Some(Default::default()); - args - }), vec![ - Deprecated::DoesNothing("--warp"), - Deprecated::DoesNothing("--jsonrpc"), - Deprecated::DoesNothing("--rpc"), - Deprecated::Replaced("--jsonrpc-off", "--no-jsonrpc"), - Deprecated::DoesNothing("--webapp"), - Deprecated::Replaced("--dapps-off", "--no-dapps"), - Deprecated::Replaced("--ipcdisable", "--no-ipc"), - Deprecated::Replaced("--ipc-off", "--no-ipc"), - Deprecated::Replaced("--etherbase", "--author"), - Deprecated::Replaced("--extradata", "--extra-data"), - Deprecated::Removed("--dapps-port"), - Deprecated::Removed("--dapps-interface"), - Deprecated::Removed("--dapps-hosts"), - Deprecated::Removed("--dapps-cors"), - Deprecated::Removed("--dapps-user"), - Deprecated::Removed("--dapps-pass"), - Deprecated::Replaced("--dapps-apis-all", "--jsonrpc-apis"), - Deprecated::Removed("--fast-and-loose"), - Deprecated::Removed("--ntp-servers"), - Deprecated::Removed("--whisper"), - Deprecated::Removed("--whisper-pool-size"), - ]); - } +/// Removed flags will go here. +pub fn find_deprecated(_args: &Args) -> Vec { + Vec::new() } diff --git a/parity/main.rs b/parity/main.rs index 0c2b98d02ef..ded00734fe0 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -49,7 +49,7 @@ use parity_daemonize::AsHandle; use parking_lot::{Condvar, Mutex}; const PLEASE_RESTART_EXIT_CODE: i32 = 69; -const PARITY_EXECUTABLE_NAME: &str = "parity"; +const CLIENT_EXECUTABLE_NAME: &str = "openethereum"; #[derive(Debug)] enum Error { @@ -392,7 +392,7 @@ fn main() { let same_name = exe_path .as_ref() .map_or(false, |p| { - p.file_stem().map_or(false, |n| n == PARITY_EXECUTABLE_NAME) + p.file_stem().map_or(false, |n| n == CLIENT_EXECUTABLE_NAME) }); trace_main!("Starting up {} (force-direct: {}, development: {}, same-name: {})",