diff --git a/crates/provider/src/traits/provider.rs b/crates/provider/src/traits/provider.rs index 324cfdda2..a49901cd0 100644 --- a/crates/provider/src/traits/provider.rs +++ b/crates/provider/src/traits/provider.rs @@ -6,8 +6,8 @@ use ethers::{ providers::ProviderError, types::{ transaction::eip2718::TypedTransaction, Address, Block, BlockId, Bytes, Filter, - GethDebugTracingOptions, GethTrace, Log, Transaction, TransactionReceipt, TxHash, H256, - U256, + GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, Log, Transaction, + TransactionReceipt, TxHash, H256, U256, }, }; #[cfg(feature = "test-utils")] @@ -83,6 +83,14 @@ pub trait Provider: Send + Sync + 'static { trace_options: GethDebugTracingOptions, ) -> Result; + /// Debug trace a call + async fn debug_trace_call( + &self, + tx: TypedTransaction, + block_id: Option, + trace_options: GethDebugTracingCallOptions, + ) -> Result; + /// Get the latest block hash async fn get_latest_block_hash(&self) -> anyhow::Result; diff --git a/crates/rundler/src/common/simulation.rs b/crates/rundler/src/common/simulation.rs index 4d455123d..fb16c9bdb 100644 --- a/crates/rundler/src/common/simulation.rs +++ b/crates/rundler/src/common/simulation.rs @@ -12,7 +12,7 @@ use ethers::{ use indexmap::IndexSet; #[cfg(test)] use mockall::automock; -use rundler_provider::{AggregatorOut, AggregatorSimOut, EntryPoint, Provider}; +use rundler_provider::{AggregatorOut, AggregatorSimOut, Provider}; use rundler_types::{contracts::i_entry_point::FailedOp, Entity, EntityType, UserOperation}; use tonic::async_trait; @@ -72,7 +72,7 @@ pub trait Simulator: Send + Sync + 'static { } #[derive(Debug)] -pub struct SimulatorImpl { +pub struct SimulatorImpl { provider: Arc

, entry_point_address: Address, simulate_validation_tracer: T, @@ -82,7 +82,7 @@ pub struct SimulatorImpl { impl SimulatorImpl where - P: ProviderLike, + P: Provider, T: SimulateValidationTracer, { pub fn new( @@ -388,7 +388,7 @@ where #[async_trait] impl Simulator for SimulatorImpl where - P: ProviderLike, + P: Provider, T: SimulateValidationTracer, { async fn simulate_validation( @@ -689,18 +689,16 @@ mod tests { use ethers::{ abi::AbiEncode, providers::{JsonRpcError, MockError, ProviderError}, - types::{Address, BlockNumber}, + types::{Address, BlockNumber, Bytes}, utils::hex, }; + use rundler_provider::{AggregatorOut, MockProvider}; use super::*; - use crate::common::{ - tracer::{MockSimulateValidationTracer, Phase}, - types::MockProviderLike, - }; + use crate::common::tracer::{MockSimulateValidationTracer, Phase}; - fn create_base_config() -> (MockProviderLike, MockSimulateValidationTracer) { - (MockProviderLike::new(), MockSimulateValidationTracer::new()) + fn create_base_config() -> (MockProvider, MockSimulateValidationTracer) { + (MockProvider::new(), MockSimulateValidationTracer::new()) } fn get_test_tracer_output() -> SimulationTracerOutput { @@ -783,9 +781,9 @@ mod tests { } fn create_simulator( - provider: MockProviderLike, + provider: MockProvider, simulate_validation_tracer: MockSimulateValidationTracer, - ) -> SimulatorImpl { + ) -> SimulatorImpl { let settings = Settings::default(); let mut mempool_configs = HashMap::new(); @@ -793,7 +791,7 @@ mod tests { let provider = Arc::new(provider); - let simulator: SimulatorImpl = + let simulator: SimulatorImpl = SimulatorImpl::new( Arc::clone(&provider), Address::from_str("0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789").unwrap(), diff --git a/crates/rundler/src/common/tracer.rs b/crates/rundler/src/common/tracer.rs index cf6c41f6b..9eb05426c 100644 --- a/crates/rundler/src/common/tracer.rs +++ b/crates/rundler/src/common/tracer.rs @@ -5,11 +5,6 @@ use std::{ sync::Arc, }; -use anyhow::{bail, Context}; -use ethers::types::{ - transaction::eip2718::TypedTransaction, Address, BlockId, GethDebugTracerType, - GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, U256, -}; use anyhow::{bail, Context}; use ethers::types::{ Address, BlockId, GethDebugTracerType, GethDebugTracingCallOptions, GethDebugTracingOptions, @@ -19,15 +14,10 @@ use ethers::types::{ use mockall::automock; use rundler_provider::{EntryPoint, Provider}; use rundler_types::UserOperation; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde::{Deserialize, Serialize}; use tonic::async_trait; -use super::{ - context::LogWithContext, - types::{EntryPointLike, ProviderLike}, -}; -use crate::common::types::{ExpectedStorage, UserOperation}; +use crate::common::types::ExpectedStorage; #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] @@ -104,8 +94,8 @@ pub trait SimulateValidationTracer: Send + Sync + 'static { #[derive(Debug)] pub struct SimulateValidationTracerImpl where - P: ProviderLike, - E: EntryPointLike, + P: Provider, + E: EntryPoint, { provider: Arc

, entry_point: E, @@ -117,8 +107,8 @@ where #[async_trait] impl SimulateValidationTracer for SimulateValidationTracerImpl where - P: ProviderLike, - E: EntryPointLike, + P: Provider, + E: EntryPoint, { async fn trace_simulate_validation( &self, @@ -153,8 +143,8 @@ where impl SimulateValidationTracerImpl where - P: ProviderLike, - E: EntryPointLike, + P: Provider, + E: EntryPoint, { pub fn new(provider: Arc

, entry_point: E) -> Self { Self {