diff --git a/crates/provider/src/alloy/da/arbitrum.rs b/crates/provider/src/alloy/da/arbitrum.rs index a76c4b385..87e13eff8 100644 --- a/crates/provider/src/alloy/da/arbitrum.rs +++ b/crates/provider/src/alloy/da/arbitrum.rs @@ -16,6 +16,7 @@ use alloy_provider::Provider as AlloyProvider; use alloy_sol_types::sol; use alloy_transport::Transport; use rundler_types::da::{DAGasBlockData, DAGasUOData}; +use tracing::instrument; use NodeInterface::NodeInterfaceInstance; use super::DAGasOracle; @@ -62,6 +63,7 @@ where AP: AlloyProvider, T: Transport + Clone, { + #[instrument(skip(self))] async fn estimate_da_gas( &self, uo_data: Bytes, diff --git a/crates/provider/src/alloy/da/local/bedrock.rs b/crates/provider/src/alloy/da/local/bedrock.rs index 275fa565f..15d08088f 100644 --- a/crates/provider/src/alloy/da/local/bedrock.rs +++ b/crates/provider/src/alloy/da/local/bedrock.rs @@ -20,7 +20,7 @@ use reth_tasks::pool::BlockingTaskPool; use rundler_types::da::{BedrockDAGasBlockData, BedrockDAGasUOData, DAGasBlockData, DAGasUOData}; use rundler_utils::cache::LruMap; use tokio::sync::Mutex as TokioMutex; -use tracing::error; +use tracing::{error, instrument}; use super::multicall::{self, Multicall::MulticallInstance, MULTICALL_BYTECODE}; use crate::{ @@ -72,6 +72,7 @@ where AP: AlloyProvider, T: Transport + Clone, { + #[instrument(skip(self))] async fn estimate_da_gas( &self, data: Bytes, @@ -93,6 +94,7 @@ where AP: AlloyProvider, T: Transport + Clone, { + #[instrument(skip(self))] async fn block_data(&self, block: BlockHashOrNumber) -> ProviderResult { let mut cache = self.block_data_cache.lock().await; match cache.get(&block) { @@ -105,6 +107,7 @@ where } } + #[instrument(skip(self, uo_data))] async fn uo_data( &self, uo_data: Bytes, @@ -147,6 +150,7 @@ where AP: AlloyProvider, T: Transport + Clone, { + #[instrument(skip(self))] async fn is_fjord(&self) -> bool { self.oracle .isFjord() @@ -157,6 +161,7 @@ where .unwrap_or(true) // Fail-open. Assume fjord if we can't check, so this can be used downstream in asserts w/o panic on RPC errors. } + #[instrument(skip(self))] async fn get_block_data( &self, block: BlockHashOrNumber, @@ -230,6 +235,7 @@ where }) } + #[instrument(skip(self, data))] async fn get_uo_data(&self, data: Bytes) -> ProviderResult { // Blocking call compressing potentially a lot of data. // Generally takes more than 100µs so should be spawned on blocking threadpool. diff --git a/crates/provider/src/alloy/da/local/nitro.rs b/crates/provider/src/alloy/da/local/nitro.rs index 2af5a4596..8247c0514 100644 --- a/crates/provider/src/alloy/da/local/nitro.rs +++ b/crates/provider/src/alloy/da/local/nitro.rs @@ -18,6 +18,7 @@ use anyhow::Context; use rundler_types::da::{DAGasBlockData, DAGasUOData, NitroDAGasBlockData, NitroDAGasUOData}; use rundler_utils::cache::LruMap; use tokio::sync::Mutex as TokioMutex; +use tracing::instrument; use crate::{ alloy::da::arbitrum::NodeInterface::NodeInterfaceInstance, BlockHashOrNumber, DAGasOracle, @@ -55,6 +56,7 @@ where AP: AlloyProvider, T: Transport + Clone, { + #[instrument(skip(self))] async fn estimate_da_gas( &self, data: Bytes, @@ -103,6 +105,7 @@ where AP: AlloyProvider, T: Transport + Clone, { + #[instrument(skip(self))] async fn block_data(&self, block: BlockHashOrNumber) -> ProviderResult { let mut cache = self.block_data_cache.lock().await; match cache.get(&block) { @@ -115,6 +118,7 @@ where } } + #[instrument(skip(self))] async fn uo_data( &self, uo_data: Bytes, diff --git a/crates/provider/src/alloy/da/optimism.rs b/crates/provider/src/alloy/da/optimism.rs index ac8d1680c..88829f24e 100644 --- a/crates/provider/src/alloy/da/optimism.rs +++ b/crates/provider/src/alloy/da/optimism.rs @@ -17,6 +17,7 @@ use alloy_sol_types::sol; use alloy_transport::Transport; use anyhow::Context; use rundler_types::da::{DAGasBlockData, DAGasUOData}; +use tracing::instrument; use GasPriceOracle::GasPriceOracleInstance; use super::DAGasOracle; @@ -58,6 +59,7 @@ where AP: AlloyProvider, T: Transport + Clone, { + #[instrument(skip(self))] async fn estimate_da_gas( &self, data: Bytes, diff --git a/crates/provider/src/alloy/entry_point/v0_6.rs b/crates/provider/src/alloy/entry_point/v0_6.rs index 2d53dd2d1..e9541e27a 100644 --- a/crates/provider/src/alloy/entry_point/v0_6.rs +++ b/crates/provider/src/alloy/entry_point/v0_6.rs @@ -36,6 +36,7 @@ use rundler_types::{ GasFees, UserOperation as _, UserOpsPerAggregator, ValidationOutput, ValidationRevert, }; use rundler_utils::authorization_utils; +use tracing::instrument; use crate::{ AggregatorOut, AggregatorSimOut, BlockHashOrNumber, BundleHandler, DAGasOracle, DAGasProvider, @@ -94,6 +95,7 @@ where self.i_entry_point.address() } + #[instrument(skip(self))] async fn balance_of( &self, address: Address, @@ -109,6 +111,7 @@ where Ok(ret._0) } + #[instrument(skip(self))] async fn get_deposit_info(&self, address: Address) -> ProviderResult { self.i_entry_point .getDepositInfo(address) @@ -118,6 +121,7 @@ where .map(|r| r.info.into()) } + #[instrument(skip(self))] async fn get_balances(&self, addresses: Vec
) -> ProviderResult> { let provider = self.i_entry_point.provider(); let call = GetBalances::deploy_builder(provider, *self.address(), addresses) @@ -232,6 +236,7 @@ where { type UO = UserOperation; + #[instrument(skip(self))] async fn call_handle_ops( &self, ops_per_aggregator: Vec>, @@ -328,6 +333,7 @@ where { type UO = UserOperation; + #[instrument(skip(self))] async fn calc_da_gas( &self, user_op: UserOperation, @@ -390,6 +396,7 @@ where Ok((call, StateOverride::default())) } + #[instrument(skip(self))] async fn simulate_validation( &self, user_op: UserOperation, @@ -455,6 +462,7 @@ where } } + #[instrument(skip(self))] async fn simulate_handle_op( &self, op: Self::UO, diff --git a/crates/provider/src/alloy/entry_point/v0_7.rs b/crates/provider/src/alloy/entry_point/v0_7.rs index 79de7db58..4c006df1c 100644 --- a/crates/provider/src/alloy/entry_point/v0_7.rs +++ b/crates/provider/src/alloy/entry_point/v0_7.rs @@ -46,12 +46,14 @@ use rundler_types::{ GasFees, UserOperation as _, UserOpsPerAggregator, ValidationOutput, ValidationRevert, }; use rundler_utils::authorization_utils; +use tracing::instrument; use crate::{ AggregatorOut, AggregatorSimOut, BlockHashOrNumber, BundleHandler, DAGasOracle, DAGasProvider, DepositInfo, EntryPoint, EntryPointProvider as EntryPointProviderTrait, EvmCall, ExecutionResult, HandleOpsOut, ProviderResult, SignatureAggregator, SimulationProvider, }; + /// Entry point provider for v0.7 #[derive(Clone)] pub struct EntryPointProvider { @@ -102,6 +104,7 @@ where self.i_entry_point.address() } + #[instrument(skip(self))] async fn balance_of( &self, address: Address, @@ -117,6 +120,7 @@ where Ok(ret._0) } + #[instrument(skip(self))] async fn get_deposit_info(&self, address: Address) -> ProviderResult { self.i_entry_point .getDepositInfo(address) @@ -126,6 +130,7 @@ where .map(|r| r.info.into()) } + #[instrument(skip(self))] async fn get_balances(&self, addresses: Vec
) -> ProviderResult> { let provider = self.i_entry_point.provider(); let call = GetBalances::deploy_builder(provider, *self.address(), addresses) @@ -158,6 +163,7 @@ where { type UO = UserOperation; + #[instrument(skip(self))] async fn aggregate_signatures( &self, aggregator_address: Address, @@ -200,6 +206,7 @@ where } } + #[instrument(skip(self))] async fn validate_user_op_signature( &self, aggregator_address: Address, @@ -243,6 +250,7 @@ where { type UO = UserOperation; + #[instrument(skip(self))] async fn call_handle_ops( &self, ops_per_aggregator: Vec>, @@ -336,6 +344,7 @@ where { type UO = UserOperation; + #[instrument(skip(self))] async fn calc_da_gas( &self, user_op: UserOperation, @@ -412,6 +421,7 @@ where Ok((call, override_ep)) } + #[instrument(skip(self))] async fn simulate_validation( &self, user_op: Self::UO, @@ -459,6 +469,7 @@ where } } + #[instrument(skip(self))] async fn simulate_handle_op( &self, op: Self::UO, diff --git a/crates/provider/src/alloy/evm.rs b/crates/provider/src/alloy/evm.rs index f0b7cb6b6..cb6652a9d 100644 --- a/crates/provider/src/alloy/evm.rs +++ b/crates/provider/src/alloy/evm.rs @@ -31,6 +31,7 @@ use rundler_contracts::utils::{ GetGasUsed::{self, GasUsedResult}, StorageLoader, }; +use tracing::instrument; use crate::{EvmCall, EvmProvider, ProviderResult}; @@ -86,6 +87,7 @@ where Ok(self.inner.raw_request(method.into(), params).await?) } + #[instrument(skip(self))] async fn fee_history( &self, block_count: u64, @@ -98,6 +100,7 @@ where .await?) } + #[instrument(skip(self, state_overrides))] async fn call( &self, tx: &TransactionRequest, @@ -113,10 +116,12 @@ where Ok(call.await?) } + #[instrument(skip(self))] async fn get_block_number(&self) -> ProviderResult { Ok(self.inner.get_block_number().await?) } + #[instrument(skip(self))] async fn get_block(&self, block_id: BlockId) -> ProviderResult> { Ok(self .inner @@ -124,6 +129,7 @@ where .await?) } + #[instrument(skip(self))] async fn get_balance(&self, address: Address, block: Option) -> ProviderResult { let mut call = self.inner.get_balance(address); if let Some(block) = block { @@ -133,10 +139,12 @@ where Ok(call.await?) } + #[instrument(skip(self))] async fn get_transaction_by_hash(&self, tx: TxHash) -> ProviderResult> { Ok(self.inner.get_transaction_by_hash(tx).await?) } + #[instrument(skip(self))] async fn get_transaction_receipt( &self, tx: TxHash, @@ -144,6 +152,7 @@ where Ok(self.inner.get_transaction_receipt(tx).await?) } + #[instrument(skip(self))] async fn get_latest_block_hash_and_number(&self) -> ProviderResult<(B256, u64)> { let latest_block = EvmProvider::get_block(self, BlockId::latest()) .await? @@ -151,6 +160,7 @@ where Ok((latest_block.header.hash, latest_block.header.number)) } + #[instrument(skip(self))] async fn get_pending_base_fee(&self) -> ProviderResult { let fee_history = self.fee_history(1, BlockNumberOrTag::Latest, &[]).await?; Ok(fee_history @@ -158,10 +168,12 @@ where .context("should have a next block base fee")?) } + #[instrument(skip(self))] async fn get_max_priority_fee(&self) -> ProviderResult { Ok(self.inner.get_max_priority_fee_per_gas().await?) } + #[instrument(skip(self))] async fn get_code(&self, address: Address, block: Option) -> ProviderResult { let mut call = self.inner.get_code_at(address); if let Some(block) = block { @@ -171,14 +183,17 @@ where Ok(call.await?) } + #[instrument(skip(self))] async fn get_transaction_count(&self, address: Address) -> ProviderResult { Ok(self.inner.get_transaction_count(address).await?) } + #[instrument(skip(self))] async fn get_logs(&self, filter: &Filter) -> ProviderResult> { Ok(self.inner.get_logs(filter).await?) } + #[instrument(skip(self))] async fn debug_trace_transaction( &self, tx_hash: TxHash, @@ -190,6 +205,7 @@ where .await?) } + #[instrument(skip(self))] async fn debug_trace_call( &self, tx: TransactionRequest, @@ -206,6 +222,7 @@ where Ok(call.await?) } + #[instrument(skip(self))] async fn get_gas_used(&self, call: EvmCall) -> ProviderResult { let EvmCall { to, @@ -233,6 +250,7 @@ where Ok(ret) } + #[instrument(skip(self))] async fn batch_get_storage_at( &self, address: Address, @@ -273,6 +291,7 @@ where .unwrap()) } + #[instrument(skip(self))] async fn get_code_hash( &self, mut addresses: Vec
, diff --git a/crates/rpc/src/eth/api.rs b/crates/rpc/src/eth/api.rs index 0ef0f9df7..6c4c5952a 100644 --- a/crates/rpc/src/eth/api.rs +++ b/crates/rpc/src/eth/api.rs @@ -20,7 +20,7 @@ use rundler_types::{ chain::ChainSpec, pool::Pool, UserOperation, UserOperationOptionalGas, UserOperationVariant, }; use rundler_utils::log::LogOnError; -use tracing::Level; +use tracing::{instrument, Level}; use super::{ error::{EthResult, EthRpcError}, @@ -62,6 +62,7 @@ where } } + #[instrument(skip(self))] pub(crate) async fn send_user_operation( &self, op: UserOperationVariant, @@ -84,6 +85,7 @@ where .log_on_error_level(Level::DEBUG, "failed to add op to the mempool") } + #[instrument(skip(self, state_override))] pub(crate) async fn estimate_user_operation_gas( &self, op: UserOperationOptionalGas, @@ -103,6 +105,7 @@ where .await } + #[instrument(skip(self))] pub(crate) async fn get_user_operation_by_hash( &self, hash: B256, @@ -128,6 +131,7 @@ where Ok(results.into_iter().find_map(|x| x)) } + #[instrument(skip(self))] pub(crate) async fn get_user_operation_receipt( &self, hash: B256, @@ -147,6 +151,7 @@ where Ok(results.into_iter().find_map(|x| x)) } + #[instrument(skip(self))] pub(crate) async fn supported_entry_points(&self) -> EthResult> { Ok(self .router @@ -155,10 +160,12 @@ where .collect()) } + #[instrument(skip(self))] pub(crate) async fn chain_id(&self) -> EthResult { Ok(U64::from(self.chain_spec.id)) } + #[instrument(skip(self))] async fn get_pending_user_operation_by_hash( &self, hash: B256, diff --git a/crates/rpc/src/eth/events/common.rs b/crates/rpc/src/eth/events/common.rs index 613249f34..4c2d498bd 100644 --- a/crates/rpc/src/eth/events/common.rs +++ b/crates/rpc/src/eth/events/common.rs @@ -24,6 +24,7 @@ use rundler_provider::{ }; use rundler_types::{chain::ChainSpec, UserOperation, UserOperationVariant}; use rundler_utils::log::LogOnError; +use tracing::instrument; use super::UserOperationEventProvider; use crate::types::{RpcUserOperationByHash, RpcUserOperationReceipt}; @@ -60,6 +61,7 @@ where P: EvmProvider, E: EntryPointEvents, { + #[instrument(skip(self))] async fn get_mined_by_hash( &self, hash: B256, @@ -119,6 +121,7 @@ where })) } + #[instrument(skip(self))] async fn get_receipt(&self, hash: B256) -> anyhow::Result> { let event = self .get_event_by_hash(hash) @@ -177,6 +180,7 @@ where } } + #[instrument(skip(self))] async fn get_event_by_hash(&self, hash: B256) -> anyhow::Result> { let to_block = self.provider.get_block_number().await?; @@ -206,6 +210,7 @@ where /// This is meant to be used when a user operation event is found in the logs of a transaction, but the top level call /// wasn't to an entrypoint, so we need to trace the transaction to find the user operation by inspecting each call frame /// and returning the user operation that matches the hash. + #[instrument(skip(self))] async fn trace_find_user_operation( &self, tx_hash: B256, diff --git a/crates/rpc/src/eth/events/mod.rs b/crates/rpc/src/eth/events/mod.rs index ad7549554..f99ad6676 100644 --- a/crates/rpc/src/eth/events/mod.rs +++ b/crates/rpc/src/eth/events/mod.rs @@ -14,6 +14,7 @@ use alloy_primitives::B256; use anyhow::bail; use rundler_provider::{Log, TransactionReceipt}; +use tracing::instrument; use crate::types::{RpcUserOperationByHash, RpcUserOperationReceipt}; @@ -44,6 +45,7 @@ pub(crate) trait UserOperationEventProvider: Send + Sync { // // NOTE: we can't convert just decode all the logs as user operations and filter because we still want all the other log types // +#[instrument(skip(reference_log))] fn filter_receipt_logs_matching_user_op( reference_log: &Log, tx_receipt: &TransactionReceipt,