From a1d4ba5291f378569507e4276519df49d4f6eb7f Mon Sep 17 00:00:00 2001 From: Daniel Xifra Date: Fri, 9 Aug 2024 15:01:06 -0300 Subject: [PATCH] typing fixes --- .../src/backtest/backtest_build_block.rs | 5 +- .../rbuilder/src/live_builder/base_config.rs | 50 ++++++++++--------- crates/rbuilder/src/live_builder/cli.rs | 2 +- crates/rbuilder/src/live_builder/config.rs | 5 +- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/crates/rbuilder/src/backtest/backtest_build_block.rs b/crates/rbuilder/src/backtest/backtest_build_block.rs index 7632b2fe..b382ca3b 100644 --- a/crates/rbuilder/src/backtest/backtest_build_block.rs +++ b/crates/rbuilder/src/backtest/backtest_build_block.rs @@ -80,10 +80,7 @@ pub async fn run_backtest_build_block() -> eyre:: print_order_and_timestamp(&block_data.available_orders, &block_data); } - let provider_factory = config - .base_config() - .provider_factory()? - .provider_factory_unchecked(); + let provider_factory = config.base_config().provider_factory()?; let chain_spec = config.base_config().chain_spec()?; let sbundle_mergeabe_signers = config.base_config().sbundle_mergeabe_signers(); diff --git a/crates/rbuilder/src/live_builder/base_config.rs b/crates/rbuilder/src/live_builder/base_config.rs index de30a035..a3fa3332 100644 --- a/crates/rbuilder/src/live_builder/base_config.rs +++ b/crates/rbuilder/src/live_builder/base_config.rs @@ -186,15 +186,15 @@ impl BaseConfig { } /// WARN: opens reth db - pub async fn create_builder( + pub async fn create_builder( &self, cancellation_token: tokio_util::sync::CancellationToken, ) -> eyre::Result< - super::LiveBuilder, - > - where - Provider: StateProviderFactory, - { + super::LiveBuilder< + ProviderFactoryReopener>, + super::building::relay_submit::RelaySubmitSinkFactory, + >, + > { let submission_config = self.submission_config()?; info!( "Builder mev boost normal relay pubkey: {:?}", @@ -216,28 +216,30 @@ impl BaseConfig { let relays = self.relays()?; let sink_factory = RelaySubmitSinkFactory::new(self.submission_config()?, relays.clone()); - Ok(LiveBuilder::, RelaySubmitSinkFactory> { - cls: self.beacon_clients()?, - relays, - watchdog_timeout: self.watchdog_timeout(), - error_storage_path: self.error_storage_path.clone(), - simulation_threads: self.simulation_threads, - order_input_config: OrderInputConfig::from_config(self), + Ok( + LiveBuilder::>, RelaySubmitSinkFactory> { + cls: self.beacon_clients()?, + relays, + watchdog_timeout: self.watchdog_timeout(), + error_storage_path: self.error_storage_path.clone(), + simulation_threads: self.simulation_threads, + order_input_config: OrderInputConfig::from_config(self), - chain_chain_spec: self.chain_spec()?, - provider_factory, + chain_chain_spec: self.chain_spec()?, + provider_factory, - coinbase_signer: self.coinbase_signer()?, - extra_data: self.extra_data()?, - blocklist: self.blocklist()?, + coinbase_signer: self.coinbase_signer()?, + extra_data: self.extra_data()?, + blocklist: self.blocklist()?, - global_cancellation: cancellation_token, + global_cancellation: cancellation_token, - bidding_service: Box::new(DummyBiddingService {}), - extra_rpc: RpcModule::new(()), - sink_factory, - builders: Vec::new(), - }) + bidding_service: Box::new(DummyBiddingService {}), + extra_rpc: RpcModule::new(()), + sink_factory, + builders: Vec::new(), + }, + ) } pub fn jsonrpc_server_ip(&self) -> Ipv4Addr { diff --git a/crates/rbuilder/src/live_builder/cli.rs b/crates/rbuilder/src/live_builder/cli.rs index 499604ad..9adb0b17 100644 --- a/crates/rbuilder/src/live_builder/cli.rs +++ b/crates/rbuilder/src/live_builder/cli.rs @@ -51,7 +51,7 @@ pub trait LiveBuilderConfig: std::fmt::Debug + serde::de::DeserializeOwned { fn build_backtest_block( &self, building_algorithm_name: &str, - input: BacktestSimulateBlockInput<'_, Arc>, + input: BacktestSimulateBlockInput<'_, ProviderFactoryReopener>>, ) -> eyre::Result<(Block, CachedReads)>; } diff --git a/crates/rbuilder/src/live_builder/config.rs b/crates/rbuilder/src/live_builder/config.rs index 0558b96e..a6e83c0a 100644 --- a/crates/rbuilder/src/live_builder/config.rs +++ b/crates/rbuilder/src/live_builder/config.rs @@ -198,7 +198,8 @@ fn create_builders( configs: Vec, root_hash_task_pool: BlockingTaskPool, sbundle_mergeabe_signers: Vec
, -) -> Vec, BestBlockCell>>> { +) -> Vec>, BestBlockCell>>> +{ configs .into_iter() .map(|cfg| create_builder(cfg, &root_hash_task_pool, &sbundle_mergeabe_signers)) @@ -209,7 +210,7 @@ fn create_builder( cfg: BuilderConfig, root_hash_task_pool: &BlockingTaskPool, sbundle_mergeabe_signers: &[Address], -) -> Arc, BestBlockCell>> { +) -> Arc>, BestBlockCell>> { match cfg.builder { SpecificBuilderConfig::OrderingBuilder(order_cfg) => { Arc::new(OrderingBuildingAlgorithm::new(