Skip to content

Commit

Permalink
Fix activationEpoch=FarFutureEpoch in validator client logging (#5608)
Browse files Browse the repository at this point in the history
* Handle pending case where activation epoch is FarFuture

* Fix logs for validators pending activation

* Reword pending activation log
  • Loading branch information
0xKiwi authored Apr 24, 2020
1 parent a33bd94 commit 9212638
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
13 changes: 9 additions & 4 deletions validator/client/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,15 @@ func (v *validator) checkAndLogValidatorStatus(validatorStatuses []*ethpb.Valida
).Info("Deposit processed, entering activation queue after finalization")
}
case ethpb.ValidatorStatus_PENDING:
log.WithFields(logrus.Fields{
"positionInActivationQueue": status.Status.PositionInActivationQueue,
"activationEpoch": status.Status.ActivationEpoch,
}).Info("Waiting to be activated")
if status.Status.ActivationEpoch == params.BeaconConfig().FarFutureEpoch {
log.WithFields(logrus.Fields{
"positionInActivationQueue": status.Status.PositionInActivationQueue,
}).Info("Waiting to be assigned activation epoch")
} else {
log.WithFields(logrus.Fields{
"activationEpoch": status.Status.ActivationEpoch,
}).Info("Waiting for activation")
}
case ethpb.ValidatorStatus_ACTIVE:
activatedKeys = append(activatedKeys, status.PublicKey)
case ethpb.ValidatorStatus_EXITED:
Expand Down
14 changes: 13 additions & 1 deletion validator/client/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,18 @@ func TestCheckAndLogValidatorStatus_OK(t *testing.T) {
},
log: "Deposit processed, entering activation queue after finalization\" positionInActivationQueue=30",
},
{
name: "PENDING",
status: &ethpb.ValidatorActivationResponse_Status{
PublicKey: pubKeys[0],
Status: &ethpb.ValidatorStatusResponse{
Status: ethpb.ValidatorStatus_PENDING,
ActivationEpoch: params.BeaconConfig().FarFutureEpoch,
PositionInActivationQueue: 6,
},
},
log: "Waiting to be assigned activation epoch\" positionInActivationQueue=6",
},
{
name: "PENDING",
status: &ethpb.ValidatorActivationResponse_Status{
Expand All @@ -869,7 +881,7 @@ func TestCheckAndLogValidatorStatus_OK(t *testing.T) {
PositionInActivationQueue: 5,
},
},
log: "Waiting to be activated\" activationEpoch=60 positionInActivationQueue=5",
log: "Waiting for activation\" activationEpoch=60",
},
{
name: "EXITED",
Expand Down

0 comments on commit 9212638

Please sign in to comment.