From 4cfe8104304fd33436ae21c58672c90abce55c44 Mon Sep 17 00:00:00 2001 From: arkpar Date: Wed, 11 Oct 2017 19:35:23 +0200 Subject: [PATCH 1/3] v1.7.4 --- Cargo.lock | 50 +++++++++++++++++++++++----------------------- Cargo.toml | 2 +- mac/Parity.pkgproj | 2 +- nsis/installer.nsi | 2 +- util/Cargo.toml | 2 +- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bae5ac635d8..9c88f1291fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -277,7 +277,7 @@ dependencies = [ name = "common-types" version = "0.1.0" dependencies = [ - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "ethjson 0.1.0", "rlp 0.2.0", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -476,7 +476,7 @@ dependencies = [ "ethcore-ipc-nano 1.7.0", "ethcore-logger 1.7.0", "ethcore-stratum 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "ethjson 0.1.0", "ethkey 0.2.0", "ethstore 0.1.0", @@ -545,7 +545,7 @@ name = "ethcore-ipc" version = "1.7.0" dependencies = [ "ethcore-devtools 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -594,7 +594,7 @@ dependencies = [ "ethcore-ipc 1.7.0", "ethcore-ipc-codegen 1.7.0", "ethcore-ipc-nano 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -611,7 +611,7 @@ dependencies = [ "ethcore-ipc 1.7.0", "ethcore-ipc-codegen 1.7.0", "ethcore-network 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "evm 0.1.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -650,7 +650,7 @@ dependencies = [ "ethcore-devtools 1.7.0", "ethcore-io 1.7.0", "ethcore-logger 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "ethcrypto 0.1.0", "ethkey 0.2.0", "igd 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -681,7 +681,7 @@ dependencies = [ "ethcore-ipc-codegen 1.7.0", "ethcore-ipc-nano 1.7.0", "ethcore-logger 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "ethcrypto 0.1.0", "ethkey 0.2.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -711,7 +711,7 @@ dependencies = [ "ethcore-ipc-codegen 1.7.0", "ethcore-ipc-nano 1.7.0", "ethcore-logger 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "jsonrpc-macros 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", @@ -724,7 +724,7 @@ dependencies = [ [[package]] name = "ethcore-util" -version = "1.7.3" +version = "1.7.4" dependencies = [ "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", @@ -774,7 +774,7 @@ name = "ethjson" version = "0.1.0" dependencies = [ "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -855,7 +855,7 @@ dependencies = [ "ethcore-ipc-nano 1.7.0", "ethcore-light 1.7.0", "ethcore-network 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "ethkey 0.2.0", "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -874,7 +874,7 @@ dependencies = [ "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "common-types 0.1.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "ethjson 0.1.0", "evmjit 1.7.0", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -891,7 +891,7 @@ version = "0.1.0" dependencies = [ "docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "ethjson 0.1.0", "evm 0.1.0", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1136,7 +1136,7 @@ version = "1.7.0" dependencies = [ "ethcore-ipc 1.7.0", "ethcore-ipc-codegen 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1530,7 +1530,7 @@ version = "0.1.0" dependencies = [ "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "native-contract-generator 0.1.0", ] @@ -1735,7 +1735,7 @@ dependencies = [ [[package]] name = "parity" -version = "1.7.3" +version = "1.7.4" dependencies = [ "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1755,7 +1755,7 @@ dependencies = [ "ethcore-logger 1.7.0", "ethcore-secretstore 1.0.0", "ethcore-stratum 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "ethkey 0.2.0", "ethsync 1.7.0", "fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1801,7 +1801,7 @@ dependencies = [ "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-devtools 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "fetch 0.1.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", @@ -1845,7 +1845,7 @@ name = "parity-hash-fetch" version = "1.7.0" dependencies = [ "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "fetch 0.1.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1863,7 +1863,7 @@ version = "1.7.0" dependencies = [ "cid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "jsonrpc-http-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1876,7 +1876,7 @@ version = "0.1.0" dependencies = [ "ethcore 1.7.0", "ethcore-io 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "ethkey 0.2.0", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.0", @@ -1906,7 +1906,7 @@ dependencies = [ "ethcore-ipc 1.7.0", "ethcore-light 1.7.0", "ethcore-logger 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "ethcrypto 0.1.0", "ethjson 0.1.0", "ethkey 0.2.0", @@ -1948,7 +1948,7 @@ dependencies = [ name = "parity-rpc-client" version = "1.4.0" dependencies = [ - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "jsonrpc-ws-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", @@ -2011,7 +2011,7 @@ dependencies = [ "ethcore 1.7.0", "ethcore-ipc 1.7.0", "ethcore-ipc-codegen 1.7.0", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "ethsync 1.7.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-common-types 1.7.0", @@ -2367,7 +2367,7 @@ name = "rpc-cli" version = "1.4.0" dependencies = [ "bigint 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore-util 1.7.3", + "ethcore-util 1.7.4", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "parity-rpc 1.7.0", "parity-rpc-client 1.4.0", diff --git a/Cargo.toml b/Cargo.toml index a5f504fc500..af725249b1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Parity Ethereum client" name = "parity" -version = "1.7.3" +version = "1.7.4" license = "GPL-3.0" authors = ["Parity Technologies "] build = "build.rs" diff --git a/mac/Parity.pkgproj b/mac/Parity.pkgproj index 2546e7a0f2d..0ea72a5458d 100755 --- a/mac/Parity.pkgproj +++ b/mac/Parity.pkgproj @@ -462,7 +462,7 @@ OVERWRITE_PERMISSIONS VERSION - 1.7.3 + 1.7.4 UUID 2DCD5B81-7BAF-4DA1-9251-6274B089FD36 diff --git a/nsis/installer.nsi b/nsis/installer.nsi index f465813d378..f60d9d9b43a 100644 --- a/nsis/installer.nsi +++ b/nsis/installer.nsi @@ -10,7 +10,7 @@ !define DESCRIPTION "Fast, light, robust Ethereum implementation" !define VERSIONMAJOR 1 !define VERSIONMINOR 7 -!define VERSIONBUILD 3 +!define VERSIONBUILD 4 !define ARGS "--warp" !define FIRST_START_ARGS "ui --warp --mode=passive" diff --git a/util/Cargo.toml b/util/Cargo.toml index 466073863d8..7cf53a15fab 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -3,7 +3,7 @@ description = "Ethcore utility library" homepage = "http://parity.io" license = "GPL-3.0" name = "ethcore-util" -version = "1.7.3" +version = "1.7.4" authors = ["Parity Technologies "] build = "build.rs" From 4b6eb4e44f04eb209bdf18e89f0f0c89e42268f8 Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Wed, 11 Oct 2017 16:41:28 +0200 Subject: [PATCH 2/3] Fixed potential exp len overflow (#6686) --- ethcore/src/builtin.rs | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/ethcore/src/builtin.rs b/ethcore/src/builtin.rs index be73c913b61..d1d4148fce2 100644 --- a/ethcore/src/builtin.rs +++ b/ethcore/src/builtin.rs @@ -98,18 +98,17 @@ impl Pricer for ModexpPricer { let exp_len = read_len(); let mod_len = read_len(); + if mod_len.is_zero() && base_len.is_zero() { + return U256::zero() + } + let max_len = U256::from(u32::max_value() / 2); - if base_len > max_len || mod_len > max_len { + if base_len > max_len || mod_len > max_len || exp_len > max_len { return U256::max_value(); } + let (base_len, exp_len, mod_len) = (base_len.low_u64(), exp_len.low_u64(), mod_len.low_u64()); - let base_len = base_len.low_u64(); - let exp_len = exp_len.low_u64(); - let mod_len = mod_len.low_u64(); let m = max(mod_len, base_len); - if m == 0 { - return U256::zero(); - } // read fist 32-byte word of the exponent. let exp_low = if base_len + 96 >= input.len() as u64 { U256::zero() } else { let mut buf = [0; 32]; @@ -130,8 +129,7 @@ impl ModexpPricer { let bit_index = if exp_low.is_zero() { 0 } else { (255 - exp_low.leading_zeros()) as u64 }; if len <= 32 { bit_index - } - else { + } else { 8 * (len - 32) + bit_index } } @@ -712,6 +710,24 @@ mod tests { native: ethereum_builtin("modexp"), activate_at: 0, }; + + // test for potential exp len overflow + { + let input = FromHex::from_hex("\ + 00000000000000000000000000000000000000000000000000000000000000ff\ + 2a1e530000000000000000000000000000000000000000000000000000000000\ + 0000000000000000000000000000000000000000000000000000000000000000" + ).unwrap(); + + let mut output = vec![0u8; 32]; + let expected = FromHex::from_hex("0000000000000000000000000000000000000000000000000000000000000000").unwrap(); + let expected_cost = U256::max_value(); + + f.execute(&input[..], &mut BytesRef::Fixed(&mut output[..])).expect("Builtin should fail"); + assert_eq!(output, expected); + assert_eq!(f.cost(&input[..]), expected_cost.into()); + } + // fermat's little theorem example. { let input = FromHex::from_hex("\ From e997a896f1678e1d3c7cb605026b905bb82690cc Mon Sep 17 00:00:00 2001 From: arkpar Date: Tue, 10 Oct 2017 17:42:20 +0200 Subject: [PATCH 3/3] Fix warp sync blockers detection --- parity/configuration.rs | 12 ++---------- parity/run.rs | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/parity/configuration.rs b/parity/configuration.rs index b81d94ac156..9fad2b95687 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -23,7 +23,6 @@ use std::cmp::max; use std::str::FromStr; use cli::{Args, ArgsError}; use util::{Hashable, H256, U256, Bytes, version_data, Address}; -use util::journaldb::Algorithm; use util::Colour; use ethsync::{NetworkConfiguration, is_valid_node_url, AllowIP}; use ethcore::ethstore::ethkey::{Secret, Public}; @@ -37,7 +36,7 @@ use parity_rpc::NetworkSettings; 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, 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::{SpecType, ResealPolicy, AccountsConfig, GasPricerConfig, MinerExtras}; use ethcore_logger::Config as LogConfig; use dir::{self, Directories, default_hypervisor_path, default_local_path, default_data_path}; use dapps::Configuration as DappsConfiguration; @@ -123,15 +122,8 @@ impl Configuration { let fat_db = self.args.flag_fat_db.parse()?; let compaction = self.args.flag_db_compaction.parse()?; let wal = !self.args.flag_fast_and_loose; - match self.args.flag_warp { - // Logging is not initialized yet, so we print directly to stderr - Some(true) if fat_db == Switch::On => writeln!(&mut stderr(), "Warning: Warp Sync is disabled because Fat DB is turned on").expect("Error writing to stderr"), - Some(true) if tracing == Switch::On => writeln!(&mut stderr(), "Warning: Warp Sync is disabled because tracing is turned on").expect("Error writing to stderr"), - Some(true) if pruning == Pruning::Specific(Algorithm::Archive) => writeln!(&mut stderr(), "Warning: Warp Sync is disabled because pruning mode is set to archive").expect("Error writing to stderr"), - _ => {}, - }; let public_node = self.args.flag_public_node; - let warp_sync = !self.args.flag_no_warp && fat_db != Switch::On && tracing != Switch::On && pruning != Pruning::Specific(Algorithm::Archive); + let warp_sync = !self.args.flag_no_warp; let geth_compatibility = self.args.flag_geth; let mut dapps_conf = self.dapps_config(); let ipfs_conf = self.ipfs_config(); diff --git a/parity/run.rs b/parity/run.rs index 8ef32cf572b..ade32894002 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -38,6 +38,7 @@ use parity_reactor::EventLoop; use parity_rpc::{NetworkSettings, informant, is_major_importing}; use updater::{UpdatePolicy, Updater}; use util::{Colour, version, Mutex, Condvar}; +use util::journaldb::Algorithm; use params::{ SpecType, Pruning, AccountsConfig, GasPricerConfig, MinerExtras, Switch, @@ -474,7 +475,21 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc) -> R } sync_config.fork_block = spec.fork_block(); - sync_config.warp_sync = spec.engine.supports_warp() && cmd.warp_sync; + let mut warp_sync = cmd.warp_sync; + if warp_sync { + // Logging is not initialized yet, so we print directly to stderr + if fat_db { + warn!("Warning: Warp Sync is disabled because Fat DB is turned on."); + warp_sync = false; + } else if tracing { + warn!("Warning: Warp Sync is disabled because tracing is turned on."); + warp_sync = false; + } else if algorithm != Algorithm::OverlayRecent { + warn!("Warning: Warp Sync is disabled because of non-default pruning mode."); + warp_sync = false; + } + } + sync_config.warp_sync = spec.engine.supports_warp() && warp_sync; sync_config.download_old_blocks = cmd.download_old_blocks; sync_config.serve_light = cmd.serve_light;