Consider missing validator count for performance metric (#4928)

* Consider missing validator count
* Use validator count reported
* Merge branch 'master' into missing-validators
* Merge refs/heads/master into missing-validators
This commit is contained in:
terence tsao 2020-02-24 08:28:22 -08:00 committed by GitHub
parent 15b649d760
commit 0470d37072
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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{