Skip to content

Commit

Permalink
Add todos (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablomendezroyo authored Dec 4, 2024
1 parent 1813861 commit d904511
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/application/services/validatorEjector.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ func (ve *ValidatorEjector) EjectValidator() error {
continue
}

// TODO: simplify this logic
// if the validator status is not active ongoing or active slashed we skip the exit request because it is already exiting.
if onchainStatus != domain.StatusActiveOngoing && onchainStatus != domain.StatusActiveSlashed {
if onchainStatus != domain.StatusPendingInitialized && onchainStatus != domain.StatusPendingQueued {
logger.InfoWithPrefix(ve.servicePrefix, "Validator %s is %s so no exit request is required, deleting the exit request from db", exitRequest.Event.ValidatorIndex, exitRequest.Status)
// TODO: send notiifcation validator exited if timestamp of the event is within an hour
//Since the validator is already exiting, we remove the exit request from the db
if err := ve.storagePort.DeleteExitRequest(operatorID.String(), exitRequest.Event.ValidatorIndex.String()); err != nil {
// An error here is no big deal, we will retry to delete this in the next iteration of the cron
Expand All @@ -102,7 +104,7 @@ func (ve *ValidatorEjector) EjectValidator() error {
}

// send notification and skip on error
message := fmt.Sprintf("- 🚨 Your validator %s is requested to exit.", exitRequest.Event.ValidatorIndex)
message := fmt.Sprintf("- 🚨 Your validator %s is requested to exit. Executing automatic exit.", exitRequest.Event.ValidatorIndex)
if err := ve.notifierPort.SendNotification(message); err != nil {
logger.ErrorWithPrefix(ve.servicePrefix, "Error sending exit notification", err)
}
Expand All @@ -120,6 +122,8 @@ func (ve *ValidatorEjector) EjectValidator() error {
continue
}

// TODO: send notification "exited submitted. Your validator will exit within X minutes. wait for confirmatio, If not confirmation received, please check manually"

// wait for the transaction to be included
// call ve.beaconchainPort.GetValidatorStatus(string(validator.Event.ValidatorPubkey)) in a loop until the status is domain.StatusActiveExiting
// a maximum of 64 times with a 30 second sleep between each call (check for 32 minutes, two times x minute)
Expand Down

0 comments on commit d904511

Please sign in to comment.