Merge branch 'master' into txtracingforcall
This commit is contained in:
@@ -22,7 +22,7 @@ ethcore-util = { path = "../util" }
|
||||
evmjit = { path = "../evmjit", optional = true }
|
||||
ethash = { path = "../ethash" }
|
||||
num_cpus = "0.2"
|
||||
clippy = { version = "0.0.69", optional = true}
|
||||
clippy = { version = "0.0.71", optional = true}
|
||||
crossbeam = "0.2.9"
|
||||
lazy_static = "0.1"
|
||||
ethcore-devtools = { path = "../devtools" }
|
||||
|
||||
@@ -371,9 +371,27 @@ impl<V> Client<V> where V: Verifier {
|
||||
return Some(self.state())
|
||||
}
|
||||
|
||||
self.block_header(id).map(|header| {
|
||||
let block_number = match self.block_number(id.clone()) {
|
||||
Some(num) => num,
|
||||
None => return None,
|
||||
};
|
||||
|
||||
self.block_header(id).and_then(|header| {
|
||||
let db = self.state_db.lock().unwrap().boxed_clone();
|
||||
State::from_existing(db, HeaderView::new(&header).state_root(), self.engine.account_start_nonce())
|
||||
|
||||
// early exit for pruned blocks
|
||||
if db.is_pruned() && self.chain.best_block_number() >= block_number + HISTORY {
|
||||
return None;
|
||||
}
|
||||
|
||||
let root = HeaderView::new(&header).state_root();
|
||||
|
||||
// TODO [rob]: refactor State::from_existing so we avoid doing redundant lookups.
|
||||
if !db.contains(&root) {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(State::from_existing(db, root, self.engine.account_start_nonce()))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
///! Rust VM implementation
|
||||
|
||||
use common::*;
|
||||
use trace::VMTracer;
|
||||
use super::instructions as instructions;
|
||||
use super::instructions::{Instruction, get_info};
|
||||
use std::marker::Copy;
|
||||
|
||||
@@ -81,14 +81,14 @@ impl<'a> Executive<'a> {
|
||||
}
|
||||
|
||||
/// Creates `Externalities` from `Executive`.
|
||||
pub fn as_externalities<'_, T, V>(
|
||||
&'_ mut self,
|
||||
pub fn as_externalities<'any, T, V>(
|
||||
&'any mut self,
|
||||
origin_info: OriginInfo,
|
||||
substate: &'_ mut Substate,
|
||||
output: OutputPolicy<'_, '_>,
|
||||
tracer: &'_ mut T,
|
||||
vm_tracer: &'_ mut V
|
||||
) -> Externalities<'_, T, V> where T: Tracer, V: VMTracer {
|
||||
substate: &'any mut Substate,
|
||||
output: OutputPolicy<'any, 'any>,
|
||||
tracer: &'any mut T,
|
||||
vm_tracer: &'any mut V
|
||||
) -> Externalities<'any, T, V> where T: Tracer, V: VMTracer {
|
||||
Externalities::new(self.state, self.info, self.engine, self.vm_factory, self.depth, origin_info, substate, output, tracer, vm_tracer)
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,8 @@ declare_test!{BlockchainTests_bcForkStressTest, "BlockchainTests/bcForkStressTes
|
||||
declare_test!{BlockchainTests_bcForkUncle, "BlockchainTests/bcForkUncle"}
|
||||
declare_test!{BlockchainTests_bcGasPricerTest, "BlockchainTests/bcGasPricerTest"}
|
||||
declare_test!{BlockchainTests_bcInvalidHeaderTest, "BlockchainTests/bcInvalidHeaderTest"}
|
||||
declare_test!{BlockchainTests_bcInvalidRLPTest, "BlockchainTests/bcInvalidRLPTest"}
|
||||
// TODO [ToDr] Ignored because of incorrect JSON (https://github.com/ethereum/tests/pull/113)
|
||||
declare_test!{ignore => BlockchainTests_bcInvalidRLPTest, "BlockchainTests/bcInvalidRLPTest"}
|
||||
declare_test!{BlockchainTests_bcMultiChainTest, "BlockchainTests/bcMultiChainTest"}
|
||||
declare_test!{BlockchainTests_bcRPC_API_Test, "BlockchainTests/bcRPC_API_Test"}
|
||||
declare_test!{BlockchainTests_bcStateTest, "BlockchainTests/bcStateTest"}
|
||||
|
||||
@@ -26,7 +26,8 @@ declare_test!{BlockchainTests_Homestead_bcBlockGasLimitTest, "BlockchainTests/Ho
|
||||
declare_test!{BlockchainTests_Homestead_bcForkStressTest, "BlockchainTests/Homestead/bcForkStressTest"}
|
||||
declare_test!{BlockchainTests_Homestead_bcGasPricerTest, "BlockchainTests/Homestead/bcGasPricerTest"}
|
||||
declare_test!{BlockchainTests_Homestead_bcInvalidHeaderTest, "BlockchainTests/Homestead/bcInvalidHeaderTest"}
|
||||
declare_test!{BlockchainTests_Homestead_bcInvalidRLPTest, "BlockchainTests/Homestead/bcInvalidRLPTest"}
|
||||
// TODO [ToDr] Ignored because of incorrect JSON (https://github.com/ethereum/tests/pull/113)
|
||||
declare_test!{ignore => BlockchainTests_Homestead_bcInvalidRLPTest, "BlockchainTests/Homestead/bcInvalidRLPTest"}
|
||||
declare_test!{BlockchainTests_Homestead_bcMultiChainTest, "BlockchainTests/Homestead/bcMultiChainTest"}
|
||||
declare_test!{BlockchainTests_Homestead_bcRPC_API_Test, "BlockchainTests/Homestead/bcRPC_API_Test"}
|
||||
declare_test!{BlockchainTests_Homestead_bcStateTest, "BlockchainTests/Homestead/bcStateTest"}
|
||||
|
||||
@@ -20,7 +20,7 @@ use std::sync::atomic::AtomicBool;
|
||||
use util::*;
|
||||
use util::keys::store::{AccountProvider};
|
||||
use views::{BlockView, HeaderView};
|
||||
use client::{MiningBlockChainClient, Executive, Executed, EnvInfo, TransactOptions, BlockChainClient, BlockID, CallAnalytics};
|
||||
use client::{MiningBlockChainClient, Executive, Executed, EnvInfo, TransactOptions, BlockID, CallAnalytics};
|
||||
use block::{ClosedBlock, IsBlock};
|
||||
use error::*;
|
||||
use transaction::SignedTransaction;
|
||||
@@ -282,7 +282,7 @@ impl MinerService for Miner {
|
||||
}
|
||||
let options = TransactOptions { tracing: analytics.transaction_tracing, vm_tracing: analytics.vm_tracing, check_nonce: false };
|
||||
let mut ret = Executive::new(&mut state, &env_info, self.engine(), chain.vm_factory()).transact(t, options);
|
||||
|
||||
|
||||
// TODO gav move this into Executive.
|
||||
if analytics.state_diffing {
|
||||
if let Ok(ref mut x) = ret {
|
||||
|
||||
@@ -287,7 +287,7 @@ impl State {
|
||||
fn query_pod(&mut self, query: &PodState) {
|
||||
for (ref address, ref pod_account) in query.get() {
|
||||
if self.get(address, true).is_some() {
|
||||
for (ref key, _) in &pod_account.storage {
|
||||
for key in pod_account.storage.keys() {
|
||||
self.storage_at(address, key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ impl VMTracer for ExecutiveVMTracer {
|
||||
self.data.operations.push(VMOperation {
|
||||
pc: pc,
|
||||
instruction: instruction,
|
||||
gas_cost: gas_cost.clone(),
|
||||
gas_cost: gas_cost.clone(),
|
||||
executed: None,
|
||||
});
|
||||
true
|
||||
@@ -133,10 +133,10 @@ impl VMTracer for ExecutiveVMTracer {
|
||||
self.data.operations.last_mut().expect("trace_executed is always called after a trace_prepare_execute").executed = Some(ex);
|
||||
}
|
||||
|
||||
fn prepare_subtrace(&self, code: &Bytes) -> Self {
|
||||
fn prepare_subtrace(&self, code: &[u8]) -> Self {
|
||||
ExecutiveVMTracer { data: VMTrace {
|
||||
parent_step: self.data.operations.len(),
|
||||
code: code.clone(),
|
||||
code: code.to_vec(),
|
||||
operations: vec![],
|
||||
subs: vec![],
|
||||
}}
|
||||
|
||||
@@ -98,7 +98,7 @@ pub trait VMTracer: Send {
|
||||
fn trace_executed(&mut self, _gas_used: U256, _stack_push: &[U256], _mem_diff: Option<(usize, &[u8])>, _store_diff: Option<(U256, U256)>) {}
|
||||
|
||||
/// Spawn subtracer which will be used to trace deeper levels of execution.
|
||||
fn prepare_subtrace(&self, code: &Bytes) -> Self where Self: Sized;
|
||||
fn prepare_subtrace(&self, code: &[u8]) -> Self where Self: Sized;
|
||||
|
||||
/// Spawn subtracer which will be used to trace deeper levels of execution.
|
||||
fn done_subtrace(&mut self, sub: Self) where Self: Sized;
|
||||
|
||||
@@ -75,7 +75,7 @@ impl VMTracer for NoopVMTracer {
|
||||
fn trace_executed(&mut self, _gas_used: U256, _stack_push: &[U256], _mem_diff: Option<(usize, &[u8])>, _store_diff: Option<(U256, U256)>) {}
|
||||
|
||||
/// Spawn subtracer which will be used to trace deeper levels of execution.
|
||||
fn prepare_subtrace(&self, _code: &Bytes) -> Self { NoopVMTracer }
|
||||
fn prepare_subtrace(&self, _code: &[u8]) -> Self { NoopVMTracer }
|
||||
|
||||
/// Spawn subtracer which will be used to trace deeper levels of execution.
|
||||
fn done_subtrace(&mut self, _sub: Self) {}
|
||||
|
||||
Reference in New Issue
Block a user