diff --git a/Cargo.toml b/Cargo.toml index f4267efa..773423a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,6 +63,6 @@ serde = { version = "1", default-features = false, features = ["derive"] } thiserror = { version = "2.0.0", default-features = false } serde_json = "1" -#[patch.crates-io] -#revm = { git = "https://github.com/bluealloy/revm", rev = "11b16259" } -#op-revm = { git = "https://github.com/bluealloy/revm", rev = "11b16259" } \ No newline at end of file +[patch.crates-io] +revm = { git = "https://github.com/bluealloy/revm", rev = "9008e93" } +op-revm = { git = "https://github.com/bluealloy/revm", rev = "9008e93" } diff --git a/crates/evm/src/either.rs b/crates/evm/src/either.rs index ba67ccc4..8461d7fa 100644 --- a/crates/evm/src/either.rs +++ b/crates/evm/src/either.rs @@ -45,6 +45,15 @@ where either::for_both!(self, evm => evm.transact(tx)) } + fn inspect_system_call( + &mut self, + caller: Address, + contract: Address, + data: Bytes, + ) -> Result, Self::Error> { + either::for_both!(self, evm => evm.inspect_system_call(caller, contract, data)) + } + fn transact_system_call( &mut self, caller: Address, diff --git a/crates/evm/src/eth/mod.rs b/crates/evm/src/eth/mod.rs index 53a12ccf..de0a0a85 100644 --- a/crates/evm/src/eth/mod.rs +++ b/crates/evm/src/eth/mod.rs @@ -14,7 +14,8 @@ use revm::{ interpreter::{interpreter::EthInterpreter, InterpreterResult}, precompile::{PrecompileSpecId, Precompiles}, primitives::hardfork::SpecId, - Context, ExecuteEvm, InspectEvm, Inspector, MainBuilder, MainContext, SystemCallEvm, + Context, ExecuteEvm, InspectEvm, InspectSystemCallEvm, Inspector, MainBuilder, MainContext, + SystemCallEvm, }; mod block; @@ -136,13 +137,22 @@ where } } + fn inspect_system_call( + &mut self, + caller: Address, + contract: Address, + data: Bytes, + ) -> Result, Self::Error> { + self.inner.inspect_system_call_with_caller(caller, contract, data) + } + fn transact_system_call( &mut self, caller: Address, contract: Address, data: Bytes, ) -> Result, Self::Error> { - self.inner.transact_system_call_with_caller_finalize(caller, contract, data) + self.inner.system_call_with_caller(caller, contract, data) } fn finish(self) -> (Self::DB, EvmEnv) { diff --git a/crates/evm/src/evm.rs b/crates/evm/src/evm.rs index 104f15d2..f1aac75d 100644 --- a/crates/evm/src/evm.rs +++ b/crates/evm/src/evm.rs @@ -88,6 +88,18 @@ pub trait Evm { self.transact_raw(tx.into_tx_env()) } + /// Inspects a system call without committing state changes. + /// + /// This method executes a system call with inspection enabled, allowing observation of the + /// execution without modifying the underlying state. Similar to [`Evm::transact_system_call`] + /// but returns the result with state changes that can be examined or discarded. + fn inspect_system_call( + &mut self, + caller: Address, + contract: Address, + data: Bytes, + ) -> Result, Self::Error>; + /// Executes a system call. /// /// Note: this will only keep the target `contract` in the state. This is done because revm is diff --git a/crates/op-evm/src/lib.rs b/crates/op-evm/src/lib.rs index e5d52cf2..3ffd64f2 100644 --- a/crates/op-evm/src/lib.rs +++ b/crates/op-evm/src/lib.rs @@ -25,7 +25,7 @@ use revm::{ handler::{instructions::EthInstructions, PrecompileProvider}, inspector::NoOpInspector, interpreter::{interpreter::EthInterpreter, InterpreterResult}, - Context, ExecuteEvm, InspectEvm, Inspector, SystemCallEvm, + Context, ExecuteEvm, InspectEvm, InspectSystemCallEvm, Inspector, SystemCallEvm, }; pub mod block; @@ -116,13 +116,22 @@ where } } + fn inspect_system_call( + &mut self, + caller: Address, + contract: Address, + data: Bytes, + ) -> Result, Self::Error> { + self.inner.inspect_system_call_with_caller(caller, contract, data) + } + fn transact_system_call( &mut self, caller: Address, contract: Address, data: Bytes, ) -> Result, Self::Error> { - self.inner.transact_system_call_with_caller_finalize(caller, contract, data) + self.inner.system_call_with_caller(caller, contract, data) } fn finish(self) -> (Self::DB, EvmEnv) {