-
Notifications
You must be signed in to change notification settings - Fork 47
/
pipeline.rs
29 lines (23 loc) · 1.02 KB
/
pipeline.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//! Defines the interface for the core derivation pipeline.
use alloc::boxed::Box;
use async_trait::async_trait;
use core::iter::Iterator;
use op_alloy_genesis::{RollupConfig, SystemConfig};
use op_alloy_protocol::L2BlockInfo;
use op_alloy_rpc_types_engine::OpAttributesWithParent;
use crate::{errors::PipelineErrorKind, traits::OriginProvider, types::StepResult};
/// This trait defines the interface for interacting with the derivation pipeline.
#[async_trait]
pub trait Pipeline: OriginProvider + Iterator<Item = OpAttributesWithParent> {
/// Peeks at the next [OpAttributesWithParent] from the pipeline.
fn peek(&self) -> Option<&OpAttributesWithParent>;
/// Attempts to progress the pipeline.
async fn step(&mut self, cursor: L2BlockInfo) -> StepResult;
/// Returns the rollup config.
fn rollup_config(&self) -> &RollupConfig;
/// Returns the [SystemConfig] by L2 number.
async fn system_config_by_number(
&mut self,
number: u64,
) -> Result<SystemConfig, PipelineErrorKind>;
}