Skip to content

Commit

Permalink
fix: alloy provider
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell committed Nov 28, 2024
1 parent 1e70f26 commit b5f0c2e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
10 changes: 7 additions & 3 deletions crates/driver/src/driver.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -64,7 +65,10 @@ where
/// Initializes the [HiloPipeline].
pub async fn init_pipeline(&self, cursor: PipelineCursor) -> Result<HiloPipeline, ConfigError> {
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,
Expand Down
18 changes: 9 additions & 9 deletions crates/driver/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ 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<HiloAttributesQueue<HiloDataProvider>, InMemoryL2ChainProvider>;
DerivationPipeline<HiloAttributesQueue<HiloDataProvider>, AlloyL2ChainProvider>;

/// Hilo Ethereum data source.
pub type HiloDataProvider = EthereumDataSource<InMemoryChainProvider, DurableBlobProvider>;

/// Hilo payload attributes builder for the `AttributesQueue` stage of the derivation
/// pipeline.
pub type HiloAttributesBuilder =
StatefulAttributesBuilder<InMemoryChainProvider, InMemoryL2ChainProvider>;
StatefulAttributesBuilder<InMemoryChainProvider, AlloyL2ChainProvider>;

/// Hilo attributes queue for the derivation pipeline.
pub type HiloAttributesQueue<DAP> = AttributesQueue<
Expand All @@ -41,9 +41,9 @@ pub type HiloAttributesQueue<DAP> = AttributesQueue<
ChannelReader<
ChannelProvider<FrameQueue<L1Retrieval<DAP, L1Traversal<InMemoryChainProvider>>>>,
>,
InMemoryL2ChainProvider,
AlloyL2ChainProvider,
>,
InMemoryL2ChainProvider,
AlloyL2ChainProvider,
>,
HiloAttributesBuilder,
>;
Expand All @@ -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 {
Expand All @@ -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(),
Expand All @@ -93,7 +93,7 @@ impl DriverPipeline<HiloDerivationPipeline> 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();
}
}

Expand Down

0 comments on commit b5f0c2e

Please sign in to comment.