Skip to content
Open
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
8 changes: 4 additions & 4 deletions crates/evm/src/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<E: Evm<Inspector: Clone, DB: DatabaseCommit>> TxTracer<E> {
mut f: F,
) -> TracerIter<'_, E, Txs::IntoIter, impl FnMut(TracingCtx<'_, T, E>) -> Result<O, E::Error>>
where
T: IntoTxEnv<E::Tx> + Clone,
for<'a> &'a T: IntoTxEnv<E::Tx>,
Txs: IntoIterator<Item = T>,
F: FnMut(TracingCtx<'_, Txs::Item, E>) -> O,
{
Expand All @@ -85,7 +85,7 @@ impl<E: Evm<Inspector: Clone, DB: DatabaseCommit>> TxTracer<E> {
hook: F,
) -> TracerIter<'_, E, Txs::IntoIter, F>
where
T: IntoTxEnv<E::Tx> + Clone,
for<'a> &'a T: IntoTxEnv<E::Tx>,
Txs: IntoIterator<Item = T>,
F: FnMut(TracingCtx<'_, T, E>) -> Result<O, Err>,
Err: From<E::Error>,
Expand Down Expand Up @@ -140,7 +140,7 @@ impl<E: Evm, Txs: Iterator, F> TracerIter<'_, E, Txs, F> {
impl<E, T, Txs, F, O, Err> Iterator for TracerIter<'_, E, Txs, F>
where
E: Evm<DB: DatabaseCommit, Inspector: Clone>,
T: IntoTxEnv<E::Tx> + Clone,
for<'a> &'a T: IntoTxEnv<E::Tx>,
Txs: Iterator<Item = T>,
Err: From<E::Error>,
F: FnMut(TracingCtx<'_, T, E>) -> Result<O, Err>,
Expand All @@ -149,7 +149,7 @@ where

fn next(&mut self) -> Option<Self::Item> {
let tx = self.txs.next()?;
let result = self.inner.evm.transact(tx.clone());
let result = self.inner.evm.transact(&tx);

let TxTracer { evm, fused_inspector } = self.inner;
let (db, inspector, _) = evm.components_mut();
Expand Down
16 changes: 16 additions & 0 deletions crates/evm/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ impl IntoTxEnv<Self> for TxEnv {
}
}

impl ToTxEnv<TxEnv> for &TxEnv {
fn to_tx_env(&self) -> TxEnv {
(*self).clone()
}
}

/// A helper trait to allow implementing [`IntoTxEnv`] for types that build transaction environment
/// by cloning data.
#[auto_impl::auto_impl(&)]
Expand Down Expand Up @@ -89,6 +95,16 @@ where
}
}

#[cfg(feature = "op")]
impl<T> ToTxEnv<op_revm::OpTransaction<T>> for &op_revm::OpTransaction<T>
where
op_revm::OpTransaction<T>: Clone,
{
fn to_tx_env(&self) -> op_revm::OpTransaction<T> {
(*self).clone()
}
}

/// Helper trait for building a transaction environment from a recovered transaction.
///
/// This trait enables the conversion of consensus transaction types (which have been recovered
Expand Down