Skip to content

Commit 0cda6da

Browse files
committed
missed cl/el rewards, missed attestations rewards, missed sync rewards for group summary
1 parent 3b2df71 commit 0cda6da

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

backend/pkg/api/data_access/vdb_summary.go

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -592,14 +592,18 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
592592
goqu.L("attestations_head_executed"),
593593
goqu.L("attestations_source_executed"),
594594
goqu.L("attestations_target_executed"),
595+
goqu.L("attestations_reward_rewards_only"),
595596
goqu.L("blocks_scheduled"),
596597
goqu.L("blocks_proposed"),
598+
goqu.L("blocks_cl_missed_median_reward"),
597599
goqu.L("sync_scheduled"),
598600
goqu.L("sync_executed"),
599601
goqu.L("slashed AS slashed_in_period"),
600602
goqu.L("blocks_slashing_count AS slashed_amount"),
601603
goqu.L("blocks_expected"),
602604
goqu.L("inclusion_delay_sum"),
605+
goqu.L("sync_localized_max_reward"),
606+
goqu.L("sync_reward_rewards_only"),
603607
goqu.L("sync_committees_expected")).
604608
From(goqu.L(fmt.Sprintf(`%s AS r FINAL`, clickhouseTable)))
605609

@@ -614,10 +618,10 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
614618
}
615619

616620
type QueryResult struct {
617-
ValidatorIndex uint32 `db:"validator_index"`
618-
EpochStart uint64 `db:"epoch_start"`
619-
AttestationReward int64 `db:"attestations_reward"`
620-
AttestationIdealReward int64 `db:"attestations_ideal_reward"`
621+
ValidatorIndex uint32 `db:"validator_index"`
622+
EpochStart uint64 `db:"epoch_start"`
623+
AttestationReward int64 `db:"attestations_reward"`
624+
AttestationsIdealReward int64 `db:"attestations_ideal_reward"`
621625

622626
AttestationsScheduled int64 `db:"attestations_scheduled"`
623627
AttestationsObserved int64 `db:"attestations_observed"`
@@ -637,6 +641,11 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
637641
BlockChance float64 `db:"blocks_expected"`
638642
SyncCommitteesExpected float64 `db:"sync_committees_expected"`
639643

644+
AttestationsRewardRewardsOnly int64 `db:"attestations_reward_rewards_only"`
645+
BlocksCLMissedReward int64 `db:"blocks_cl_missed_median_reward"`
646+
SyncLocalizedMaxRewards int64 `db:"sync_localized_max_reward"`
647+
SyncRewardRewardsOnly int64 `db:"sync_reward_rewards_only"`
648+
640649
InclusionDelaySum int64 `db:"inclusion_delay_sum"`
641650
}
642651

@@ -681,11 +690,15 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
681690
totalSyncExpected := float64(0)
682691
totalProposals := uint32(0)
683692

693+
totalMissedRewardsCl := int64(0)
694+
totalMissedRewardsAttestations := int64(0)
695+
totalMissedRewardsSync := int64(0)
696+
684697
validatorArr := make([]t.VDBValidator, 0)
685698
for _, row := range rows {
686699
validatorArr = append(validatorArr, t.VDBValidator(row.ValidatorIndex))
687700
totalAttestationRewards += row.AttestationReward
688-
totalIdealAttestationRewards += row.AttestationIdealReward
701+
totalIdealAttestationRewards += row.AttestationsIdealReward
689702

690703
ret.AttestationsHead.Success += uint64(row.AttestationsHeadExecuted)
691704
ret.AttestationsHead.Failed += uint64(row.AttestationsScheduled) - uint64(row.AttestationsHeadExecuted)
@@ -696,6 +709,10 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
696709
ret.AttestationsTarget.Success += uint64(row.AttestationsTargetExecuted)
697710
ret.AttestationsTarget.Failed += uint64(row.AttestationsScheduled) - uint64(row.AttestationsTargetExecuted)
698711

712+
totalMissedRewardsCl += row.BlocksCLMissedReward
713+
totalMissedRewardsAttestations += row.AttestationsIdealReward - row.AttestationsRewardRewardsOnly
714+
totalMissedRewardsSync += row.SyncLocalizedMaxRewards - row.SyncRewardRewardsOnly
715+
699716
if row.ValidatorIndex == 0 && row.BlocksProposed > 0 && row.BlocksProposed != row.BlocksScheduled {
700717
row.BlocksProposed-- // subtract the genesis block from validator 0 (TODO: remove when fixed in the dashoard data exporter)
701718
}
@@ -743,6 +760,10 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
743760
}
744761
}
745762

763+
ret.MissedRewards.Attestations = utils.GWeiToWei(big.NewInt(totalMissedRewardsAttestations))
764+
ret.MissedRewards.Sync = utils.GWeiToWei(big.NewInt(totalMissedRewardsSync))
765+
ret.MissedRewards.ProposerRewards.Cl = utils.GWeiToWei(big.NewInt(totalMissedRewardsCl))
766+
746767
_, ret.Apr.El, _, ret.Apr.Cl, err = d.internal_getElClAPR(ctx, dashboardId, groupId, hours)
747768
if err != nil {
748769
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[decimal.Decimal] `json:"proposer_rewards" faker:"cl_el_eth"`
81-
Attestations decimal.Decimal `json:"attestations" faker:"eth"`
82-
Sync decimal.Decimal `json:"sync" faker:"eth"`
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)