Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/revm/src/evm_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,9 @@ impl<'a, GSPEC: Spec, DB: Database + 'a, const INSPECT: bool> Host
}

fn log(&mut self, address: H160, topics: Vec<H256>, data: Bytes) {
if INSPECT {
self.inspector.log(&mut self.data, &address, &topics, &data);
}
let log = Log {
address,
topics,
Expand Down
12 changes: 11 additions & 1 deletion crates/revm/src/inspector.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use bytes::Bytes;
use primitive_types::H160;
use primitive_types::{H160, H256};

use crate::{evm_impl::EVMData, CallInputs, CreateInputs, Database, Gas, Interpreter, Return};
use auto_impl::auto_impl;
Expand Down Expand Up @@ -36,6 +36,16 @@ pub trait Inspector<DB: Database> {
Return::Continue
}

/// Called when a log is emitted.
fn log(
&mut self,
_evm_data: &mut EVMData<'_, DB>,
_address: &H160,
_topics: &[H256],
_data: &Bytes,
) {
}

/// Called after `step` when the instruction has been executed.
///
/// Returning anything other than [Return::Continue] alters the execution of the interpreter.
Expand Down