Skip to content

Commit b82f7e0

Browse files
committed
introduce DerivationPipelineWorker
1 parent 52f5b24 commit b82f7e0

File tree

4 files changed

+149
-86
lines changed

4 files changed

+149
-86
lines changed

crates/chain-orchestrator/src/lib.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use rollup_node_primitives::{
1818
BatchCommitData, BatchInfo, BlockConsolidationOutcome, BlockInfo, ChainImport,
1919
L1MessageEnvelope, L2BlockInfoWithL1Messages,
2020
};
21-
use rollup_node_providers::{L1MessageProvider, L1Provider};
21+
use rollup_node_providers::L1MessageProvider;
2222
use rollup_node_sequencer::{Sequencer, SequencerEvent};
2323
use rollup_node_signer::{SignatureAsBytes, SignerEvent, SignerHandle};
2424
use rollup_node_watcher::L1Notification;
@@ -92,7 +92,6 @@ const EVENT_CHANNEL_SIZE: usize = 5000;
9292
pub struct ChainOrchestrator<
9393
N: FullNetwork<Primitives = ScrollNetworkPrimitives>,
9494
ChainSpec,
95-
L1P,
9695
L1MP,
9796
L2P,
9897
EC,
@@ -124,19 +123,18 @@ pub struct ChainOrchestrator<
124123
/// The signer used to sign messages.
125124
signer: Option<SignerHandle>,
126125
/// The derivation pipeline used to derive L2 blocks from batches.
127-
derivation_pipeline: DerivationPipeline<L1P>,
126+
derivation_pipeline: DerivationPipeline,
128127
/// Optional event sender for broadcasting events to listeners.
129128
event_sender: Option<EventSender<ChainOrchestratorEvent>>,
130129
}
131130

132131
impl<
133132
N: FullNetwork<Primitives = ScrollNetworkPrimitives> + Send + Sync + 'static,
134133
ChainSpec: ScrollHardforks + EthChainSpec + Send + Sync + 'static,
135-
L1P: L1Provider + Unpin + Clone + Send + Sync + 'static,
136134
L1MP: L1MessageProvider + Unpin + Clone + Send + Sync + 'static,
137135
L2P: Provider<Scroll> + 'static,
138136
EC: ScrollEngineApi + Sync + Send + 'static,
139-
> ChainOrchestrator<N, ChainSpec, L1P, L1MP, L2P, EC>
137+
> ChainOrchestrator<N, ChainSpec, L1MP, L2P, EC>
140138
{
141139
/// Creates a new chain orchestrator.
142140
#[allow(clippy::too_many_arguments)]
@@ -151,7 +149,7 @@ impl<
151149
engine: Engine<EC>,
152150
sequencer: Option<Sequencer<L1MP, ChainSpec>>,
153151
signer: Option<SignerHandle>,
154-
derivation_pipeline: DerivationPipeline<L1P>,
152+
derivation_pipeline: DerivationPipeline,
155153
) -> Result<(Self, ChainOrchestratorHandle<N>), ChainOrchestratorError> {
156154
let (handle_tx, handle_rx) = mpsc::unbounded_channel();
157155
let handle = ChainOrchestratorHandle::new(handle_tx);
@@ -224,7 +222,7 @@ impl<
224222
let res = self.handle_network_event(event).await;
225223
self.handle_outcome(res);
226224
}
227-
Some(notification) = self.l1_notification_rx.recv(), if self.sync_state.l2().is_synced() && self.derivation_pipeline.is_empty().await => {
225+
Some(notification) = self.l1_notification_rx.recv(), if self.sync_state.l2().is_synced() && self.derivation_pipeline.is_empty() => {
228226
let res = self.handle_l1_notification(notification).await;
229227
self.handle_outcome(res);
230228
}

crates/derivation-pipeline/benches/pipeline.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ type L1ProviderFactory<P> =
6363
/// Returns a pipeline with a provider initiated from the factory function.
6464
async fn setup_pipeline<P: L1Provider + Clone + Send + Sync + 'static>(
6565
factory: L1ProviderFactory<P>,
66-
) -> DerivationPipeline<P> {
66+
) -> DerivationPipeline {
6767
// load batch data in the db.
6868
let db = Arc::new(setup_test_db().await);
6969
let blob_hashes: Vec<B256> = serde_json::from_str(
@@ -105,7 +105,7 @@ async fn setup_pipeline<P: L1Provider + Clone + Send + Sync + 'static>(
105105

106106
// construct the pipeline.
107107
let l1_provider = factory(db.clone()).await;
108-
DerivationPipeline::new(l1_provider, db, u64::MAX)
108+
DerivationPipeline::new(l1_provider, db, u64::MAX).await
109109
}
110110

111111
/// Benchmark the derivation pipeline with blobs fetched from file. This does not bench the network

0 commit comments

Comments
 (0)