Merge remote-tracking branch 'parity/master' into bft

This commit is contained in:
keorn
2016-11-07 11:34:45 +00:00
1245 changed files with 71972 additions and 5008 deletions

View File

@@ -28,6 +28,10 @@ nat = "any"
id = "0x1"
bootnodes = []
discovery = true
warp = true
allow_ips = "all"
snapshot_peers = 0
max_pending_peers = 64
reserved_only = false
reserved_peers = "./path_to_file"
@@ -37,13 +41,13 @@ disable = false
port = 8545
interface = "local"
cors = "null"
apis = ["web3", "eth", "net", "personal", "ethcore", "traces", "rpc"]
apis = ["web3", "eth", "net", "ethcore", "traces", "rpc", "personal_safe"]
hosts = ["none"]
[ipc]
disable = false
path = "$HOME/.parity/jsonrpc.ipc"
apis = ["web3", "eth", "net", "personal", "ethcore", "traces", "rpc"]
apis = ["web3", "eth", "net", "ethcore", "traces", "rpc", "personal_safe"]
[dapps]
disable = false
@@ -67,9 +71,13 @@ usd_per_eth = "auto"
price_update_period = "hourly"
gas_floor_target = "4700000"
gas_cap = "6283184"
tx_queue_size = 2048
tx_queue_size = 1024
tx_queue_gas = "auto"
tx_queue_strategy = "gas_factor"
tx_queue_ban_count = 1
tx_queue_ban_time = 180 #s
tx_gas_limit = "6283184"
tx_time_limit = 100 #ms
extra_data = "Parity"
remove_solved = false
notify_work = ["http://localhost:3001"]
@@ -77,9 +85,11 @@ notify_work = ["http://localhost:3001"]
[footprint]
tracing = "auto"
pruning = "auto"
pruning_history = 64
cache_size_db = 64
cache_size_blocks = 8
cache_size_queue = 50
cache_size_state = 25
cache_size = 128 # Overrides above caches with total size
fast_and_loose = false
db_compaction = "ssd"

View File

@@ -13,10 +13,14 @@ disable = true
[network]
disable = false
warp = false
discovery = true
nat = "any"
min_peers = 10
max_peers = 20
max_pending_peers = 30
snapshot_peers = 40
allow_ips = "public"
reserved_only = true
reserved_peers = "./path/to/reserved_peers"
@@ -40,15 +44,17 @@ force_sealing = true
reseal_on_txs = "all"
reseal_min_period = 4000
price_update_period = "hourly"
tx_queue_size = 2048
tx_queue_size = 1024
tx_queue_gas = "auto"
[footprint]
tracing = "on"
pruning = "fast"
pruning_history = 64
cache_size_db = 128
cache_size_blocks = 16
cache_size_queue = 100
cache_size_state = 25
db_compaction = "ssd"
fat_db = "off"

View File

