Merge branch 'master' into ui-2
This commit is contained in:
commit
715fb688d3
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2009,7 +2009,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "parity-ui-precompiled"
|
name = "parity-ui-precompiled"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
source = "git+https://github.com/paritytech/js-precompiled.git#fef524b2c679407d32a9ddef3af5dced97cdd3d0"
|
source = "git+https://github.com/paritytech/js-precompiled.git#9394d746f859365082ae375119ee70a0a18956a5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "parity.js",
|
"name": "parity.js",
|
||||||
"version": "1.8.5",
|
"version": "1.8.6",
|
||||||
"main": "release/index.js",
|
"main": "release/index.js",
|
||||||
"jsnext:main": "src/index.js",
|
"jsnext:main": "src/index.js",
|
||||||
"author": "Parity Team <admin@parity.io>",
|
"author": "Parity Team <admin@parity.io>",
|
||||||
|
@ -145,34 +145,37 @@ export function updateTokensFilter (_addresses, _tokens, options = {}) {
|
|||||||
promises.push(api.eth.uninstallFilter(tokensFilter.filterToId));
|
promises.push(api.eth.uninstallFilter(tokensFilter.filterToId));
|
||||||
}
|
}
|
||||||
|
|
||||||
const promise = Promise.all(promises);
|
Promise
|
||||||
|
.all([
|
||||||
|
api.eth.blockNumber()
|
||||||
|
].concat(promises))
|
||||||
|
.then(([ block ]) => {
|
||||||
|
const topicsFrom = [ TRANSFER_SIGNATURE, addresses, null ];
|
||||||
|
const topicsTo = [ TRANSFER_SIGNATURE, null, addresses ];
|
||||||
|
|
||||||
const topicsFrom = [ TRANSFER_SIGNATURE, addresses, null ];
|
const filterOptions = {
|
||||||
const topicsTo = [ TRANSFER_SIGNATURE, null, addresses ];
|
fromBlock: block,
|
||||||
|
toBlock: 'pending',
|
||||||
|
address: tokenAddresses
|
||||||
|
};
|
||||||
|
|
||||||
const filterOptions = {
|
const optionsFrom = {
|
||||||
fromBlock: 0,
|
...filterOptions,
|
||||||
toBlock: 'pending',
|
topics: topicsFrom
|
||||||
address: tokenAddresses
|
};
|
||||||
};
|
|
||||||
|
|
||||||
const optionsFrom = {
|
const optionsTo = {
|
||||||
...filterOptions,
|
...filterOptions,
|
||||||
topics: topicsFrom
|
topics: topicsTo
|
||||||
};
|
};
|
||||||
|
|
||||||
const optionsTo = {
|
const newFilters = Promise.all([
|
||||||
...filterOptions,
|
api.eth.newFilter(optionsFrom),
|
||||||
topics: topicsTo
|
api.eth.newFilter(optionsTo)
|
||||||
};
|
]);
|
||||||
|
|
||||||
const newFilters = Promise.all([
|
return newFilters;
|
||||||
api.eth.newFilter(optionsFrom),
|
})
|
||||||
api.eth.newFilter(optionsTo)
|
|
||||||
]);
|
|
||||||
|
|
||||||
promise
|
|
||||||
.then(() => newFilters)
|
|
||||||
.then(([ filterFromId, filterToId ]) => {
|
.then(([ filterFromId, filterToId ]) => {
|
||||||
const nextTokensFilter = {
|
const nextTokensFilter = {
|
||||||
filterFromId, filterToId,
|
filterFromId, filterToId,
|
||||||
|
@ -339,10 +339,12 @@ export default class TypedInput extends Component {
|
|||||||
|
|
||||||
renderBoolean () {
|
renderBoolean () {
|
||||||
const { allowCopy, className, label, error, hint, readOnly } = this.props;
|
const { allowCopy, className, label, error, hint, readOnly } = this.props;
|
||||||
const value = this.getValue();
|
const value = this.getValue()
|
||||||
|
? 'true'
|
||||||
|
: 'false';
|
||||||
|
|
||||||
if (readOnly) {
|
if (readOnly) {
|
||||||
return this.renderDefault();
|
return this.renderDefault(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -353,11 +355,7 @@ export default class TypedInput extends Component {
|
|||||||
hint={ hint }
|
hint={ hint }
|
||||||
label={ label }
|
label={ label }
|
||||||
onChange={ this.onChangeBool }
|
onChange={ this.onChangeBool }
|
||||||
value={
|
value={ value }
|
||||||
value
|
|
||||||
? 'true'
|
|
||||||
: 'false'
|
|
||||||
}
|
|
||||||
options={
|
options={
|
||||||
['false', 'true'].map((bool) => {
|
['false', 'true'].map((bool) => {
|
||||||
return {
|
return {
|
||||||
|
@ -101,6 +101,7 @@ reseal_min_period = 4000
|
|||||||
reseal_max_period = 60000
|
reseal_max_period = 60000
|
||||||
work_queue_size = 20
|
work_queue_size = 20
|
||||||
relay_set = "cheap"
|
relay_set = "cheap"
|
||||||
|
min_gas_price = 0
|
||||||
usd_per_tx = "0.0025"
|
usd_per_tx = "0.0025"
|
||||||
usd_per_eth = "auto"
|
usd_per_eth = "auto"
|
||||||
price_update_period = "hourly"
|
price_update_period = "hourly"
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod usage;
|
mod usage;
|
||||||
|
mod presets;
|
||||||
use dir;
|
use dir;
|
||||||
|
|
||||||
usage! {
|
usage! {
|
||||||
@ -266,6 +267,8 @@ usage! {
|
|||||||
or |c: &Config| otry!(c.mining).tx_time_limit.clone().map(Some),
|
or |c: &Config| otry!(c.mining).tx_time_limit.clone().map(Some),
|
||||||
flag_relay_set: String = "cheap",
|
flag_relay_set: String = "cheap",
|
||||||
or |c: &Config| otry!(c.mining).relay_set.clone(),
|
or |c: &Config| otry!(c.mining).relay_set.clone(),
|
||||||
|
flag_min_gas_price: Option<u64> = None,
|
||||||
|
or |c: &Config| otry!(c.mining).min_gas_price.clone().map(Some),
|
||||||
flag_usd_per_tx: String = "0.0025",
|
flag_usd_per_tx: String = "0.0025",
|
||||||
or |c: &Config| otry!(c.mining).usd_per_tx.clone(),
|
or |c: &Config| otry!(c.mining).usd_per_tx.clone(),
|
||||||
flag_usd_per_eth: String = "auto",
|
flag_usd_per_eth: String = "auto",
|
||||||
@ -548,6 +551,7 @@ struct Mining {
|
|||||||
tx_gas_limit: Option<String>,
|
tx_gas_limit: Option<String>,
|
||||||
tx_time_limit: Option<u64>,
|
tx_time_limit: Option<u64>,
|
||||||
relay_set: Option<String>,
|
relay_set: Option<String>,
|
||||||
|
min_gas_price: Option<u64>,
|
||||||
usd_per_tx: Option<String>,
|
usd_per_tx: Option<String>,
|
||||||
usd_per_eth: Option<String>,
|
usd_per_eth: Option<String>,
|
||||||
price_update_period: Option<String>,
|
price_update_period: Option<String>,
|
||||||
@ -819,6 +823,7 @@ mod tests {
|
|||||||
flag_tx_gas_limit: Some("6283184".into()),
|
flag_tx_gas_limit: Some("6283184".into()),
|
||||||
flag_tx_time_limit: Some(100u64),
|
flag_tx_time_limit: Some(100u64),
|
||||||
flag_relay_set: "cheap".into(),
|
flag_relay_set: "cheap".into(),
|
||||||
|
flag_min_gas_price: Some(0u64),
|
||||||
flag_usd_per_tx: "0.0025".into(),
|
flag_usd_per_tx: "0.0025".into(),
|
||||||
flag_usd_per_eth: "auto".into(),
|
flag_usd_per_eth: "auto".into(),
|
||||||
flag_price_update_period: "hourly".into(),
|
flag_price_update_period: "hourly".into(),
|
||||||
@ -1051,6 +1056,7 @@ mod tests {
|
|||||||
reseal_max_period: Some(60000),
|
reseal_max_period: Some(60000),
|
||||||
work_queue_size: None,
|
work_queue_size: None,
|
||||||
relay_set: None,
|
relay_set: None,
|
||||||
|
min_gas_price: None,
|
||||||
usd_per_tx: None,
|
usd_per_tx: None,
|
||||||
usd_per_eth: None,
|
usd_per_eth: None,
|
||||||
price_update_period: Some("hourly".into()),
|
price_update_period: Some("hourly".into()),
|
||||||
|
16
parity/cli/presets/config.dev-insecure.toml
Normal file
16
parity/cli/presets/config.dev-insecure.toml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[parity]
|
||||||
|
no_consensus = true
|
||||||
|
chain = "dev"
|
||||||
|
|
||||||
|
[mining]
|
||||||
|
reseal_min_period = 0
|
||||||
|
min_gas_price = 0
|
||||||
|
|
||||||
|
[rpc]
|
||||||
|
interface = "all"
|
||||||
|
apis = ["all"]
|
||||||
|
hosts = ["all"]
|
||||||
|
|
||||||
|
[ipfs]
|
||||||
|
enable = false # this is the default
|
||||||
|
hosts = ["all"]
|
6
parity/cli/presets/config.dev.toml
Normal file
6
parity/cli/presets/config.dev.toml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[parity]
|
||||||
|
chain = "dev"
|
||||||
|
|
||||||
|
[mining]
|
||||||
|
reseal_min_period = 0
|
||||||
|
min_gas_price = 0
|
11
parity/cli/presets/config.insecure.toml
Normal file
11
parity/cli/presets/config.insecure.toml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[parity]
|
||||||
|
no_consensus = true
|
||||||
|
|
||||||
|
[rpc]
|
||||||
|
interface = "all"
|
||||||
|
apis = ["all"]
|
||||||
|
hosts = ["all"]
|
||||||
|
|
||||||
|
[ipfs]
|
||||||
|
enable = false # this is the default
|
||||||
|
hosts = ["all"]
|
31
parity/cli/presets/config.mining.toml
Normal file
31
parity/cli/presets/config.mining.toml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
[network]
|
||||||
|
# Parity will try to maintain connection to at least 50 peers.
|
||||||
|
min_peers = 50
|
||||||
|
# Parity 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.
|
||||||
|
disable = true
|
||||||
|
|
||||||
|
[mining]
|
||||||
|
# Prepare a block to seal even when there are no miners connected.
|
||||||
|
force_sealing = true
|
||||||
|
# New pending block will be created for all transactions (both local and external).
|
||||||
|
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 2048 transactions in queue.
|
||||||
|
tx_queue_size = 2048
|
||||||
|
|
||||||
|
[footprint]
|
||||||
|
# If defined will never use more then 256MB for all caches. (Overrides other cache settings).
|
||||||
|
cache_size = 256
|
||||||
|
|
||||||
|
[misc]
|
||||||
|
# Logging pattern (`<module>=<level>`, e.g. `own_tx=trace`).
|
||||||
|
logging = "miner=trace,own_tx=trace"
|
7
parity/cli/presets/config.non-standard-ports.toml
Normal file
7
parity/cli/presets/config.non-standard-ports.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[network]
|
||||||
|
# Parity will listen for connections on port 30305.
|
||||||
|
port = 30305
|
||||||
|
|
||||||
|
[rpc]
|
||||||
|
# JSON-RPC over HTTP will be accessible on port 8645.
|
||||||
|
port = 8645
|
28
parity/cli/presets/mod.rs
Normal file
28
parity/cli/presets/mod.rs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
||||||
|
// 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/>.
|
||||||
|
|
||||||
|
use std::io::{Error, ErrorKind};
|
||||||
|
|
||||||
|
pub fn preset_config_string(arg: &str) -> Result<&'static str, Error> {
|
||||||
|
match arg.to_lowercase().as_ref() {
|
||||||
|
"dev" => Ok(include_str!("./config.dev.toml")),
|
||||||
|
"mining" => Ok(include_str!("./config.mining.toml")),
|
||||||
|
"non-standard-ports" => Ok(include_str!("./config.non-standard-ports.toml")),
|
||||||
|
"insecure" => Ok(include_str!("./config.insecure.toml")),
|
||||||
|
"dev-insecure" => Ok(include_str!("./config.dev-insecure.toml")),
|
||||||
|
_ => Err(Error::new(ErrorKind::InvalidInput, "Config doesn't match any presets [dev, mining, non-standard-ports, insecure, dev-insecure]"))
|
||||||
|
}
|
||||||
|
}
|
@ -151,23 +151,24 @@ macro_rules! usage {
|
|||||||
|
|
||||||
let config_file = raw_args.flag_config.clone().unwrap_or_else(|| raw_args.clone().into_args(Config::default()).flag_config);
|
let config_file = raw_args.flag_config.clone().unwrap_or_else(|| raw_args.clone().into_args(Config::default()).flag_config);
|
||||||
let config_file = replace_home(&::dir::default_data_path(), &config_file);
|
let config_file = replace_home(&::dir::default_data_path(), &config_file);
|
||||||
let config = match (fs::File::open(&config_file), raw_args.flag_config.is_some()) {
|
match (fs::File::open(&config_file), raw_args.flag_config.clone()) {
|
||||||
// Load config file
|
// Load config file
|
||||||
(Ok(mut file), _) => {
|
(Ok(mut file), _) => {
|
||||||
println_stderr!("Loading config file from {}", &config_file);
|
println_stderr!("Loading config file from {}", &config_file);
|
||||||
let mut config = String::new();
|
let mut config = String::new();
|
||||||
file.read_to_string(&mut config).map_err(|e| ArgsError::Config(config_file, e))?;
|
file.read_to_string(&mut config).map_err(|e| ArgsError::Config(config_file, e))?;
|
||||||
Self::parse_config(&config)?
|
Ok(raw_args.into_args(Self::parse_config(&config)?))
|
||||||
},
|
},
|
||||||
// Don't display error in case default config cannot be loaded.
|
// Don't display error in case default config cannot be loaded.
|
||||||
(Err(_), false) => Config::default(),
|
(Err(_), None) => Ok(raw_args.into_args(Config::default())),
|
||||||
// Config set from CLI (fail with error)
|
// Config set from CLI (fail with error)
|
||||||
(Err(e), true) => {
|
(Err(_), Some(ref config_arg)) => {
|
||||||
return Err(ArgsError::Config(config_file, e));
|
match presets::preset_config_string(config_arg) {
|
||||||
|
Ok(s) => Ok(raw_args.into_args(Self::parse_config(&s)?)),
|
||||||
|
Err(e) => Err(ArgsError::Config(config_file, e))
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
|
|
||||||
Ok(raw_args.into_args(config))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -77,8 +77,10 @@ Operating Options:
|
|||||||
subcommands (default: {flag_light}).
|
subcommands (default: {flag_light}).
|
||||||
|
|
||||||
Convenience Options:
|
Convenience Options:
|
||||||
-c --config CONFIG Specify a filename containing a configuration file.
|
-c --config CONFIG Specify a configuration. CONFIG may be either a
|
||||||
(default: {flag_config})
|
configuration file or a preset: dev, insecure, dev-insecure,
|
||||||
|
mining, or non-standard-ports.
|
||||||
|
(default: {flag_config}).
|
||||||
--ports-shift SHIFT Add SHIFT to all port numbers Parity is listening on.
|
--ports-shift SHIFT Add SHIFT to all port numbers Parity is listening on.
|
||||||
Includes network port and all servers (RPC, WebSockets, UI, IPFS, SecretStore).
|
Includes network port and all servers (RPC, WebSockets, UI, IPFS, SecretStore).
|
||||||
(default: {flag_ports_shift})
|
(default: {flag_ports_shift})
|
||||||
@ -294,6 +296,10 @@ Sealing/Mining Options:
|
|||||||
means we relay nothing if not mining);
|
means we relay nothing if not mining);
|
||||||
lenient - Same as strict when mining, and cheap
|
lenient - Same as strict when mining, and cheap
|
||||||
when not (default: {flag_relay_set}).
|
when not (default: {flag_relay_set}).
|
||||||
|
--min-gas-price WEI Minimum amount of Wei per GAS to be paid for a
|
||||||
|
transaction to be accepted for mining. Overrides
|
||||||
|
--basic-tx-usd.
|
||||||
|
(default: {flag_min_gas_price:?})
|
||||||
--usd-per-tx USD Amount of USD to be paid for a basic transaction
|
--usd-per-tx USD Amount of USD to be paid for a basic transaction
|
||||||
(default: {flag_usd_per_tx}). The minimum gas price is set
|
(default: {flag_usd_per_tx}). The minimum gas price is set
|
||||||
accordingly.
|
accordingly.
|
||||||
@ -464,9 +470,7 @@ Legacy Options:
|
|||||||
--ipc-off Equivalent to --no-ipc.
|
--ipc-off Equivalent to --no-ipc.
|
||||||
--ipcapi APIS Equivalent to --ipc-apis APIS.
|
--ipcapi APIS Equivalent to --ipc-apis APIS.
|
||||||
--ipcpath PATH Equivalent to --ipc-path PATH.
|
--ipcpath PATH Equivalent to --ipc-path PATH.
|
||||||
--gasprice WEI Minimum amount of Wei per GAS to be paid for a
|
--gasprice WEI Equivalent to --min-gas-price WEI.
|
||||||
transaction to be accepted for mining. Overrides
|
|
||||||
--basic-tx-usd.
|
|
||||||
--etherbase ADDRESS Equivalent to --author ADDRESS.
|
--etherbase ADDRESS Equivalent to --author ADDRESS.
|
||||||
--extradata STRING Equivalent to --extra-data STRING.
|
--extradata STRING Equivalent to --extra-data STRING.
|
||||||
--cache MB Equivalent to --cache-size MB.
|
--cache MB Equivalent to --cache-size MB.
|
||||||
|
@ -36,7 +36,7 @@ use parity_rpc::NetworkSettings;
|
|||||||
use cache::CacheConfig;
|
use cache::CacheConfig;
|
||||||
use helpers::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_price, replace_home, replace_home_and_local,
|
use helpers::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_price, replace_home, replace_home_and_local,
|
||||||
geth_ipc_path, parity_ipc_path, to_bootnodes, to_addresses, to_address, to_gas_limit, to_queue_strategy};
|
geth_ipc_path, parity_ipc_path, to_bootnodes, to_addresses, to_address, to_gas_limit, to_queue_strategy};
|
||||||
use params::{SpecType, ResealPolicy, AccountsConfig, GasPricerConfig, MinerExtras, Pruning, Switch};
|
use params::{ResealPolicy, AccountsConfig, GasPricerConfig, MinerExtras, Pruning, Switch};
|
||||||
use ethcore_logger::Config as LogConfig;
|
use ethcore_logger::Config as LogConfig;
|
||||||
use dir::{self, Directories, default_hypervisor_path, default_local_path, default_data_path};
|
use dir::{self, Directories, default_hypervisor_path, default_local_path, default_data_path};
|
||||||
use dapps::Configuration as DappsConfiguration;
|
use dapps::Configuration as DappsConfiguration;
|
||||||
@ -331,13 +331,6 @@ impl Configuration {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let verifier_settings = self.verifier_settings();
|
let verifier_settings = self.verifier_settings();
|
||||||
|
|
||||||
// Special presets are present for the dev chain.
|
|
||||||
let (gas_pricer_conf, miner_options) = match spec {
|
|
||||||
SpecType::Dev => (GasPricerConfig::Fixed(0.into()), self.miner_options(0)?),
|
|
||||||
_ => (self.gas_pricer_config()?, self.miner_options(self.args.flag_reseal_min_period)?),
|
|
||||||
};
|
|
||||||
|
|
||||||
let whisper_config = self.whisper_config();
|
let whisper_config = self.whisper_config();
|
||||||
|
|
||||||
let run_cmd = RunCmd {
|
let run_cmd = RunCmd {
|
||||||
@ -349,14 +342,14 @@ impl Configuration {
|
|||||||
pruning_memory: self.args.flag_pruning_memory,
|
pruning_memory: self.args.flag_pruning_memory,
|
||||||
daemon: daemon,
|
daemon: daemon,
|
||||||
logger_config: logger_config.clone(),
|
logger_config: logger_config.clone(),
|
||||||
miner_options: miner_options,
|
miner_options: self.miner_options(self.args.flag_reseal_min_period)?,
|
||||||
ws_conf: ws_conf,
|
ws_conf: ws_conf,
|
||||||
http_conf: http_conf,
|
http_conf: http_conf,
|
||||||
ipc_conf: ipc_conf,
|
ipc_conf: ipc_conf,
|
||||||
net_conf: net_conf,
|
net_conf: net_conf,
|
||||||
network_id: network_id,
|
network_id: network_id,
|
||||||
acc_conf: self.accounts_config()?,
|
acc_conf: self.accounts_config()?,
|
||||||
gas_pricer_conf: gas_pricer_conf,
|
gas_pricer_conf: self.gas_pricer_config()?,
|
||||||
miner_extras: self.miner_extras()?,
|
miner_extras: self.miner_extras()?,
|
||||||
stratum: self.stratum_options()?,
|
stratum: self.stratum_options()?,
|
||||||
update_policy: update_policy,
|
update_policy: update_policy,
|
||||||
@ -630,8 +623,10 @@ impl Configuration {
|
|||||||
U256::from_dec_str(&format!("{:.0}", wei_per_gas)).unwrap()
|
U256::from_dec_str(&format!("{:.0}", wei_per_gas)).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(d) = self.args.flag_gasprice.as_ref() {
|
if let Some(dec) = self.args.flag_gasprice.as_ref() {
|
||||||
return Ok(GasPricerConfig::Fixed(to_u256(d)?));
|
return Ok(GasPricerConfig::Fixed(to_u256(dec)?));
|
||||||
|
} else if let Some(dec) = self.args.flag_min_gas_price {
|
||||||
|
return Ok(GasPricerConfig::Fixed(U256::from(dec)));
|
||||||
}
|
}
|
||||||
|
|
||||||
let usd_per_tx = to_price(&self.args.flag_usd_per_tx)?;
|
let usd_per_tx = to_price(&self.args.flag_usd_per_tx)?;
|
||||||
@ -1599,11 +1594,12 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_dev_chain() {
|
fn test_dev_preset() {
|
||||||
let args = vec!["parity", "--chain", "dev"];
|
let args = vec!["parity", "--config", "dev"];
|
||||||
let conf = parse(&args);
|
let conf = Configuration::parse(&args, None).unwrap();
|
||||||
match conf.into_command().unwrap().cmd {
|
match conf.into_command().unwrap().cmd {
|
||||||
Cmd::Run(c) => {
|
Cmd::Run(c) => {
|
||||||
|
assert_eq!(c.net_settings.chain, "dev");
|
||||||
assert_eq!(c.gas_pricer_conf, GasPricerConfig::Fixed(0.into()));
|
assert_eq!(c.gas_pricer_conf, GasPricerConfig::Fixed(0.into()));
|
||||||
assert_eq!(c.miner_options.reseal_min_period, Duration::from_millis(0));
|
assert_eq!(c.miner_options.reseal_min_period, Duration::from_millis(0));
|
||||||
},
|
},
|
||||||
@ -1611,6 +1607,96 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_mining_preset() {
|
||||||
|
let args = vec!["parity", "--config", "mining"];
|
||||||
|
let conf = Configuration::parse(&args, None).unwrap();
|
||||||
|
match conf.into_command().unwrap().cmd {
|
||||||
|
Cmd::Run(c) => {
|
||||||
|
assert_eq!(c.net_conf.min_peers, 50);
|
||||||
|
assert_eq!(c.net_conf.max_peers, 100);
|
||||||
|
assert_eq!(c.ipc_conf.enabled, false);
|
||||||
|
assert_eq!(c.dapps_conf.enabled, false);
|
||||||
|
assert_eq!(c.miner_options.force_sealing, true);
|
||||||
|
assert_eq!(c.miner_options.reseal_on_external_tx, true);
|
||||||
|
assert_eq!(c.miner_options.reseal_on_own_tx, true);
|
||||||
|
assert_eq!(c.miner_options.reseal_min_period, Duration::from_millis(4000));
|
||||||
|
assert_eq!(c.miner_options.tx_queue_size, 2048);
|
||||||
|
assert_eq!(c.cache_config, CacheConfig::new_with_total_cache_size(256));
|
||||||
|
assert_eq!(c.logger_config.mode.unwrap(), "miner=trace,own_tx=trace");
|
||||||
|
},
|
||||||
|
_ => panic!("Should be Cmd::Run"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_non_standard_ports_preset() {
|
||||||
|
let args = vec!["parity", "--config", "non-standard-ports"];
|
||||||
|
let conf = Configuration::parse(&args, None).unwrap();
|
||||||
|
match conf.into_command().unwrap().cmd {
|
||||||
|
Cmd::Run(c) => {
|
||||||
|
assert_eq!(c.net_settings.network_port, 30305);
|
||||||
|
assert_eq!(c.net_settings.rpc_port, 8645);
|
||||||
|
},
|
||||||
|
_ => panic!("Should be Cmd::Run"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_insecure_preset() {
|
||||||
|
let args = vec!["parity", "--config", "insecure"];
|
||||||
|
let conf = Configuration::parse(&args, None).unwrap();
|
||||||
|
match conf.into_command().unwrap().cmd {
|
||||||
|
Cmd::Run(c) => {
|
||||||
|
assert_eq!(c.update_policy.require_consensus, false);
|
||||||
|
assert_eq!(c.net_settings.rpc_interface, "0.0.0.0");
|
||||||
|
match c.http_conf.apis {
|
||||||
|
ApiSet::List(set) => assert_eq!(set, ApiSet::All.list_apis()),
|
||||||
|
_ => panic!("Incorrect rpc apis"),
|
||||||
|
}
|
||||||
|
// "web3,eth,net,personal,parity,parity_set,traces,rpc,parity_accounts");
|
||||||
|
assert_eq!(c.http_conf.hosts, None);
|
||||||
|
assert_eq!(c.ipfs_conf.hosts, None);
|
||||||
|
},
|
||||||
|
_ => panic!("Should be Cmd::Run"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dev_insecure_preset() {
|
||||||
|
let args = vec!["parity", "--config", "dev-insecure"];
|
||||||
|
let conf = Configuration::parse(&args, None).unwrap();
|
||||||
|
match conf.into_command().unwrap().cmd {
|
||||||
|
Cmd::Run(c) => {
|
||||||
|
assert_eq!(c.net_settings.chain, "dev");
|
||||||
|
assert_eq!(c.gas_pricer_conf, GasPricerConfig::Fixed(0.into()));
|
||||||
|
assert_eq!(c.miner_options.reseal_min_period, Duration::from_millis(0));
|
||||||
|
assert_eq!(c.update_policy.require_consensus, false);
|
||||||
|
assert_eq!(c.net_settings.rpc_interface, "0.0.0.0");
|
||||||
|
match c.http_conf.apis {
|
||||||
|
ApiSet::List(set) => assert_eq!(set, ApiSet::All.list_apis()),
|
||||||
|
_ => panic!("Incorrect rpc apis"),
|
||||||
|
}
|
||||||
|
// "web3,eth,net,personal,parity,parity_set,traces,rpc,parity_accounts");
|
||||||
|
assert_eq!(c.http_conf.hosts, None);
|
||||||
|
assert_eq!(c.ipfs_conf.hosts, None);
|
||||||
|
},
|
||||||
|
_ => panic!("Should be Cmd::Run"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_override_preset() {
|
||||||
|
let args = vec!["parity", "--config", "mining", "--min-peers=99"];
|
||||||
|
let conf = Configuration::parse(&args, None).unwrap();
|
||||||
|
match conf.into_command().unwrap().cmd {
|
||||||
|
Cmd::Run(c) => {
|
||||||
|
assert_eq!(c.net_conf.min_peers, 99);
|
||||||
|
},
|
||||||
|
_ => panic!("Should be Cmd::Run"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_apply_ports_shift() {
|
fn should_apply_ports_shift() {
|
||||||
// given
|
// given
|
||||||
|
Loading…
Reference in New Issue
Block a user