From 62ad3dfd61240c8b2ade96ed7b61bb2bfce11763 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Wed, 27 Mar 2019 13:58:02 -0700 Subject: [PATCH] Fix epoch numbers for logs (#2096) * fixed loggings * imports --- beacon-chain/attestation/service.go | 2 +- validator/client/runner.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/beacon-chain/attestation/service.go b/beacon-chain/attestation/service.go index b02fc9d8f..0b47a0d3d 100644 --- a/beacon-chain/attestation/service.go +++ b/beacon-chain/attestation/service.go @@ -198,7 +198,7 @@ func (a *Service) UpdateLatestAttestation(ctx context.Context, attestation *pb.A } log.WithFields(logrus.Fields{ - "attestation slot": attestation.Data.Slot, + "attestation slot": attestation.Data.Slot - params.BeaconConfig().GenesisSlot, "attestation shard": attestation.Data.Shard, "committees shard": committees[0].Shard, "committees list": committees[0].Committee, diff --git a/validator/client/runner.go b/validator/client/runner.go index a157aa873..0714bffb4 100644 --- a/validator/client/runner.go +++ b/validator/client/runner.go @@ -60,7 +60,8 @@ func run(ctx context.Context, v Validator) { slotCtx, _ := context.WithDeadline(ctx, v.SlotDeadline(slot)) // Report this validator client's rewards and penalties throughout its lifecycle. if err := v.LogValidatorGainsAndLosses(slotCtx, slot); err != nil { - log.Errorf("Could not report validator's rewards/penalties for slot %d: %v", slot, err) + log.Errorf("Could not report validator's rewards/penalties for slot %d: %v", + slot-params.BeaconConfig().GenesisSlot, err) } // Keep trying to update assignments if they are nil or if we are past an @@ -92,7 +93,7 @@ func run(ctx context.Context, v Validator) { func handleAssignmentError(err error, slot uint64) { if errCode, ok := status.FromError(err); ok && errCode.Code() == codes.NotFound { log.WithField( - "epoch", (slot*params.BeaconConfig().SlotsPerEpoch)-params.BeaconConfig().GenesisEpoch, + "epoch", (slot/params.BeaconConfig().SlotsPerEpoch)-params.BeaconConfig().GenesisEpoch, ).Warn("Validator not yet assigned to epoch") } else { log.WithField("error", err).Error("Failed to update assignments")