Merge branch 'master' into check-updates

This commit is contained in:
Gav Wood
2016-12-07 19:19:44 +01:00
139 changed files with 5289 additions and 761 deletions

View File

@@ -28,6 +28,7 @@ use ethcore::service::ClientService;
use ethcore::client::{Mode, DatabaseCompactionProfile, VMType, BlockImportError, BlockChainClient, BlockId};
use ethcore::error::ImportError;
use ethcore::miner::Miner;
use ethcore::verification::queue::VerifierSettings;
use cache::CacheConfig;
use informant::{Informant, MillisecondDuration};
use params::{SpecType, Pruning, Switch, tracing_switch_to_bool, fatdb_switch_to_bool};
@@ -84,6 +85,7 @@ pub struct ImportBlockchain {
pub vm_type: VMType,
pub check_seal: bool,
pub with_color: bool,
pub verifier_settings: VerifierSettings,
}
#[derive(Debug, PartialEq)]
@@ -175,7 +177,22 @@ fn execute_import(cmd: ImportBlockchain) -> Result<String, String> {
try!(execute_upgrades(&db_dirs, algorithm, cmd.compaction.compaction_profile(db_dirs.fork_path().as_path())));
// prepare client config
let client_config = to_client_config(&cmd.cache_config, Default::default(), Mode::Active, tracing, fat_db, cmd.compaction, cmd.wal, cmd.vm_type, "".into(), algorithm, cmd.pruning_history, cmd.check_seal);
let mut client_config = to_client_config(
&cmd.cache_config,
Default::default(),
Mode::Active,
tracing,
fat_db,
cmd.compaction,
cmd.wal,
cmd.vm_type,
"".into(),
algorithm,
cmd.pruning_history,
cmd.check_seal
);
client_config.queue.verifier_settings = cmd.verifier_settings;
// build client
let service = try!(ClientService::start(

View File

@@ -94,6 +94,8 @@ cache_size = 128 # Overrides above caches with total size
fast_and_loose = false
db_compaction = "ssd"
fat_db = "auto"
scale_verifiers = true
num_verifiers = 6
[snapshots]
disable_periodic = false

View File

@@ -57,6 +57,7 @@ cache_size_queue = 100
cache_size_state = 25
db_compaction = "ssd"
fat_db = "off"
scale_verifiers = false
[snapshots]
disable_periodic = true

View File

@@ -48,7 +48,7 @@ usage! {
flag_testnet: bool,
flag_import_geth_keys: bool,
flag_datadir: Option<String>,
flag_networkid: Option<usize>,
flag_networkid: Option<u64>,
flag_peers: Option<u16>,
flag_nodekey: Option<String>,
flag_nodiscover: bool,
@@ -125,7 +125,7 @@ usage! {
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<usize> = None,
flag_network_id: Option<u64> = None,
or |c: &Config| otry!(c.network).id.clone().map(Some),
flag_bootnodes: Option<String> = None,
or |c: &Config| otry!(c.network).bootnodes.clone().map(|vec| Some(vec.join(","))),
@@ -245,6 +245,10 @@ usage! {
or |c: &Config| otry!(c.footprint).db_compaction.clone(),
flag_fat_db: String = "auto",
or |c: &Config| otry!(c.footprint).fat_db.clone(),
flag_scale_verifiers: bool = false,
or |c: &Config| otry!(c.footprint).scale_verifiers.clone(),
flag_num_verifiers: Option<usize> = None,
or |c: &Config| otry!(c.footprint).num_verifiers.clone().map(Some),
// -- Import/Export Options
flag_from: String = "1", or |_| None,
@@ -334,7 +338,7 @@ struct Network {
max_pending_peers: Option<u16>,
nat: Option<String>,
allow_ips: Option<String>,
id: Option<usize>,
id: Option<u64>,
bootnodes: Option<Vec<String>>,
discovery: Option<bool>,
node_key: Option<String>,
@@ -408,6 +412,8 @@ struct Footprint {
cache_size_state: Option<u32>,
db_compaction: Option<String>,
fat_db: Option<String>,
scale_verifiers: Option<bool>,
num_verifiers: Option<usize>,
}
#[derive(Default, Debug, PartialEq, RustcDecodable)]
@@ -611,6 +617,8 @@ mod tests {
flag_fast_and_loose: false,
flag_db_compaction: "ssd".into(),
flag_fat_db: "auto".into(),
flag_scale_verifiers: true,
flag_num_verifiers: Some(6),
// -- Import/Export Options
flag_from: "1".into(),
@@ -783,6 +791,8 @@ mod tests {
cache_size_state: Some(25),
db_compaction: Some("ssd".into()),
fat_db: Some("off".into()),
scale_verifiers: Some(false),
num_verifiers: None,
}),
snapshots: Some(Snapshots {
disable_periodic: Some(true),

View File

@@ -263,7 +263,7 @@ Footprint Options:
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:?})
options. (default: {flag_cache_size:?})
--fast-and-loose Disables DB WAL, which gives a significant speed up
but means an unclean exit is unrecoverable. (default: {flag_fast_and_loose})
--db-compaction TYPE Database compaction type. TYPE may be one of:
@@ -274,6 +274,11 @@ Footprint Options:
of all accounts and storage keys. Doubles the size
of the state database. BOOL may be one of on, off
or auto. (default: {flag_fat_db})
--scale-verifiers Automatically scale amount of verifier threads based on
workload. Not guaranteed to be faster.
(default: {flag_scale_verifiers})
--num-verifiers INT Amount of verifier threads to use or to begin with, if verifier
auto-scaling is enabled. (default: {flag_num_verifiers:?})
Import/Export Options:
--from BLOCK Export from block BLOCK, which may be an index or

View File

@@ -25,6 +25,7 @@ use util::log::Colour;
use ethsync::{NetworkConfiguration, is_valid_node_url, AllowIP};
use ethcore::client::{VMType, UpdatePolicy, UpdateFilter};
use ethcore::miner::{MinerOptions, Banning};
use ethcore::verification::queue::VerifierSettings;
use rpc::{IpcConfiguration, HttpConfiguration};
use ethcore_rpc::NetworkSettings;
@@ -159,6 +160,7 @@ impl Configuration {
vm_type: vm_type,
check_seal: !self.args.flag_no_seal_check,
with_color: logger_config.color,
verifier_settings: self.verifier_settings(),
};
Cmd::Blockchain(BlockchainCmd::Import(import_cmd))
} else if self.args.cmd_export {
@@ -242,6 +244,8 @@ impl Configuration {
None
};
let verifier_settings = self.verifier_settings();
let run_cmd = RunCmd {
cache_config: cache_config,
dirs: dirs,
@@ -278,6 +282,7 @@ impl Configuration {
check_seal: !self.args.flag_no_seal_check,
download_old_blocks: !self.args.flag_no_ancient_blocks,
require_consensus: !self.args.flag_no_consensus,
verifier_settings: verifier_settings,
};
Cmd::Run(run_cmd)
};
@@ -530,7 +535,7 @@ impl Configuration {
Ok(ret)
}
fn network_id(&self) -> Option<usize> {
fn network_id(&self) -> Option<u64> {
self.args.flag_network_id.or(self.args.flag_networkid)
}
@@ -718,6 +723,16 @@ impl Configuration {
!ui_disabled
}
fn verifier_settings(&self) -> VerifierSettings {
let mut settings = VerifierSettings::default();
settings.scale_verifiers = self.args.flag_scale_verifiers;
if let Some(num_verifiers) = self.args.flag_num_verifiers {
settings.num_verifiers = num_verifiers;
}
settings
}
}
#[cfg(test)]
@@ -814,6 +829,7 @@ mod tests {
vm_type: VMType::Interpreter,
check_seal: true,
with_color: !cfg!(windows),
verifier_settings: Default::default(),
})));
}
@@ -920,6 +936,7 @@ mod tests {
acc_conf: Default::default(),
gas_pricer: Default::default(),
miner_extras: Default::default(),
update_policy: Default::default(),
mode: Default::default(),
tracing: Default::default(),
compaction: Default::default(),
@@ -938,7 +955,7 @@ mod tests {
check_seal: true,
download_old_blocks: true,
require_consensus: true,
update_policy: Default::default(),
verifier_settings: Default::default(),
}));
}

View File

@@ -28,6 +28,7 @@ use ethcore::service::ClientService;
use ethcore::account_provider::AccountProvider;
use ethcore::miner::{Miner, MinerService, ExternalMiner, MinerOptions};
use ethcore::snapshot;
use ethcore::verification::queue::VerifierSettings;
use ethsync::SyncConfig;
use informant::Informant;
@@ -70,7 +71,7 @@ pub struct RunCmd {
pub http_conf: HttpConfiguration,
pub ipc_conf: IpcConfiguration,
pub net_conf: NetworkConfiguration,
pub network_id: Option<usize>,
pub network_id: Option<u64>,
pub warp_sync: bool,
pub acc_conf: AccountsConfig,
pub gas_pricer: GasPricerConfig,
@@ -94,6 +95,7 @@ pub struct RunCmd {
pub check_seal: bool,
pub download_old_blocks: bool,
pub require_consensus: bool,
pub verifier_settings: VerifierSettings,
}
pub fn open_ui(dapps_conf: &dapps::Configuration, signer_conf: &signer::Configuration) -> Result<(), String> {
@@ -222,7 +224,7 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<(), String> {
miner.set_transactions_limit(cmd.miner_extras.transactions_limit);
// create client config
let client_config = to_client_config(
let mut client_config = to_client_config(
&cmd.cache_config,
update_policy,
mode.clone(),
@@ -237,6 +239,8 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<(), String> {
cmd.check_seal,
);
client_config.queue.verifier_settings = cmd.verifier_settings;
// set up bootnodes
let mut net_conf = cmd.net_conf;
if !cmd.custom_bootnodes {