/
submit-scrub-minipools.go
638 lines (540 loc) · 20.3 KB
/
submit-scrub-minipools.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
package watchtower
import (
"context"
"fmt"
"math/big"
"sync"
"time"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/signing"
prdeposit "github.com/prysmaticlabs/prysm/v5/contracts/deposit"
"github.com/rocket-pool/rocketpool-go/minipool"
"github.com/rocket-pool/rocketpool-go/rocketpool"
"github.com/rocket-pool/rocketpool-go/types"
rputils "github.com/rocket-pool/rocketpool-go/utils"
"github.com/rocket-pool/rocketpool-go/utils/eth"
rpstate "github.com/rocket-pool/rocketpool-go/utils/state"
"github.com/urfave/cli"
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
"github.com/rocket-pool/smartnode/rocketpool/watchtower/collectors"
"github.com/rocket-pool/smartnode/rocketpool/watchtower/utils"
"github.com/rocket-pool/smartnode/shared/services"
"github.com/rocket-pool/smartnode/shared/services/beacon"
"github.com/rocket-pool/smartnode/shared/services/config"
"github.com/rocket-pool/smartnode/shared/services/state"
"github.com/rocket-pool/smartnode/shared/services/wallet"
"github.com/rocket-pool/smartnode/shared/utils/api"
"github.com/rocket-pool/smartnode/shared/utils/log"
eth2types "github.com/wealdtech/go-eth2-types/v2"
)
// Settings
const MinipoolBatchSize = 20
const BlockStartOffset = 100000
const ScrubSafetyDivider = 2
const MinScrubSafetyTime = time.Duration(0) * time.Hour
// Submit scrub minipools task
type submitScrubMinipools struct {
c *cli.Context
log log.ColorLogger
errLog log.ColorLogger
cfg *config.RocketPoolConfig
w *wallet.Wallet
rp *rocketpool.RocketPool
ec rocketpool.ExecutionClient
bc beacon.Client
it *iterationData
coll *collectors.ScrubCollector
lock *sync.Mutex
isRunning bool
}
type iterationData struct {
// Counters
totalMinipools int
vacantMinipools int
goodOnBeaconCount int
badOnBeaconCount int
goodPrestakeCount int
badPrestakeCount int
goodOnDepositContract int
badOnDepositContract int
unknownMinipools int
safetyScrubs int
// Minipool info
minipools map[minipool.Minipool]*minipoolDetails
// ETH1 search artifacts
startBlock *big.Int
eventLogInterval *big.Int
depositDomain []byte
stateBlockTime time.Time
}
type minipoolDetails struct {
pubkey types.ValidatorPubkey
expectedWithdrawalCredentials common.Hash
}
// Create submit scrub minipools task
func newSubmitScrubMinipools(c *cli.Context, logger log.ColorLogger, errorLogger log.ColorLogger, coll *collectors.ScrubCollector) (*submitScrubMinipools, error) {
// Get services
cfg, err := services.GetConfig(c)
if err != nil {
return nil, err
}
w, err := services.GetWallet(c)
if err != nil {
return nil, err
}
ec, err := services.GetEthClient(c)
if err != nil {
return nil, err
}
rp, err := services.GetRocketPool(c)
if err != nil {
return nil, err
}
bc, err := services.GetBeaconClient(c)
if err != nil {
return nil, err
}
// Return task
lock := &sync.Mutex{}
return &submitScrubMinipools{
c: c,
log: logger,
errLog: errorLogger,
cfg: cfg,
w: w,
rp: rp,
ec: ec,
bc: bc,
coll: coll,
lock: lock,
isRunning: false,
}, nil
}
// Submit scrub minipools
func (t *submitScrubMinipools) run(state *state.NetworkState) error {
// Wait for eth clients to sync
if err := services.WaitEthClientSynced(t.c, true); err != nil {
return err
}
if err := services.WaitBeaconClientSynced(t.c, true); err != nil {
return err
}
// Log
t.log.Println("Checking for minipools to scrub...")
// Check if the check is already running
t.lock.Lock()
if t.isRunning {
t.log.Println("Scrub check is already running in the background.")
t.lock.Unlock()
return nil
}
t.lock.Unlock()
// Run the check
go func() {
t.lock.Lock()
t.isRunning = true
t.lock.Unlock()
checkPrefix := "[Minipool Scrub]"
t.log.Printlnf("%s Starting scrub check in a separate thread.", checkPrefix)
t.it = new(iterationData)
// Get minipools in prelaunch status
prelaunchMinipools := []rpstate.NativeMinipoolDetails{}
for _, mpd := range state.MinipoolDetails {
if mpd.Status == types.Prelaunch {
prelaunchMinipools = append(prelaunchMinipools, mpd)
}
}
t.it.totalMinipools = len(prelaunchMinipools)
if t.it.totalMinipools == 0 {
t.log.Printlnf("%s No minipools in prelaunch.", checkPrefix)
t.lock.Lock()
t.isRunning = false
t.lock.Unlock()
return
}
t.it.minipools = make(map[minipool.Minipool]*minipoolDetails, t.it.totalMinipools)
// Get the correct withdrawal credentials and validator pubkeys for each minipool
opts := &bind.CallOpts{
BlockNumber: big.NewInt(0).SetUint64(state.ElBlockNumber),
}
t.initializeMinipoolDetails(prelaunchMinipools, opts)
// Step 1: Verify the Beacon credentials if they exist
t.verifyBeaconWithdrawalCredentials(state)
// If there aren't any minipools left to check, print the final tally and exit
if len(t.it.minipools) == 0 {
t.printFinalTally(checkPrefix)
t.lock.Lock()
t.isRunning = false
t.lock.Unlock()
return
}
// Get various elements needed to do eth1 prestake and deposit contract searches
err := t.getEth1SearchArtifacts(state)
if err != nil {
t.handleError(fmt.Errorf("%s %w", checkPrefix, err))
return
}
// Step 2: Verify the MinipoolPrestaked events
t.verifyPrestakeEvents()
// If there aren't any minipools left to check, print the final tally and exit
if len(t.it.minipools) == 0 {
t.printFinalTally(checkPrefix)
t.lock.Lock()
t.isRunning = false
t.lock.Unlock()
return
}
// Step 3: Verify the deposit data of the remaining minipools
err = t.verifyDeposits()
if err != nil {
t.handleError(fmt.Errorf("%s %w", checkPrefix, err))
return
}
// If there aren't any minipools left to check, print the final tally and exit
if len(t.it.minipools) == 0 {
t.printFinalTally(checkPrefix)
t.lock.Lock()
t.isRunning = false
t.lock.Unlock()
return
}
// Step 4: Scrub all of the undeposited minipools after half the scrub period for safety
err = t.checkSafetyScrub(state)
if err != nil {
t.handleError(fmt.Errorf("%s %w", checkPrefix, err))
return
}
// Log and return
t.printFinalTally(checkPrefix)
t.it = nil
t.lock.Lock()
t.isRunning = false
t.lock.Unlock()
}()
// Return
return nil
}
func (t *submitScrubMinipools) handleError(err error) {
t.errLog.Println(err)
t.errLog.Println("*** Minipool scrub check failed. ***")
t.lock.Lock()
t.isRunning = false
t.lock.Unlock()
}
// Get the correct withdrawal credentials and pubkeys for each minipool
func (t *submitScrubMinipools) initializeMinipoolDetails(minipools []rpstate.NativeMinipoolDetails, opts *bind.CallOpts) {
for _, mpd := range minipools {
// Ignore vacant minipools - they have the wrong withdrawal creds (temporarily) by design
if mpd.IsVacant {
t.it.vacantMinipools++
continue
}
// Create a minipool contract wrapper for the given address
mp, err := minipool.NewMinipoolFromVersion(t.rp, mpd.MinipoolAddress, mpd.Version, opts)
if err != nil {
t.log.Printf("Error creating minipool wrapper for %s: %s", mpd.MinipoolAddress.Hex(), err.Error())
continue
}
// Create a new details entry for this minipool
t.it.minipools[mp] = &minipoolDetails{
expectedWithdrawalCredentials: mpd.WithdrawalCredentials,
pubkey: mpd.Pubkey,
}
}
}
// Step 1: Verify the Beacon Chain credentials for a minipool if they're present
func (t *submitScrubMinipools) verifyBeaconWithdrawalCredentials(state *state.NetworkState) error {
minipoolsToScrub := []minipool.Minipool{}
// Get the withdrawal credentials on Beacon for each validator if they exist
for minipool, details := range t.it.minipools {
pubkey := details.pubkey
status := state.ValidatorDetails[pubkey]
if status.Exists {
// This minipool's deposit has been seen on the Beacon Chain
expectedCreds := details.expectedWithdrawalCredentials
beaconCreds := status.WithdrawalCredentials
if beaconCreds != expectedCreds {
t.log.Println("=== SCRUB DETECTED ON BEACON CHAIN ===")
t.log.Printlnf("\tMinipool: %s", minipool.GetAddress().Hex())
t.log.Printlnf("\tExpected creds: %s", expectedCreds.Hex())
t.log.Printlnf("\tActual creds: %s", beaconCreds.Hex())
t.log.Println("======================================")
minipoolsToScrub = append(minipoolsToScrub, minipool)
t.it.badOnBeaconCount++
} else {
// This minipool's credentials match, it's clean.
t.it.goodOnBeaconCount++
}
// If it was seen on Beacon we can remove it from the list of things to check on eth1.
// Otherwise we have to keep it in the map.
delete(t.it.minipools, minipool)
}
}
// Scrub the offending minipools
for _, minipool := range minipoolsToScrub {
err := t.submitVoteScrubMinipool(minipool)
if err != nil {
t.log.Printlnf("ALERT: Couldn't scrub minipool %s: %s", minipool.GetAddress().Hex(), err.Error())
}
}
return nil
}
// Get various elements needed to do eth1 prestake and deposit contract searches
func (t *submitScrubMinipools) getEth1SearchArtifacts(state *state.NetworkState) error {
// Get the time of the state's EL block
genesisTime := time.Unix(int64(state.BeaconConfig.GenesisTime), 0)
secondsSinceGenesis := time.Duration(state.BeaconSlotNumber*state.BeaconConfig.SecondsPerSlot) * time.Second
t.it.stateBlockTime = genesisTime.Add(secondsSinceGenesis)
// Get the block to start searching the deposit contract from
stateBlockNumber := big.NewInt(0).SetUint64(state.ElBlockNumber)
offset := big.NewInt(BlockStartOffset)
if stateBlockNumber.Cmp(offset) < 0 {
offset = stateBlockNumber // Deal with chains that are younger than the look-behind interval
}
targetBlockNumber := big.NewInt(0).Sub(stateBlockNumber, offset)
targetBlock, err := t.ec.HeaderByNumber(context.Background(), targetBlockNumber)
if err != nil {
return fmt.Errorf("error getting header for EL block %d: %w", targetBlockNumber, err)
}
t.it.startBlock = targetBlock.Number
// Check the prestake event from the minipool and validate its signature
eventLogInterval, err := t.cfg.GetEventLogInterval()
if err != nil {
return fmt.Errorf("error getting event log interval %w", err)
}
t.it.eventLogInterval = big.NewInt(int64(eventLogInterval))
// Put together the signature validation data
eth2Config := state.BeaconConfig
depositDomain, err := signing.ComputeDomain(eth2types.DomainDeposit, eth2Config.GenesisForkVersion, eth2types.ZeroGenesisValidatorsRoot)
if err != nil {
return fmt.Errorf("error computing deposit domain: %w", err)
}
t.it.depositDomain = depositDomain
return nil
}
// Step 2: Verify the MinipoolPrestaked event of each minipool
func (t *submitScrubMinipools) verifyPrestakeEvents() {
minipoolsToScrub := []minipool.Minipool{}
weiPerGwei := big.NewInt(int64(eth.WeiPerGwei))
for minipool := range t.it.minipools {
// Get the MinipoolPrestaked event
prestakeData, err := minipool.GetPrestakeEvent(t.it.eventLogInterval, nil)
if err != nil {
t.log.Printlnf("Error getting prestake event for minipool %s: %s", minipool.GetAddress().Hex(), err.Error())
continue
}
// Convert the amount to gwei
prestakeData.Amount.Div(prestakeData.Amount, weiPerGwei)
// Convert it into Prysm's deposit data struct
depositData := new(ethpb.Deposit_Data)
depositData.Amount = prestakeData.Amount.Uint64()
depositData.PublicKey = prestakeData.Pubkey.Bytes()
depositData.WithdrawalCredentials = prestakeData.WithdrawalCredentials.Bytes()
depositData.Signature = prestakeData.Signature.Bytes()
// Validate the signature
err = prdeposit.VerifyDepositSignature(depositData, t.it.depositDomain)
if err != nil {
// The signature is illegal
t.log.Println("=== SCRUB DETECTED ON PRESTAKE EVENT ===")
t.log.Printlnf("Invalid prestake data for minipool %s:", minipool.GetAddress().Hex())
t.log.Printlnf("\tError: %s", err.Error())
t.log.Println("========================================")
// Remove this minipool from the list of things to process in the next step
minipoolsToScrub = append(minipoolsToScrub, minipool)
t.it.badPrestakeCount++
delete(t.it.minipools, minipool)
} else {
// The signature is good, it can proceed to the next step
t.it.goodPrestakeCount++
}
}
// Scrub the offending minipools
for _, minipool := range minipoolsToScrub {
err := t.submitVoteScrubMinipool(minipool)
if err != nil {
t.log.Printlnf("ALERT: Couldn't scrub minipool %s: %s", minipool.GetAddress().Hex(), err.Error())
}
}
}
// Step 3: Verify minipools by their deposits
func (t *submitScrubMinipools) verifyDeposits() error {
minipoolsToScrub := []minipool.Minipool{}
// Create a "hashset" of the remaining pubkeys
pubkeys := make(map[types.ValidatorPubkey]bool, len(t.it.minipools))
for _, details := range t.it.minipools {
pubkeys[details.pubkey] = true
}
// Get the deposits from the deposit contract
depositMap, err := rputils.GetDeposits(t.rp, pubkeys, t.it.startBlock, t.it.eventLogInterval, nil)
if err != nil {
return err
}
// Check each minipool's deposit data
for minipool, details := range t.it.minipools {
// Get the deposit list for this minipool
deposits, exists := depositMap[details.pubkey]
if !exists || len(deposits) == 0 {
// Somehow this minipool doesn't have a deposit?
t.it.unknownMinipools++
continue
}
// Go through each deposit for this minipool and find the first one that's valid
for depositIndex, deposit := range deposits {
depositData := new(ethpb.Deposit_Data)
depositData.Amount = deposit.Amount
depositData.PublicKey = deposit.Pubkey.Bytes()
depositData.WithdrawalCredentials = deposit.WithdrawalCredentials.Bytes()
depositData.Signature = deposit.Signature.Bytes()
err := prdeposit.VerifyDepositSignature(depositData, t.it.depositDomain)
if err != nil {
// This isn't a valid deposit, so ignore it
t.log.Printlnf("Invalid deposit for minipool %s:", minipool.GetAddress().Hex())
t.log.Printlnf("\tTX Hash: %s", deposit.TxHash.Hex())
t.log.Printlnf("\tBlock: %d, TX Index: %d, Deposit Index: %d", deposit.BlockNumber, deposit.TxIndex, depositIndex)
t.log.Printlnf("\tError: %s", err.Error())
} else {
// This is a valid deposit
expectedCreds := details.expectedWithdrawalCredentials
actualCreds := deposit.WithdrawalCredentials
if actualCreds != expectedCreds {
t.log.Println("=== SCRUB DETECTED ON DEPOSIT CONTRACT ===")
t.log.Printlnf("\tTX Hash: %s", deposit.TxHash.Hex())
t.log.Printlnf("\tBlock: %d, TX Index: %d, Deposit Index: %d", deposit.BlockNumber, deposit.TxIndex, depositIndex)
t.log.Printlnf("\tMinipool: %s", minipool.GetAddress().Hex())
t.log.Printlnf("\tExpected creds: %s", expectedCreds.Hex())
t.log.Printlnf("\tActual creds: %s", actualCreds.Hex())
t.log.Println("==========================================")
minipoolsToScrub = append(minipoolsToScrub, minipool)
t.it.badOnDepositContract++
} else {
t.it.goodOnDepositContract++
}
// Remove this minipool from the list of things to process in the next step
delete(t.it.minipools, minipool)
break
}
}
}
// Scrub the offending minipools
for _, minipool := range minipoolsToScrub {
err := t.submitVoteScrubMinipool(minipool)
if err != nil {
t.log.Printlnf("ALERT: Couldn't scrub minipool %s: %s", minipool.GetAddress().Hex(), err.Error())
}
}
return nil
}
// Step 4: Catch-all safety mechanism that scrubs minipools without valid deposits after a certain period of time
// This should never be used, it's simply here as a redundant check
func (t *submitScrubMinipools) checkSafetyScrub(state *state.NetworkState) error {
minipoolsToScrub := []minipool.Minipool{}
// Warn if there are any remaining minipools - this should never happen
remainingMinipools := len(t.it.minipools)
if remainingMinipools > 0 {
t.log.Printlnf("WARNING: %d minipools did not have deposit information", remainingMinipools)
} else {
return nil
}
// Get the scrub period
scrubPeriod := state.NetworkDetails.ScrubPeriod
// Get the safety period where minipools can be scrubbed without a valid deposit
safetyPeriod := scrubPeriod / ScrubSafetyDivider
if safetyPeriod < MinScrubSafetyTime {
safetyPeriod = MinScrubSafetyTime
}
for minipool := range t.it.minipools {
// Get the minipool's status
mpd := state.MinipoolDetailsByAddress[minipool.GetAddress()]
// Verify this is actually a prelaunch minipool
if mpd.Status != types.Prelaunch {
t.log.Printlnf("\tMinipool %s is under review but is in %d status?", minipool.GetAddress().Hex(), types.MinipoolDepositTypes[mpd.Status])
continue
}
// Check the time it entered prelaunch against the safety period
statusTime := time.Unix(mpd.StatusTime.Int64(), 0)
if t.it.stateBlockTime.Sub(statusTime) > safetyPeriod {
t.log.Println("=== SAFETY SCRUB DETECTED ===")
t.log.Printlnf("\tMinipool: %s", minipool.GetAddress().Hex())
t.log.Printlnf("\tTime since prelaunch: %s", time.Since(statusTime))
t.log.Printlnf("\tSafety scrub period: %s", safetyPeriod)
t.log.Println("=============================")
minipoolsToScrub = append(minipoolsToScrub, minipool)
t.it.safetyScrubs++
// Remove this minipool from the list of things to process in the next step
delete(t.it.minipools, minipool)
}
}
// Scrub the offending minipools
for _, minipool := range minipoolsToScrub {
err := t.submitVoteScrubMinipool(minipool)
if err != nil {
t.log.Printlnf("ALERT: Couldn't scrub minipool %s: %s", minipool.GetAddress().Hex(), err.Error())
}
}
return nil
}
// Submit minipool scrub status
func (t *submitScrubMinipools) submitVoteScrubMinipool(mp minipool.Minipool) error {
// Log
t.log.Printlnf("Voting to scrub minipool %s...", mp.GetAddress().Hex())
// Get transactor
opts, err := t.w.GetNodeAccountTransactor()
if err != nil {
return err
}
// Get the gas limit
gasInfo, err := mp.EstimateVoteScrubGas(opts)
if err != nil {
return fmt.Errorf("Could not estimate the gas required to voteScrub the minipool: %w", err)
}
// Print the gas info
maxFee := eth.GweiToWei(utils.GetWatchtowerMaxFee(t.cfg))
if !api.PrintAndCheckGasInfo(gasInfo, false, 0, &t.log, maxFee, 0) {
return nil
}
// Set the gas settings
opts.GasFeeCap = maxFee
opts.GasTipCap = eth.GweiToWei(utils.GetWatchtowerPrioFee(t.cfg))
opts.GasLimit = gasInfo.SafeGasLimit
// Dissolve
hash, err := mp.VoteScrub(opts)
if err != nil {
return fmt.Errorf("error voting to scrub minipool %s: %w", mp.GetAddress().Hex(), err)
}
// Print TX info and wait for it to be included in a block
err = api.PrintAndWaitForTransaction(t.cfg, hash, t.rp.Client, &t.log)
if err != nil {
return err
}
// Log
t.log.Printlnf("Successfully voted to scrub the minipool %s.", mp.GetAddress().Hex())
// Return
return nil
}
// Prints the final tally of minipool counts
func (t *submitScrubMinipools) printFinalTally(prefix string) {
t.log.Printlnf("%s Scrub check complete.", prefix)
t.log.Printlnf("\tTotal prelaunch minipools: %d", t.it.totalMinipools)
t.log.Printlnf("\tVacant minipools: %d", t.it.vacantMinipools)
t.log.Printlnf("\tBeacon Chain scrubs: %d/%d", t.it.badOnBeaconCount, (t.it.badOnBeaconCount + t.it.goodOnBeaconCount))
t.log.Printlnf("\tPrestake scrubs: %d/%d", t.it.badPrestakeCount, (t.it.badPrestakeCount + t.it.goodPrestakeCount))
t.log.Printlnf("\tDeposit Contract scrubs: %d/%d", t.it.badOnDepositContract, (t.it.badOnDepositContract + t.it.goodOnDepositContract))
t.log.Printlnf("\tPools without deposits: %d", t.it.unknownMinipools)
t.log.Printlnf("\tRemaining uncovered minipools: %d", len(t.it.minipools))
// Update the metrics collector
if t.coll != nil {
t.coll.UpdateLock.Lock()
defer t.coll.UpdateLock.Unlock()
t.coll.TotalMinipools = float64(t.it.totalMinipools)
t.coll.GoodOnBeaconCount = float64(t.it.goodOnBeaconCount)
t.coll.BadOnBeaconCount = float64(t.it.badOnBeaconCount)
t.coll.GoodPrestakeCount = float64(t.it.goodPrestakeCount)
t.coll.BadPrestakeCount = float64(t.it.badPrestakeCount)
t.coll.GoodOnDepositContract = float64(t.it.goodOnDepositContract)
t.coll.BadOnDepositContract = float64(t.it.badOnDepositContract)
t.coll.DepositlessMinipools = float64(t.it.unknownMinipools)
t.coll.UncoveredMinipools = float64(len(t.it.minipools))
t.coll.LatestBlockTime = float64(t.it.stateBlockTime.Unix())
}
}