Skip to content

Commit 0302de0

Browse files
committed
Only start setting flag after 24 hours running. Alert user to give them op to rollback
1 parent 8afd891 commit 0302de0

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

rocketpool/node/node.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const (
4040
DownloadRewardsTreesColor = color.FgGreen
4141
MetricsColor = color.FgHiYellow
4242
ManageFeeRecipientColor = color.FgHiCyan
43-
ReduceBondAmountColor = color.FgHiBlue
4443
DefendPdaoPropsColor = color.FgYellow
4544
VerifyPdaoPropsColor = color.FgYellow
4645
DistributeMinipoolsColor = color.FgHiGreen

rocketpool/node/set-latest-delegate.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package node
33
import (
44
"fmt"
55
"math/big"
6+
"time"
67

78
"github.com/docker/docker/client"
89
"github.com/ethereum/go-ethereum/accounts/abi/bind"
@@ -11,6 +12,7 @@ import (
1112
"github.com/rocket-pool/smartnode/bindings/rocketpool"
1213
"github.com/rocket-pool/smartnode/bindings/utils/eth"
1314
rpstate "github.com/rocket-pool/smartnode/bindings/utils/state"
15+
"github.com/rocket-pool/smartnode/shared/services/alerting"
1416
"github.com/urfave/cli/v3"
1517

1618
"github.com/rocket-pool/smartnode/shared/services"
@@ -36,6 +38,7 @@ type setUseLatestDelegate struct {
3638
maxFee *big.Int
3739
maxPriorityFee *big.Int
3840
gasLimit uint64
41+
startTime time.Time
3942
}
4043

4144
// Create distribute minipools task
@@ -84,6 +87,8 @@ func newSetUseLatestDelegate(c *cli.Command, logger log.ColorLogger) (*setUseLat
8487

8588
gasThreshold := cfg.Smartnode.AutoTxGasThreshold.Value.(float64)
8689

90+
startTime := time.Now()
91+
8792
// Return task
8893
return &setUseLatestDelegate{
8994
c: c,
@@ -97,6 +102,7 @@ func newSetUseLatestDelegate(c *cli.Command, logger log.ColorLogger) (*setUseLat
97102
maxFee: maxFee,
98103
maxPriorityFee: priorityFee,
99104
gasLimit: 0,
105+
startTime: startTime,
100106
}, nil
101107

102108
}
@@ -129,6 +135,13 @@ func (t *setUseLatestDelegate) run(state *state.NetworkState) error {
129135
// Log
130136
t.log.Printlnf("%d minipool(s) can have their use latest delegate set...", len(minipools))
131137

138+
// If the node has been running for less than 24 hours, alert the user. After that, set the flag for the minipools.
139+
if time.Since(t.startTime) < 24*time.Hour {
140+
t.log.Println("Alerting user they have minipools that can have the 'use latest delegate' flag set...")
141+
alerting.AlertMinipoolUseLatestDelegateSet(t.cfg)
142+
return nil
143+
}
144+
132145
// Set use latest delegate for minipools
133146
successCount := 0
134147
for _, mpd := range minipools {

shared/services/alerting/alerting.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,19 @@ func getAlertSettingsForEvent(succeeded bool) (strfmt.DateTime, Severity, string
192192
return endsAt, severity, succeededOrFailedText
193193
}
194194

195+
// Sends an alert when the node has minipools that can have their use latest delegate set.
196+
func AlertMinipoolUseLatestDelegateSet(cfg *config.RocketPoolConfig) error {
197+
alert := createAlert(
198+
"MinipoolUseLatestDelegateSet",
199+
"Minipools can have the 'use latest delegate' flag set",
200+
"Starting with v1.19.1, the Smart Node includes an automatic task that will set all legacy minipools to use the latest delegate contract. For Megapools, node operators continue to have 120 days to choose when to upgrade after a new delegate is released. If you do not wish to opt into using the latest delegate contract on your minipools, you should rollback to v1.19.0.",
201+
SeverityWarning,
202+
strfmt.DateTime(time.Now().Add(DefaultEndsAtDurationForSeverityInfo)),
203+
nil,
204+
)
205+
return sendAlert(alert, cfg)
206+
}
207+
195208
// Sends an alert when the execution client's P2P port is not accessible from the internet.
196209
func AlertEth1P2PPortNotOpen(cfg *config.RocketPoolConfig, port uint16) error {
197210
alert := createAlert(

0 commit comments

Comments
 (0)