openethereum/ethcore/trace/src/noop_tracer.rs

50 lines
1.7 KiB
Rust
Raw Normal View History

// 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/>.
//! Nonoperative tracer.
use ethereum_types::{U256, Address};
2018-10-02 16:33:19 +02:00
use vm::{Error as VmError, ActionParams};
Move more code into state-account (#10840) * WIP move errors, pod_account and state account to own crates * Sort out dependencies, fix broken code and tests Remove botched ethcore-error crate * remove template line * fix review feedback * Remove test-only AccountDBMut::new * Extract AccountDB to account-db * Move Substate to state-account – wip * Add lib.rs * cleanup * test failure * test failure 2 * third time's the charm * Add factories crate * Use new factories crate * Use factories crate * Extract trace * Fix tests * Sort out parity-util-mem and parking_lot * cleanup * WIP port over the rest of state from ethcore * Collect all impls for Machine * some notes * Rename pod-account to pod * Move PodState to pod crate * Use PodState from pod crate * Fix use clause for json tests * Sort out evmbin * Add missing code and use PodState * Move code that depends on Machine and Executive to own module * Sort out cloning errors, fix ethcore to use new state crate * Do without funky From impls * Fix ethcore tests * Fixes around the project to use new state crate * Add back the more specific impls of StateOrBlock From conversions * Move execute to freestanding function and remove it from trait Sort out the error handling in executive_state by moving the result types from state to ethcore Undo the verbose code added to work around the StateOrBlock From conversions * cleanup * Fix "error: enum variants on type aliases are experimental" * Bring back the state tests Fix whitespace * remove ethcore/state/mod.rs * cleanup * cleanup * Cleanup state-account errors * Fix more todos Add module docs * Add error.rs * Fixup Cargo.lock * Smaller ethcore API is fine * Add `to-pod-full` feature to state-account Fix evmbin * Fix a few more test failures * Fix RPC test build * Baptize the new trait * Remove resolved TODOs * Rename state-account to account-state * Do not re-export the trace crate * Don't export state_db from ethcore * Let private-tx use StateDB. :( * Remove ethcore/src/pod_state.rs * Inner type does not need to be pub/pub(crate) * optimise imports * Revert "Inner type does not need to be pub/pub(crate)" This reverts commit 2f839f8a0f72f71334da64620f57e6dd6039f06b. * Move DatabaseExtras to ethcore-blockchain * Add database_extra module to ethcore-blockchain * Remove to-pod-full feature * Sort out the merge * sort imports * address grumbles * rename crate * address more grumbles
2019-07-08 18:17:48 +02:00
use crate::{
Tracer, VMTracer, FlatTrace,
trace::{VMTrace, RewardType}
};
/// Nonoperative tracer. Does not trace anything.
pub struct NoopTracer;
impl Tracer for NoopTracer {
2017-10-20 15:40:25 +02:00
type Output = FlatTrace;
2018-10-02 16:33:19 +02:00
fn prepare_trace_call(&mut self, _: &ActionParams, _: usize, _: bool) { }
fn prepare_trace_create(&mut self, _: &ActionParams) { }
fn done_trace_call(&mut self, _: U256, _: &[u8]) { }
fn done_trace_create(&mut self, _: U256, _: &[u8], _: Address) { }
fn done_trace_failed(&mut self, _: &VmError) { }
fn trace_suicide(&mut self, _: Address, _: U256, _: Address) { }
fn trace_reward(&mut self, _: Address, _: U256, _: RewardType) { }
fn drain(self) -> Vec<FlatTrace> { vec![] }
}
/// Nonoperative VM tracer. Does not trace anything.
pub struct NoopVMTracer;
impl VMTracer for NoopVMTracer {
2017-10-20 15:40:25 +02:00
type Output = VMTrace;
fn drain(self) -> Option<VMTrace> { None }
}