From b5f0c2ed74484583d534e981335fb23ae8e0495c Mon Sep 17 00:00:00 2001 From: refcell Date: Thu, 28 Nov 2024 11:49:07 -0500 Subject: [PATCH] fix: alloy provider --- crates/driver/src/driver.rs | 10 +++++++--- crates/driver/src/pipeline.rs | 18 +++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/crates/driver/src/driver.rs b/crates/driver/src/driver.rs index 8a6638a..2564372 100644 --- a/crates/driver/src/driver.rs +++ b/crates/driver/src/driver.rs @@ -1,13 +1,14 @@ //! Contains the core `HiloDriver`. +use alloy_provider::ReqwestProvider; use alloy_transport::TransportResult; use kona_derive::{errors::PipelineErrorKind, traits::SignalReceiver, types::ResetSignal}; use kona_driver::{Driver, PipelineCursor, TipCursor}; use std::sync::Arc; -// use tokio::sync::watch::{channel, Receiver}; use hilo_engine::EngineController; -use hilo_providers_local::{InMemoryChainProvider, InMemoryL2ChainProvider}; +use hilo_providers_alloy::AlloyL2ChainProvider; +use hilo_providers_local::InMemoryChainProvider; use crate::{ ChainNotification, Config, ConfigError, Context, HiloDerivationPipeline, HiloPipeline, @@ -64,7 +65,10 @@ where /// Initializes the [HiloPipeline]. pub async fn init_pipeline(&self, cursor: PipelineCursor) -> Result { let chain_provider = InMemoryChainProvider::with_capacity(self.cfg.cache_size); - let l2_chain_provider = InMemoryL2ChainProvider::with_capacity(self.cfg.cache_size); + // let l2_chain_provider = InMemoryL2ChainProvider::with_capacity(self.cfg.cache_size); + let provider = ReqwestProvider::new_http(self.cfg.l2_rpc_url.clone()); + let l2_chain_provider = + AlloyL2ChainProvider::new(provider, Arc::new(self.cfg.rollup_config.clone())); Ok(HiloPipeline::new( Arc::new(self.cfg.rollup_config.clone()), cursor, diff --git a/crates/driver/src/pipeline.rs b/crates/driver/src/pipeline.rs index 185dd7d..b132e74 100644 --- a/crates/driver/src/pipeline.rs +++ b/crates/driver/src/pipeline.rs @@ -19,12 +19,12 @@ use op_alloy_protocol::{BlockInfo, L2BlockInfo}; use op_alloy_rpc_types_engine::OpAttributesWithParent; use std::{boxed::Box, sync::Arc}; -use hilo_providers_alloy::DurableBlobProvider; -use hilo_providers_local::{InMemoryChainProvider, InMemoryL2ChainProvider}; +use hilo_providers_alloy::{AlloyL2ChainProvider, DurableBlobProvider}; +use hilo_providers_local::InMemoryChainProvider; /// Hilo Derivation Pipeline. pub type HiloDerivationPipeline = - DerivationPipeline, InMemoryL2ChainProvider>; + DerivationPipeline, AlloyL2ChainProvider>; /// Hilo Ethereum data source. pub type HiloDataProvider = EthereumDataSource; @@ -32,7 +32,7 @@ pub type HiloDataProvider = EthereumDataSource; + StatefulAttributesBuilder; /// Hilo attributes queue for the derivation pipeline. pub type HiloAttributesQueue = AttributesQueue< @@ -41,9 +41,9 @@ pub type HiloAttributesQueue = AttributesQueue< ChannelReader< ChannelProvider>>>, >, - InMemoryL2ChainProvider, + AlloyL2ChainProvider, >, - InMemoryL2ChainProvider, + AlloyL2ChainProvider, >, HiloAttributesBuilder, >; @@ -58,7 +58,7 @@ pub struct HiloPipeline { pub chain_provider: InMemoryChainProvider, /// The L2 chain provider. #[allow(unused)] - pub l2_chain_provider: InMemoryL2ChainProvider, + pub l2_chain_provider: AlloyL2ChainProvider, } impl HiloPipeline { @@ -68,7 +68,7 @@ impl HiloPipeline { sync_start: PipelineCursor, blob_provider: DurableBlobProvider, chain_provider: InMemoryChainProvider, - l2_chain_provider: InMemoryL2ChainProvider, + l2_chain_provider: AlloyL2ChainProvider, ) -> Self { let attributes = StatefulAttributesBuilder::new( cfg.clone(), @@ -93,7 +93,7 @@ impl DriverPipeline for HiloPipeline { /// Flushes provider caches on re-orgs. fn flush(&mut self) { self.chain_provider.flush(); - self.l2_chain_provider.flush(); + // self.l2_chain_provider.flush(); } }