Skip to content

Commit fd51bee

Browse files
apollo_l1_provider: add reset_bootstrapper function (#10513)
* apollo_l1_provider: check for uninitialized instead of bootstrapping+sync started * apollo_l1_provider: add reset_bootstrapper function
1 parent 2150b53 commit fd51bee

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

crates/apollo_l1_provider/src/l1_provider.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ impl L1Provider {
7272
start_height: None,
7373
}
7474
}
75+
pub fn reset_bootstrapper(&mut self) {
76+
self.bootstrapper = Bootstrapper::new(
77+
self.bootstrapper.l1_provider_client.clone(),
78+
self.bootstrapper.sync_client.clone(),
79+
self.config.startup_sync_sleep_retry_interval_seconds,
80+
);
81+
}
7582
// Functions Called by the scraper.
7683

7784
// Start the provider, get first-scrape events, start L2 sync.
@@ -323,6 +330,7 @@ impl L1Provider {
323330

324331
/// Go from current state to Bootstrap state and start the L2 sync.
325332
pub fn start_bootstrapping(&mut self, target_height: BlockNumber) {
333+
self.reset_bootstrapper();
326334
self.state = ProviderState::Bootstrap;
327335
self.bootstrapper.start_l2_sync(self.current_height, target_height);
328336
}

crates/apollo_l1_provider/src/l1_provider_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,8 @@ async fn commit_block_backlog() {
375375
.build_into_l1_provider();
376376

377377
l1_provider.initialize(STARTUP_HEIGHT, vec![]).await.expect("l1 provider initialize failed");
378-
commit_block_expect_error_just_to_start_bootstrapping(&mut l1_provider, TARGET_HEIGHT);
378+
l1_provider.state = ProviderState::Bootstrap;
379+
l1_provider.bootstrapper.start_l2_sync(STARTUP_HEIGHT, TARGET_HEIGHT);
379380

380381
// Test.
381382
// Commit height is below target height. Doesn't trigger backlog.

0 commit comments

Comments
 (0)