Skip to content

chore: relax tracer bounds #11024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2025
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
12 changes: 4 additions & 8 deletions crates/anvil/src/eth/backend/mem/inspector.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
//! Anvil specific [`revm::Inspector`] implementation

use crate::eth::macros::node_info;
use alloy_evm::eth::EthEvmContext;
use alloy_primitives::{Address, Log, U256};
use foundry_evm::{
backend::DatabaseError,
call_inspectors,
decode::decode_console_logs,
inspectors::{LogCollector, TracingInspector},
Expand All @@ -13,7 +11,7 @@ use foundry_evm::{
},
};
use revm::{
Database, Inspector,
Inspector,
context::ContextTr,
inspector::JournalExt,
interpreter::{
Expand Down Expand Up @@ -108,11 +106,9 @@ fn print_traces(tracer: TracingInspector) {
node_info!("{}", render_trace_arena_inner(&traces, false, true));
}

impl<CTX, D> Inspector<CTX, EthInterpreter> for AnvilInspector
impl<CTX> Inspector<CTX, EthInterpreter> for AnvilInspector
where
D: Database<Error = DatabaseError>,
CTX: ContextTr<Db = D>,
CTX::Journal: JournalExt,
CTX: ContextTr<Journal: JournalExt>,
{
fn initialize_interp(&mut self, interp: &mut Interpreter, ecx: &mut CTX) {
call_inspectors!([&mut self.tracer], |inspector| {
Expand Down Expand Up @@ -172,7 +168,7 @@ where
#[inline]
fn selfdestruct(&mut self, contract: Address, target: Address, value: U256) {
if let Some(tracer) = &mut self.tracer {
Inspector::<EthEvmContext<D>>::selfdestruct(tracer, contract, target, value);
<TracingInspector as Inspector<CTX>>::selfdestruct(tracer, contract, target, value);
}
}
}
Expand Down
15 changes: 5 additions & 10 deletions crates/evm/evm/src/inspectors/logs.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
use alloy_primitives::Log;
use alloy_sol_types::{SolEvent, SolInterface, SolValue};
use foundry_common::{ErrorExt, fmt::ConsoleFmt};
use foundry_evm_core::{
InspectorExt, abi::console, backend::DatabaseError, constants::HARDHAT_CONSOLE_ADDRESS,
};
use foundry_evm_core::{InspectorExt, abi::console, constants::HARDHAT_CONSOLE_ADDRESS};
use revm::{
Database, Inspector,
Inspector,
context::ContextTr,
inspector::JournalExt,
interpreter::{
CallInputs, CallOutcome, Gas, InstructionResult, Interpreter, InterpreterResult,
interpreter::EthInterpreter,
Expand All @@ -27,7 +24,7 @@ impl LogCollector {
#[cold]
fn do_hardhat_log<CTX>(&mut self, context: &mut CTX, inputs: &CallInputs) -> Option<CallOutcome>
where
CTX: ContextTr<Db: Database<Error = DatabaseError>, Journal: JournalExt>,
CTX: ContextTr,
{
if let Err(err) = self.hardhat_log(&inputs.input.bytes(context)) {
let result = InstructionResult::Revert;
Expand All @@ -47,11 +44,9 @@ impl LogCollector {
}
}

impl<CTX, D> Inspector<CTX, EthInterpreter> for LogCollector
impl<CTX> Inspector<CTX, EthInterpreter> for LogCollector
where
D: Database<Error = DatabaseError>,
CTX: ContextTr<Db = D>,
CTX::Journal: JournalExt,
CTX: ContextTr,
{
fn log(&mut self, _interp: &mut Interpreter, _context: &mut CTX, log: Log) {
self.logs.push(log);
Expand Down
Loading