diff --git a/validator/client/validator_metrics.go b/validator/client/validator_metrics.go index a58a93a90..b8344a2ff 100644 --- a/validator/client/validator_metrics.go +++ b/validator/client/validator_metrics.go @@ -61,6 +61,7 @@ func (v *validator) LogValidatorGainsAndLosses(ctx context.Context, slot uint64) votedTarget := 0 votedHead := 0 + reported := 0 for i, pkey := range pubKeys { pubKey := fmt.Sprintf("%#x", pkey[:8]) log := log.WithField("pubKey", pubKey) @@ -95,21 +96,23 @@ func (v *validator) LogValidatorGainsAndLosses(ctx context.Context, slot uint64) } } - if i < len(resp.InclusionSlots) && resp.InclusionSlots[i] != ^uint64(0) { + if reported < len(resp.InclusionSlots) && resp.InclusionSlots[i] != ^uint64(0) { included++ } - if i < len(resp.CorrectlyVotedSource) && resp.CorrectlyVotedSource[i] { + if reported < len(resp.CorrectlyVotedSource) && resp.CorrectlyVotedSource[i] { votedSource++ } - if i < len(resp.CorrectlyVotedTarget) && resp.CorrectlyVotedTarget[i] { + if reported < len(resp.CorrectlyVotedTarget) && resp.CorrectlyVotedTarget[i] { votedTarget++ } - if i < len(resp.CorrectlyVotedHead) && resp.CorrectlyVotedHead[i] { + if reported < len(resp.CorrectlyVotedHead) && resp.CorrectlyVotedHead[i] { votedHead++ } - if i < len(resp.BalancesAfterEpochTransition) { + if reported < len(resp.BalancesAfterEpochTransition) { v.prevBalance[bytesutil.ToBytes48(pkey)] = resp.BalancesBeforeEpochTransition[i] } + + reported++ } log.WithFields(logrus.Fields{