Commit 50cb3057 authored by Andronik Ordian's avatar Andronik Ordian

Merge branch 'master' into rpc-txpool-error

* master:
  [evmbin] fix compilation (#10976)
  Update to latest trie version. (#10972)
  [blooms-db] Fix benchmarks (#10974)
  Fix ethcore/benches build. (#10964)
  tx-pool: accept local tx with higher gas price when pool full (#10901)
  Disable unsyncable expanse chain (#10926)
  Extract Machine from ethcore (#10949)
  removed redundant state_root function from spec, improve spec error types (#10955)
  Add support for Energy Web Foundation's new chains (#10957)
  [evmbin] add more tests to main.rs (#10956)
  Fix compiler warnings in util/io and upgrade to edition 2018 Upgrade mio to latest (#10953)
  unify loading spec && further spec cleanups (#10948)
  refactor: Refactor evmbin CLI (#10742)
  journaldb changes (#10929)
  Allow default block parameter to be blockHash (#10932)
  Enable sealing when engine is ready (#10938)
  Fix some warnings and typos. (#10941)
  Updated security@parity.io key (#10939)
  Change the return type of step_inner function. (#10940)
parents 54181d8d ef47426a
Pipeline #65214 canceled with stages
in 0 seconds
This diff is collapsed.
......@@ -31,6 +31,7 @@ fdlimit = "0.1"
ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" }
jsonrpc-core = "12.0.0"
parity-bytes = "0.1"
client-traits = { path = "ethcore/client-traits" }
common-types = { path = "ethcore/types" }
ethcore = { path = "ethcore", features = ["parity"] }
ethcore-accounts = { path = "accounts", optional = true }
......@@ -72,7 +73,7 @@ ethcore-secretstore = { path = "secret-store", optional = true }
registrar = { path = "util/registrar" }
parity-util-mem = { version = "0.1", features = ["jemalloc-global"] }
parity-util-mem = { version = "0.2.0", features = ["jemalloc-global"] }
[build-dependencies]
rustc_version = "0.2"
......
......@@ -48,33 +48,54 @@ Our Bug Bounty Program allows us to recognise and reward members of the Parity c
```
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFlyIAwBCACe0keNPjgYzZ1Oy/8t3zj/Qw9bHHqrzx7FWy8NbXnYBM19NqOZ
DIP7Oe0DvCaf/uruBskCS0iVstHlEFQ2AYe0Ei0REt9lQdy61GylU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VozlC+fZfC9hCtU7bXJK
0UJZ4qjSvj6whzfaNgOZAqJpmwgOnd8W/3YJk1DwUeX98FcU38MR23SOkx2EDdDE
77Kdu62vTs/tLmOTuyKBvYPaHaYulYjQTxurG+o8vhHtaL87ARvuq+83dj+nO5z3
5O9vkcVJYWjOEnJe7ZvCTxeLJehpCmHIbyUuDx5P24MWVbyXOxIlxNxTqlub5GlW
rQF6Qsa/0k9TRk7Htbct6fAA0/VahJS0g096MrTH8AxBXDNE8lIoNeGikVlaxK9Z
S+aannlWYIJymZ4FygIPPaRlzhAoXBuJd8OaR5giC7dS1xquxKOiQEXTGsLeGFaI
BZYiIhW7GG4ozvKDqyNm4eg=
=yKcB
-----END PGP PUBLIC KEY BLOCK-----
```
......@@ -10,6 +10,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
account-db = { path = "account-db" }
ansi_term = "0.11"
blooms-db = { path = "../util/blooms-db", optional = true }
client-traits = { path = "./client-traits" }
common-types = { path = "types" }
crossbeam-utils = "0.6"
env_logger = { version = "0.5", optional = true }
......@@ -31,8 +32,8 @@ ethkey = { path = "../accounts/ethkey" }
evm = { path = "evm" }
trie-vm-factories = { path = "trie-vm-factories" }
futures = "0.1"
hash-db = "0.12.4"
parity-util-mem = "0.1"
hash-db = "0.15.0"
parity-util-mem = "0.2.0"
itertools = "0.5"
journaldb = { path = "../util/journaldb" }
keccak-hash = "0.2.0"
......@@ -44,6 +45,7 @@ lazy_static = "1.2.0"
len-caching-lock = { path = "../util/len-caching-lock" }
log = "0.4"
lru-cache = "0.1"
machine = { path = "./machine" }
macros = { path = "../util/macros" }
memory-cache = { path = "../util/memory-cache" }
num_cpus = "1.2"
......@@ -51,7 +53,7 @@ parity-bytes = "0.1"
parity-snappy = "0.1"
parking_lot = "0.8"
pod = { path = "pod" }
trie-db = "0.12.4"
trie-db = "0.15.0"
patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" }
rand = "0.6"
rayon = "1.1"
......@@ -84,7 +86,8 @@ parity-runtime = { path = "../util/runtime" }
rlp_compress = { path = "../util/rlp-compress" }
serde_json = "1.0"
tempdir = "0.3"
trie-standardmap = "0.12.4"
trie-standardmap = "0.15.0"
machine = { path = "./machine", features = ["test-helpers"] }
[features]
parity = ["work-notify", "price-info", "stratum"]
......@@ -108,7 +111,7 @@ evm-debug-tests = ["evm-debug", "evm/evm-debug-tests"]
# EVM debug traces are printed.
slow-blocks = []
# Run JSON consensus tests.
json-tests = ["env_logger", "test-helpers"]
json-tests = ["env_logger", "test-helpers", "machine/test-helpers"]
# Skip JSON consensus tests with pending issues.
ci-skip-tests = []
# Run memory/cpu heavy tests.
......
......@@ -8,7 +8,7 @@ edition = "2018"
[dependencies]
ethereum-types = "0.6"
hash-db = "0.12.4"
hash-db = "0.15.0"
keccak-hash = "0.2.0"
keccak-hasher = { path = "../../util/keccak-hasher" }
kvdb = "0.1"
......
......@@ -12,22 +12,22 @@ derive_more = "0.15.0"
ethereum-types = "0.6.0"
ethtrie = { package = "patricia-trie-ethereum", path = "../../util/patricia-trie-ethereum" }
trie-vm-factories = { path = "../trie-vm-factories" }
hash-db = "0.12.4"
hash-db = "0.15.0"
journaldb = { path = "../../util/journaldb" }
keccak-hash = "0.2.0"
keccak-hasher = { path = "../../util/keccak-hasher" }
kvdb = "0.1.0"
log = "0.4"
lru-cache = "0.1.2"
memory-db = "0.12.4"
memory-db = "0.15.0"
parity-bytes = "0.1.0"
parity-util-mem = "0.1.0"
parity-util-mem = "0.2.0"
parking_lot = "0.8.0"
pod = { path = "../pod" }
rlp = "0.4.0"
serde = { version = "1.0", features = ["derive"] }
trace = { path = "../trace" }
trie-db = "0.12.4"
trie-db = "0.15.0"
[dev-dependencies]
account-db = { path = "../account-db" }
......
......@@ -21,7 +21,7 @@
//! should become general over time to the point where not even a
//! merkle trie is strictly necessary.
use std::collections::{HashMap, HashSet};
use std::collections::HashSet;
use std::sync::Arc;
use ethereum_types::{Address, H256};
......@@ -29,7 +29,6 @@ use hash_db::{AsHashDB, EMPTY_PREFIX, HashDB, Prefix};
use kvdb::DBValue;
use memory_db::{HashKey, MemoryDB};
use parking_lot::Mutex;
use journaldb::AsKeyedHashDB;
use keccak_hasher::KeccakHasher;
use crate::account::Account;
......@@ -90,10 +89,6 @@ impl ProofCheck {
}
}
impl journaldb::KeyedHashDB for ProofCheck {
fn keys(&self) -> HashMap<H256, i32> { self.0.keys() }
}
impl HashDB<KeccakHasher, DBValue> for ProofCheck {
fn get(&self, key: &H256, prefix: Prefix) -> Option<DBValue> {
self.0.get(key, prefix)
......@@ -146,23 +141,11 @@ pub struct Proving<H> {
proof: Mutex<HashSet<DBValue>>,
}
impl<AH: AsKeyedHashDB + Send + Sync> AsKeyedHashDB for Proving<AH> {
fn as_keyed_hash_db(&self) -> &dyn journaldb::KeyedHashDB { self }
}
impl<AH: AsHashDB<KeccakHasher, DBValue> + Send + Sync> AsHashDB<KeccakHasher, DBValue> for Proving<AH> {
fn as_hash_db(&self) -> &dyn HashDB<KeccakHasher, DBValue> { self }
fn as_hash_db_mut(&mut self) -> &mut dyn HashDB<KeccakHasher, DBValue> { self }
}
impl<H: AsKeyedHashDB + Send + Sync> journaldb::KeyedHashDB for Proving<H> {
fn keys(&self) -> HashMap<H256, i32> {
let mut keys = self.base.as_keyed_hash_db().keys();
keys.extend(self.changed.keys());
keys
}
}
impl<H: AsHashDB<KeccakHasher, DBValue> + Send + Sync> HashDB<KeccakHasher, DBValue> for Proving<H> {
fn get(&self, key: &H256, prefix: Prefix) -> Option<DBValue> {
match self.base.as_hash_db().get(key, prefix) {
......
......@@ -20,17 +20,19 @@ extern crate criterion;
#[macro_use]
extern crate lazy_static;
extern crate machine;
extern crate ethcore;
extern crate ethcore_builtin;
extern crate ethereum_types;
extern crate parity_bytes as bytes;
extern crate rustc_hex;
use criterion::{Criterion, Bencher};
use bytes::BytesRef;
use ethcore::builtin::Builtin;
use ethcore::machine::Machine;
use ethcore_builtin::Builtin;
use ethereum_types::H160;
use ethcore::ethereum::new_byzantium_test_machine;
use machine::Machine;
use machine::test_helpers::new_byzantium_test_machine;
use rustc_hex::FromHex;
lazy_static! {
......
......@@ -14,7 +14,7 @@ common-types = { path = "../types" }
ethcore-db = { path = "../db" }
ethereum-types = "0.6.0"
keccak-hash = "0.2.0"
parity-util-mem = "0.1"
parity-util-mem = "0.2.0"
itertools = "0.5"
kvdb = "0.1"
log = "0.4"
......
[package]
description = "Trait definitions relative the ethereum client"
name = "client-traits"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
license = "GPL-3.0"
[dependencies]
ethereum-types = "0.6.0"
common-types = { path = "../types" }
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity Ethereum.
// Parity Ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity Ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// 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 ethereum_types::{Address, H256};
use common_types::{
header::Header,
encoded,
ids::BlockId,
};
/// Provides various information on a block by it's ID
pub trait BlockInfo {
/// Get raw block header data by block id.
fn block_header(&self, id: BlockId) -> Option<encoded::Header>;
/// Get the best block header.
fn best_block_header(&self) -> Header;
/// Get raw block data by block header hash.
fn block(&self, id: BlockId) -> Option<encoded::Block>;
/// Get address code hash at given block's state.
fn code_hash(&self, address: &Address, id: BlockId) -> Option<H256>;
}
......@@ -11,7 +11,7 @@ edition = "2018"
common-types = { path = "../types" }
ethereum-types = "0.6.0"
kvdb = "0.1"
parity-util-mem = "0.1"
parity-util-mem = "0.2.0"
parking_lot = "0.8"
rlp = "0.4.0"
rlp_derive = { path = "../../util/rlp-derive" }
......@@ -8,7 +8,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
bit-set = "0.4"
parity-bytes = "0.1"
ethereum-types = "0.6.0"
parity-util-mem = "0.1"
parity-util-mem = "0.2.0"
lazy_static = "1.0"
log = "0.4"
vm = { path = "../vm" }
......
......@@ -109,8 +109,6 @@ enum InstructionResult<Gas> {
Trap(TrapKind),
}
enum Never {}
/// ActionParams without code, so that it can be feed into CodeReader.
#[derive(Debug)]
struct InterpreterParams {
......@@ -171,12 +169,6 @@ pub enum InterpreterResult {
Trap(TrapKind),
}
impl From<vm::Error> for InterpreterResult {
fn from(error: vm::Error) -> InterpreterResult {
InterpreterResult::Done(Err(error))
}
}
/// Intepreter EVM implementation
pub struct Interpreter<Cost: CostType> {
mem: Vec<u8>,
......@@ -309,7 +301,7 @@ impl<Cost: CostType> Interpreter<Cost> {
} else if self.reader.len() == 0 {
InterpreterResult::Done(Ok(GasLeft::Known(self.gasometer.as_ref().expect("Gasometer None case is checked above; qed").current_gas.as_u256())))
} else {
self.step_inner(ext).err().expect("step_inner never returns Ok(()); qed")
self.step_inner(ext)
};
if let &InterpreterResult::Done(_) = &result {
......@@ -321,7 +313,7 @@ impl<Cost: CostType> Interpreter<Cost> {
/// Inner helper function for step.
#[inline(always)]
fn step_inner(&mut self, ext: &mut dyn vm::Ext) -> Result<Never, InterpreterResult> {
fn step_inner(&mut self, ext: &mut dyn vm::Ext) -> InterpreterResult {
let result = match self.resume_result.take() {
Some(result) => result,
None => {
......@@ -336,22 +328,28 @@ impl<Cost: CostType> Interpreter<Cost> {
let instruction = match instruction {
Some(i) => i,
None => return Err(InterpreterResult::Done(Err(vm::Error::BadInstruction {
None => return InterpreterResult::Done(Err(vm::Error::BadInstruction {
instruction: opcode
}))),
})),
};
let info = instruction.info();
self.last_stack_ret_len = info.ret;
self.verify_instruction(ext, instruction, info)?;
if let Err(e) = self.verify_instruction(ext, instruction, info) {
return InterpreterResult::Done(Err(e));
};
// Calculate gas cost
let requirements = self.gasometer.as_mut().expect(GASOMETER_PROOF).requirements(ext, instruction, info, &self.stack, self.mem.size())?;
let requirements = match self.gasometer.as_mut().expect(GASOMETER_PROOF).requirements(ext, instruction, info, &self.stack, self.mem.size()) {
Ok(t) => t,
Err(e) => return InterpreterResult::Done(Err(e)),
};
if self.do_trace {
ext.trace_prepare_execute(self.reader.position - 1, opcode, requirements.gas_cost.as_u256(), Self::mem_written(instruction, &self.stack), Self::store_written(instruction, &self.stack));
}
self.gasometer.as_mut().expect(GASOMETER_PROOF).verify_gas(&requirements.gas_cost)?;
if let Err(e) = self.gasometer.as_mut().expect(GASOMETER_PROOF).verify_gas(&requirements.gas_cost) {
return InterpreterResult::Done(Err(e));
}
self.mem.expand(requirements.memory_required_size);
self.gasometer.as_mut().expect(GASOMETER_PROOF).current_mem_gas = requirements.memory_total_gas;
self.gasometer.as_mut().expect(GASOMETER_PROOF).current_gas = self.gasometer.as_mut().expect(GASOMETER_PROOF).current_gas - requirements.gas_cost;
......@@ -360,18 +358,19 @@ impl<Cost: CostType> Interpreter<Cost> {
// Execute instruction
let current_gas = self.gasometer.as_mut().expect(GASOMETER_PROOF).current_gas;
let result = self.exec_instruction(
let result = match self.exec_instruction(
current_gas, ext, instruction, requirements.provide_gas
)?;
) {
Err(x) => return InterpreterResult::Done(Err(x)),
Ok(x) => x,
};
evm_debug!({ self.informant.after_instruction(instruction) });
result
},
};
if let InstructionResult::Trap(trap) = result {
return Err(InterpreterResult::Trap(trap));
return InterpreterResult::Trap(trap);
}
if let InstructionResult::UnusedGas(ref gas) = result {
......@@ -393,28 +392,31 @@ impl<Cost: CostType> Interpreter<Cost> {
self.valid_jump_destinations = Some(self.cache.jump_destinations(&self.params.code_hash, &self.reader.code));
}
let jump_destinations = self.valid_jump_destinations.as_ref().expect("jump_destinations are initialized on first jump; qed");
let pos = self.verify_jump(position, jump_destinations)?;
let pos = match self.verify_jump(position, jump_destinations) {
Ok(x) => x,
Err(e) => return InterpreterResult::Done(Err(e))
};
self.reader.position = pos;
},
InstructionResult::StopExecutionNeedsReturn {gas, init_off, init_size, apply} => {
let mem = mem::replace(&mut self.mem, Vec::new());
return Err(InterpreterResult::Done(Ok(GasLeft::NeedsReturn {
return InterpreterResult::Done(Ok(GasLeft::NeedsReturn {
gas_left: gas.as_u256(),
data: mem.into_return_data(init_off, init_size),
apply_state: apply
})));
}));
},
InstructionResult::StopExecution => {
return Err(InterpreterResult::Done(Ok(GasLeft::Known(self.gasometer.as_mut().expect(GASOMETER_PROOF).current_gas.as_u256()))));
return InterpreterResult::Done(Ok(GasLeft::Known(self.gasometer.as_mut().expect(GASOMETER_PROOF).current_gas.as_u256())));
},
_ => {},
}
if self.reader.position >= self.reader.len() {
return Err(InterpreterResult::Done(Ok(GasLeft::Known(self.gasometer.as_mut().expect(GASOMETER_PROOF).current_gas.as_u256()))));
return InterpreterResult::Done(Ok(GasLeft::Known(self.gasometer.as_mut().expect(GASOMETER_PROOF).current_gas.as_u256())));
}
Err(InterpreterResult::Continue)
InterpreterResult::Continue
}
fn verify_instruction(&self, ext: &dyn vm::Ext, instruction: Instruction, info: &InstructionInfo) -> vm::Result<()> {
......
......@@ -9,20 +9,22 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
log = "0.4"
parity-bytes = "0.1"
client-traits = { path = "../client-traits" }
common-types = { path = "../types" }
derive_more = "0.14.0"
ethcore = { path = ".."}
ethcore-db = { path = "../db" }
ethcore-blockchain = { path = "../blockchain" }
ethereum-types = "0.6.0"
memory-db = "0.12.4"
trie-db = "0.12.4"
machine = { path = "../machine" }
memory-db = "0.15.0"
trie-db = "0.15.0"
patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
ethcore-network = { path = "../../util/network" }
ethcore-miner = { path = "../../miner" }
ethcore-io = { path = "../../util/io" }
hash-db = "0.12.4"
parity-util-mem = "0.1"
hash-db = "0.15.0"
parity-util-mem = "0.2.0"
vm = { path = "../vm" }
fastmap = { path = "../../util/fastmap" }
failsafe = { version = "0.3.0", default-features = false, features = ["parking_lot_mutex"] }
......
......@@ -874,7 +874,7 @@ mod tests {
use cache::Cache;
use common_types::header::Header;
use common_types::ids::BlockId;
use ethcore::spec::Spec;
use ethcore::spec;
use ethereum_types::U256;
use kvdb::KeyValueDB;
use kvdb_memorydb;
......@@ -888,7 +888,7 @@ mod tests {
#[test]
fn basic_chain() {
let spec = Spec::new_test();
let spec = spec::new_test();
let genesis_header = spec.genesis_header();
let db = make_db();
......@@ -922,7 +922,7 @@ mod tests {
#[test]
fn reorganize() {
let spec = Spec::new_test();
let spec = spec::new_test();
let genesis_header = spec.genesis_header();
let db = make_db();
let cache = Arc::new(Mutex::new(Cache::new(Default::default(), Duration::from_secs(6 * 3600))));
......@@ -1005,7 +1005,7 @@ mod tests {
#[test]
fn earliest_is_latest() {
let spec = Spec::new_test();
let spec = spec::new_test();
let db = make_db();
let cache = Arc::new(Mutex::new(Cache::new(Default::default(), Duration::from_secs(6 * 3600))));
......@@ -1017,7 +1017,7 @@ mod tests {
#[test]
fn restore_from_db() {
let spec = Spec::new_test();
let spec = spec::new_test();
let genesis_header = spec.genesis_header();
let db = make_db();
let cache = Arc::new(Mutex::new(Cache::new(Default::default(), Duration::from_secs(6 * 3600))));
......@@ -1055,7 +1055,7 @@ mod tests {
#[test]
fn restore_higher_non_canonical() {
let spec = Spec::new_test();
let spec = spec::new_test();
let genesis_header = spec.genesis_header();
let db = make_db();
let cache = Arc::new(Mutex::new(Cache::new(Default::default(), Duration::from_secs(6 * 3600))));
......@@ -1112,7 +1112,7 @@ mod tests {
#[test]
fn genesis_header_available() {
let spec = Spec::new_test();
let spec = spec::new_test();
let genesis_header = spec.genesis_header();
let db = make_db();
let cache = Arc::new(Mutex::new(Cache::new(Default::default(), Duration::from_secs(6 * 3600))));
......@@ -1127,7 +1127,7 @@ mod tests {
#[test]
fn epoch_transitions_available_after_cht() {
let spec = Spec::new_test();
let spec = spec::new_test();
let genesis_header = spec.genesis_header();
let db = make_db();
let cache = Arc::new(Mutex::new(Cache::new(Default::default(), Duration::from_secs(6 * 3600))));
......@@ -1193,7 +1193,7 @@ mod tests {
#[test]
fn hardcoded_sync_gen() {
let spec = Spec::new_test();
let spec = spec::new_test();
let genesis_header = spec.genesis_header();
let db = make_db();
......
......@@ -113,7 +113,7 @@ impl<T: ChainDataFetcher> IoHandler<ClientIoMessage> for ImportBlocks<T> {
#[cfg(test)]
mod tests {
use super::Service;
use ethcore::spec::Spec;
use ethcore::spec;
use std::sync::Arc;
use cache::Cache;
......@@ -125,7 +125,7 @@ mod tests {
#[test]
fn it_works() {
let db = test_helpers::new_db();
let spec = Spec::new_test();
let spec = spec::new_test();
let cache = Arc::new(Mutex::new(Cache::new(Default::default(), Duration::from_secs(6 * 3600))));
Service::start(Default::default(), &spec, fetch::unavailable(), db, cache).unwrap();
......
......@@ -54,6 +54,7 @@ extern crate serde_derive;
extern crate log;
extern crate bincode;
extern crate client_traits;
extern crate common_types;
extern crate ethcore_blockchain;
extern crate ethcore_db;
......@@ -71,6 +72,7 @@ extern crate failsafe;
extern crate futures;
extern crate itertools;
extern crate keccak_hasher;
extern crate machine;
extern crate memory_db;
extern crate trie_db as trie;
extern crate patricia_trie_ethereum as ethtrie;
......
......@@ -39,8 +39,8 @@ use net::{
use cache::Cache;
use request::{self as basic_request, Request as NetworkRequest};
use self::request::CheckedRequest;
use machine::executed::ExecutionResult;
pub use ethcore::executed::ExecutionResult;
pub use self::request::{Request, Response, HeaderRef, Error as ValidityError};
pub use self::request_guard::{RequestGuard, Error as RequestError};
pub use self::response_guard::{ResponseGuard, Error as ResponseGuardError, Inner as ResponseGuardInner};
......
......@@ -1099,7 +1099,8 @@ mod tests {
use trie::Recorder;
use hash::keccak;
use ethcore::client::{BlockChainClient, BlockInfo, TestBlockChainClient, EachBlockWith};
use ethcore::client::{BlockChainClient, TestBlockChainClient, EachBlockWith};