Skip to content

Commit 1154722

Browse files
committed
missed rewards rework
1 parent 312444f commit 1154722

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

backend/pkg/api/data_access/vdb_summary.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,10 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
690690
totalSyncExpected := float64(0)
691691
totalProposals := uint32(0)
692692

693+
totalMissedRewardsCl := int64(0)
694+
totalMissedRewardsAttestations := int64(0)
695+
totalMissedRewardsSync := int64(0)
696+
693697
validatorArr := make([]t.VDBValidator, 0)
694698
for _, row := range rows {
695699
validatorArr = append(validatorArr, t.VDBValidator(row.ValidatorIndex))
@@ -705,9 +709,9 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
705709
ret.AttestationsTarget.Success += uint64(row.AttestationsTargetExecuted)
706710
ret.AttestationsTarget.Failed += uint64(row.AttestationsScheduled) - uint64(row.AttestationsTargetExecuted)
707711

708-
ret.MissedRewards.ProposerRewards.Cl += uint64(row.BlocksCLMissedReward)
709-
ret.MissedRewards.Attestations += uint64(row.AttestationsIdealReward) - uint64(row.AttestationsRewardRewardsOnly)
710-
ret.MissedRewards.Sync += uint64(row.SyncLocalizedMaxRewards) - uint64(row.SyncRewardRewardsOnly)
712+
totalMissedRewardsCl += row.BlocksCLMissedReward
713+
totalMissedRewardsAttestations += row.AttestationsIdealReward - row.AttestationsRewardRewardsOnly
714+
totalMissedRewardsSync += row.SyncLocalizedMaxRewards - row.SyncRewardRewardsOnly
711715

712716
if row.ValidatorIndex == 0 && row.BlocksProposed > 0 && row.BlocksProposed != row.BlocksScheduled {
713717
row.BlocksProposed-- // subtract the genesis block from validator 0 (TODO: remove when fixed in the dashoard data exporter)
@@ -756,6 +760,10 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
756760
}
757761
}
758762

763+
ret.MissedRewards.Attestations = ret.MissedRewards.Attestations.Add(decimal.NewFromInt(totalMissedRewardsAttestations))
764+
ret.MissedRewards.Sync = ret.MissedRewards.Sync.Add(decimal.NewFromInt(totalMissedRewardsSync))
765+
ret.MissedRewards.ProposerRewards.Cl = ret.MissedRewards.ProposerRewards.Cl.Add(decimal.NewFromInt(totalMissedRewardsCl))
766+
759767
_, ret.Apr.El, _, ret.Apr.Cl, err = d.internal_getElClAPR(ctx, dashboardId, groupId, hours)
760768
if err != nil {
761769
return nil, err

backend/pkg/api/types/validator_dashboard.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ type VDBGroupSummarySyncCount struct {
7777
}
7878

7979
type VDBGroupSummaryMissedRewards struct {
80-
ProposerRewards ClElValue[uint64] `json:"proposer_rewards"`
81-
Attestations uint64 `json:"attestations"`
82-
Sync uint64 `json:"sync"`
80+
ProposerRewards ClElValue[decimal.Decimal] `json:"proposer_rewards"`
81+
Attestations decimal.Decimal `json:"attestations"`
82+
Sync decimal.Decimal `json:"sync"`
8383
}
8484
type VDBGroupSummaryData struct {
8585
AttestationsHead StatusCount `json:"attestations_head"`

0 commit comments

Comments
 (0)