Skip to content

Commit

Permalink
feat(derive): return the concrete online attributes queue type from t…
Browse files Browse the repository at this point in the history
…he online stack constructor (#158)
  • Loading branch information
refcell authored Apr 28, 2024
1 parent f3a961b commit 4eab5e4
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions crates/derive/src/online/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,44 @@
use crate::{
stages::{
AttributesQueue, BatchQueue, ChannelBank, ChannelReader, FrameQueue, L1Retrieval,
L1Traversal, NextAttributes, StatefulAttributesBuilder,
L1Traversal, StatefulAttributesBuilder,
},
traits::{DataAvailabilityProvider, ResettableStage},
traits::DataAvailabilityProvider,
types::RollupConfig,
};
use alloc::sync::Arc;
use alloy_provider::ReqwestProvider;
use core::fmt::Debug;

/// An `online` payload attributes builder for the `AttributesQueue` stage of the derivation
/// pipeline.
pub type OnlineAttributesBuilder = StatefulAttributesBuilder<
AlloyChainProvider<ReqwestProvider>,
AlloyL2ChainProvider<ReqwestProvider>,
>;

/// An `online` attributes queue for the derivation pipeline.
pub type OnlineAttributesQueue<DAP> = AttributesQueue<
BatchQueue<
ChannelReader<
ChannelBank<
FrameQueue<L1Retrieval<DAP, L1Traversal<AlloyChainProvider<ReqwestProvider>>>>,
>,
>,
AlloyL2ChainProvider<ReqwestProvider>,
>,
OnlineAttributesBuilder,
>;

/// Creates a new online stack.
#[cfg(feature = "online")]
pub fn new_online_stack<DAP>(
rollup_config: Arc<RollupConfig>,
chain_provider: AlloyChainProvider<ReqwestProvider>,
dap_source: DAP,
fetcher: AlloyL2ChainProvider<ReqwestProvider>,
builder: StatefulAttributesBuilder<
AlloyChainProvider<ReqwestProvider>,
AlloyL2ChainProvider<ReqwestProvider>,
>,
) -> impl NextAttributes + ResettableStage + Debug + Send
builder: OnlineAttributesBuilder,
) -> OnlineAttributesQueue<DAP>
where
DAP: DataAvailabilityProvider + Debug + Send,
{
Expand Down

0 comments on commit 4eab5e4

Please sign in to comment.