@@ -7,12 +7,13 @@ use crate::{
7
7
} ;
8
8
use environment:: RuntimeContext ;
9
9
use futures:: future:: join_all;
10
- use slog :: { crit, debug , error , info , trace , warn } ;
10
+ use logging :: crit;
11
11
use slot_clock:: SlotClock ;
12
12
use std:: collections:: HashMap ;
13
13
use std:: ops:: Deref ;
14
14
use std:: sync:: Arc ;
15
15
use tokio:: time:: { sleep, sleep_until, Duration , Instant } ;
16
+ use tracing:: { debug, error, info, trace, warn} ;
16
17
use tree_hash:: TreeHash ;
17
18
use types:: { Attestation , AttestationData , ChainSpec , CommitteeIndex , EthSpec , Slot } ;
18
19
@@ -130,9 +131,8 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
130
131
. ok_or ( "Unable to determine duration to next slot" ) ?;
131
132
132
133
info ! (
133
- log,
134
- "Attestation production service started" ;
135
- "next_update_millis" => duration_to_next_slot. as_millis( )
134
+ next_update_millis = duration_to_next_slot. as_millis( ) ,
135
+ "Attestation production service started"
136
136
) ;
137
137
138
138
let executor = self . context . executor . clone ( ) ;
@@ -144,19 +144,12 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
144
144
let log = self . context . log ( ) ;
145
145
146
146
if let Err ( e) = self . spawn_attestation_tasks ( slot_duration) {
147
- crit ! (
148
- log,
149
- "Failed to spawn attestation tasks" ;
150
- "error" => e
151
- )
147
+ crit ! ( error = e, "Failed to spawn attestation tasks" )
152
148
} else {
153
- trace ! (
154
- log,
155
- "Spawned attestation tasks" ;
156
- )
149
+ trace ! ( "Spawned attestation tasks" )
157
150
}
158
151
} else {
159
- error ! ( log , "Failed to read slot clock" ) ;
152
+ error ! ( "Failed to read slot clock" ) ;
160
153
// If we can't read the slot clock, just wait another slot.
161
154
sleep ( slot_duration) . await ;
162
155
continue ;
@@ -258,11 +251,10 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
258
251
. await
259
252
. map_err ( move |e| {
260
253
crit ! (
261
- log,
262
- "Error during attestation routine" ;
263
- "error" => format!( "{:?}" , e) ,
264
- "committee_index" => committee_index,
265
- "slot" => slot. as_u64( ) ,
254
+ error = format!( "{:?}" , e) ,
255
+ committee_index,
256
+ slot = slot. as_u64( ) ,
257
+ "Error during attestation routine"
266
258
)
267
259
} ) ?;
268
260
@@ -295,11 +287,10 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
295
287
. await
296
288
. map_err ( move |e| {
297
289
crit ! (
298
- log,
299
- "Error during attestation routine" ;
300
- "error" => format!( "{:?}" , e) ,
301
- "committee_index" => committee_index,
302
- "slot" => slot. as_u64( ) ,
290
+ error = format!( "{:?}" , e) ,
291
+ committee_index,
292
+ slot = slot. as_u64( ) ,
293
+ "Error during attestation routine"
303
294
)
304
295
} ) ?;
305
296
}
@@ -366,13 +357,12 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
366
357
// Ensure that the attestation matches the duties.
367
358
if !duty. match_attestation_data :: < E > ( attestation_data, & self . context . eth2_config . spec ) {
368
359
crit ! (
369
- log,
370
- "Inconsistent validator duties during signing" ;
371
- "validator" => ?duty. pubkey,
372
- "duty_slot" => duty. slot,
373
- "attestation_slot" => attestation_data. slot,
374
- "duty_index" => duty. committee_index,
375
- "attestation_index" => attestation_data. index,
360
+ validator = ?duty. pubkey,
361
+ ?duty. slot,
362
+ attestation_slot = ?attestation_data. slot,
363
+ duty_index = duty. committee_index,
364
+ attestation_index = attestation_data. index,
365
+ "Inconsistent validator duties during signing"
376
366
) ;
377
367
return None ;
378
368
}
@@ -389,11 +379,10 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
389
379
Ok ( attestation) => attestation,
390
380
Err ( err) => {
391
381
crit ! (
392
- log,
393
- "Invalid validator duties during signing" ;
394
- "validator" => ?duty. pubkey,
395
- "duty" => ?duty,
396
- "err" => ?err,
382
+ validator = ?duty. pubkey,
383
+ ?duty,
384
+ ?err,
385
+ "Invalid validator duties during signing"
397
386
) ;
398
387
return None ;
399
388
}
@@ -414,24 +403,22 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
414
403
// A pubkey can be missing when a validator was recently
415
404
// removed via the API.
416
405
warn ! (
417
- log,
418
- "Missing pubkey for attestation" ;
419
- "info" => "a validator may have recently been removed from this VC" ,
420
- "pubkey" => ?pubkey,
421
- "validator" => ?duty. pubkey,
422
- "committee_index" => committee_index,
423
- "slot" => slot. as_u64( ) ,
406
+ info = "a validator may have recently been removed from this VC" ,
407
+ ?pubkey,
408
+ validator = ?duty. pubkey,
409
+ committee_index = committee_index,
410
+ slot = slot. as_u64( ) ,
411
+ "Missing pubkey for attestation"
424
412
) ;
425
413
None
426
414
}
427
415
Err ( e) => {
428
416
crit ! (
429
- log,
430
- "Failed to sign attestation" ;
431
- "error" => ?e,
432
- "validator" => ?duty. pubkey,
433
- "committee_index" => committee_index,
434
- "slot" => slot. as_u64( ) ,
417
+ error = ?e,
418
+ validator = ?duty. pubkey,
419
+ committee_index,
420
+ slot = slot. as_u64( ) ,
421
+ "Failed to sign attestation"
435
422
) ;
436
423
None
437
424
}
@@ -446,7 +433,7 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
446
433
. unzip ( ) ;
447
434
448
435
if attestations. is_empty ( ) {
449
- warn ! ( log , "No attestations were published" ) ;
436
+ warn ! ( "No attestations were published" ) ;
450
437
return Ok ( None ) ;
451
438
}
452
439
let fork_name = self
@@ -481,22 +468,20 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
481
468
. await
482
469
{
483
470
Ok ( ( ) ) => info ! (
484
- log,
485
- "Successfully published attestations" ;
486
- "count" => attestations. len( ) ,
487
- "validator_indices" => ?validator_indices,
488
- "head_block" => ?attestation_data. beacon_block_root,
489
- "committee_index" => attestation_data. index,
490
- "slot" => attestation_data. slot. as_u64( ) ,
491
- "type" => "unaggregated" ,
471
+ count = attestations. len( ) ,
472
+ ?validator_indices,
473
+ head_block = ?attestation_data. beacon_block_root,
474
+ committee_index = attestation_data. index,
475
+ slot = attestation_data. slot. as_u64( ) ,
476
+ r#type = "unaggregated" ,
477
+ "Successfully published attestations"
492
478
) ,
493
479
Err ( e) => error ! (
494
- log,
495
- "Unable to publish attestations" ;
496
- "error" => %e,
497
- "committee_index" => attestation_data. index,
498
- "slot" => slot. as_u64( ) ,
499
- "type" => "unaggregated" ,
480
+ error = %e,
481
+ committee_index = attestation_data. index,
482
+ slot = slot. as_u64( ) ,
483
+ r#type = "unaggregated" ,
484
+ "Unable to publish attestations"
500
485
) ,
501
486
}
502
487
@@ -589,7 +574,7 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
589
574
let selection_proof = duty_and_proof. selection_proof . as_ref ( ) ?;
590
575
591
576
if !duty. match_attestation_data :: < E > ( attestation_data, & self . context . eth2_config . spec ) {
592
- crit ! ( log , "Inconsistent validator duties during signing" ) ;
577
+ crit ! ( "Inconsistent validator duties during signing" ) ;
593
578
return None ;
594
579
}
595
580
@@ -607,19 +592,14 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
607
592
Err ( ValidatorStoreError :: UnknownPubkey ( pubkey) ) => {
608
593
// A pubkey can be missing when a validator was recently
609
594
// removed via the API.
610
- debug ! (
611
- log,
612
- "Missing pubkey for aggregate" ;
613
- "pubkey" => ?pubkey,
614
- ) ;
595
+ debug ! ( ?pubkey, "Missing pubkey for aggregate" ) ;
615
596
None
616
597
}
617
598
Err ( e) => {
618
599
crit ! (
619
- log,
620
- "Failed to sign aggregate" ;
621
- "error" => ?e,
622
- "pubkey" => ?duty. pubkey,
600
+ error = ?e,
601
+ pubkey = ?duty. pubkey,
602
+ "Failed to sign aggregate"
623
603
) ;
624
604
None
625
605
}
@@ -667,28 +647,26 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
667
647
for signed_aggregate_and_proof in signed_aggregate_and_proofs {
668
648
let attestation = signed_aggregate_and_proof. message ( ) . aggregate ( ) ;
669
649
info ! (
670
- log,
671
- "Successfully published attestation" ;
672
- "aggregator" => signed_aggregate_and_proof. message( ) . aggregator_index( ) ,
673
- "signatures" => attestation. num_set_aggregation_bits( ) ,
674
- "head_block" => format!( "{:?}" , attestation. data( ) . beacon_block_root) ,
675
- "committee_index" => attestation. committee_index( ) ,
676
- "slot" => attestation. data( ) . slot. as_u64( ) ,
677
- "type" => "aggregated" ,
650
+ aggregator = signed_aggregate_and_proof. message( ) . aggregator_index( ) ,
651
+ signatures = attestation. num_set_aggregation_bits( ) ,
652
+ head_block = format!( "{:?}" , attestation. data( ) . beacon_block_root) ,
653
+ committee_index = attestation. committee_index( ) ,
654
+ slot = attestation. data( ) . slot. as_u64( ) ,
655
+ r#type = "aggregated" ,
656
+ "Successfully published attestation"
678
657
) ;
679
658
}
680
659
}
681
660
Err ( e) => {
682
661
for signed_aggregate_and_proof in signed_aggregate_and_proofs {
683
662
let attestation = & signed_aggregate_and_proof. message ( ) . aggregate ( ) ;
684
663
crit ! (
685
- log,
686
- "Failed to publish attestation" ;
687
- "error" => %e,
688
- "aggregator" => signed_aggregate_and_proof. message( ) . aggregator_index( ) ,
689
- "committee_index" => attestation. committee_index( ) ,
690
- "slot" => attestation. data( ) . slot. as_u64( ) ,
691
- "type" => "aggregated" ,
664
+ error = %e,
665
+ aggregator = signed_aggregate_and_proof. message( ) . aggregator_index( ) ,
666
+ committee_index = attestation. committee_index( ) ,
667
+ slot = attestation. data( ) . slot. as_u64( ) ,
668
+ r#type = "aggregated" ,
669
+ "Failed to publish attestation"
692
670
) ;
693
671
}
694
672
}
0 commit comments