Integrated VM tracing into JSONRPC.

This commit is contained in:
Gav Wood
2016-05-29 00:58:52 +02:00
parent 86fdcabd0e
commit cd16828fef
6 changed files with 44 additions and 8 deletions

View File

@@ -124,6 +124,7 @@ pub struct InstructionInfo {
pub side_effects: bool,
pub tier: GasPriceTier
}
impl InstructionInfo {
pub fn new(name: &'static str, additional: usize, args: usize, ret: usize, side_effects: bool, tier: GasPriceTier) -> InstructionInfo {
InstructionInfo {
@@ -139,7 +140,7 @@ impl InstructionInfo {
#[cfg_attr(rustfmt, rustfmt_skip)]
/// Return details about specific instruction
pub fn get_info (instruction: Instruction) -> InstructionInfo {
pub fn get_info(instruction: Instruction) -> InstructionInfo {
match instruction {
STOP => InstructionInfo::new("STOP", 0, 0, 0, true, GasPriceTier::Zero),
ADD => InstructionInfo::new("ADD", 0, 2, 1, false, GasPriceTier::VeryLow),

View File

@@ -33,3 +33,4 @@ pub use self::evm::{Evm, Error, Result};
pub use self::ext::{Ext, ContractCreateResult, MessageCallResult};
pub use self::factory::{Factory, VMType};
pub use self::schedule::Schedule;
pub use self::instructions::get_info;

View File

@@ -196,7 +196,7 @@ impl<'a> Executive<'a> {
};
// finalize here!
Ok(try!(self.finalize(t, substate, gas_left, output, tracer.traces().pop(), vm_tracer.drain())))
Ok(try!(self.finalize(t, substate, gas_left, output, tracer.traces().pop(), vm_tracer.drain().and_then(|mut i| i.subs.pop()))))
}
fn exec_vm<T, V>(

View File

@@ -139,3 +139,4 @@ mod tests;
mod json_tests;
pub use types::*;
pub use evm::get_info;

View File

@@ -106,7 +106,7 @@ impl Tracer for ExecutiveTracer {
}
}
/// Simple VM tracer. Traces all operations. Ignores delegatecalls.
/// Simple VM tracer. Traces all operations.
#[derive(Default)]
pub struct ExecutiveVMTracer {
data: VMTrace,