-
Notifications
You must be signed in to change notification settings - Fork 6
feat: implement self-healing recovery mechanism for gaps in L1 data #403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 16 commits
b509314
0ea4ef7
5670af8
ba20206
476d906
f6eaf09
21588bc
c907bd4
10bc36c
51100a5
46c09f9
04c7e18
c1a0500
b96bda5
ccad3cb
abcc90b
937b0e0
f15ffb9
02fb909
49d38e5
6a23c25
b0e1e94
dce07df
524304a
0493ec9
47d35e7
f4a999e
c59007d
53d0923
de57dc4
08ca239
41b3ead
90fc085
9865e89
2f2960c
d35eba1
8ed53a6
875f745
54bb0c3
c19beb8
32587a2
7eaf491
283bcf9
ba5497a
1a7949f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -342,35 +342,34 @@ impl ScrollRollupNodeConfig { | |
| }; | ||
| let consensus = self.consensus_args.consensus(authorized_signer)?; | ||
|
|
||
| let (l1_notification_tx, l1_notification_rx): (Option<Sender<Arc<L1Notification>>>, _) = | ||
| if let Some(provider) = l1_provider.filter(|_| !self.test) { | ||
| tracing::info!(target: "scroll::node::args", ?l1_start_block_number, "Starting L1 watcher"); | ||
| ( | ||
| None, | ||
| Some( | ||
| L1Watcher::spawn( | ||
| provider, | ||
| l1_start_block_number, | ||
| node_config, | ||
| self.l1_provider_args.logs_query_block_range, | ||
| ) | ||
| .await, | ||
| ), | ||
| ) | ||
| } else { | ||
| // Create a channel for L1 notifications that we can use to inject L1 messages for | ||
| // testing | ||
| #[cfg(feature = "test-utils")] | ||
| { | ||
| let (tx, rx) = tokio::sync::mpsc::channel(1000); | ||
| (Some(tx), Some(rx)) | ||
| } | ||
|
|
||
| #[cfg(not(feature = "test-utils"))] | ||
| { | ||
| (None, None) | ||
| } | ||
| }; | ||
| let (l1_notification_tx, l1_notification_rx, l1_watcher_handle): ( | ||
| Option<Sender<Arc<L1Notification>>>, | ||
| _, | ||
| Option<rollup_node_watcher::L1WatcherHandle>, | ||
| ) = if let Some(provider) = l1_provider.filter(|_| !self.test) { | ||
| tracing::info!(target: "scroll::node::args", ?l1_start_block_number, "Starting L1 watcher"); | ||
| let (rx, handle) = L1Watcher::spawn( | ||
| provider, | ||
| l1_start_block_number, | ||
| node_config, | ||
| self.l1_provider_args.logs_query_block_range, | ||
| ) | ||
| .await; | ||
| (None, Some(rx), Some(handle)) | ||
| } else { | ||
| // Create a channel for L1 notifications that we can use to inject L1 messages for | ||
| // testing | ||
| #[cfg(feature = "test-utils")] | ||
| { | ||
| let (tx, rx) = tokio::sync::mpsc::channel(1000); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we create a L1 watcher handle and receiver channel here that can be used for testing?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done in 41b3ead |
||
| (Some(tx), Some(rx), None) | ||
| } | ||
|
|
||
| #[cfg(not(feature = "test-utils"))] | ||
| { | ||
| (None, None, None) | ||
| } | ||
| }; | ||
|
|
||
| // Construct the l1 provider. | ||
| let l1_messages_provider = db.clone(); | ||
|
|
@@ -450,6 +449,7 @@ impl ScrollRollupNodeConfig { | |
| Arc::new(block_client), | ||
| l2_provider, | ||
| l1_notification_rx.expect("L1 notification receiver should be set"), | ||
| l1_watcher_handle, | ||
| scroll_network_handle.into_scroll_network().await, | ||
| consensus, | ||
| engine, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| use crate::L1Notification; | ||
| use std::sync::Arc; | ||
| use tokio::sync::{mpsc, oneshot}; | ||
|
|
||
| /// Commands that can be sent to the L1 Watcher. | ||
| #[derive(Debug)] | ||
| pub enum L1WatcherCommand { | ||
| /// Reset the watcher to a specific L1 block number. | ||
| /// | ||
| /// This is used for gap recovery when the chain orchestrator detects missing L1 events. | ||
| ResetToBlock { | ||
| /// The L1 block number to reset to (last known good state) | ||
| block: u64, | ||
| /// New sender to replace the current notification channel | ||
| new_sender: mpsc::Sender<Arc<L1Notification>>, | ||
| /// Oneshot sender to signal completion of the reset operation | ||
| response_sender: oneshot::Sender<()>, | ||
|
||
| }, | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of adding the
processedfilter?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought I needed it at some point. reverted.