Skip to content

Commit 731ae47

Browse files
committed
add test-utils
1 parent e7f00c3 commit 731ae47

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

crates/node/src/args.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,17 @@ impl ScrollRollupNodeConfig {
366366
.filter(|_| !self.test_args.test || self.blob_provider_args.anvil_url.is_some())
367367
{
368368
tracing::info!(target: "scroll::node::args", ?l1_block_startup_info, "Starting L1 watcher");
369+
370+
#[cfg(feature = "test-utils")]
371+
let skip_synced = self.test_args.test && self.test_args.skip_l1_synced;
372+
369373
let (tx, rx) = L1Watcher::spawn(
370374
provider,
371375
l1_block_startup_info,
372376
node_config,
373377
self.l1_provider_args.logs_query_block_range,
374-
self.test_args.test && self.test_args.skip_l1_synced,
378+
#[cfg(feature = "test-utils")]
379+
skip_synced,
375380
)
376381
.await;
377382
(Some(tx), Some(rx))

crates/watcher/src/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ pub struct L1Watcher<EP> {
100100
/// The log query block range.
101101
log_query_block_range: u64,
102102
/// Test mode: skip sending `L1Notification::Synced` events.
103+
#[cfg(feature = "test-utils")]
103104
test_mode_skip_synced_notification: bool,
104105
}
105106

@@ -210,7 +211,7 @@ where
210211
l1_block_startup_info: L1BlockStartupInfo,
211212
config: Arc<NodeConfig>,
212213
log_query_block_range: u64,
213-
test_mode_skip_synced_notification: bool,
214+
#[cfg(feature = "test-utils")] test_mode_skip_synced_notification: bool,
214215
) -> (mpsc::Sender<Arc<L1Notification>>, mpsc::Receiver<Arc<L1Notification>>) {
215216
tracing::trace!(target: "scroll::watcher", ?l1_block_startup_info, ?config, "spawning L1 watcher");
216217

@@ -274,6 +275,7 @@ where
274275
metrics: WatcherMetrics::default(),
275276
is_synced: false,
276277
log_query_block_range,
278+
#[cfg(feature = "test-utils")]
277279
test_mode_skip_synced_notification,
278280
};
279281

@@ -317,7 +319,12 @@ where
317319
} else if self.current_block_number == self.l1_state.head {
318320
// if we have synced to the head of the L1, notify the channel and set the
319321
// `is_synced`` flag.
320-
if !self.test_mode_skip_synced_notification {
322+
#[cfg(feature = "test-utils")]
323+
let should_skip = self.test_mode_skip_synced_notification;
324+
#[cfg(not(feature = "test-utils"))]
325+
let should_skip = false;
326+
327+
if !should_skip {
321328
if let Err(L1WatcherError::SendError(_)) =
322329
self.notify(L1Notification::Synced).await
323330
{
@@ -910,6 +917,7 @@ mod tests {
910917
metrics: WatcherMetrics::default(),
911918
is_synced: false,
912919
log_query_block_range: LOG_QUERY_BLOCK_RANGE,
920+
#[cfg(feature = "test-utils")]
913921
test_mode_skip_synced_notification: false,
914922
},
915923
rx,

0 commit comments

Comments
 (0)