Skip to content

Commit 48b95f9

Browse files
authored
feat: implement EOF methods in Inspector trait (#8123)
* feat: implement EOF methods in Inspector trait * create and eofcreate refactored * create_end and eofcreate_end refactored * log_debug_fn * move allow_cheatcodes_fn from CreateParams to create_common arg * pass caller value * fix tests that require modified CreateInputs.caller to be propagated * use FnMut bounds for closures and remove dyn aliases * fix end_common * fix tests * log_debug_fn uses CreateScheme instead of full input * introduce CommonCreateInput trait * introduce CommonEndInput trait * recover referecens to ecx.inner * end_common -> create_end_common and docs * move legacy/EOF traits and types to inspector::utils * updates for latest revm * add missing inspector::utils mod def * fix build
1 parent b3c872b commit 48b95f9

File tree

4 files changed

+465
-228
lines changed

4 files changed

+465
-228
lines changed

crates/anvil/src/eth/backend/mem/inspector.rs

+32-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ use foundry_evm::{
77
decode::decode_console_logs,
88
inspectors::{LogCollector, TracingInspector},
99
revm::{
10-
interpreter::{CallInputs, CallOutcome, CreateInputs, CreateOutcome, Interpreter},
10+
interpreter::{
11+
CallInputs, CallOutcome, CreateInputs, CreateOutcome, EOFCreateInputs, Interpreter,
12+
},
1113
primitives::U256,
1214
EvmContext,
1315
},
@@ -117,6 +119,35 @@ impl<DB: Database> revm::Inspector<DB> for Inspector {
117119
outcome
118120
}
119121

122+
#[inline]
123+
fn eofcreate(
124+
&mut self,
125+
ecx: &mut EvmContext<DB>,
126+
inputs: &mut EOFCreateInputs,
127+
) -> Option<CreateOutcome> {
128+
if let Some(tracer) = &mut self.tracer {
129+
if let Some(out) = tracer.eofcreate(ecx, inputs) {
130+
return Some(out);
131+
}
132+
}
133+
None
134+
}
135+
136+
#[inline]
137+
fn eofcreate_end(
138+
&mut self,
139+
ecx: &mut EvmContext<DB>,
140+
inputs: &EOFCreateInputs,
141+
outcome: CreateOutcome,
142+
) -> CreateOutcome {
143+
if let Some(tracer) = &mut self.tracer {
144+
return tracer.eofcreate_end(ecx, inputs, outcome);
145+
}
146+
147+
outcome
148+
}
149+
150+
#[inline]
120151
fn selfdestruct(&mut self, contract: Address, target: Address, value: U256) {
121152
if let Some(tracer) = &mut self.tracer {
122153
revm::Inspector::<DB>::selfdestruct(tracer, contract, target, value);

0 commit comments

Comments
 (0)