Skip to content

Commit abddc5f

Browse files
committed
missed CL rewards, missed attestations rewards, missed sync rewards for group summary
1 parent a72be22 commit abddc5f

File tree

2 files changed

+35
-14
lines changed

2 files changed

+35
-14
lines changed

backend/pkg/api/data_access/vdb_summary.go

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -581,14 +581,18 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
581581
goqu.L("attestations_head_executed"),
582582
goqu.L("attestations_source_executed"),
583583
goqu.L("attestations_target_executed"),
584+
goqu.L("attestations_reward_rewards_only"),
584585
goqu.L("blocks_scheduled"),
585586
goqu.L("blocks_proposed"),
587+
goqu.L("blocks_cl_missed_median_reward"),
586588
goqu.L("sync_scheduled"),
587589
goqu.L("sync_executed"),
588590
goqu.L("slashed AS slashed_in_period"),
589591
goqu.L("blocks_slashing_count AS slashed_amount"),
590592
goqu.L("blocks_expected"),
591593
goqu.L("inclusion_delay_sum"),
594+
goqu.L("sync_localized_max_reward"),
595+
goqu.L("sync_reward_rewards_only"),
592596
goqu.L("sync_committees_expected")).
593597
From(goqu.L(fmt.Sprintf(`%s AS r FINAL`, clickhouseTable)))
594598

@@ -603,16 +607,17 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
603607
}
604608

605609
type QueryResult struct {
606-
ValidatorIndex uint32 `db:"validator_index"`
607-
EpochStart uint64 `db:"epoch_start"`
608-
AttestationReward int64 `db:"attestations_reward"`
609-
AttestationIdealReward int64 `db:"attestations_ideal_reward"`
610-
611-
AttestationsScheduled int64 `db:"attestations_scheduled"`
612-
AttestationsObserved int64 `db:"attestations_observed"`
613-
AttestationsHeadExecuted int64 `db:"attestations_head_executed"`
614-
AttestationsSourceExecuted int64 `db:"attestations_source_executed"`
615-
AttestationsTargetExecuted int64 `db:"attestations_target_executed"`
610+
ValidatorIndex uint32 `db:"validator_index"`
611+
EpochStart uint64 `db:"epoch_start"`
612+
AttestationReward int64 `db:"attestations_reward"`
613+
AttestationsIdealReward int64 `db:"attestations_ideal_reward"`
614+
615+
AttestationsScheduled int64 `db:"attestations_scheduled"`
616+
AttestationsObserved int64 `db:"attestations_observed"`
617+
AttestationsHeadExecuted int64 `db:"attestations_head_executed"`
618+
AttestationsSourceExecuted int64 `db:"attestations_source_executed"`
619+
AttestationsTargetExecuted int64 `db:"attestations_target_executed"`
620+
AttestationsRewardRewardsOnly int64 `db:"attestations_reward_rewards_only"`
616621

617622
BlocksScheduled uint32 `db:"blocks_scheduled"`
618623
BlocksProposed uint32 `db:"blocks_proposed"`
@@ -626,6 +631,10 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
626631
BlockChance float64 `db:"blocks_expected"`
627632
SyncCommitteesExpected float64 `db:"sync_committees_expected"`
628633

634+
BlocksCLMissedReward int64 `db:"blocks_cl_missed_median_reward"`
635+
SyncLocalizedMaxRewards int64 `db:"sync_localized_max_reward"`
636+
SyncRewardRewardsOnly int64 `db:"sync_reward_rewards_only"`
637+
629638
InclusionDelaySum int64 `db:"inclusion_delay_sum"`
630639
}
631640

@@ -670,11 +679,15 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
670679
totalSyncExpected := float64(0)
671680
totalProposals := uint32(0)
672681

682+
totalMissedRewardsCl := int64(0)
683+
totalMissedRewardsAttestations := int64(0)
684+
totalMissedRewardsSync := int64(0)
685+
673686
validatorArr := make([]t.VDBValidator, 0)
674687
for _, row := range rows {
675688
validatorArr = append(validatorArr, t.VDBValidator(row.ValidatorIndex))
676689
totalAttestationRewards += row.AttestationReward
677-
totalIdealAttestationRewards += row.AttestationIdealReward
690+
totalIdealAttestationRewards += row.AttestationsIdealReward
678691

679692
ret.AttestationsHead.Success += uint64(row.AttestationsHeadExecuted)
680693
ret.AttestationsHead.Failed += uint64(row.AttestationsScheduled) - uint64(row.AttestationsHeadExecuted)
@@ -685,6 +698,10 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
685698
ret.AttestationsTarget.Success += uint64(row.AttestationsTargetExecuted)
686699
ret.AttestationsTarget.Failed += uint64(row.AttestationsScheduled) - uint64(row.AttestationsTargetExecuted)
687700

701+
totalMissedRewardsCl += row.BlocksCLMissedReward
702+
totalMissedRewardsAttestations += row.AttestationsIdealReward - row.AttestationsRewardRewardsOnly
703+
totalMissedRewardsSync += row.SyncLocalizedMaxRewards - row.SyncRewardRewardsOnly
704+
688705
if row.ValidatorIndex == 0 && row.BlocksProposed > 0 && row.BlocksProposed != row.BlocksScheduled {
689706
row.BlocksProposed-- // subtract the genesis block from validator 0 (TODO: remove when fixed in the dashoard data exporter)
690707
}
@@ -732,6 +749,10 @@ func (d *DataAccessService) GetValidatorDashboardGroupSummary(ctx context.Contex
732749
}
733750
}
734751

752+
ret.MissedRewards.Attestations = utils.GWeiToWei(big.NewInt(totalMissedRewardsAttestations))
753+
ret.MissedRewards.Sync = utils.GWeiToWei(big.NewInt(totalMissedRewardsSync))
754+
ret.MissedRewards.ProposerRewards.Cl = utils.GWeiToWei(big.NewInt(totalMissedRewardsCl))
755+
735756
_, ret.Apr.El, _, ret.Apr.Cl, err = d.internal_getElClAPR(ctx, dashboardId, groupId, hours)
736757
if err != nil {
737758
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)