Skip to content

Commit

Permalink
Review notifications copies (#87)
Browse files Browse the repository at this point in the history
* Review notifications copies

* add -
  • Loading branch information
pablomendezroyo authored Dec 13, 2024
1 parent 0f48eea commit 7082c69
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ func (ds *DistributionLogUpdatedEventScanner) runScan(ctx context.Context) {

// HandleDistributionLogUpdatedEvent processes a DistributionLogUpdated event
func (ds *DistributionLogUpdatedEventScanner) HandleDistributionLogUpdatedEvent(distributionLogUpdated *domain.BindingsDistributionLogUpdated) error {
// TODO add message saying go to this dashboard to see the validator performance
logger.DebugWithPrefix(ds.servicePrefix, "Found DistributionLogUpdated event with log cid: %s", distributionLogUpdated.LogCid)

if err := ds.storagePort.AddPendingHash(distributionLogUpdated.LogCid); err != nil {
Expand All @@ -119,7 +118,7 @@ func (ds *DistributionLogUpdatedEventScanner) HandleDistributionLogUpdatedEvent(

// If the block timestamp is within the last 24 hours, send a notification
if time.Now().Unix()-int64(blockTimestamp) < 24*60*60 {
message := fmt.Sprintf("- 📦 New distribution log updated: %s", distributionLogUpdated.LogCid)
message := fmt.Sprintf("- 📦 New distribution log updated: %s. This report will be fetched and parsed from an IPFS gateway for later validator performance visualization.", distributionLogUpdated.LogCid)
if err := ds.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ds.servicePrefix, "Error sending distributionLogUpdated notification: %v", err)
return err
Expand Down
26 changes: 13 additions & 13 deletions internal/application/services/events_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (ew *EventsWatcher) watchCsFeeDistributorEvents(ctx context.Context) error

func (ew *EventsWatcher) HandleReportSubmittedEvent(reportSubmitted *domain.VeboReportSubmitted) error {
// send the notification message
message := fmt.Sprintf("- 📈 New submitted report: %s", reportSubmitted.RefSlot)
message := fmt.Sprintf("- 📈 New submitted report in slot %s", reportSubmitted.RefSlot)
if err := ew.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ew.servicePrefix, "Error sending reportSubmitted event notification", err)
return err
Expand All @@ -109,7 +109,7 @@ func (ew *EventsWatcher) HandleReportSubmittedEvent(reportSubmitted *domain.Vebo

func (ew *EventsWatcher) HandleDistributionDataUpdated(rewardsDistributed *domain.CsfeedistributorDistributionDataUpdated) error {
// send the notification message
message := fmt.Sprintf("- 📈 New rewards distributed: %s", rewardsDistributed.TotalClaimableShares)
message := fmt.Sprintf("- 📈 New rewards distributed. Total claimable shares: %s", rewardsDistributed.TotalClaimableShares)
if err := ew.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ew.servicePrefix, "Error sending rewardsDistributed event notification", err)
return err
Expand All @@ -121,7 +121,7 @@ func (ew *EventsWatcher) HandleDistributionDataUpdated(rewardsDistributed *domai
// Handlers CSModule

func (ew *EventsWatcher) HandleDepositedSigningKeysCountChanged(depositedSigningKeysCountChanged *domain.CsmoduleDepositedSigningKeysCountChanged) error {
message := fmt.Sprintf("- 🤩 Node Operator's keys received depositst: %s", depositedSigningKeysCountChanged.DepositedKeysCount)
message := fmt.Sprintf("- 🤩 Node Operator's keys received deposit keys count: %s", depositedSigningKeysCountChanged.DepositedKeysCount)
if err := ew.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ew.servicePrefix, "Error sending depositedSigningKeysCountChanged event notification", err)
return err
Expand All @@ -130,7 +130,7 @@ func (ew *EventsWatcher) HandleDepositedSigningKeysCountChanged(depositedSigning
}

func (ew *EventsWatcher) HandleElRewardsStealingPenaltyReported(eLRewardsStealingPenaltyReported *domain.CsmoduleELRewardsStealingPenaltyReported) error {
message := fmt.Sprintf("- 🚨 Penalty for stealing EL rewards reported: %s", eLRewardsStealingPenaltyReported.StolenAmount)
message := fmt.Sprintf("- 🚨 Penalty for stealing EL rewards reported. Stolen amont: %s", eLRewardsStealingPenaltyReported.StolenAmount)
if err := ew.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ew.servicePrefix, "Error sending eLRewardsStealingPenaltyReported event notification", err)
return err
Expand All @@ -139,7 +139,7 @@ func (ew *EventsWatcher) HandleElRewardsStealingPenaltyReported(eLRewardsStealin
}

func (ew *EventsWatcher) HandleElRewardsStealingPenaltySettled(eLRewardsStealingPenaltySettled *domain.CsmoduleELRewardsStealingPenaltySettled) error {
message := fmt.Sprintf("- 🚨 EL rewards stealing penalty confirmed and applied: %s", eLRewardsStealingPenaltySettled.NodeOperatorId)
message := fmt.Sprintf("- 🚨 EL rewards stealing penalty confirmed and applied for Node Operator ID: %s", eLRewardsStealingPenaltySettled.NodeOperatorId)
if err := ew.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ew.servicePrefix, "Error sending eLRewardsStealingPenaltySettled event notification", err)
return err
Expand All @@ -148,7 +148,7 @@ func (ew *EventsWatcher) HandleElRewardsStealingPenaltySettled(eLRewardsStealing
}

func (ew *EventsWatcher) HandleElRewardsStealingPenaltyCancelled(eLRewardsStealingPenaltyCancelled *domain.CsmoduleELRewardsStealingPenaltyCancelled) error {
message := fmt.Sprintf("- 😮‍💨 Cancelled penalty for stealing EL reward: %s", eLRewardsStealingPenaltyCancelled.Amount)
message := fmt.Sprintf("- 😮‍💨 Cancelled penalty for stealing EL reward. Amount: %s", eLRewardsStealingPenaltyCancelled.Amount)
if err := ew.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ew.servicePrefix, "Error sending eLRewardsStealingPenaltyCancelled event notification", err)
return err
Expand All @@ -157,7 +157,7 @@ func (ew *EventsWatcher) HandleElRewardsStealingPenaltyCancelled(eLRewardsSteali
}

func (ew *EventsWatcher) HandleInitialSlashingSubmitted(initialSlashingSubmitted *domain.CsmoduleInitialSlashingSubmitted) error {
message := fmt.Sprintf("- 🚨 Initial slashing submitted for one of the validators: %s", initialSlashingSubmitted.KeyIndex)
message := fmt.Sprintf("- 🚨 Initial slashing submitted for one of the validators. Key index: %s", initialSlashingSubmitted.KeyIndex)
if err := ew.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ew.servicePrefix, "Error sending initialSlashingSubmitted event notification", err)
return err
Expand All @@ -166,7 +166,7 @@ func (ew *EventsWatcher) HandleInitialSlashingSubmitted(initialSlashingSubmitted
}

func (ew *EventsWatcher) HandleKeyRemovalChargeApplied(keyRemovalChargeApplied *domain.CsmoduleKeyRemovalChargeApplied) error {
message := fmt.Sprintf("- 🔑 Applied charge for key removal: %s", keyRemovalChargeApplied.NodeOperatorId)
message := fmt.Sprintf("- 🔑 Applied charge for key removal for Node Operator ID: %s", keyRemovalChargeApplied.NodeOperatorId)
if err := ew.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ew.servicePrefix, "Error sending keyRemovalChargeApplied event notification", err)
return err
Expand Down Expand Up @@ -212,7 +212,7 @@ func (ew *EventsWatcher) HandleNodeOperatorRewardAddressChanged(nodeOperatorRewa
}

func (ew *EventsWatcher) HandleStuckSigningKeysCountChanged(stuckSigningKeysCountChanged *domain.CsmoduleStuckSigningKeysCountChanged) error {
message := fmt.Sprintf("- 🚨 Reported stuck keys that were not exited in time: %s", stuckSigningKeysCountChanged.StuckKeysCount)
message := fmt.Sprintf("- 🚨 Reported stuck keys that were not exited in time. Stuck keys count: %s", stuckSigningKeysCountChanged.StuckKeysCount)
if err := ew.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ew.servicePrefix, "Error sending stuckSigningKeysCountChanged event notification", err)
return err
Expand All @@ -221,7 +221,7 @@ func (ew *EventsWatcher) HandleStuckSigningKeysCountChanged(stuckSigningKeysCoun
}

func (ew *EventsWatcher) HandleVettedSigningKeysCountDecreased(vettedSigningKeysCountDecreased *domain.CsmoduleVettedSigningKeysCountDecreased) error {
message := fmt.Sprintf("- 🚨 Uploaded invalid keys: %s", vettedSigningKeysCountDecreased.NodeOperatorId)
message := fmt.Sprintf("- 🚨 Uploaded invalid keys for Node Operator ID: %s", vettedSigningKeysCountDecreased.NodeOperatorId)
if err := ew.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ew.servicePrefix, "Error sending vettedSigningKeysCountDecreased event notification", err)
return err
Expand All @@ -230,7 +230,7 @@ func (ew *EventsWatcher) HandleVettedSigningKeysCountDecreased(vettedSigningKeys
}

func (ew *EventsWatcher) HandleWithdrawalSubmitted(withdrawalSubmitted *domain.CsmoduleWithdrawalSubmitted) error {
message := fmt.Sprintf("- 👀 Key withdrawal information submitted: %s", withdrawalSubmitted.Amount)
message := fmt.Sprintf("- 👀 Key withdrawal information submitted. Amount: %s", withdrawalSubmitted.Amount)
if err := ew.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ew.servicePrefix, "Error sending withdrawalSubmitted event notification", err)
return err
Expand All @@ -239,7 +239,7 @@ func (ew *EventsWatcher) HandleWithdrawalSubmitted(withdrawalSubmitted *domain.C
}

func (ew *EventsWatcher) HandleTotalSigningKeysCountChanged(totalSigningKeysCountChanged *domain.CsmoduleTotalSigningKeysCountChanged) error {
message := fmt.Sprintf("- 👀 New keys uploaded or removedt: %s", totalSigningKeysCountChanged.TotalKeysCount)
message := fmt.Sprintf("- 👀 New keys uploaded or removed. Keys count: %s", totalSigningKeysCountChanged.TotalKeysCount)
if err := ew.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ew.servicePrefix, "Error sending totalSigningKeysCountChanged event notification", err)
return err
Expand All @@ -248,7 +248,7 @@ func (ew *EventsWatcher) HandleTotalSigningKeysCountChanged(totalSigningKeysCoun
}

func (ew *EventsWatcher) HandlePublicRelease(publicRelease *domain.CsmodulePublicRelease) error {
message := fmt.Sprintf("- 🎉 Public release of CSM!: %s", publicRelease.Raw.TxHash)
message := fmt.Sprintf("- 🎉 Public release of CSM!. Tx Hash: %s", publicRelease.Raw.TxHash)
if err := ew.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ew.servicePrefix, "Error sending publicRelease event notification", err)
return err
Expand Down
4 changes: 2 additions & 2 deletions internal/application/services/relaysChecker.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (rcs *RelayCronService) analyzeRelays(allowedRelays []domain.RelayAllowed,
}

func (rcs *RelayCronService) buildMissingMandatoryNotification(allowedRelays []domain.RelayAllowed) string {
message := "⚠️ Mandatory Relay Alert\n\nNo mandatory relays are currently in use. At least one mandatory relay must be used. Edit your relays in the stakers UI\n"
message := "- ⚠️ Mandatory Relay Alert\n\nNo mandatory relays are currently in use. At least one mandatory relay must be used. Edit your relays in the stakers UI\n"
message += "\nMandatory relays:\n"
for _, relay := range allowedRelays {
if relay.IsMandatory {
Expand All @@ -138,7 +138,7 @@ func (rcs *RelayCronService) buildMissingMandatoryNotification(allowedRelays []d
}

func (rcs *RelayCronService) buildBlacklistNotification(blacklistedRelays []string) string {
message := "🚨 Relay Blacklist Warning\n\nThe following relays are being used but are not allowed:\n"
message := "- 🚨 Relay Blacklist Warning\n\nThe following relays are being used but are not allowed:\n"
for _, relay := range blacklistedRelays {
message += fmt.Sprintf("- `%s`\n", relay)
}
Expand Down

0 comments on commit 7082c69

Please sign in to comment.