Skip to content

Commit 485b569

Browse files
committed
Merge branch 'master' into migrate-version-check
2 parents 5a58fa7 + f031b25 commit 485b569

7 files changed

Lines changed: 42 additions & 20 deletions

File tree

bindings/utils/state/network.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ func GetTotalEffectiveRplStake(rp *rocketpool.RocketPool, contracts *NetworkCont
265265
}
266266
for j := i; j < m; j++ {
267267
address := addresses[j]
268-
err = mc.AddCall(contracts.RocketNodeStaking, &minimumStakes[j], "getNodeMinimumRPLStake", address)
268+
err = mc.AddCall(contracts.RocketNodeStaking, &minimumStakes[j], "getNodeMinimumLegacyRPLStake", address)
269269
if err != nil {
270270
return fmt.Errorf("error adding node minimum RPL stake call for address %s: %w", address.Hex(), err)
271271
}

rocketpool/node/node.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func run(c *cli.Command) error {
139139
}
140140

141141
// Wait until the node wallet stored on disk is registered
142-
if err := services.WaitNodeRegistered(c, true); err != nil {
142+
if err := services.WaitNodeRegistered(ctx, c, true); err != nil {
143143
return err
144144
}
145145

rocketpool/watchtower/watchtower.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func run(c *cli.Command) error {
107107
}
108108

109109
// Wait until the node wallet stored on disk is registered
110-
if err := services.WaitNodeRegistered(c, true); err != nil {
110+
if err := services.WaitNodeRegistered(ctx, c, true); err != nil {
111111
return err
112112
}
113113

shared/services/config/nethermind-params.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010

1111
// Constants
1212
const (
13-
nethermindTagProd string = "nethermind/nethermind:1.37.1"
14-
nethermindTagTest string = "nethermind/nethermind:1.37.1"
13+
nethermindTagProd string = "nethermind/nethermind:1.37.2"
14+
nethermindTagTest string = "nethermind/nethermind:1.37.2"
1515
nethermindEventLogInterval int = 1000
1616
nethermindStopSignal string = "SIGTERM"
1717
)

shared/services/proposals/checksum-manager.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"os"
99
"path/filepath"
10+
"slices"
1011
"sort"
1112
"strings"
1213

@@ -138,9 +139,7 @@ func LoadFromFile[ContextType any, DataType IDataType](m *ChecksumManager[Contex
138139

139140
// Iterate over each file, counting backwards from the bottom
140141
dataFolder := filepath.Dir(m.checksumFilename)
141-
for i := len(lines) - 1; i >= 0; i-- {
142-
line := lines[i]
143-
142+
for _, line := range slices.Backward(lines) {
144143
// Get the checksum from the line
145144
checksumString, filename, found := strings.Cut(line, " ")
146145
if !found {

shared/services/requirements.go

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func RequireNodeSecurityMember(c *cli.Command) error {
137137
// Service synchronization
138138
//
139139

140-
func WaitNodeHdPassword(c *cli.Command, verbose bool) error {
140+
func WaitNodeHdPassword(ctx context.Context, c *cli.Command, verbose bool) error {
141141
for {
142142
nodePasswordSet, err := getNodeHdPasswordSet(c)
143143
if err != nil {
@@ -149,12 +149,14 @@ func WaitNodeHdPassword(c *cli.Command, verbose bool) error {
149149
if verbose {
150150
log.Printf("The node password has not been set, retrying in %s...\n", checkNodePasswordInterval.String())
151151
}
152-
time.Sleep(checkNodePasswordInterval)
152+
if err := sleepCtx(ctx, checkNodePasswordInterval); err != nil {
153+
return err
154+
}
153155
}
154156
}
155157

156-
func WaitNodeHdWallet(c *cli.Command, verbose bool) error {
157-
if err := WaitNodeHdPassword(c, verbose); err != nil {
158+
func WaitNodeHdWallet(ctx context.Context, c *cli.Command, verbose bool) error {
159+
if err := WaitNodeHdPassword(ctx, c, verbose); err != nil {
158160
return err
159161
}
160162
for {
@@ -168,7 +170,9 @@ func WaitNodeHdWallet(c *cli.Command, verbose bool) error {
168170
if verbose {
169171
log.Printf("The node wallet has not been initialized, retrying in %s...\n", checkNodeWalletInterval.String())
170172
}
171-
time.Sleep(checkNodeWalletInterval)
173+
if err := sleepCtx(ctx, checkNodeWalletInterval); err != nil {
174+
return err
175+
}
172176
}
173177
}
174178

@@ -182,7 +186,7 @@ func WaitBeaconClientSynced(c *cli.Command, verbose bool) error {
182186
return err
183187
}
184188

185-
func WaitRocketStorage(c *cli.Command, verbose bool) error {
189+
func WaitRocketStorage(ctx context.Context, c *cli.Command, verbose bool) error {
186190
if err := WaitEthClientSynced(c, verbose); err != nil {
187191
return err
188192
}
@@ -197,16 +201,18 @@ func WaitRocketStorage(c *cli.Command, verbose bool) error {
197201
if verbose {
198202
log.Printf("The Rocket Pool storage contract was not found, retrying in %s...\n", checkRocketStorageInterval.String())
199203
}
200-
time.Sleep(checkRocketStorageInterval)
204+
if err := sleepCtx(ctx, checkRocketStorageInterval); err != nil {
205+
return err
206+
}
201207
}
202208
}
203209

204210
// This check makes calls to GetHdWallet instead of GetWallet as it's used in node and watchtower
205-
func WaitNodeRegistered(c *cli.Command, verbose bool) error {
206-
if err := WaitNodeHdWallet(c, verbose); err != nil {
211+
func WaitNodeRegistered(ctx context.Context, c *cli.Command, verbose bool) error {
212+
if err := WaitNodeHdWallet(ctx, c, verbose); err != nil {
207213
return err
208214
}
209-
if err := WaitRocketStorage(c, verbose); err != nil {
215+
if err := WaitRocketStorage(ctx, c, verbose); err != nil {
210216
return err
211217
}
212218
for {
@@ -220,7 +226,21 @@ func WaitNodeRegistered(c *cli.Command, verbose bool) error {
220226
if verbose {
221227
log.Printf("The node is not registered with Rocket Pool, retrying in %s...\n", checkNodeRegisteredInterval.String())
222228
}
223-
time.Sleep(checkNodeRegisteredInterval)
229+
if err := sleepCtx(ctx, checkNodeRegisteredInterval); err != nil {
230+
return err
231+
}
232+
}
233+
}
234+
235+
// sleepCtx sleeps for d, returning ctx.Err() if the context is cancelled first.
236+
func sleepCtx(ctx context.Context, d time.Duration) error {
237+
timer := time.NewTimer(d)
238+
defer timer.Stop()
239+
select {
240+
case <-ctx.Done():
241+
return ctx.Err()
242+
case <-timer.C:
243+
return nil
224244
}
225245
}
226246

shared/services/state/network-state.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,10 @@ func (s *NetworkState) GetMegapoolEligibleBorrowedEth(node *rpstate.NativeNodeDe
534534
return big.NewInt(0)
535535
}
536536

537-
megapool := s.MegapoolDetails[node.MegapoolAddress]
537+
megapool, exists := s.MegapoolDetails[node.MegapoolAddress]
538+
if !exists {
539+
return big.NewInt(0)
540+
}
538541
eligibleBorrowedEth := big.NewInt(0).Set(megapool.UserCapital)
539542

540543
// Iterate over the validators

0 commit comments

Comments
 (0)