v2.6.5 beta (#11240)

* [CI] check evmbin build (#11096)
* Correct EIP-712 encoding (#11092)
* [client]: Fix for incorrectly dropped consensus messages (#11082) (#11086)
* Update hardcoded headers (foundation, classic, kovan, xdai, ewc, ...) (#11053)
* Add cargo-remote dir to .gitignore (?)
* Update light client headers: ropsten 6631425 foundation 8798209 (#11201)
* Update list of bootnodes for xDai chain (#11236)
* ethcore/res: add mordor testnet configuration (#11200)
* [chain specs]: activate Istanbul on mainnet (#11228)
* [builtin]: support multiple prices and activations in chain spec (#11039)
* [receipt]: add sender & receiver to RichReceipts (#11179)
* [ethcore/builtin]: do not panic in blake2pricer on short input (#11180)
* Made ecrecover implementation trait public (#11188)
* Fix docker centos build (#11226)
* Update MIX bootnodes. (#11203)
* Insert explicit warning into the panic hook (#11225)
* Use provided usd-per-eth value if an endpoint is specified (#11209)
* Cleanup stratum a bit (#11161)
* Add Constantinople EIPs to the dev (instant_seal) config (#10809) (already backported)
* util Host: fix a double Read Lock bug in fn Host::session_readable() (#11175)
* ethcore client: fix a double Read Lock bug in fn Client::logs() (#11172)
* Type annotation for next_key() matching of json filter options (#11192)
* Upgrade jsonrpc to latest (#11206)
* [dependencies]: jsonrpc 14.0.1 (#11183)
* Upgrade to jsonrpc v14 (#11151)
* Switching sccache from local to Redis (#10971)
* Snapshot restoration overhaul (#11219)
* Add new line after writing block to hex file. (#10984)
* Pause pruning while snapshotting (#11178)
* Change how RPCs eth_call and eth_estimateGas handle "Pending" (#11127)
* Fix block detail updating (#11015)
* Make InstantSeal Instant again #11186
* Filter out some bad ropsten warp snapshots (#11247)
This commit is contained in:
Talha Cross
2019-11-11 23:55:19 +01:00
committed by s3krit
parent 9838c9f447
commit bc90ba2863
193 changed files with 24263 additions and 3349 deletions

View File

@@ -81,7 +81,7 @@ mod accounts {
let account_settings = AccountProviderSettings {
unlock_keep_secret: cfg.enable_fast_unlock,
blacklisted_accounts: match *spec {
SpecType::Morden | SpecType::Ropsten | SpecType::Kovan | SpecType::Sokol | SpecType::Dev => vec![],
SpecType::Morden | SpecType::Mordor | SpecType::Ropsten | SpecType::Kovan | SpecType::Goerli | SpecType::Kotti | SpecType::Sokol | SpecType::Dev => vec![],
_ => vec![
H160::from_str("00a329c0648769a73afac7f9381e08fb43dbea72").expect("the string is valid hex; qed"),
],

View File

@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
use std::str::{FromStr, from_utf8};
use std::str::from_utf8;
use std::{io, fs};
use std::io::{BufReader, BufRead};
use std::time::{Instant, Duration};
@@ -26,12 +26,12 @@ use ethereum_types::{U256, H256, Address};
use bytes::ToPretty;
use rlp::PayloadInfo;
use ethcore::client::{
Mode, DatabaseCompactionProfile, VMType, Nonce, Balance, BlockChainClient, BlockId, BlockInfo, ImportBlock, BlockChainReset
Mode, DatabaseCompactionProfile, VMType, Nonce, Balance, BlockChainClient, BlockId,
BlockInfo, ImportBlock, BlockChainReset, ImportExportBlocks
};
use ethcore::error::{ImportError, Error as EthcoreError};
use ethcore::miner::Miner;
use ethcore::verification::queue::VerifierSettings;
use ethcore::verification::queue::kind::blocks::Unverified;
use ethcore_service::ClientService;
use cache::CacheConfig;
use informant::{Informant, FullNodeInformantData, MillisecondDuration};
@@ -42,30 +42,7 @@ use user_defaults::UserDefaults;
use ethcore_private_tx;
use db;
use ansi_term::Colour;
#[derive(Debug, PartialEq)]
pub enum DataFormat {
Hex,
Binary,
}
impl Default for DataFormat {
fn default() -> Self {
DataFormat::Binary
}
}
impl FromStr for DataFormat {
type Err = String;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"binary" | "bin" => Ok(DataFormat::Binary),
"hex" => Ok(DataFormat::Hex),
x => Err(format!("Invalid format: {}", x))
}
}
}
use types::data_format::DataFormat;
#[derive(Debug, PartialEq)]
pub enum BlockchainCmd {
@@ -406,27 +383,11 @@ fn execute_import(cmd: ImportBlockchain) -> Result<(), String> {
let client = service.client();
let mut instream: Box<io::Read> = match cmd.file_path {
let instream: Box<dyn io::Read> = match cmd.file_path {
Some(f) => Box::new(fs::File::open(&f).map_err(|_| format!("Cannot open given file: {}", f))?),
None => Box::new(io::stdin()),
};
const READAHEAD_BYTES: usize = 8;
let mut first_bytes: Vec<u8> = vec![0; READAHEAD_BYTES];
let mut first_read = 0;
let format = match cmd.format {
Some(format) => format,
None => {
first_read = instream.read(&mut first_bytes).map_err(|_| "Error reading from the file/stream.")?;
match first_bytes[0] {
0xf9 => DataFormat::Binary,
_ => DataFormat::Hex,
}
}
};
let informant = Arc::new(Informant::new(
FullNodeInformantData {
client: client.clone(),
@@ -440,49 +401,7 @@ fn execute_import(cmd: ImportBlockchain) -> Result<(), String> {
service.register_io_handler(informant).map_err(|_| "Unable to register informant handler".to_owned())?;
let do_import = |bytes| {
let block = Unverified::from_rlp(bytes).map_err(|_| "Invalid block rlp")?;
while client.queue_info().is_full() { sleep(Duration::from_secs(1)); }
match client.import_block(block) {
Err(EthcoreError::Import(ImportError::AlreadyInChain)) => {
trace!("Skipping block already in chain.");
}
Err(e) => {
return Err(format!("Cannot import block: {:?}", e));
},
Ok(_) => {},
}
Ok(())
};
match format {
DataFormat::Binary => {
loop {
let mut bytes = if first_read > 0 {first_bytes.clone()} else {vec![0; READAHEAD_BYTES]};
let n = if first_read > 0 {
first_read
} else {
instream.read(&mut bytes).map_err(|_| "Error reading from the file/stream.")?
};
if n == 0 { break; }
first_read = 0;
let s = PayloadInfo::from(&bytes).map_err(|e| format!("Invalid RLP in the file/stream: {:?}", e))?.total();
bytes.resize(s, 0);
instream.read_exact(&mut bytes[n..]).map_err(|_| "Error reading from the file/stream.")?;
do_import(bytes)?;
}
}
DataFormat::Hex => {
for line in BufReader::new(instream).lines() {
let s = line.map_err(|_| "Error reading from the file/stream.")?;
let s = if first_read > 0 {from_utf8(&first_bytes).unwrap().to_owned() + &(s[..])} else {s};
first_read = 0;
let bytes = s.from_hex().map_err(|_| "Invalid hex in file/stream.")?;
do_import(bytes)?;
}
}
}
client.flush_queue();
client.import_blocks(instream, cmd.format)?;
// save user defaults
user_defaults.pruning = algorithm;
@@ -611,32 +530,14 @@ fn execute_export(cmd: ExportBlockchain) -> Result<(), String> {
false,
cmd.max_round_blocks_to_import,
)?;
let format = cmd.format.unwrap_or_default();
let client = service.client();
let mut out: Box<io::Write> = match cmd.file_path {
let out: Box<dyn io::Write> = match cmd.file_path {
Some(f) => Box::new(fs::File::create(&f).map_err(|_| format!("Cannot write to file given: {}", f))?),
None => Box::new(io::stdout()),
};
let from = client.block_number(cmd.from_block).ok_or("From block could not be found")?;
let to = client.block_number(cmd.to_block).ok_or("To block could not be found")?;
for i in from..(to + 1) {
if i % 10000 == 0 {
info!("#{}", i);
}
let b = client.block(BlockId::Number(i)).ok_or("Error exporting incomplete chain")?.into_inner();
match format {
DataFormat::Binary => {
out.write(&b).map_err(|e| format!("Couldn't write to stream. Cause: {}", e))?;
}
DataFormat::Hex => {
out.write_fmt(format_args!("{}", b.pretty())).map_err(|e| format!("Couldn't write to stream. Cause: {}", e))?;
}
}
}
client.export_blocks(out, cmd.from_block, cmd.to_block, cmd.format)?;
info!("Export completed.");
Ok(())

View File

@@ -300,7 +300,7 @@ usage! {
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, poacore, xdai, volta, ewc, expanse, musicoin, ellaism, mix, callisto, morden, ropsten, kovan, rinkeby, goerli, kotti, poasokol, testnet, or dev.",
"Specify the blockchain type. CHAIN may be either a JSON chain specification file or ethereum, classic, poacore, xdai, volta, ewc, musicoin, ellaism, mix, callisto, morden, mordor, ropsten, kovan, rinkeby, goerli, kotti, poasokol, testnet, or dev.",
ARG arg_keys_path: (String) = "$BASE/keys", or |c: &Config| c.parity.as_ref()?.keys_path.clone(),
"--keys-path=[PATH]",
@@ -1559,14 +1559,14 @@ mod tests {
// given
let mut config = Config::default();
let mut operating = Operating::default();
operating.chain = Some("morden".into());
operating.chain = Some("mordor".into());
config.parity = Some(operating);
// when
let args = Args::parse_with_config(&["parity"], config).unwrap();
// then
assert_eq!(args.arg_chain, "morden".to_owned());
assert_eq!(args.arg_chain, "mordor".to_owned());
}
#[test]
@@ -1574,7 +1574,7 @@ mod tests {
// given
let mut config = Config::default();
let mut operating = Operating::default();
operating.chain = Some("morden".into());
operating.chain = Some("mordor".into());
config.parity = Some(operating);
// when

View File

@@ -48,7 +48,8 @@ use ethcore_private_tx::{ProviderConfig, EncryptorConfig};
use secretstore::{NodeSecretKey, Configuration as SecretStoreConfiguration, ContractAddress as SecretStoreContractAddress};
use updater::{UpdatePolicy, UpdateFilter, ReleaseTrack};
use run::RunCmd;
use blockchain::{BlockchainCmd, ImportBlockchain, ExportBlockchain, KillBlockchain, ExportState, DataFormat, ResetBlockchain};
use types::data_format::DataFormat;
use blockchain::{BlockchainCmd, ImportBlockchain, ExportBlockchain, KillBlockchain, ExportState, ResetBlockchain};
use export_hardcoded_sync::ExportHsyncCmd;
use presale::ImportWallet;
use account::{AccountCmd, NewAccount, ListAccounts, ImportAccounts, ImportFromGethAccounts};
@@ -57,6 +58,7 @@ use network::{IpFilter};
const DEFAULT_MAX_PEERS: u16 = 50;
const DEFAULT_MIN_PEERS: u16 = 25;
pub const ETHERSCAN_ETH_PRICE_ENDPOINT: &str = "https://api.etherscan.io/api?module=stats&action=ethprice";
#[derive(Debug, PartialEq)]
pub enum Cmd {
@@ -667,23 +669,30 @@ impl Configuration {
}
let usd_per_tx = to_price(&self.args.arg_usd_per_tx)?;
if "auto" == self.args.arg_usd_per_eth.as_str() {
return Ok(GasPricerConfig::Calibrated {
if "auto" == self.args.arg_usd_per_eth {
Ok(GasPricerConfig::Calibrated {
usd_per_tx: usd_per_tx,
recalibration_period: to_duration(self.args.arg_price_update_period.as_str())?,
});
api_endpoint: ETHERSCAN_ETH_PRICE_ENDPOINT.to_string(),
})
} else if let Ok(usd_per_eth_parsed) = to_price(&self.args.arg_usd_per_eth) {
let wei_per_gas = wei_per_gas(usd_per_tx, usd_per_eth_parsed);
info!(
"Using a fixed conversion rate of Ξ1 = {} ({} wei/gas)",
Colour::White.bold().paint(format!("US${:.2}", usd_per_eth_parsed)),
Colour::Yellow.bold().paint(format!("{}", wei_per_gas))
);
Ok(GasPricerConfig::Fixed(wei_per_gas))
} else {
Ok(GasPricerConfig::Calibrated {
usd_per_tx: usd_per_tx,
recalibration_period: to_duration(self.args.arg_price_update_period.as_str())?,
api_endpoint: self.args.arg_usd_per_eth.clone(),
})
}
let usd_per_eth = to_price(&self.args.arg_usd_per_eth)?;
let wei_per_gas = wei_per_gas(usd_per_tx, usd_per_eth);
info!(
"Using a fixed conversion rate of Ξ1 = {} ({} wei/gas)",
Colour::White.bold().paint(format!("US${:.2}", usd_per_eth)),
Colour::Yellow.bold().paint(format!("{}", wei_per_gas))
);
Ok(GasPricerConfig::Fixed(wei_per_gas))
}
fn extra_data(&self) -> Result<Bytes, String> {
@@ -1208,9 +1217,9 @@ mod tests {
use miner::pool::PrioritizationStrategy;
use parity_rpc::NetworkSettings;
use updater::{UpdatePolicy, UpdateFilter, ReleaseTrack};
use types::data_format::DataFormat;
use account::{AccountCmd, NewAccount, ImportAccounts, ListAccounts};
use blockchain::{BlockchainCmd, ImportBlockchain, ExportBlockchain, DataFormat, ExportState};
use blockchain::{BlockchainCmd, ImportBlockchain, ExportBlockchain, ExportState};
use cli::Args;
use dir::{Directories, default_hypervisor_path};
use helpers::{default_network_config};
@@ -1568,7 +1577,7 @@ mod tests {
// then
assert_eq!(conf.network_settings(), Ok(NetworkSettings {
name: "testname".to_owned(),
chain: "kovan".to_owned(),
chain: "goerli".to_owned(),
is_dev_chain: false,
network_port: 30303,
rpc_enabled: true,

View File

@@ -141,7 +141,7 @@ pub fn to_addresses(s: &Option<String>) -> Result<Vec<Address>, String> {
/// Tries to parse string as a price.
pub fn to_price(s: &str) -> Result<f32, String> {
s.parse::<f32>().map_err(|_| format!("Invalid transaciton price 's' given. Must be a decimal number."))
s.parse::<f32>().map_err(|_| format!("Invalid transaction price {:?} given. Must be a decimal number.", s))
}
pub fn join_set(set: Option<&HashSet<String>>) -> Option<String> {

View File

@@ -12,6 +12,6 @@ atty = "0.2"
lazy_static = "1.0"
regex = "1.0"
time = "0.1"
parking_lot = "0.7"
parking_lot = "0.9"
arrayvec = "0.4"
ansi_term = "0.11"

View File

@@ -285,6 +285,7 @@ fn main_direct(force_can_restart: bool) -> i32 {
let e = exit.clone();
let exiting = exiting.clone();
move |panic_msg| {
warn!("Panic occured, see stderr for details");
eprintln!("{}", panic_msg);
if !exiting.swap(true, Ordering::SeqCst) {
*e.0.lock() = ExitStatus {

View File

@@ -30,6 +30,8 @@ use miner::gas_price_calibrator::{GasPriceCalibratorOptions, GasPriceCalibrator}
use parity_version::version_data;
use user_defaults::UserDefaults;
use crate::configuration;
#[derive(Debug, PartialEq)]
pub enum SpecType {
Foundation,
@@ -44,6 +46,7 @@ pub enum SpecType {
Mix,
Callisto,
Morden,
Mordor,
Ropsten,
Kovan,
Rinkeby,
@@ -65,8 +68,8 @@ impl str::FromStr for SpecType {
fn from_str(s: &str) -> Result<Self, Self::Err> {
let spec = match s {
"ethereum" | "frontier" | "homestead" | "byzantium" | "foundation" | "mainnet" => SpecType::Foundation,
"classic" | "frontier-dogmatic" | "homestead-dogmatic" => SpecType::Classic,
"eth" | "ethereum" | "foundation" | "mainnet" => SpecType::Foundation,
"etc" | "classic" => SpecType::Classic,
"poanet" | "poacore" => SpecType::Poanet,
"xdai" => SpecType::Xdai,
"volta" => SpecType::Volta,
@@ -76,11 +79,12 @@ impl str::FromStr for SpecType {
"ellaism" => SpecType::Ellaism,
"mix" => SpecType::Mix,
"callisto" => SpecType::Callisto,
"morden" | "classic-testnet" => SpecType::Morden,
"morden" => SpecType::Morden,
"mordor" | "classic-testnet" => SpecType::Mordor,
"ropsten" => SpecType::Ropsten,
"kovan" | "testnet" => SpecType::Kovan,
"kovan" => SpecType::Kovan,
"rinkeby" => SpecType::Rinkeby,
"goerli" | "görli" => SpecType::Goerli,
"goerli" | "görli" | "testnet" => SpecType::Goerli,
"kotti" => SpecType::Kotti,
"sokol" | "poasokol" => SpecType::Sokol,
"dev" => SpecType::Dev,
@@ -105,6 +109,7 @@ impl fmt::Display for SpecType {
SpecType::Mix => "mix",
SpecType::Callisto => "callisto",
SpecType::Morden => "morden",
SpecType::Mordor => "mordor",
SpecType::Ropsten => "ropsten",
SpecType::Kovan => "kovan",
SpecType::Rinkeby => "rinkeby",
@@ -133,6 +138,7 @@ impl SpecType {
SpecType::Mix => Ok(ethereum::new_mix(params)),
SpecType::Callisto => Ok(ethereum::new_callisto(params)),
SpecType::Morden => Ok(ethereum::new_morden(params)),
SpecType::Mordor => Ok(ethereum::new_mordor(params)),
SpecType::Ropsten => Ok(ethereum::new_ropsten(params)),
SpecType::Kovan => Ok(ethereum::new_kovan(params)),
SpecType::Rinkeby => Ok(ethereum::new_rinkeby(params)),
@@ -254,6 +260,7 @@ pub enum GasPricerConfig {
Calibrated {
usd_per_tx: f32,
recalibration_period: Duration,
api_endpoint: String
}
}
@@ -262,6 +269,7 @@ impl Default for GasPricerConfig {
GasPricerConfig::Calibrated {
usd_per_tx: 0.0001f32,
recalibration_period: Duration::from_secs(3600),
api_endpoint: configuration::ETHERSCAN_ETH_PRICE_ENDPOINT.to_string(),
}
}
}
@@ -270,7 +278,7 @@ impl GasPricerConfig {
pub fn to_gas_pricer(&self, fetch: FetchClient, p: Executor) -> GasPricer {
match *self {
GasPricerConfig::Fixed(u) => GasPricer::Fixed(u),
GasPricerConfig::Calibrated { usd_per_tx, recalibration_period, .. } => {
GasPricerConfig::Calibrated { usd_per_tx, recalibration_period, ref api_endpoint } => {
GasPricer::new_calibrated(
GasPriceCalibrator::new(
GasPriceCalibratorOptions {
@@ -279,6 +287,7 @@ impl GasPricerConfig {
},
fetch,
p,
api_endpoint.clone(),
)
)
}
@@ -370,15 +379,12 @@ mod tests {
#[test]
fn test_spec_type_parsing() {
assert_eq!(SpecType::Foundation, "foundation".parse().unwrap());
assert_eq!(SpecType::Foundation, "frontier".parse().unwrap());
assert_eq!(SpecType::Foundation, "homestead".parse().unwrap());
assert_eq!(SpecType::Foundation, "byzantium".parse().unwrap());
assert_eq!(SpecType::Foundation, "mainnet".parse().unwrap());
assert_eq!(SpecType::Foundation, "eth".parse().unwrap());
assert_eq!(SpecType::Foundation, "ethereum".parse().unwrap());
assert_eq!(SpecType::Foundation, "foundation".parse().unwrap());
assert_eq!(SpecType::Foundation, "mainnet".parse().unwrap());
assert_eq!(SpecType::Classic, "etc".parse().unwrap());
assert_eq!(SpecType::Classic, "classic".parse().unwrap());
assert_eq!(SpecType::Classic, "frontier-dogmatic".parse().unwrap());
assert_eq!(SpecType::Classic, "homestead-dogmatic".parse().unwrap());
assert_eq!(SpecType::Poanet, "poanet".parse().unwrap());
assert_eq!(SpecType::Poanet, "poacore".parse().unwrap());
assert_eq!(SpecType::Xdai, "xdai".parse().unwrap());
@@ -391,13 +397,14 @@ mod tests {
assert_eq!(SpecType::Mix, "mix".parse().unwrap());
assert_eq!(SpecType::Callisto, "callisto".parse().unwrap());
assert_eq!(SpecType::Morden, "morden".parse().unwrap());
assert_eq!(SpecType::Morden, "classic-testnet".parse().unwrap());
assert_eq!(SpecType::Mordor, "mordor".parse().unwrap());
assert_eq!(SpecType::Mordor, "classic-testnet".parse().unwrap());
assert_eq!(SpecType::Ropsten, "ropsten".parse().unwrap());
assert_eq!(SpecType::Kovan, "kovan".parse().unwrap());
assert_eq!(SpecType::Kovan, "testnet".parse().unwrap());
assert_eq!(SpecType::Rinkeby, "rinkeby".parse().unwrap());
assert_eq!(SpecType::Goerli, "goerli".parse().unwrap());
assert_eq!(SpecType::Goerli, "görli".parse().unwrap());
assert_eq!(SpecType::Goerli, "testnet".parse().unwrap());
assert_eq!(SpecType::Kotti, "kotti".parse().unwrap());
assert_eq!(SpecType::Sokol, "sokol".parse().unwrap());
assert_eq!(SpecType::Sokol, "poasokol".parse().unwrap());
@@ -422,6 +429,7 @@ mod tests {
assert_eq!(format!("{}", SpecType::Mix), "mix");
assert_eq!(format!("{}", SpecType::Callisto), "callisto");
assert_eq!(format!("{}", SpecType::Morden), "morden");
assert_eq!(format!("{}", SpecType::Mordor), "mordor");
assert_eq!(format!("{}", SpecType::Ropsten), "ropsten");
assert_eq!(format!("{}", SpecType::Kovan), "kovan");
assert_eq!(format!("{}", SpecType::Rinkeby), "rinkeby");

View File

@@ -65,10 +65,10 @@ use secretstore;
use signer;
use db;
// how often to take periodic snapshots.
// How often we attempt to take a snapshot: only snapshot on blocknumbers that are multiples of this.
const SNAPSHOT_PERIOD: u64 = 5000;
// how many blocks to wait before starting a periodic snapshot.
// Start snapshots `history` blocks from the tip. Should be smaller than `SNAPSHOT_HISTORY`.
const SNAPSHOT_HISTORY: u64 = 100;
// Number of minutes before a given gas price corpus should expire.

View File

@@ -252,18 +252,18 @@ impl SnapshotCommand {
let writer = PackedWriter::new(&file_path)
.map_err(|e| format!("Failed to open snapshot writer: {}", e))?;
let progress = Arc::new(Progress::default());
let progress = Arc::new(Progress::new());
let p = progress.clone();
let informant_handle = ::std::thread::spawn(move || {
::std::thread::sleep(Duration::from_secs(5));
let mut last_size = 0;
while !p.done() {
let cur_size = p.size();
let cur_size = p.bytes();
if cur_size != last_size {
last_size = cur_size;
let bytes = ::informant::format_bytes(cur_size as usize);
info!("Snapshot: {} accounts {} blocks {}", p.accounts(), p.blocks(), bytes);
info!("Snapshot: {} accounts (state), {} blocks, {} bytes", p.accounts(), p.blocks(), bytes);
}
::std::thread::sleep(Duration::from_secs(5));