diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 4be437c364..cfc3cf98de 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -608,6 +608,9 @@ impl<'a, GSPEC: Spec, DB: Database + 'a, const INSPECT: bool> Host } fn log(&mut self, address: H160, topics: Vec, data: Bytes) { + if INSPECT { + self.inspector.log(&mut self.data, &address, &topics, &data); + } let log = Log { address, topics, diff --git a/crates/revm/src/inspector.rs b/crates/revm/src/inspector.rs index 47b50e8187..1e1db4e85f 100644 --- a/crates/revm/src/inspector.rs +++ b/crates/revm/src/inspector.rs @@ -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; @@ -36,6 +36,16 @@ pub trait Inspector { 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.