From 8d0f94d4fd6342e5668b0b33ab0cae77a3269253 Mon Sep 17 00:00:00 2001 From: dancoombs Date: Sat, 30 Mar 2024 13:26:17 -0500 Subject: [PATCH] chore: fixing PR comments --- crates/builder/src/bundle_proposer.rs | 14 ++--- crates/rpc/src/eth/api.rs | 61 +++++++++++---------- crates/sim/src/simulation/v0_6/simulator.rs | 4 +- crates/types/src/pool/types.rs | 11 +--- 4 files changed, 42 insertions(+), 48 deletions(-) diff --git a/crates/builder/src/bundle_proposer.rs b/crates/builder/src/bundle_proposer.rs index 6ec830050..49452b457 100644 --- a/crates/builder/src/bundle_proposer.rs +++ b/crates/builder/src/bundle_proposer.rs @@ -105,9 +105,9 @@ pub(crate) trait BundleProposer: Send + Sync + 'static { } #[derive(Debug)] -pub(crate) struct BundleProposerImpl { +pub(crate) struct BundleProposerImpl { builder_index: u64, - pool: C, + pool: M, simulator: S, entry_point: E, provider: Arc

, @@ -128,14 +128,14 @@ pub(crate) struct Settings { } #[async_trait] -impl BundleProposer for BundleProposerImpl +impl BundleProposer for BundleProposerImpl where UO: UserOperation + From, UserOperationVariant: AsRef, S: Simulator, E: EntryPoint + SignatureAggregator + BundleHandler + L1GasProvider, P: Provider, - C: Pool, + M: Pool, { type UO = UO; @@ -234,18 +234,18 @@ where } } -impl BundleProposerImpl +impl BundleProposerImpl where UO: UserOperation + From, UserOperationVariant: AsRef, S: Simulator, E: EntryPoint + SignatureAggregator + BundleHandler + L1GasProvider, P: Provider, - C: Pool, + M: Pool, { pub(crate) fn new( builder_index: u64, - pool: C, + pool: M, simulator: S, entry_point: E, provider: Arc

, diff --git a/crates/rpc/src/eth/api.rs b/crates/rpc/src/eth/api.rs index 47c3cf56e..1f12e0e7b 100644 --- a/crates/rpc/src/eth/api.rs +++ b/crates/rpc/src/eth/api.rs @@ -172,9 +172,8 @@ mod tests { types::{Bytes, Log, Transaction}, }; use mockall::predicate::eq; - use rundler_pool::{IntoPoolOperationVariant, MockPoolServer, PoolOperation}; - use rundler_provider::{MockEntryPoint, MockEntryPointV0_6, MockProvider}; - use rundler_sim::{EntityInfos, PriorityFeeMode}; + use rundler_provider::{EntryPoint, MockEntryPointV0_6, MockProvider}; + use rundler_sim::{EstimationSettings, FeeEstimator, GasEstimatorV0_6, PriorityFeeMode}; use rundler_types::{ contracts::v0_6::i_entry_point::{HandleOpsCall, IEntryPointCalls}, pool::{MockPool, PoolOperation}, @@ -319,38 +318,42 @@ mod tests { ep: MockEntryPointV0_6, pool: MockPool, ) -> EthApi { + let ep = Arc::new(ep); let provider = Arc::new(provider); let chain_spec = ChainSpec { id: 1, ..Default::default() }; - contexts_by_entry_point - .insert( - ep.address(), - EntryPointContext::new( - chain_spec.clone(), - Arc::clone(&provider), - ep, - EstimationSettings { - max_verification_gas: 1_000_000, - max_call_gas: 1_000_000, - max_simulate_handle_ops_gas: 1_000_000, - verification_estimation_gas_fee: 1_000_000_000_000, - }, - FeeEstimator::new( - &chain_spec, - Arc::clone(&provider), - PriorityFeeMode::BaseFeePercent(0), - 0, - ), - UserOperationEventProviderV0_6::new( - chain_spec.id, - ep.address(), - provider.clone(), - None, - ), + + let gas_estimator = GasEstimatorV0_6::new( + chain_spec.clone(), + provider.clone(), + ep.clone(), + EstimationSettings { + max_verification_gas: 1_000_000, + max_call_gas: 1_000_000, + max_simulate_handle_ops_gas: 1_000_000, + verification_estimation_gas_fee: 1_000_000_000_000, + }, + FeeEstimator::new( + &chain_spec, + Arc::clone(&provider), + PriorityFeeMode::BaseFeePercent(0), + 0, + ), + ); + + let router = EntryPointRouterBuilder::default() + .v0_6(EntryPointRouteImpl::new( + ep.clone(), + gas_estimator, + UserOperationEventProviderV0_6::new( + chain_spec.id, + ep.address(), + provider.clone(), + None, ), - ) + )) .build(); EthApi { diff --git a/crates/sim/src/simulation/v0_6/simulator.rs b/crates/sim/src/simulation/v0_6/simulator.rs index b553deb8d..2176ead0b 100644 --- a/crates/sim/src/simulation/v0_6/simulator.rs +++ b/crates/sim/src/simulation/v0_6/simulator.rs @@ -1009,7 +1009,7 @@ mod tests { has_factory: true, associated_addresses: HashSet::new(), block_id: BlockId::Number(BlockNumber::Latest), - entity_infos: EntityInfos::new( + entity_infos: simulation::infos_from_validation_output( Some(Address::from_str("0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789").unwrap()), Address::from_str("0xb856dbd4fa1a79a46d426f537455e7d3e79ab7c4").unwrap(), Some(Address::from_str("0x8abb13360b87be5eeb1b98647a016add927a136c").unwrap()), @@ -1126,7 +1126,7 @@ mod tests { has_factory: true, associated_addresses: HashSet::new(), block_id: BlockId::Number(BlockNumber::Latest), - entity_infos: EntityInfos::new( + entity_infos: simulation::infos_from_validation_output( Some(factory_address), sender_address, None, diff --git a/crates/types/src/pool/types.rs b/crates/types/src/pool/types.rs index d2753c159..694f29f02 100644 --- a/crates/types/src/pool/types.rs +++ b/crates/types/src/pool/types.rs @@ -20,7 +20,7 @@ use crate::{ }; /// The new head of the chain, as viewed by the pool -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct NewHead { /// The hash of the new head pub block_hash: H256, @@ -28,15 +28,6 @@ pub struct NewHead { pub block_number: u64, } -impl Default for NewHead { - fn default() -> NewHead { - NewHead { - block_hash: H256::zero(), - block_number: 0, - } - } -} - /// The reputation of an entity #[derive(Debug, Clone)] pub struct Reputation {