Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions crates/derive/src/stages/attributes_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use crate::{
batch::SingleBatch,
errors::{PipelineError, PipelineResult, ResetError},
traits::{
AttributesBuilder, NextAttributes, OriginAdvancer, OriginProvider, Signal, SignalReceiver,
AttributesBuilder, AttributesProvider, NextAttributes, OriginAdvancer, OriginProvider,
Signal, SignalReceiver,
},
};
use alloc::{boxed::Box, sync::Arc};
Expand All @@ -15,18 +16,6 @@ use op_alloy_protocol::{BlockInfo, L2BlockInfo};
use op_alloy_rpc_types_engine::{OpAttributesWithParent, OpPayloadAttributes};
use tracing::info;

/// [AttributesProvider] is a trait abstraction that generalizes the [BatchQueue] stage.
///
/// [BatchQueue]: crate::stages::BatchQueue
#[async_trait]
pub trait AttributesProvider {
/// Returns the next valid batch upon the given safe head.
async fn next_batch(&mut self, parent: L2BlockInfo) -> PipelineResult<SingleBatch>;

/// Returns whether the current batch is the last in its span.
fn is_last_in_span(&self) -> bool;
}

/// [AttributesQueue] accepts batches from the [BatchQueue] stage
/// and transforms them into [OpPayloadAttributes].
///
Expand Down
4 changes: 2 additions & 2 deletions crates/derive/src/stages/batch/batch_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use super::NextBatchProvider;
use crate::{
batch::{Batch, BatchValidity, BatchWithInclusionBlock, SingleBatch},
errors::{PipelineEncodingError, PipelineError, PipelineErrorKind, PipelineResult, ResetError},
stages::attributes_queue::AttributesProvider,
traits::{
L2ChainProvider, OriginAdvancer, OriginProvider, ResetSignal, Signal, SignalReceiver,
AttributesProvider, L2ChainProvider, OriginAdvancer, OriginProvider, ResetSignal, Signal,
SignalReceiver,
},
};
use alloc::{boxed::Box, sync::Arc, vec::Vec};
Expand Down
7 changes: 3 additions & 4 deletions crates/derive/src/stages/batch/batch_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use crate::{
errors::ResetError,
pipeline::{OriginAdvancer, PipelineResult, Signal, SignalReceiver},
prelude::{OriginProvider, PipelineError, PipelineErrorKind},
stages::AttributesProvider,
traits::ResetSignal,
traits::{AttributesProvider, ResetSignal},
};
use alloc::{boxed::Box, sync::Arc, vec::Vec};
use async_trait::async_trait;
Expand Down Expand Up @@ -318,9 +317,9 @@ mod test {
errors::{PipelineErrorKind, ResetError},
pipeline::{PipelineResult, SignalReceiver},
prelude::PipelineError,
stages::{AttributesProvider, NextBatchProvider},
stages::NextBatchProvider,
test_utils::{CollectingLayer, TestBatchQueueProvider, TraceStorage},
traits::{OriginAdvancer, ResetSignal, Signal},
traits::{AttributesProvider, OriginAdvancer, ResetSignal, Signal},
};
use alloc::sync::Arc;
use alloy_eips::{BlockNumHash, NumHash};
Expand Down
2 changes: 1 addition & 1 deletion crates/derive/src/stages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mod batch;
pub use batch::{BatchQueue, BatchStream, BatchStreamProvider, BatchValidator, NextBatchProvider};

mod attributes_queue;
pub use attributes_queue::{AttributesProvider, AttributesQueue};
pub use attributes_queue::AttributesQueue;

#[macro_use]
mod multiplexed;
Expand Down
6 changes: 4 additions & 2 deletions crates/derive/src/test_utils/attributes_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
use crate::{
batch::SingleBatch,
errors::{BuilderError, PipelineError, PipelineErrorKind, PipelineResult},
stages::AttributesProvider,
traits::{AttributesBuilder, OriginAdvancer, OriginProvider, Signal, SignalReceiver},
traits::{
AttributesBuilder, AttributesProvider, OriginAdvancer, OriginProvider, Signal,
SignalReceiver,
},
};
use alloc::{boxed::Box, string::ToString, vec::Vec};
use alloy_eips::BlockNumHash;
Expand Down
14 changes: 13 additions & 1 deletion crates/derive/src/traits/attributes.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
//! Contains traits for working with payload attributes and their providers.

use crate::errors::PipelineResult;
use crate::{batch::SingleBatch, errors::PipelineResult};
use alloc::boxed::Box;
use alloy_eips::BlockNumHash;
use async_trait::async_trait;
use op_alloy_protocol::L2BlockInfo;
use op_alloy_rpc_types_engine::{OpAttributesWithParent, OpPayloadAttributes};

/// [AttributesProvider] is a trait abstraction that generalizes the [BatchQueue] stage.
///
/// [BatchQueue]: crate::stages::BatchQueue
#[async_trait]
pub trait AttributesProvider {
/// Returns the next valid batch upon the given safe head.
async fn next_batch(&mut self, parent: L2BlockInfo) -> PipelineResult<SingleBatch>;

/// Returns whether the current batch is the last in its span.
fn is_last_in_span(&self) -> bool;
}

/// [NextAttributes] defines the interface for pulling attributes from
/// the top level `AttributesQueue` stage of the pipeline.
#[async_trait]
Expand Down
2 changes: 1 addition & 1 deletion crates/derive/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod providers;
pub use providers::{ChainProvider, L2ChainProvider};

mod attributes;
pub use attributes::{AttributesBuilder, NextAttributes};
pub use attributes::{AttributesBuilder, AttributesProvider, NextAttributes};

mod data_sources;
pub use data_sources::{AsyncIterator, BlobProvider, DataAvailabilityProvider};
Expand Down