@@ -149,8 +149,8 @@ async fn bootstrap_e2e() {
149
149
// Setup.
150
150
151
151
let l1_provider_client = Arc :: new ( FakeL1ProviderClient :: default ( ) ) ;
152
- let startup_height = BlockNumber ( 2 ) ;
153
- let catch_up_height = BlockNumber ( 5 ) ;
152
+ const STARTUP_HEIGHT : BlockNumber = BlockNumber ( 2 ) ;
153
+ const CATCH_UP_HEIGHT : BlockNumber = BlockNumber ( 5 ) ;
154
154
155
155
// Make the mocked sync client try removing from a hashmap as a response to get block.
156
156
let mut sync_client = MockStateSyncClient :: default ( ) ;
@@ -159,15 +159,15 @@ async fn bootstrap_e2e() {
159
159
sync_client. expect_get_block ( ) . returning ( move |input| Ok ( sync_response_clone. remove ( & input) ) ) ;
160
160
161
161
let config = L1ProviderConfig {
162
- bootstrap_catch_up_height_override : Some ( catch_up_height ) ,
162
+ bootstrap_catch_up_height_override : Some ( CATCH_UP_HEIGHT ) ,
163
163
startup_sync_sleep_retry_interval : Duration :: from_millis ( 10 ) ,
164
164
..Default :: default ( )
165
165
} ;
166
166
let mut l1_provider = create_l1_provider (
167
167
config,
168
168
l1_provider_client. clone ( ) ,
169
169
Arc :: new ( sync_client) ,
170
- startup_height ,
170
+ STARTUP_HEIGHT ,
171
171
) ;
172
172
173
173
// Test.
@@ -182,25 +182,25 @@ async fn bootstrap_e2e() {
182
182
183
183
// Load first **Sync** response: the initializer task will pick it up within the specified
184
184
// interval.
185
- sync_response. lock ( ) . unwrap ( ) . insert ( startup_height , SyncBlock :: default ( ) ) ;
185
+ sync_response. lock ( ) . unwrap ( ) . insert ( STARTUP_HEIGHT , SyncBlock :: default ( ) ) ;
186
186
tokio:: time:: sleep ( config. startup_sync_sleep_retry_interval ) . await ;
187
187
188
188
// **Commit** 2 blocks past catchup height, should be received after the previous sync.
189
189
let no_txs_committed = vec ! [ ] ; // Not testing txs in this test.
190
190
l1_provider_client
191
- . commit_block ( no_txs_committed. clone ( ) , catch_up_height . unchecked_next ( ) )
191
+ . commit_block ( no_txs_committed. clone ( ) , CATCH_UP_HEIGHT . unchecked_next ( ) )
192
192
. await
193
193
. unwrap ( ) ;
194
194
tokio:: time:: sleep ( config. startup_sync_sleep_retry_interval ) . await ;
195
195
l1_provider_client
196
- . commit_block ( no_txs_committed, catch_up_height . unchecked_next ( ) . unchecked_next ( ) )
196
+ . commit_block ( no_txs_committed, CATCH_UP_HEIGHT . unchecked_next ( ) . unchecked_next ( ) )
197
197
. await
198
198
. unwrap ( ) ;
199
199
tokio:: time:: sleep ( config. startup_sync_sleep_retry_interval ) . await ;
200
200
201
201
// Feed sync task the remaining blocks, will be received after the commits above.
202
- sync_response. lock ( ) . unwrap ( ) . insert ( BlockNumber ( startup_height . 0 + 1 ) , SyncBlock :: default ( ) ) ;
203
- sync_response. lock ( ) . unwrap ( ) . insert ( BlockNumber ( startup_height . 0 + 2 ) , SyncBlock :: default ( ) ) ;
202
+ sync_response. lock ( ) . unwrap ( ) . insert ( BlockNumber ( STARTUP_HEIGHT . 0 + 1 ) , SyncBlock :: default ( ) ) ;
203
+ sync_response. lock ( ) . unwrap ( ) . insert ( BlockNumber ( STARTUP_HEIGHT . 0 + 2 ) , SyncBlock :: default ( ) ) ;
204
204
tokio:: time:: sleep ( 2 * config. startup_sync_sleep_retry_interval ) . await ;
205
205
206
206
// Assert that initializer task has received the stubbed responses from the sync client and sent
@@ -265,7 +265,7 @@ async fn bootstrap_delayed_sync_state_with_trivial_catch_up() {
265
265
// Setup.
266
266
267
267
let l1_provider_client = Arc :: new ( FakeL1ProviderClient :: default ( ) ) ;
268
- let startup_height = BlockNumber ( 2 ) ;
268
+ const STARTUP_HEIGHT : BlockNumber = BlockNumber ( 2 ) ;
269
269
270
270
let mut sync_client = MockStateSyncClient :: default ( ) ;
271
271
// Mock sync response for an arbitrary number of calls to get_latest_block_number.
@@ -284,7 +284,7 @@ async fn bootstrap_delayed_sync_state_with_trivial_catch_up() {
284
284
config,
285
285
l1_provider_client. clone ( ) ,
286
286
Arc :: new ( sync_client) ,
287
- startup_height ,
287
+ STARTUP_HEIGHT ,
288
288
) ;
289
289
290
290
// Test.
@@ -297,9 +297,9 @@ async fn bootstrap_delayed_sync_state_with_trivial_catch_up() {
297
297
// is a trivial catchup scenario (nothing to catch up).
298
298
// This checks that the trivial catch_up_height doesn't mess up this flow.
299
299
let no_txs_committed = [ ] ; // Not testing txs in this test.
300
- l1_provider_client. commit_block ( no_txs_committed. to_vec ( ) , startup_height ) . await . unwrap ( ) ;
300
+ l1_provider_client. commit_block ( no_txs_committed. to_vec ( ) , STARTUP_HEIGHT ) . await . unwrap ( ) ;
301
301
l1_provider_client
302
- . commit_block ( no_txs_committed. to_vec ( ) , startup_height . unchecked_next ( ) )
302
+ . commit_block ( no_txs_committed. to_vec ( ) , STARTUP_HEIGHT . unchecked_next ( ) )
303
303
. await
304
304
. unwrap ( ) ;
305
305
@@ -311,7 +311,7 @@ async fn bootstrap_delayed_sync_state_with_trivial_catch_up() {
311
311
}
312
312
313
313
// Commit blocks should have been applied.
314
- let start_height_plus_2 = startup_height . unchecked_next ( ) . unchecked_next ( ) ;
314
+ let start_height_plus_2 = STARTUP_HEIGHT . unchecked_next ( ) . unchecked_next ( ) ;
315
315
assert_eq ! ( l1_provider. current_height, start_height_plus_2) ;
316
316
// Should still be bootstrapping, since catchup height isn't determined yet.
317
317
// Technically we could end bootstrapping at this point, but its simpler to let it
0 commit comments