From d904511d4b211cfc83a3b608121e1ac74d7b50fd Mon Sep 17 00:00:00 2001 From: pablomendezroyo <41727368+pablomendezroyo@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:54:58 +0100 Subject: [PATCH] Add todos (#56) --- internal/application/services/validatorEjector.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/application/services/validatorEjector.go b/internal/application/services/validatorEjector.go index 4a33cee..ba008bb 100644 --- a/internal/application/services/validatorEjector.go +++ b/internal/application/services/validatorEjector.go @@ -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 @@ -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) } @@ -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)