Skip to content

Commit e3cd33b

Browse files
committed
apollo_l1_provider: minor updates to some bootstrapping tests of the L1 provider
1 parent 31cfc70 commit e3cd33b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

crates/apollo_l1_provider/src/l1_provider_tests.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,7 @@ async fn bootstrap_e2e() {
14831483

14841484
let mut l1_provider =
14851485
L1Provider::new(config, l1_provider_client.clone(), Arc::new(sync_client), None);
1486+
14861487
// Test.
14871488

14881489
// Trigger the bootstrapper: this will trigger the sync task to start trying to fetch blocks
@@ -1492,10 +1493,7 @@ async fn bootstrap_e2e() {
14921493
// understand though.
14931494
let scraped_l1_handler_txs = vec![]; // No txs to scrape in this test.
14941495
l1_provider.initialize(STARTUP_HEIGHT, scraped_l1_handler_txs).await.unwrap();
1495-
// TODO(guyn): this test assumes we start in bootstrapping state. The test should be updated to
1496-
// include the part where the batcher's first commit_block command is what determines the
1497-
// catchup height and causes the bootstrapping to begin.
1498-
l1_provider.start_bootstrapping(CATCH_UP_HEIGHT);
1496+
commit_block_expect_error_just_to_start_bootstrapping(&mut l1_provider, CATCH_UP_HEIGHT);
14991497

15001498
// Load first **Sync** response: the initializer task will pick it up within the specified
15011499
// interval.
@@ -1578,6 +1576,7 @@ async fn bootstrap_delayed_batcher_and_sync_state_with_trivial_catch_up() {
15781576

15791577
let l1_provider_client = Arc::new(FakeL1ProviderClient::default());
15801578
const STARTUP_HEIGHT: BlockNumber = BlockNumber(3);
1579+
const CATCH_UP_HEIGHT: BlockNumber = BlockNumber(5);
15811580

15821581
let sync_client = MockStateSyncClient::default();
15831582
let config = L1ProviderConfig {
@@ -1587,12 +1586,13 @@ async fn bootstrap_delayed_batcher_and_sync_state_with_trivial_catch_up() {
15871586

15881587
let mut l1_provider =
15891588
L1Provider::new(config, l1_provider_client.clone(), Arc::new(sync_client), None);
1589+
15901590
// Test.
15911591

15921592
// Start the sync sequence, should busy-wait until the batcher height is sent.
15931593
let scraped_l1_handler_txs = []; // No txs to scrape in this test.
15941594
l1_provider.initialize(STARTUP_HEIGHT, scraped_l1_handler_txs.into()).await.unwrap();
1595-
1595+
commit_block_expect_error_just_to_start_bootstrapping(&mut l1_provider, CATCH_UP_HEIGHT);
15961596
// **Commit** a few blocks. The height starts from the provider's current height, since this
15971597
// is a trivial catchup scenario (nothing to catch up).
15981598
// This checks that the trivial catch_up_height doesn't mess up this flow.
@@ -1606,11 +1606,11 @@ async fn bootstrap_delayed_batcher_and_sync_state_with_trivial_catch_up() {
16061606
// Commit blocks should have been applied.
16071607
let start_height_plus_2 = height_add(STARTUP_HEIGHT, 2);
16081608
assert_eq!(l1_provider.current_height, start_height_plus_2);
1609-
// TODO(guyn): it is possible that the rest of this test is trivial.
1609+
16101610
// Should still be bootstrapping, since catchup height isn't determined yet.
16111611
// Technically we could end bootstrapping at this point, but its simpler to let it
16121612
// terminate gracefully once the batcher and sync are ready.
1613-
assert_eq!(l1_provider.state, ProviderState::Pending);
1613+
assert!(l1_provider.state.is_bootstrapping());
16141614

16151615
// Let the sync task continue, it should short circuit.
16161616
tokio::time::sleep(config.startup_sync_sleep_retry_interval_seconds).await;

0 commit comments

Comments
 (0)