Skip to content

Commit

Permalink
Update attestation schedule log with total attester count (#8013)
Browse files Browse the repository at this point in the history
* Log attesting total

* Use the right library

* Go fmt

* Use fmt

* No space is better

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Dec 4, 2020
1 parent d2ba45a commit 3ce9670
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions validator/client/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ func (v *validator) logDuties(slot uint64, duties []*ethpb.DutiesResponse_Duty)
}
proposerKeys := make([]string, params.BeaconConfig().SlotsPerEpoch)
slotOffset := slot - (slot % params.BeaconConfig().SlotsPerEpoch)

var totalAttestingKeys uint64
for _, duty := range duties {
if v.emitAccountMetrics {
fmtKey := fmt.Sprintf("%#x", duty.PublicKey)
Expand All @@ -658,6 +658,7 @@ func (v *validator) logDuties(slot uint64, duties []*ethpb.DutiesResponse_Duty)
log.WithField("duty", duty).Warn("Invalid attester slot")
} else {
attesterKeys[duty.AttesterSlot-slotOffset] = append(attesterKeys[duty.AttesterSlot-slotOffset], validatorKey)
totalAttestingKeys++
}

for _, proposerSlot := range duty.ProposerSlots {
Expand All @@ -671,7 +672,11 @@ func (v *validator) logDuties(slot uint64, duties []*ethpb.DutiesResponse_Duty)
}
for i := uint64(0); i < params.BeaconConfig().SlotsPerEpoch; i++ {
if len(attesterKeys[i]) > 0 {
log.WithField("slot", slotOffset+i).WithField("attesters", len(attesterKeys[i])).WithField("pubKeys", attesterKeys[i]).Info("Attestation schedule")
log.WithFields(logrus.Fields{
"slot": slotOffset + i,
"attesters": fmt.Sprintf("%d/%d", len(attesterKeys[i]), totalAttestingKeys),
"pubKeys": attesterKeys[i],
}).Info("Attestation schedule")
}
if proposerKeys[i] != "" {
log.WithField("slot", slotOffset+i).WithField("pubKey", proposerKeys[i]).Info("Proposal schedule")
Expand Down

0 comments on commit 3ce9670

Please sign in to comment.