Suicides tracing (#1688)

* tracing suicide

* fixed #1635

* fixed typo
This commit is contained in:
Marek Kotewicz
2016-07-22 14:47:23 +02:00
committed by Gav Wood
parent ce00c13c7a
commit 63dbb527cc
8 changed files with 208 additions and 11 deletions

View File

@@ -18,7 +18,7 @@
use util::{Bytes, Address, U256};
use action_params::ActionParams;
use trace::trace::{Trace, Call, Create, Action, Res, CreateResult, CallResult, VMTrace, VMOperation, VMExecutedOperation, MemoryDiff, StorageDiff};
use trace::trace::{Trace, Call, Create, Action, Res, CreateResult, CallResult, VMTrace, VMOperation, VMExecutedOperation, MemoryDiff, StorageDiff, Suicide};
use trace::{Tracer, VMTracer};
/// Simple executive tracer. Traces all calls and creates. Ignores delegatecalls.
@@ -97,6 +97,20 @@ impl Tracer for ExecutiveTracer {
self.traces.push(trace);
}
fn trace_suicide(&mut self, address: Address, balance: U256, refund_address: Address, depth: usize) {
let trace = Trace {
depth: depth,
subs: vec![],
action: Action::Suicide(Suicide {
address: address,
refund_address: refund_address,
balance: balance,
}),
result: Res::None,
};
self.traces.push(trace);
}
fn subtracer(&self) -> Self {
ExecutiveTracer::default()
}

View File

@@ -81,6 +81,9 @@ pub trait Tracer: Send {
/// Stores failed create trace.
fn trace_failed_create(&mut self, create: Option<Create>, depth: usize, subs: Vec<Trace>);
/// Stores suicide info.
fn trace_suicide(&mut self, address: Address, balance: U256, refund_address: Address, depth: usize);
/// Spawn subtracer which will be used to trace deeper levels of execution.
fn subtracer(&self) -> Self where Self: Sized;

View File

@@ -55,6 +55,9 @@ impl Tracer for NoopTracer {
assert!(create.is_none(), "self.prepare_trace_create().is_none(): so we can't be tracing: qed");
}
fn trace_suicide(&mut self, _address: Address, _balance: U256, _refund_address: Address, _depth: usize) {
}
fn subtracer(&self) -> Self {
NoopTracer
}