Skip to content

Commit 1b58ca9

Browse files
committed
refactor: split api block proposal success & miss notification events
See: BEDS-1078
1 parent d219720 commit 1b58ca9

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

backend/pkg/api/data_access/notifications.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,8 +1681,10 @@ func (d *DataAccessService) GetNotificationSettingsDashboards(ctx context.Contex
16811681
settings.GroupEfficiencyBelowThreshold = event.Threshold
16821682
case types.ValidatorMissedAttestationEventName:
16831683
settings.IsAttestationsMissedSubscribed = true
1684-
case types.ValidatorMissedProposalEventName, types.ValidatorExecutedProposalEventName:
1685-
settings.IsBlockProposalSubscribed = true
1684+
case types.ValidatorExecutedProposalEventName:
1685+
settings.IsBlockProposalSuccessSubscribed = true
1686+
case types.ValidatorMissedProposalEventName:
1687+
settings.IsBlockProposalMissedSubscribed = true
16861688
case types.ValidatorUpcomingProposalEventName:
16871689
settings.IsUpcomingBlockProposalSubscribed = true
16881690
case types.SyncCommitteeSoonEventName:
@@ -1922,9 +1924,8 @@ func (d *DataAccessService) UpdateNotificationSettingsValidatorDashboard(ctx con
19221924
d.AddOrRemoveEvent(&eventsToInsert, &eventsToDelete, settings.IsSlashedSubscribed, userId, types.ValidatorGotSlashedEventName, networkName, eventFilter, epoch, 0)
19231925
d.AddOrRemoveEvent(&eventsToInsert, &eventsToDelete, settings.IsMaxCollateralSubscribed, userId, types.RocketpoolCollateralMaxReachedEventName, networkName, eventFilter, epoch, settings.MaxCollateralThreshold)
19241926
d.AddOrRemoveEvent(&eventsToInsert, &eventsToDelete, settings.IsMinCollateralSubscribed, userId, types.RocketpoolCollateralMinReachedEventName, networkName, eventFilter, epoch, settings.MinCollateralThreshold)
1925-
// Set two events for IsBlockProposalSubscribed
1926-
d.AddOrRemoveEvent(&eventsToInsert, &eventsToDelete, settings.IsBlockProposalSubscribed, userId, types.ValidatorMissedProposalEventName, networkName, eventFilter, epoch, 0)
1927-
d.AddOrRemoveEvent(&eventsToInsert, &eventsToDelete, settings.IsBlockProposalSubscribed, userId, types.ValidatorExecutedProposalEventName, networkName, eventFilter, epoch, 0)
1927+
d.AddOrRemoveEvent(&eventsToInsert, &eventsToDelete, settings.IsBlockProposalSuccessSubscribed, userId, types.ValidatorMissedProposalEventName, networkName, eventFilter, epoch, 0)
1928+
d.AddOrRemoveEvent(&eventsToInsert, &eventsToDelete, settings.IsBlockProposalMissedSubscribed, userId, types.ValidatorExecutedProposalEventName, networkName, eventFilter, epoch, 0)
19281929

19291930
// Insert all the events or update the threshold if they already exist
19301931
if len(eventsToInsert) > 0 {

backend/pkg/api/types/notifications.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ type NotificationSettingsValidatorDashboard struct {
186186
IsGroupEfficiencyBelowSubscribed bool `json:"is_group_efficiency_below_subscribed"`
187187
GroupEfficiencyBelowThreshold float64 `json:"group_efficiency_below_threshold" faker:"boundary_start=0, boundary_end=1"`
188188
IsAttestationsMissedSubscribed bool `json:"is_attestations_missed_subscribed"`
189-
IsBlockProposalSubscribed bool `json:"is_block_proposal_subscribed"`
189+
IsBlockProposalSuccessSubscribed bool `json:"is_block_proposal_success_subscribed"`
190+
IsBlockProposalMissedSubscribed bool `json:"is_block_proposal_missed_subscribed"`
190191
IsUpcomingBlockProposalSubscribed bool `json:"is_upcoming_block_proposal_subscribed"`
191192
IsSyncSubscribed bool `json:"is_sync_subscribed"`
192193
IsWithdrawalProcessedSubscribed bool `json:"is_withdrawal_processed_subscribed"`

0 commit comments

Comments
 (0)