@@ -128,7 +128,7 @@ async fn wait_for_enough_immutable(db_directory: &Path) -> Result<(), String> {
128
128
}
129
129
130
130
async fn wait_for_epoch_settings ( aggregator_endpoint : & str ) -> Result < EpochSettings , String > {
131
- let url = format ! ( "{}/epoch-settings" , aggregator_endpoint ) ;
131
+ let url = format ! ( "{aggregator_endpoint }/epoch-settings" ) ;
132
132
info ! ( "Waiting for the aggregator to expose epoch settings" ) ;
133
133
134
134
match attempt ! ( 20 , Duration :: from_millis( 1000 ) , {
@@ -138,7 +138,7 @@ async fn wait_for_epoch_settings(aggregator_endpoint: &str) -> Result<EpochSetti
138
138
let epoch_settings = response
139
139
. json:: <EpochSettings >( )
140
140
. await
141
- . map_err( |e| format!( "Invalid EpochSettings body : {}" , e ) ) ?;
141
+ . map_err( |e| format!( "Invalid EpochSettings body : {e}" ) ) ?;
142
142
info!( "Aggregator ready" ; "epoch_settings" => #?epoch_settings) ;
143
143
Ok ( Some ( epoch_settings) )
144
144
}
@@ -157,8 +157,7 @@ async fn wait_for_epoch_settings(aggregator_endpoint: &str) -> Result<EpochSetti
157
157
AttemptResult :: Ok ( epoch_settings) => Ok ( epoch_settings) ,
158
158
AttemptResult :: Err ( error) => Err ( error) ,
159
159
AttemptResult :: Timeout ( ) => Err ( format ! (
160
- "Timeout exhausted for aggregator to be up, no response from `{}`" ,
161
- url
160
+ "Timeout exhausted for aggregator to be up, no response from `{url}`"
162
161
) ) ,
163
162
}
164
163
}
@@ -183,7 +182,7 @@ async fn wait_for_target_epoch(
183
182
}
184
183
}
185
184
Ok ( None ) => Ok ( None ) ,
186
- Err ( err) => Err ( format!( "Could not query current epoch: {}" , err ) ) ,
185
+ Err ( err) => Err ( format!( "Could not query current epoch: {err}" ) ) ,
187
186
}
188
187
} ) {
189
188
AttemptResult :: Ok ( _) => {
@@ -242,7 +241,7 @@ async fn update_protocol_parameters(aggregator: &mut Aggregator) -> Result<(), S
242
241
}
243
242
244
243
async fn assert_node_producing_snapshot ( aggregator_endpoint : & str ) -> Result < String , String > {
245
- let url = format ! ( "{}/snapshots" , aggregator_endpoint ) ;
244
+ let url = format ! ( "{aggregator_endpoint }/snapshots" ) ;
246
245
info ! ( "Waiting for the aggregator to produce a snapshot" ) ;
247
246
248
247
// todo: reduce the number of attempts if we can reduce the delay between two immutables
@@ -252,11 +251,11 @@ async fn assert_node_producing_snapshot(aggregator_endpoint: &str) -> Result<Str
252
251
StatusCode :: OK => match response. json:: <Vec <Snapshot >>( ) . await . as_deref( ) {
253
252
Ok ( [ snapshot, ..] ) => Ok ( Some ( snapshot. digest. clone( ) ) ) ,
254
253
Ok ( & [ ] ) => Ok ( None ) ,
255
- Err ( err) => Err ( format!( "Invalid snapshot body : {}" , err , ) ) ,
254
+ Err ( err) => Err ( format!( "Invalid snapshot body : {err}" , ) ) ,
256
255
} ,
257
- s => Err ( format!( "Unexpected status code from Aggregator: {}" , s ) ) ,
256
+ s => Err ( format!( "Unexpected status code from Aggregator: {s}" ) ) ,
258
257
} ,
259
- Err ( err) => Err ( format!( "Request to `{}` failed: {}" , url , err ) ) ,
258
+ Err ( err) => Err ( format!( "Request to `{url }` failed: {err}" ) ) ,
260
259
}
261
260
} ) {
262
261
AttemptResult :: Ok ( digest) => {
@@ -265,8 +264,7 @@ async fn assert_node_producing_snapshot(aggregator_endpoint: &str) -> Result<Str
265
264
}
266
265
AttemptResult :: Err ( error) => Err ( error) ,
267
266
AttemptResult :: Timeout ( ) => Err ( format ! (
268
- "Timeout exhausted assert_node_producing_snapshot, no response from `{}`" ,
269
- url
267
+ "Timeout exhausted assert_node_producing_snapshot, no response from `{url}`"
270
268
) ) ,
271
269
}
272
270
}
@@ -276,7 +274,7 @@ async fn assert_signer_is_signing_snapshot(
276
274
digest : & str ,
277
275
expected_epoch_min : Epoch ,
278
276
) -> Result < String , String > {
279
- let url = format ! ( "{}/snapshot/{}" , aggregator_endpoint , digest ) ;
277
+ let url = format ! ( "{aggregator_endpoint }/snapshot/{digest}" ) ;
280
278
info ! (
281
279
"Asserting the aggregator is signing the snapshot message `{}` with an expected min epoch of `{}`" ,
282
280
digest,
@@ -290,16 +288,15 @@ async fn assert_signer_is_signing_snapshot(
290
288
Ok ( snapshot) => match snapshot. beacon. epoch {
291
289
epoch if epoch >= expected_epoch_min => Ok ( Some ( snapshot) ) ,
292
290
epoch => Err ( format!(
293
- "Minimum expected snapshot epoch not reached : {} < {}" ,
294
- epoch, expected_epoch_min
291
+ "Minimum expected snapshot epoch not reached : {epoch} < {expected_epoch_min}"
295
292
) ) ,
296
293
} ,
297
- Err ( err) => Err ( format!( "Invalid snapshot body : {}" , err , ) ) ,
294
+ Err ( err) => Err ( format!( "Invalid snapshot body : {err}" , ) ) ,
298
295
} ,
299
296
StatusCode :: NOT_FOUND => Ok ( None ) ,
300
- s => Err ( format!( "Unexpected status code from Aggregator: {}" , s ) ) ,
297
+ s => Err ( format!( "Unexpected status code from Aggregator: {s}" ) ) ,
301
298
} ,
302
- Err ( err) => Err ( format!( "Request to `{}` failed: {}" , url , err ) ) ,
299
+ Err ( err) => Err ( format!( "Request to `{url }` failed: {err}" ) ) ,
303
300
}
304
301
} ) {
305
302
AttemptResult :: Ok ( snapshot) => {
@@ -309,8 +306,7 @@ async fn assert_signer_is_signing_snapshot(
309
306
}
310
307
AttemptResult :: Err ( error) => Err ( error) ,
311
308
AttemptResult :: Timeout ( ) => Err ( format ! (
312
- "Timeout exhausted assert_signer_is_signing_snapshot, no response from `{}`" ,
313
- url
309
+ "Timeout exhausted assert_signer_is_signing_snapshot, no response from `{url}`"
314
310
) ) ,
315
311
}
316
312
}
@@ -320,19 +316,19 @@ async fn assert_is_creating_certificate_with_enough_signers(
320
316
certificate_hash : & str ,
321
317
total_signers_expected : usize ,
322
318
) -> Result < ( ) , String > {
323
- let url = format ! ( "{}/certificate/{}" , aggregator_endpoint , certificate_hash ) ;
319
+ let url = format ! ( "{aggregator_endpoint }/certificate/{certificate_hash}" ) ;
324
320
325
321
match attempt ! ( 10 , Duration :: from_millis( 1000 ) , {
326
322
match reqwest:: get( url. clone( ) ) . await {
327
323
Ok ( response) => match response. status( ) {
328
324
StatusCode :: OK => match response. json:: <Certificate >( ) . await {
329
325
Ok ( certificate) => Ok ( Some ( certificate) ) ,
330
- Err ( err) => Err ( format!( "Invalid snapshot body : {}" , err , ) ) ,
326
+ Err ( err) => Err ( format!( "Invalid snapshot body : {err}" , ) ) ,
331
327
} ,
332
328
StatusCode :: NOT_FOUND => Ok ( None ) ,
333
- s => Err ( format!( "Unexpected status code from Aggregator: {}" , s ) ) ,
329
+ s => Err ( format!( "Unexpected status code from Aggregator: {s}" ) ) ,
334
330
} ,
335
- Err ( err) => Err ( format!( "Request to `{}` failed: {}" , url , err ) ) ,
331
+ Err ( err) => Err ( format!( "Request to `{url }` failed: {err}" ) ) ,
336
332
}
337
333
} ) {
338
334
AttemptResult :: Ok ( certificate) => {
@@ -354,8 +350,7 @@ async fn assert_is_creating_certificate_with_enough_signers(
354
350
}
355
351
AttemptResult :: Err ( error) => Err ( error) ,
356
352
AttemptResult :: Timeout ( ) => Err ( format ! (
357
- "Timeout exhausted assert_is_creating_certificate, no response from `{}`" ,
358
- url
353
+ "Timeout exhausted assert_is_creating_certificate, no response from `{url}`"
359
354
) ) ,
360
355
}
361
356
}
0 commit comments