@@ -106,14 +106,22 @@ usage! {
// -- Networking Options
flag_no_network: bool = false,
or |c: &Config| otry!(c.network).disable.clone(),
flag_warp: bool = false,
or |c: &Config| otry!(c.network).warp.clone(),
flag_port: u16 = 30303u16,
or |c: &Config| otry!(c.network).port.clone(),
flag_min_peers: u16 = 25u16,
or |c: &Config| otry!(c.network).min_peers.clone(),
flag_max_peers: u16 = 50u16,
or |c: &Config| otry!(c.network).max_peers.clone(),
flag_max_pending_peers: u16 = 64u16,
or |c: &Config| otry!(c.network).max_pending_peers.clone(),
flag_snapshot_peers: u16 = 0u16,
or |c: &Config| otry!(c.network).snapshot_peers.clone(),
flag_nat: String = "any",
or |c: &Config| otry!(c.network).nat.clone(),
flag_allow_ips: String = "all",
or |c: &Config| otry!(c.network).allow_ips.clone(),
flag_network_id: Option<String> = None,
or |c: &Config| otry!(c.network).id.clone().map(Some),
flag_bootnodes: Option<String> = None,
@@ -137,7 +145,7 @@ usage! {
or |c: &Config| otry!(c.rpc).interface.clone(),
flag_jsonrpc_cors: Option<String> = None,
or |c: &Config| otry!(c.rpc).cors.clone().map(Some),
flag_jsonrpc_apis: String = "web3,eth,net,ethcore,personal,traces,rpc",
flag_jsonrpc_apis: String = "web3,eth,net,ethcore,traces,rpc,personal_safe",
or |c: &Config| otry!(c.rpc).apis.clone().map(|vec| vec.join(",")),
flag_jsonrpc_hosts: String = "none",
or |c: &Config| otry!(c.rpc).hosts.clone().map(|vec| vec.join(",")),
@@ -147,7 +155,7 @@ usage! {
or |c: &Config| otry!(c.ipc).disable.clone(),
flag_ipc_path: String = "$HOME/.parity/jsonrpc.ipc",
or |c: &Config| otry!(c.ipc).path.clone(),
flag_ipc_apis: String = "web3,eth,net,ethcore,personal,traces,rpc",
flag_ipc_apis: String = "web3,eth,net,ethcore,traces,rpc,personal_safe",
or |c: &Config| otry!(c.ipc).apis.clone().map(|vec| vec.join(",")),
// DAPPS
@@ -179,6 +187,8 @@ usage! {
or |c: &Config| otry!(c.mining).work_queue_size.clone(),
flag_tx_gas_limit: Option<String> = None,
or |c: &Config| otry!(c.mining).tx_gas_limit.clone().map(Some),
flag_tx_time_limit: Option<u64> = None,
or |c: &Config| otry!(c.mining).tx_time_limit.clone().map(Some),
flag_relay_set: String = "cheap",
or |c: &Config| otry!(c.mining).relay_set.clone(),
flag_usd_per_tx: String = "0",
@@ -197,6 +207,12 @@ usage! {
or |c: &Config| otry!(c.mining).tx_queue_size.clone(),
flag_tx_queue_gas: String = "auto",
or |c: &Config| otry!(c.mining).tx_queue_gas.clone(),
flag_tx_queue_strategy: String = "gas_price",
or |c: &Config| otry!(c.mining).tx_queue_strategy.clone(),
flag_tx_queue_ban_count: u16 = 1u16,
or |c: &Config| otry!(c.mining).tx_queue_ban_count.clone(),
flag_tx_queue_ban_time: u16 = 180u16,
or |c: &Config| otry!(c.mining).tx_queue_ban_time.clone(),
flag_remove_solved: bool = false,
or |c: &Config| otry!(c.mining).remove_solved.clone(),
flag_notify_work: Option<String> = None,
@@ -207,17 +223,21 @@ usage! {
or |c: &Config| otry!(c.footprint).tracing.clone(),
flag_pruning: String = "auto",
or |c: &Config| otry!(c.footprint).pruning.clone(),
flag_pruning_history: u64 = 64u64,
or |c: &Config| otry!(c.footprint).pruning_history.clone(),
flag_cache_size_db: u32 = 64u32,
or |c: &Config| otry!(c.footprint).cache_size_db.clone(),
flag_cache_size_blocks: u32 = 8u32,
or |c: &Config| otry!(c.footprint).cache_size_blocks.clone(),
flag_cache_size_queue: u32 = 50u32,
or |c: &Config| otry!(c.footprint).cache_size_queue.clone(),
flag_cache_size_state: u32 = 25u32,
or |c: &Config| otry!(c.footprint).cache_size_state.clone(),
flag_cache_size: Option<u32> = None,
or |c: &Config| otry!(c.footprint).cache_size.clone().map(Some),
flag_fast_and_loose: bool = false,
or |c: &Config| otry!(c.footprint).fast_and_loose.clone(),
flag_db_compaction: String = "ssd",
flag_db_compaction: String = "auto",
or |c: &Config| otry!(c.footprint).db_compaction.clone(),
flag_fat_db: String = "auto",
or |c: &Config| otry!(c.footprint).fat_db.clone(),
@@ -226,6 +246,7 @@ usage! {
flag_from: String = "1", or |_| None,
flag_to: String = "latest", or |_| None,
flag_format: Option<String> = None, or |_| None,
flag_no_seal_check: bool = false, or |_| None,
// -- Snapshot Optons
flag_at: String = "latest", or |_| None,
@@ -294,10 +315,14 @@ struct Signer {
#[derive(Default, Debug, PartialEq, RustcDecodable)]
struct Network {
disable: Option<bool>,
warp: Option<bool>,
port: Option<u16>,
min_peers: Option<u16>,
max_peers: Option<u16>,
snapshot_peers: Option<u16>,
max_pending_peers: Option<u16>,
nat: Option<String>,
allow_ips: Option<String>,
id: Option<String>,
bootnodes: Option<Vec<String>>,
discovery: Option<bool>,
@@ -342,6 +367,7 @@ struct Mining {
reseal_min_period: Option<u64>,
work_queue_size: Option<usize>,
tx_gas_limit: Option<String>,
tx_time_limit: Option<u64>,
relay_set: Option<String>,
usd_per_tx: Option<String>,
usd_per_eth: Option<String>,
@@ -351,6 +377,9 @@ struct Mining {
extra_data: Option<String>,
tx_queue_size: Option<usize>,
tx_queue_gas: Option<String>,
tx_queue_strategy: Option<String>,
tx_queue_ban_count: Option<u16>,
tx_queue_ban_time: Option<u16>,
remove_solved: Option<bool>,
notify_work: Option<Vec<String>>,
}
@@ -359,11 +388,13 @@ struct Mining {
struct Footprint {
tracing: Option<String>,
pruning: Option<String>,
pruning_history: Option<u64>,
fast_and_loose: Option<bool>,
cache_size: Option<u32>,
cache_size_db: Option<u32>,
cache_size_blocks: Option<u32>,
cache_size_queue: Option<u32>,
cache_size_state: Option<u32>,
db_compaction: Option<String>,
fat_db: Option<String>,
}
@@ -423,6 +454,20 @@ mod tests {
assert_eq!(args.flag_chain, "xyz".to_owned());
}
#[test]
fn should_use_config_if_cli_is_missing() {
let mut config = Config::default();
let mut footprint = Footprint::default();
footprint.pruning_history = Some(128);
config.footprint = Some(footprint);
// when
let args = Args::parse_with_config(&["parity"], config).unwrap();
// then
assert_eq!(args.flag_pruning_history, 128);
}
#[test]
fn should_parse_full_config() {
// given
@@ -477,9 +522,13 @@ mod tests {
// -- Networking Options
flag_no_network: false,
flag_warp: true,
flag_port: 30303u16,
flag_min_peers: 25u16,
flag_max_peers: 50u16,
flag_max_pending_peers: 64u16,
flag_snapshot_peers: 0u16,
flag_allow_ips: "all".into(),
flag_nat: "any".into(),
flag_network_id: Some("0x1".into()),
flag_bootnodes: Some("".into()),
@@ -494,13 +543,13 @@ mod tests {
flag_jsonrpc_port: 8545u16,
flag_jsonrpc_interface: "local".into(),
flag_jsonrpc_cors: Some("null".into()),
flag_jsonrpc_apis: "web3,eth,net,personal,ethcore,traces,rpc".into(),
flag_jsonrpc_apis: "web3,eth,net,ethcore,traces,rpc,personal_safe".into(),
flag_jsonrpc_hosts: "none".into(),
// IPC
flag_no_ipc: false,
flag_ipc_path: "$HOME/.parity/jsonrpc.ipc".into(),
flag_ipc_apis: "web3,eth,net,personal,ethcore,traces,rpc".into(),
flag_ipc_apis: "web3,eth,net,ethcore,traces,rpc,personal_safe".into(),
// DAPPS
flag_no_dapps: false,
@@ -518,6 +567,7 @@ mod tests {
flag_reseal_min_period: 4000u64,
flag_work_queue_size: 20usize,
flag_tx_gas_limit: Some("6283184".into()),
flag_tx_time_limit: Some(100u64),
flag_relay_set: "cheap".into(),
flag_usd_per_tx: "0".into(),
flag_usd_per_eth: "auto".into(),
@@ -525,17 +575,27 @@ mod tests {
flag_gas_floor_target: "4700000".into(),
flag_gas_cap: "6283184".into(),
flag_extra_data: Some("Parity".into()),
<<<<<<< HEAD
flag_tx_queue_size: 2048usize,
flag_tx_queue_gas: "auto".into(),
=======
flag_tx_queue_size: 1024usize,
flag_tx_queue_gas: "auto".into(),
flag_tx_queue_strategy: "gas_factor".into(),
flag_tx_queue_ban_count: 1u16,
flag_tx_queue_ban_time: 180u16,
>>>>>>> parity/master
flag_remove_solved: false,
flag_notify_work: Some("http://localhost:3001".into()),
// -- Footprint Options
flag_tracing: "auto".into(),
flag_pruning: "auto".into(),
flag_pruning_history: 64u64,
flag_cache_size_db: 64u32,
flag_cache_size_blocks: 8u32,
flag_cache_size_queue: 50u32,
flag_cache_size_state: 25u32,
flag_cache_size: Some(128),
flag_fast_and_loose: false,
flag_db_compaction: "ssd".into(),
@@ -545,6 +605,7 @@ mod tests {
flag_from: "1".into(),
flag_to: "latest".into(),
flag_format: None,
flag_no_seal_check: false,
// -- Snapshot Optons
flag_at: "latest".into(),
@@ -631,9 +692,13 @@ mod tests {
}),
network: Some(Network {
disable: Some(false),
warp: Some(false),
port: None,
min_peers: Some(10),
max_peers: Some(20),
max_pending_peers: Some(30),
snapshot_peers: Some(40),
allow_ips: Some("public".into()),
nat: Some("any".into()),
id: None,
bootnodes: None,
@@ -676,9 +741,18 @@ mod tests {
price_update_period: Some("hourly".into()),
gas_floor_target: None,
gas_cap: None,
<<<<<<< HEAD
tx_queue_size: Some(2048),
tx_queue_gas: Some("auto".into()),
=======
tx_queue_size: Some(1024),
tx_queue_gas: Some("auto".into()),
tx_queue_strategy: None,
tx_queue_ban_count: None,
tx_queue_ban_time: None,
>>>>>>> parity/master
tx_gas_limit: None,
tx_time_limit: None,
extra_data: None,
remove_solved: None,
notify_work: None,
@@ -686,11 +760,13 @@ mod tests {
footprint: Some(Footprint {
tracing: Some("on".into()),
pruning: Some("fast".into()),
pruning_history: Some(64),
fast_and_loose: None,
cache_size: None,
cache_size_db: Some(128),
cache_size_blocks: Some(16),
cache_size_queue: Some(100),
cache_size_state: Some(25),
db_compaction: Some("ssd".into()),
fat_db: Some("off".into()),
}),

View File

@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
macro_rules! println_stderr(
($($arg:tt)*) => { {
let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
r.expect("failed printing to stderr");
} }
);
macro_rules! otry {
($e: expr) => (
match $e {
@@ -39,7 +46,7 @@ macro_rules! usage {
) => {
use toml;
use std::{fs, io, process};
use std::io::Read;
use std::io::{Read, Write};
use util::version;
use docopt::{Docopt, Error as DocoptError};
use helpers::replace_home;
@@ -58,20 +65,20 @@ macro_rules! usage {
match self {
ArgsError::Docopt(e) => e.exit(),
ArgsError::Parsing(errors) => {
println!("There is an error in config file.");
println_stderr!("There is an error in config file.");
for e in &errors {
println!("{}", e);
println_stderr!("{}", e);
}
process::exit(2)
},
ArgsError::Decode(e) => {
println!("You might have supplied invalid parameters in config file.");
println!("{}", e);
println_stderr!("You might have supplied invalid parameters in config file.");
println_stderr!("{}", e);
process::exit(2)
},
ArgsError::Config(path, e) => {
println!("There was an error reading your config file at: {}", path);
println!("{}", e);
println_stderr!("There was an error reading your config file at: {}", path);
println_stderr!("{}", e);
process::exit(2)
}
}
@@ -136,7 +143,7 @@ macro_rules! usage {
let config = match (fs::File::open(&config_file), raw_args.flag_config.is_some()) {
// Load config file
(Ok(mut file), _) => {
println!("Loading config file from {}", &config_file);
println_stderr!("Loading config file from {}", &config_file);
let mut config = String::new();
try!(file.read_to_string(&mut config).map_err(|e| ArgsError::Config(config_file, e)));
try!(Self::parse_config(&config))

View File

@@ -67,10 +67,13 @@ Account Options:
Networking Options:
--no-network Disable p2p networking. (default: {flag_no_network})
--warp Enable syncing from the snapshot over the network. (default: {flag_warp})
--port PORT Override the port on which the node should listen
(default: {flag_port}).
--min-peers NUM Try to maintain at least NUM peers (default: {flag_min_peers}).
--max-peers NUM Allow up to that many peers (default: {flag_max_peers}).
--max-peers NUM Allow up to NUM peers (default: {flag_max_peers}).
--snapshot-peers NUM Allow additional NUM peers for a snapshot sync
(default: {flag_snapshot_peers}).
--nat METHOD Specify method to use for determining public
address. Must be one of: any, none, upnp,
extip:<IP> (default: {flag_nat}).
@@ -85,6 +88,12 @@ Networking Options:
These nodes will always have a reserved slot on top
of the normal maximum peers. (default: {flag_reserved_peers:?})
--reserved-only Connect only to reserved nodes. (default: {flag_reserved_only})
--allow-ips FILTER Filter outbound connections. Must be one of:
private - connect to private network IP addresses only;
public - connect to public network IP addresses only;
all - connect to any IP address.
(default: {flag_allow_ips})
--max-pending-peers NUM Allow up to NUM pending connections. (default: {flag_max_pending_peers})
API and Console Options:
--no-jsonrpc Disable the JSON-RPC API server. (default: {flag_no_jsonrpc})
@@ -98,7 +107,7 @@ API and Console Options:
--jsonrpc-apis APIS Specify the APIs available through the JSONRPC
interface. APIS is a comma-delimited list of API
name. Possible name are web3, eth, net, personal,
ethcore, ethcore_set, traces, rpc.
ethcore, ethcore_set, traces, rpc, personal_safe.
(default: {flag_jsonrpc_apis}).
--jsonrpc-hosts HOSTS List of allowed Host header values. This option will
validate the Host header sent by the browser, it
@@ -157,6 +166,11 @@ Sealing/Mining Options:
--tx-gas-limit GAS Apply a limit of GAS as the maximum amount of gas
a single transaction may have for it to be mined.
(default: {flag_tx_gas_limit:?})
--tx-time-limit MS Maximal time for processing single transaction.
If enabled senders/recipients/code of transactions
offending the limit will be banned from being included
in transaction queue for 180 seconds.
(default: {flag_tx_time_limit:?})
--relay-set SET Set of transactions to relay. SET may be:
cheap - Relay any transaction in the queue (this
may include invalid transactions);
@@ -186,8 +200,21 @@ Sealing/Mining Options:
to be included in next block) (default: {flag_tx_queue_size}).
--tx-queue-gas LIMIT Maximum amount of total gas for external transactions in
the queue. LIMIT can be either an amount of gas or
'auto' or 'off'. 'auto' sets the limit to be 2x
'auto' or 'off'. 'auto' sets the limit to be 20x
the current block gas limit. (default: {flag_tx_queue_gas}).
--tx-queue-strategy S Prioritization strategy used to order transactions
in the queue. S may be:
gas - Prioritize txs with low gas limit;
gas_price - Prioritize txs with high gas price;
gas_factor - Prioritize txs using gas price
and gas limit ratio (default: {flag_tx_queue_strategy}).
--tx-queue-ban-count C Number of times maximal time for execution (--tx-time-limit)
can be exceeded before banning sender/recipient/code.
(default: {flag_tx_queue_ban_count})
--tx-queue-ban-time SEC Banning time (in seconds) for offenders of specified
execution time limit. Also number of offending actions
have to reach the threshold within that time.
(default: {flag_tx_queue_ban_time} seconds)
--remove-solved Move solved blocks from the work package queue
instead of cloning them. This gives a slightly
faster import speed, but means that extra solutions
@@ -209,11 +236,15 @@ Footprint Options:
fast - maintain journal overlay. Fast but 50MB used.
auto - use the method most recently synced or
default to fast if none synced (default: {flag_pruning}).
--pruning-history NUM Set a number of recent states to keep when pruning
is active. (default: {flag_pruning_history}).
--cache-size-db MB Override database cache size (default: {flag_cache_size_db}).
--cache-size-blocks MB Specify the prefered size of the blockchain cache in
megabytes (default: {flag_cache_size_blocks}).
--cache-size-queue MB Specify the maximum size of memory to use for block
queue (default: {flag_cache_size_queue}).
--cache-size-state MB Specify the maximum size of memory to use for
the state cache (default: {flag_cache_size_state}).
--cache-size MB Set total amount of discretionary memory to use for
the entire system, overrides other cache and queue
options.a (default: {flag_cache_size:?})
@@ -221,7 +252,8 @@ Footprint Options:
but means an unclean exit is unrecoverable. (default: {flag_fast_and_loose})
--db-compaction TYPE Database compaction type. TYPE may be one of:
ssd - suitable for SSDs and fast HDDs;
hdd - suitable for slow HDDs (default: {flag_db_compaction}).
hdd - suitable for slow HDDs;
auto - determine automatically (default: {flag_db_compaction}).
--fat-db BOOL Build appropriate information to allow enumeration
of all accounts and storage keys. Doubles the size
of the state database. BOOL may be one of on, off
@@ -235,6 +267,7 @@ Import/Export Options:
--format FORMAT For import/export in given format. FORMAT must be
one of 'hex' and 'binary'.
(default: {flag_format:?} = Import: auto, Export: binary)
--no-seal-check Skip block seal check. (default: {flag_no_seal_check})
Snapshot Options:
--at BLOCK Take a snapshot at the given block, which may be an