Skip to content

Commit f29cc18

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

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
@@ -1679,8 +1679,10 @@ func (d *DataAccessService) GetNotificationSettingsDashboards(ctx context.Contex
16791679
settings.GroupEfficiencyBelowThreshold = event.Threshold
16801680
case types.ValidatorMissedAttestationEventName:
16811681
settings.IsAttestationsMissedSubscribed = true
1682-
case types.ValidatorMissedProposalEventName, types.ValidatorExecutedProposalEventName:
1683-
settings.IsBlockProposalSubscribed = true
1682+
case types.ValidatorExecutedProposalEventName:
1683+
settings.IsBlockProposalSuccessSubscribed = true
1684+
case types.ValidatorMissedProposalEventName:
1685+
settings.IsBlockProposalMissedSubscribed = true
16841686
case types.ValidatorUpcomingProposalEventName:
16851687
settings.IsUpcomingBlockProposalSubscribed = true
16861688
case types.SyncCommitteeSoonEventName:
@@ -1919,9 +1921,8 @@ func (d *DataAccessService) UpdateNotificationSettingsValidatorDashboard(ctx con
19191921
d.AddOrRemoveEvent(&eventsToInsert, &eventsToDelete, settings.IsSlashedSubscribed, userId, types.ValidatorGotSlashedEventName, networkName, eventFilter, epoch, 0)
19201922
d.AddOrRemoveEvent(&eventsToInsert, &eventsToDelete, settings.IsMaxCollateralSubscribed, userId, types.RocketpoolCollateralMaxReachedEventName, networkName, eventFilter, epoch, settings.MaxCollateralThreshold)
19211923
d.AddOrRemoveEvent(&eventsToInsert, &eventsToDelete, settings.IsMinCollateralSubscribed, userId, types.RocketpoolCollateralMinReachedEventName, networkName, eventFilter, epoch, settings.MinCollateralThreshold)
1922-
// Set two events for IsBlockProposalSubscribed
1923-
d.AddOrRemoveEvent(&eventsToInsert, &eventsToDelete, settings.IsBlockProposalSubscribed, userId, types.ValidatorMissedProposalEventName, networkName, eventFilter, epoch, 0)
1924-
d.AddOrRemoveEvent(&eventsToInsert, &eventsToDelete, settings.IsBlockProposalSubscribed, userId, types.ValidatorExecutedProposalEventName, networkName, eventFilter, epoch, 0)
1924+
d.AddOrRemoveEvent(&eventsToInsert, &eventsToDelete, settings.IsBlockProposalSuccessSubscribed, userId, types.ValidatorMissedProposalEventName, networkName, eventFilter, epoch, 0)
1925+
d.AddOrRemoveEvent(&eventsToInsert, &eventsToDelete, settings.IsBlockProposalMissedSubscribed, userId, types.ValidatorExecutedProposalEventName, networkName, eventFilter, epoch, 0)
19251926

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

backend/pkg/api/types/notifications.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ type NotificationSettingsValidatorDashboard struct {
196196
IsGroupEfficiencyBelowSubscribed bool `json:"is_group_efficiency_below_subscribed"`
197197
GroupEfficiencyBelowThreshold float64 `json:"group_efficiency_below_threshold" faker:"boundary_start=0, boundary_end=1"`
198198
IsAttestationsMissedSubscribed bool `json:"is_attestations_missed_subscribed"`
199-
IsBlockProposalSubscribed bool `json:"is_block_proposal_subscribed"`
199+
IsBlockProposalSuccessSubscribed bool `json:"is_block_proposal_success_subscribed"`
200+
IsBlockProposalMissedSubscribed bool `json:"is_block_proposal_missed_subscribed"`
200201
IsUpcomingBlockProposalSubscribed bool `json:"is_upcoming_block_proposal_subscribed"`
201202
IsSyncSubscribed bool `json:"is_sync_subscribed"`
202203
IsWithdrawalProcessedSubscribed bool `json:"is_withdrawal_processed_subscribed"`

0 commit comments

Comments
 (0)