Merge pull request #6724 from paritytech/backporting

Backport #6694 and #6718
This commit is contained in:
Marek Kotewicz 2017-10-12 18:53:01 +02:00 committed by GitHub
commit 822fa82056
9 changed files with 66 additions and 39 deletions

50
Cargo.lock generated
View File

@ -277,7 +277,7 @@ dependencies = [
name = "common-types"
version = "0.1.0"
dependencies = [
"ethcore-util 1.7.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4"
version = "1.7.5"
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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4"
version = "1.7.5"
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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"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.4",
"ethcore-util 1.7.5",
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-rpc 1.7.0",
"parity-rpc-client 1.4.0",

View File

@ -1,7 +1,7 @@
[package]
description = "Parity Ethereum client"
name = "parity"
version = "1.7.4"
version = "1.7.5"
license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"

View File

@ -565,7 +565,7 @@ impl<Cost: CostType> Interpreter<Cost> {
let source_offset = stack.peek(1);
let size = stack.peek(2);
let return_data_len = U256::from(self.return_data.len());
if source_offset.overflow_add(*size).0 > return_data_len {
if source_offset.saturating_add(*size) > return_data_len {
return Err(evm::Error::OutOfBounds);
}
}
@ -931,4 +931,25 @@ mod tests {
assert_eq!(ext.calls.len(), 1);
assert_eq!(gas_left, 248_212.into());
}
#[test]
fn should_not_overflow_returndata() {
let code = "6001600160000360003e00".from_hex().unwrap();
let mut params = ActionParams::default();
params.address = 5.into();
params.gas = 300_000.into();
params.gas_price = 1.into();
params.code = Some(Arc::new(code));
let mut ext = FakeExt::new_byzantium();
ext.balances.insert(5.into(), 1_000_000_000.into());
ext.tracing = true;
let err = {
let mut vm = Factory::new(VMType::Interpreter, 1).create(params.gas);
test_finalize(vm.exec(params, &mut ext)).err().unwrap()
};
assert_eq!(err, ::vm::Error::OutOfBounds);
}
}

View File

@ -970,9 +970,11 @@ impl Client {
/// Tick the client.
// TODO: manage by real events.
pub fn tick(&self) {
pub fn tick(&self, prevent_sleep: bool) {
self.check_garbage();
self.check_snooze();
if !prevent_sleep {
self.check_snooze();
}
}
fn check_garbage(&self) {
@ -1079,7 +1081,7 @@ impl Client {
if !self.liveness.load(AtomicOrdering::Relaxed) {
self.liveness.store(true, AtomicOrdering::Relaxed);
self.notify(|n| n.start());
trace!(target: "mode", "wake_up: Waking.");
info!(target: "mode", "wake_up: Waking.");
}
}
@ -1089,11 +1091,11 @@ impl Client {
if self.queue_info().total_queue_size() <= MAX_QUEUE_SIZE_TO_SLEEP_ON {
self.liveness.store(false, AtomicOrdering::Relaxed);
self.notify(|n| n.stop());
trace!(target: "mode", "sleep: Sleeping.");
info!(target: "mode", "sleep: Sleeping.");
} else {
trace!(target: "mode", "sleep: Cannot sleep - syncing ongoing.");
info!(target: "mode", "sleep: Cannot sleep - syncing ongoing.");
// TODO: Consider uncommenting.
//*self.last_activity.lock() = Some(Instant::now());
//(*self.sleep_state.lock()).last_activity = Some(Instant::now());
}
}
}

View File

@ -23,7 +23,7 @@ use error::*;
use client::{Client, ClientConfig, ChainNotify};
use miner::Miner;
use snapshot::ManifestData;
use snapshot::{ManifestData, RestorationStatus};
use snapshot::service::{Service as SnapshotService, ServiceParams as SnapServiceParams};
use std::sync::atomic::AtomicBool;
@ -175,7 +175,11 @@ impl IoHandler<ClientIoMessage> for ClientIoHandler {
fn timeout(&self, _io: &IoContext<ClientIoMessage>, timer: TimerToken) {
match timer {
CLIENT_TICK_TIMER => self.client.tick(),
CLIENT_TICK_TIMER => {
use snapshot::SnapshotService;
let snapshot_restoration = if let RestorationStatus::Ongoing{..} = self.snapshot.status() { true } else { false };
self.client.tick(snapshot_restoration)
},
SNAPSHOT_TICK_TIMER => self.snapshot.tick(),
_ => warn!("IO service triggered unregistered timer '{}'", timer),
}

View File

@ -190,7 +190,7 @@ fn imports_block_sequence() {
#[test]
fn can_collect_garbage() {
let client = generate_dummy_client(100);
client.tick();
client.tick(true);
assert!(client.blockchain_cache_info().blocks < 100 * 1024);
}

View File

@ -462,7 +462,7 @@
<key>OVERWRITE_PERMISSIONS</key>
<false/>
<key>VERSION</key>
<string>1.7.4</string>
<string>1.7.5</string>
</dict>
<key>UUID</key>
<string>2DCD5B81-7BAF-4DA1-9251-6274B089FD36</string>

View File

@ -10,7 +10,7 @@
!define DESCRIPTION "Fast, light, robust Ethereum implementation"
!define VERSIONMAJOR 1
!define VERSIONMINOR 7
!define VERSIONBUILD 4
!define VERSIONBUILD 5
!define ARGS "--warp"
!define FIRST_START_ARGS "ui --warp --mode=passive"

View File

@ -3,7 +3,7 @@ description = "Ethcore utility library"
homepage = "http://parity.io"
license = "GPL-3.0"
name = "ethcore-util"
version = "1.7.4"
version = "1.7.5"
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"