Fix reported effective balance for unknown/pending validators (#12693)

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
m3diumrare 2023-08-07 07:19:02 -07:00 committed by GitHub
parent 56a0315dde
commit d2ff995eb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -255,9 +255,11 @@ func (v *validator) LogValidatorGainsAndLosses(ctx context.Context, slot primiti
}
if v.emitAccountMetrics {
// There is no distinction between unknown and pending validators here.
// The balance is recorded as 0, as this metric is the effective balance of a participating validator.
for _, missingPubKey := range resp.MissingValidators {
fmtKey := fmt.Sprintf("%#x", missingPubKey)
ValidatorBalancesGaugeVec.WithLabelValues(fmtKey).Set(float64(params.BeaconConfig().MaxEffectiveBalance) / float64(params.BeaconConfig().GweiPerEth))
ValidatorBalancesGaugeVec.WithLabelValues(fmtKey).Set(0)
}
}