2.6.1-beta (#10973)
* Add support for Energy Web Foundation's new chains (#10957) * Kaspersky AV whitelisting (#10919) * Avast whitelist script (#10900) * Docker images renaming (#10863) * Remove excessive warning (#10831) * Allow --nat extip:your.host.here.org (#10830) * When updating the client or when called from RPC, sleep should mean sleep (#10814) * added new ropsten-bootnode and removed old one (#10794) * ethkey no longer uses byteorder (#10786) * docs: Update Readme with TOC, Contributor Guideline. Update Cargo package descriptions (#10652)
This commit is contained in:
@@ -12,7 +12,7 @@ ansi_term = "0.11"
|
||||
blooms-db = { path = "../util/blooms-db", optional = true }
|
||||
bn = { git = "https://github.com/paritytech/bn", default-features = false }
|
||||
common-types = { path = "types" }
|
||||
crossbeam = "0.4"
|
||||
crossbeam-utils = "0.6"
|
||||
derive_more = "0.14.0"
|
||||
env_logger = { version = "0.5", optional = true }
|
||||
ethabi = "8.0"
|
||||
@@ -57,7 +57,7 @@ pod-account = { path = "pod-account" }
|
||||
trie-db = "0.12.4"
|
||||
patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" }
|
||||
rand = "0.6"
|
||||
rayon = "1.0"
|
||||
rayon = "1.1"
|
||||
rlp = "0.4.0"
|
||||
rlp_derive = { path = "../util/rlp-derive" }
|
||||
rustc-hex = "1.0"
|
||||
|
||||
@@ -19,7 +19,7 @@ kvdb = "0.1"
|
||||
log = "0.4"
|
||||
parity-bytes = "0.1"
|
||||
parking_lot = "0.7"
|
||||
rayon = "1.0"
|
||||
rayon = "1.1"
|
||||
rlp = "0.4.0"
|
||||
rlp_compress = { path = "../../util/rlp-compress" }
|
||||
rlp_derive = { path = "../../util/rlp-derive" }
|
||||
|
||||
@@ -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 {
|
||||
@@ -168,12 +166,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>,
|
||||
@@ -306,7 +298,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 {
|
||||
@@ -318,7 +310,7 @@ impl<Cost: CostType> Interpreter<Cost> {
|
||||
|
||||
/// Inner helper function for step.
|
||||
#[inline(always)]
|
||||
fn step_inner(&mut self, ext: &mut 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 => {
|
||||
@@ -333,22 +325,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;
|
||||
@@ -357,18 +355,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 {
|
||||
@@ -390,28 +389,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: &vm::Ext, instruction: Instruction, info: &InstructionInfo) -> vm::Result<()> {
|
||||
|
||||
208
ethcore/res/ethereum/ewc.json
Normal file
208
ethcore/res/ethereum/ewc.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
202
ethcore/res/ethereum/volta.json
Normal file
202
ethcore/res/ethereum/volta.json
Normal file
File diff suppressed because one or more lines are too long
@@ -57,9 +57,14 @@ pub fn new_poanet<'a, T: Into<SpecParams<'a>>>(params: T) -> Spec {
|
||||
load(params.into(), include_bytes!("../../res/ethereum/poacore.json"))
|
||||
}
|
||||
|
||||
/// Create a new Tobalaba mainnet chain spec.
|
||||
pub fn new_tobalaba<'a, T: Into<SpecParams<'a>>>(params: T) -> Spec {
|
||||
load(params.into(), include_bytes!("../../res/ethereum/tobalaba.json"))
|
||||
/// Create a new Volta mainnet chain spec.
|
||||
pub fn new_volta<'a, T: Into<SpecParams<'a>>>(params: T) -> Spec {
|
||||
load(params.into(), include_bytes!("../../res/ethereum/volta.json"))
|
||||
}
|
||||
|
||||
/// Create a new EWC mainnet chain spec.
|
||||
pub fn new_ewc<'a, T: Into<SpecParams<'a>>>(params: T) -> Spec {
|
||||
load(params.into(), include_bytes!("../../res/ethereum/ewc.json"))
|
||||
}
|
||||
|
||||
/// Create a new Expanse mainnet chain spec.
|
||||
|
||||
@@ -34,7 +34,7 @@ use externalities::*;
|
||||
use trace::{self, Tracer, VMTracer};
|
||||
use types::transaction::{Action, SignedTransaction};
|
||||
use transaction_ext::Transaction;
|
||||
use crossbeam;
|
||||
use crossbeam_utils::thread;
|
||||
pub use executed::{Executed, ExecutionResult};
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
@@ -977,11 +977,18 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
|
||||
if stack_depth != depth_threshold {
|
||||
self.call_with_stack_depth(params, substate, stack_depth, tracer, vm_tracer)
|
||||
} else {
|
||||
crossbeam::scope(|scope| {
|
||||
scope.builder().stack_size(::std::cmp::max(self.schedule.max_depth.saturating_sub(depth_threshold) * STACK_SIZE_PER_DEPTH, local_stack_size)).spawn(move || {
|
||||
self.call_with_stack_depth(params, substate, stack_depth, tracer, vm_tracer)
|
||||
}).expect("Sub-thread creation cannot fail; the host might run out of resources; qed")
|
||||
}).join().expect("Sub-thread never panics; qed")
|
||||
thread::scope(|scope| {
|
||||
let stack_size = cmp::max(self.schedule.max_depth.saturating_sub(depth_threshold) * STACK_SIZE_PER_DEPTH, local_stack_size);
|
||||
scope.builder()
|
||||
.stack_size(stack_size)
|
||||
.spawn(|_| {
|
||||
self.call_with_stack_depth(params, substate, stack_depth, tracer, vm_tracer)
|
||||
})
|
||||
.expect("Sub-thread creation cannot fail; the host might run out of resources; qed")
|
||||
.join()
|
||||
})
|
||||
.expect("Sub-thread never panics; qed")
|
||||
.expect("Sub-thread never panics; qed")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1061,11 +1068,18 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
|
||||
if stack_depth != depth_threshold {
|
||||
self.create_with_stack_depth(params, substate, stack_depth, tracer, vm_tracer)
|
||||
} else {
|
||||
crossbeam::scope(|scope| {
|
||||
scope.builder().stack_size(::std::cmp::max(self.schedule.max_depth.saturating_sub(depth_threshold) * STACK_SIZE_PER_DEPTH, local_stack_size)).spawn(move || {
|
||||
self.create_with_stack_depth(params, substate, stack_depth, tracer, vm_tracer)
|
||||
}).expect("Sub-thread creation cannot fail; the host might run out of resources; qed")
|
||||
}).join().expect("Sub-thread never panics; qed")
|
||||
thread::scope(|scope| {
|
||||
let stack_size = cmp::max(self.schedule.max_depth.saturating_sub(depth_threshold) * STACK_SIZE_PER_DEPTH, local_stack_size);
|
||||
scope.builder()
|
||||
.stack_size(stack_size)
|
||||
.spawn(|_| {
|
||||
self.create_with_stack_depth(params, substate, stack_depth, tracer, vm_tracer)
|
||||
})
|
||||
.expect("Sub-thread creation cannot fail; the host might run out of resources; qed")
|
||||
.join()
|
||||
})
|
||||
.expect("Sub-thread never panics; qed")
|
||||
.expect("Sub-thread never panics; qed")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ extern crate account_db;
|
||||
extern crate ansi_term;
|
||||
extern crate bn;
|
||||
extern crate common_types as types;
|
||||
extern crate crossbeam;
|
||||
extern crate crossbeam_utils;
|
||||
extern crate ethabi;
|
||||
extern crate ethash;
|
||||
extern crate ethcore_blockchain as blockchain;
|
||||
|
||||
@@ -859,7 +859,10 @@ impl Miner {
|
||||
fn prepare_and_update_sealing<C: miner::BlockChainClient>(&self, chain: &C) {
|
||||
use miner::MinerService;
|
||||
match self.engine.sealing_state() {
|
||||
SealingState::Ready => self.update_sealing(chain),
|
||||
SealingState::Ready => {
|
||||
self.maybe_enable_sealing();
|
||||
self.update_sealing(chain)
|
||||
}
|
||||
SealingState::External => {
|
||||
// this calls `maybe_enable_sealing()`
|
||||
if self.prepare_pending_block(chain) == BlockPreparationStatus::NotPrepared {
|
||||
|
||||
@@ -50,7 +50,7 @@ use self::io::SnapshotWriter;
|
||||
use super::state_db::StateDB;
|
||||
use super::state::Account as StateAccount;
|
||||
|
||||
use crossbeam::scope;
|
||||
use crossbeam_utils::thread;
|
||||
use rand::{Rng, rngs::OsRng};
|
||||
|
||||
pub use self::error::Error;
|
||||
@@ -167,9 +167,9 @@ pub fn take_snapshot<W: SnapshotWriter + Send>(
|
||||
|
||||
let version = chunker.current_version();
|
||||
let writer = Mutex::new(writer);
|
||||
let (state_hashes, block_hashes) = scope(|scope| -> Result<(Vec<H256>, Vec<H256>), Error> {
|
||||
let (state_hashes, block_hashes) = thread::scope(|scope| -> Result<(Vec<H256>, Vec<H256>), Error> {
|
||||
let writer = &writer;
|
||||
let block_guard = scope.spawn(move || {
|
||||
let block_guard = scope.spawn(move |_| {
|
||||
chunk_secondary(chunker, chain, block_hash, writer, p)
|
||||
});
|
||||
|
||||
@@ -181,7 +181,7 @@ pub fn take_snapshot<W: SnapshotWriter + Send>(
|
||||
let mut state_guards = Vec::with_capacity(num_threads as usize);
|
||||
|
||||
for thread_idx in 0..num_threads {
|
||||
let state_guard = scope.spawn(move || -> Result<Vec<H256>, Error> {
|
||||
let state_guard = scope.spawn(move |_| -> Result<Vec<H256>, Error> {
|
||||
let mut chunk_hashes = Vec::new();
|
||||
|
||||
for part in (thread_idx..SNAPSHOT_SUBPARTS).step_by(num_threads) {
|
||||
@@ -205,7 +205,7 @@ pub fn take_snapshot<W: SnapshotWriter + Send>(
|
||||
|
||||
debug!(target: "snapshot", "Took a snapshot of {} accounts", p.accounts.load(Ordering::SeqCst));
|
||||
Ok((state_hashes, block_hashes))
|
||||
})?;
|
||||
}).expect("Sub-thread never panics; qed")?;
|
||||
|
||||
info!(target: "snapshot", "produced {} state chunks and {} block chunks.", state_hashes.len(), block_hashes.len());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user