forked from rocket-pool/smartnode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmartnode-config.go
More file actions
973 lines (784 loc) · 41.6 KB
/
smartnode-config.go
File metadata and controls
973 lines (784 loc) · 41.6 KB
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
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
package config
import (
"fmt"
"path/filepath"
"strings"
"github.com/ethereum/go-ethereum/common"
"github.com/rocket-pool/smartnode/shared"
"github.com/rocket-pool/smartnode/shared/types/config"
)
// Constants
const (
smartnodeTag string = "rocketpool/smartnode:v" + shared.RocketPoolVersion
pruneProvisionerTag string = "rocketpool/eth1-prune-provision:v0.0.1"
NetworkID string = "network"
ProjectNameID string = "projectName"
SnapshotID string = "rocketpool-dao.eth"
rewardsTreeFilenameFormat string = "rp-rewards-%s-%d%s"
minipoolPerformanceFilenameFormat string = "rp-minipool-performance-%s-%d%s"
RewardsTreeIpfsExtension string = ".zst"
RewardsTreesFolder string = "rewards-trees"
ChecksumTableFilename string = "checksums.sha384"
DaemonDataPath string = "/.rocketpool/data"
WatchtowerFolder string = "watchtower"
WatchtowerStateFile string = "state.yml"
RegenerateRewardsTreeRequestSuffix string = ".request"
RegenerateRewardsTreeRequestFormat string = "%d" + RegenerateRewardsTreeRequestSuffix
PrimaryRewardsFileUrl string = "https://%s.ipfs.dweb.link/%s"
SecondaryRewardsFileUrl string = "https://ipfs.io/ipfs/%s/%s"
GithubRewardsFileUrl string = "https://github.com/rocket-pool/rewards-trees/raw/main/%s/%s"
FeeRecipientFilename string = "rp-fee-recipient.txt"
NativeFeeRecipientFilename string = "rp-fee-recipient-env.txt"
)
// Defaults
const (
defaultProjectName string = "rocketpool"
WatchtowerMaxFeeDefault uint64 = 200
WatchtowerPrioFeeDefault uint64 = 3
)
type RewardsExtension string
const (
RewardsExtensionJSON RewardsExtension = ".json"
RewardsExtensionSSZ RewardsExtension = ".ssz"
)
// Contract addresses for multicall / network state manager
type StateManagerContracts struct {
Multicaller common.Address
BalanceBatcher common.Address
}
// Configuration for the Smartnode
type SmartnodeConfig struct {
Title string `yaml:"-"`
// The parent config
parent *RocketPoolConfig
////////////////////////////
// User-editable settings //
////////////////////////////
// Docker container prefix
ProjectName config.Parameter `yaml:"projectName,omitempty"`
// The path of the data folder where everything is stored
DataPath config.Parameter `yaml:"dataPath,omitempty"`
// The path of the watchtower's persistent state storage
WatchtowerStatePath config.Parameter `yaml:"watchtowerStatePath"`
// Which network we're on
Network config.Parameter `yaml:"network,omitempty"`
// Manual max fee override
ManualMaxFee config.Parameter `yaml:"manualMaxFee,omitempty"`
// Manual priority fee override
PriorityFee config.Parameter `yaml:"priorityFee,omitempty"`
// Threshold for automatic transactions
AutoTxGasThreshold config.Parameter `yaml:"minipoolStakeGasThreshold,omitempty"`
// The amount of ETH in a minipool's balance before auto-distribute kicks in
DistributeThreshold config.Parameter `yaml:"distributeThreshold,omitempty"`
// Mode for acquiring Merkle rewards trees
RewardsTreeMode config.Parameter `yaml:"rewardsTreeMode,omitempty"`
// Timestamp used as reference for prices/balances submissions
PriceBalanceSubmissionReferenceTimestamp config.Parameter `yaml:"priceBalanceSubmissionReferenceTimestamp,omitempty"`
// Custom URL to download a rewards tree
RewardsTreeCustomUrl config.Parameter `yaml:"rewardsTreeCustomUrl,omitempty"`
// URL for an EC with archive mode, for manual rewards tree generation
ArchiveECUrl config.Parameter `yaml:"archiveEcUrl,omitempty"`
// Manual override for the watchtower's max fee
WatchtowerMaxFeeOverride config.Parameter `yaml:"watchtowerMaxFeeOverride,omitempty"`
// Manual override for the watchtower's priority fee
WatchtowerPrioFeeOverride config.Parameter `yaml:"watchtowerPrioFeeOverride,omitempty"`
// The toggle for enabling pDAO proposal verification duties
VerifyProposals config.Parameter `yaml:"verifyProposals,omitempty"`
// Threshold for automatic vote power initialization transactions
AutoInitVPThreshold config.Parameter `yaml:"autoInitVPThreshold,omitempty"`
///////////////////////////
// Non-editable settings //
///////////////////////////
// The URL to provide the user so they can follow pending transactions
txWatchUrl map[config.Network]string `yaml:"-"`
// The URL to use for staking rETH
stakeUrl map[config.Network]string `yaml:"-"`
// The map of networks to execution chain IDs
chainID map[config.Network]uint `yaml:"-"`
// The contract address of RocketStorage
storageAddress map[config.Network]string `yaml:"-"`
// The contract address of RocketSignerRegistry
rocketSignerRegistryAddress map[config.Network]string `yaml:"-"`
// The contract address of the RPL token
rplTokenAddress map[config.Network]string `yaml:"-"`
// The Snapshot API domain
snapshotApiDomain map[config.Network]string `yaml:"-"`
// The contract address of rETH
rethAddress map[config.Network]string `yaml:"-"`
// The contract address of rocketRewardsPool from v1.0.0
v1_0_0_RewardsPoolAddress map[config.Network]string `yaml:"-"`
// The contract address of rocketClaimNode from v1.0.0
v1_0_0_ClaimNodeAddress map[config.Network]string `yaml:"-"`
// The contract address of rocketClaimTrustedNode from v1.0.0
v1_0_0_ClaimTrustedNodeAddress map[config.Network]string `yaml:"-"`
// The contract address of rocketMinipoolManager from v1.0.0
v1_0_0_MinipoolManagerAddress map[config.Network]string `yaml:"-"`
// The contract address of rocketNetworkPrices from v1.1.0
v1_1_0_NetworkPricesAddress map[config.Network]string `yaml:"-"`
// The contract address of rocketNodeStaking from v1.1.0
v1_1_0_NodeStakingAddress map[config.Network]string `yaml:"-"`
// The contract address of rocketNodeDeposit from v1.1.0
v1_1_0_NodeDepositAddress map[config.Network]string `yaml:"-"`
// The contract address of rocketMinipoolQueue from v1.1.0
v1_1_0_MinipoolQueueAddress map[config.Network]string `yaml:"-"`
// The contract address of rocketMinipoolFactory from v1.1.0
v1_1_0_MinipoolFactoryAddress map[config.Network]string `yaml:"-"`
// The contract address of rocketNetworkPrices from v1.2.0
v1_2_0_NetworkPricesAddress map[config.Network]string `yaml:"-"`
// The contract address of rocketNetworkBalances from v1.2.0
v1_2_0_NetworkBalancesAddress map[config.Network]string `yaml:"-"`
// Addresses for RocketRewardsPool that have been upgraded during development
previousRewardsPoolAddresses map[config.Network][]common.Address `yaml:"-"`
// Addresses for RocketDAOProtocolVerifier that have been upgraded during development
previousRocketDAOProtocolVerifier map[config.Network][]common.Address `yaml:"-"`
// The RocketOvmPriceMessenger Optimism address for each network
optimismPriceMessengerAddress map[config.Network]string `yaml:"-"`
// The RocketPolygonPriceMessenger Polygon address for each network
polygonPriceMessengerAddress map[config.Network]string `yaml:"-"`
// The RocketArbitumPriceMessenger Arbitrum address for each network
arbitrumPriceMessengerAddress map[config.Network]string `yaml:"-"`
// The RocketArbitumPriceMessengerV2 Arbitrum address for each network
arbitrumPriceMessengerAddressV2 map[config.Network]string `yaml:"-"`
// The RocketZkSyncPriceMessenger zkSyncEra address for each network
zkSyncEraPriceMessengerAddress map[config.Network]string `yaml:"-"`
// The RocketBasePriceMessenger Base address for each network
basePriceMessengerAddress map[config.Network]string `yaml:"-"`
// The RocketScrollPriceMessenger Scroll address for each network
scrollPriceMessengerAddress map[config.Network]string `yaml:"-"`
// The Scroll L2 message fee estimator address for each network
scrollFeeEstimatorAddress map[config.Network]string `yaml:"-"`
// The UniswapV3 pool address for each network (used for RPL price TWAP info)
rplTwapPoolAddress map[config.Network]string `yaml:"-"`
// The multicall contract address
multicallAddress map[config.Network]string `yaml:"-"`
// The BalanceChecker contract address
balancebatcherAddress map[config.Network]string `yaml:"-"`
// The FlashBots Protect RPC endpoint
flashbotsProtectUrl map[config.Network]string `yaml:"-"`
}
// Generates a new Smartnode configuration
func NewSmartnodeConfig(cfg *RocketPoolConfig) *SmartnodeConfig {
return &SmartnodeConfig{
Title: "Smartnode Settings",
parent: cfg,
ProjectName: config.Parameter{
ID: ProjectNameID,
Name: "Project Name",
Description: "This is the prefix that will be attached to all of the Docker containers managed by the Smartnode.",
Type: config.ParameterType_String,
Default: map[config.Network]interface{}{config.Network_All: defaultProjectName},
AffectsContainers: []config.ContainerID{config.ContainerID_Api, config.ContainerID_Node, config.ContainerID_Watchtower, config.ContainerID_Eth1, config.ContainerID_Eth2, config.ContainerID_Validator, config.ContainerID_Grafana, config.ContainerID_Prometheus, config.ContainerID_Exporter},
CanBeBlank: false,
OverwriteOnUpgrade: false,
},
DataPath: config.Parameter{
ID: "dataPath",
Name: "Data Path",
Description: "The absolute path of the `data` folder that contains your node wallet's encrypted file, the password for your node wallet, and all of the validator keys for your minipools. You may use environment variables in this string.",
Type: config.ParameterType_String,
Default: map[config.Network]interface{}{config.Network_All: getDefaultDataDir(cfg)},
AffectsContainers: []config.ContainerID{config.ContainerID_Api, config.ContainerID_Node, config.ContainerID_Watchtower, config.ContainerID_Validator},
CanBeBlank: false,
OverwriteOnUpgrade: false,
},
WatchtowerStatePath: config.Parameter{
ID: "watchtowerPath",
Name: "Watchtower Path",
Description: "The absolute path of the watchtower state folder that contains persistent state that is used by the watchtower process on trusted nodes. **Only relevant for trusted nodes.**",
Type: config.ParameterType_String,
Default: map[config.Network]interface{}{config.Network_All: "$HOME/.rocketpool/watchtower"},
AffectsContainers: []config.ContainerID{config.ContainerID_Watchtower},
CanBeBlank: false,
OverwriteOnUpgrade: false,
},
Network: config.Parameter{
ID: NetworkID,
Name: "Network",
Description: "The Ethereum network you want to use - select Hoodi Testnet to practice with fake ETH, or Mainnet to stake on the real network using real ETH.",
Type: config.ParameterType_Choice,
Default: map[config.Network]interface{}{config.Network_All: config.Network_Mainnet},
AffectsContainers: []config.ContainerID{config.ContainerID_Api, config.ContainerID_Node, config.ContainerID_Watchtower, config.ContainerID_Eth1, config.ContainerID_Eth2, config.ContainerID_Validator},
CanBeBlank: false,
OverwriteOnUpgrade: false,
Options: getNetworkOptions(),
},
ManualMaxFee: config.Parameter{
ID: "manualMaxFee",
Name: "Manual Max Fee",
Description: "Set this if you want all of the Smartnode's transactions to use this specific max fee value (in gwei), which is the most you'd be willing to pay (*including the priority fee*).\n\nA value of 0 will show you the current suggested max fee based on the current network conditions and let you specify it each time you do a transaction.\n\nAny other value will ignore the recommended max fee and explicitly use this value instead.\n\nThis applies to automated transactions (such as claiming RPL and staking minipools) as well.",
Type: config.ParameterType_Float,
Default: map[config.Network]interface{}{config.Network_All: float64(0)},
AffectsContainers: []config.ContainerID{config.ContainerID_Node, config.ContainerID_Watchtower},
CanBeBlank: false,
OverwriteOnUpgrade: false,
},
PriorityFee: config.Parameter{
ID: "priorityFee",
Name: "Priority Fee",
Description: "The default value for the priority fee (in gwei) for all of your transactions. This describes how much you're willing to pay *above the network's current base fee* - the higher this is, the more ETH you give to the validators for including your transaction, which generally means it will be included in a block faster (as long as your max fee is sufficiently high to cover the current network conditions).\n\nMust be larger than 0.",
Type: config.ParameterType_Float,
Default: map[config.Network]interface{}{config.Network_All: float64(2)},
AffectsContainers: []config.ContainerID{config.ContainerID_Node, config.ContainerID_Watchtower},
CanBeBlank: false,
OverwriteOnUpgrade: false,
},
AutoTxGasThreshold: config.Parameter{
ID: "minipoolStakeGasThreshold",
Name: "Automatic TX Gas Threshold",
Description: "Occasionally, the Smartnode will attempt to perform some automatic transactions (such as the second `stake` transaction to finish launching a minipool or the `reduce bond` transaction to convert a 16-ETH minipool to an 8-ETH one). During these, your node will use the `Rapid` suggestion from the gas estimator as its max fee.\n\nThis threshold is a limit (in gwei) you can put on that suggestion; your node will not `stake` the new minipool until the suggestion is below this limit.\n\n" +
"A value of 0 will disable non-essential automatic transactions (such as minipool balance distribution and bond reduction), but essential transactions (such as minipool staking and solo migration promotion) will not be disabled.\n\n" +
"NOTE: the node will ignore this limit and automatically execute transactions at whatever the suggested fee happens to be once too much time has passed since those transactions were first eligible. You may end up paying more than you wanted to if you set this too low!",
Type: config.ParameterType_Float,
Default: map[config.Network]interface{}{config.Network_All: float64(150)},
AffectsContainers: []config.ContainerID{config.ContainerID_Node},
CanBeBlank: false,
OverwriteOnUpgrade: false,
},
DistributeThreshold: config.Parameter{
ID: "distributeThreshold",
Name: "Auto-Distribute Threshold",
Description: "The Smartnode will regularly check the balance of each of your minipools on the Execution Layer (**not** the Beacon Chain).\nIf any of them have a balance greater than this threshold (in ETH), the Smartnode will automatically distribute the balance. This will send your share of the balance to your withdrawal address.\n\nMust be less than 8 ETH.\n\nSet this to 0 to disable automatic distributes.\n[orange]WARNING: if you disable automatic distribution, you **must** ensure you distribute your minipool's balance before it reaches 8 ETH or you will no longer be able to distribute your rewards until you exit the minipool!",
Type: config.ParameterType_Float,
Default: map[config.Network]interface{}{config.Network_All: float64(1)},
AffectsContainers: []config.ContainerID{config.ContainerID_Node},
CanBeBlank: false,
OverwriteOnUpgrade: false,
},
VerifyProposals: config.Parameter{
ID: "verifyProposals",
Name: "Enable PDAO Proposal Checker",
Description: "Check this box to opt into the responsibility for verifying Protocol DAO proposals once the Houston upgrade has been activated. Your node will regularly check for new proposals, verify their correctness, and submit challenges to any that do not match the on-chain data (e.g., if someone tampered with voting power and attempted to cheat).\n\nTo learn more about the PDAO proposal checking duty, including requirements and RPL bonding, please see the documentation at https://docs.rocketpool.net/guides/houston/pdao#challenge-process.",
Type: config.ParameterType_Bool,
Default: map[config.Network]interface{}{config.Network_All: false},
AffectsContainers: []config.ContainerID{config.ContainerID_Node},
CanBeBlank: false,
OverwriteOnUpgrade: false,
},
AutoInitVPThreshold: config.Parameter{
ID: "autoInitVPThreshold",
Name: "Auto-Init Vote Power Gas Threshold",
Description: "The Smartnode will regularly check if the node has initialized voting power and attempt to initialize voting power if it isn't initialized.\n\n" +
"This threshold is a limit (in gwei) you can set on this automatic transaction; your node will not attempt to initialize voting power if the network suggested fee is below this limit.\n\n" +
"A value of 0 will disable this task. Disable this if your node was registered post-houston or your vote power is already initialized.\n\n",
Type: config.ParameterType_Float,
Default: map[config.Network]interface{}{config.Network_All: float64(5)},
AffectsContainers: []config.ContainerID{config.ContainerID_Node},
CanBeBlank: false,
OverwriteOnUpgrade: false,
},
RewardsTreeMode: config.Parameter{
ID: "rewardsTreeMode",
Name: "Rewards Tree Mode",
Description: "Select how you want to acquire the Merkle Tree files for each rewards interval.",
Type: config.ParameterType_Choice,
Default: map[config.Network]interface{}{config.Network_All: config.RewardsMode_Download},
AffectsContainers: []config.ContainerID{config.ContainerID_Node, config.ContainerID_Watchtower},
CanBeBlank: false,
OverwriteOnUpgrade: false,
Options: []config.ParameterOption{{
Name: "Download",
Description: "Automatically download the Merkle Tree rewards files that were published by the Oracle DAO after a rewards checkpoint.",
Value: config.RewardsMode_Download,
}, {
Name: "Generate",
Description: "Use your node to automatically generate the Merkle Tree rewards file once a checkpoint has passed. This option lets you build and verify the file that the Oracle DAO created if you prefer not to trust it and want to generate the tree yourself.\n\n[orange]WARNING: Generating the tree can take a *very long time* if many node operators are opted into the Smoothing Pool, which could impact your attestation performance!",
Value: config.RewardsMode_Generate,
}},
},
PriceBalanceSubmissionReferenceTimestamp: config.Parameter{
ID: "priceBalanceSubmissionReferenceTimestamp",
Name: "P/B Submission Time Ref",
Description: "Prices and balances submission time reference. An Unix timestamp used by oDAO members as an initial reference to calculate when submissions are due based on the onchain stored submission interval value.",
Type: config.ParameterType_Int,
Default: map[config.Network]interface{}{config.Network_All: int64(config.PBSubmission_6AM)},
AffectsContainers: []config.ContainerID{config.ContainerID_Watchtower},
CanBeBlank: false,
OverwriteOnUpgrade: true,
},
RewardsTreeCustomUrl: config.Parameter{
ID: "rewardsTreeCustomUrl",
Name: "Rewards Tree Custom Download URLs",
Description: "The Smartnode will automatically download missing rewards tree files from trusted sources like IPFS and Rocket Pool's repository on GitHub. Use this field if you would like to manually specify additional sources that host the rewards tree files, so the Smartnode can download from them as well.\nMultiple URLs can be provided using ';' as separator).\n\nUse '%s' to specify the location of the rewards file name in the URL - for example: `https://my-cool-domain.com/rewards-trees/mainnet/%s`.",
Type: config.ParameterType_String,
Default: map[config.Network]interface{}{config.Network_All: ""},
AffectsContainers: []config.ContainerID{config.ContainerID_Watchtower},
CanBeBlank: true,
OverwriteOnUpgrade: false,
},
ArchiveECUrl: config.Parameter{
ID: "archiveECUrl",
Name: "Archive-Mode EC URL",
Description: "[orange]**For manual Merkle rewards tree generation only.**[white]\n\nGenerating the Merkle rewards tree files for past rewards intervals typically requires an Execution client with Archive mode enabled, which is usually disabled on your primary and fallback Execution clients to save disk space.\nIf you want to generate your own rewards tree files for intervals from a long time ago, you may enter the URL of an Execution client with Archive access here.\n\nFor a free light client with Archive access, you may use https://www.alchemy.com/supernode.",
Type: config.ParameterType_String,
Default: map[config.Network]interface{}{config.Network_All: ""},
AffectsContainers: []config.ContainerID{config.ContainerID_Watchtower},
CanBeBlank: true,
OverwriteOnUpgrade: false,
},
WatchtowerMaxFeeOverride: config.Parameter{
ID: "watchtowerMaxFeeOverride",
Name: "Watchtower Max Fee Override",
Description: fmt.Sprintf("[orange]**For Oracle DAO members only.**\n\n[white]Use this to override the max fee (in gwei) for watchtower transactions. Note that if you set it below %d, the setting will be ignored; it can only be used to set the max fee higher than %d during times of extreme network stress.", WatchtowerMaxFeeDefault, WatchtowerMaxFeeDefault),
Type: config.ParameterType_Float,
Default: map[config.Network]interface{}{config.Network_All: float64(WatchtowerMaxFeeDefault)},
AffectsContainers: []config.ContainerID{config.ContainerID_Watchtower},
CanBeBlank: false,
OverwriteOnUpgrade: true,
},
WatchtowerPrioFeeOverride: config.Parameter{
ID: "watchtowerPrioFeeOverride",
Name: "Watchtower Priority Fee Override",
Description: fmt.Sprintf("[orange]**For Oracle DAO members only.**\n\n[white]Use this to override the priority fee (in gwei) for watchtower transactions. Note that if you set it below %d, the setting will be ignored; it can only be used to set the priority fee higher than %d during times of extreme network stress.", WatchtowerPrioFeeDefault, WatchtowerPrioFeeDefault),
Type: config.ParameterType_Float,
Default: map[config.Network]interface{}{config.Network_All: float64(WatchtowerPrioFeeDefault)},
AffectsContainers: []config.ContainerID{config.ContainerID_Watchtower},
CanBeBlank: false,
OverwriteOnUpgrade: true,
},
txWatchUrl: map[config.Network]string{
config.Network_Mainnet: "https://etherscan.io/tx",
config.Network_Devnet: "https://hoodi.etherscan.io/tx",
config.Network_Testnet: "https://hoodi.etherscan.io/tx",
},
stakeUrl: map[config.Network]string{
config.Network_Mainnet: "https://stake.rocketpool.net",
config.Network_Devnet: "TBD",
config.Network_Testnet: "https://testnet.rocketpool.net",
},
chainID: map[config.Network]uint{
config.Network_Mainnet: 1, // Mainnet
config.Network_Devnet: 560048, // Hoodi
config.Network_Testnet: 560048, // Hoodi
},
storageAddress: map[config.Network]string{
config.Network_Mainnet: "0x1d8f8f00cfa6758d7bE78336684788Fb0ee0Fa46",
config.Network_Devnet: "",
config.Network_Testnet: "0x594Fb75D3dc2DFa0150Ad03F99F97817747dd4E1",
},
rocketSignerRegistryAddress: map[config.Network]string{
config.Network_Mainnet: "0xc1062617d10Ae99E09D941b60746182A87eAB38F",
config.Network_Devnet: "0xE3FbfaD4A11777E6271921E7EC1A5a1345684F4E",
config.Network_Testnet: "0xE3FbfaD4A11777E6271921E7EC1A5a1345684F4E",
},
rplTokenAddress: map[config.Network]string{
config.Network_Mainnet: "0xD33526068D116cE69F19A9ee46F0bd304F21A51f",
config.Network_Devnet: "",
config.Network_Testnet: "0x1Cc9cF5586522c6F483E84A19c3C2B0B6d027bF0",
},
rethAddress: map[config.Network]string{
config.Network_Mainnet: "0xae78736Cd615f374D3085123A210448E74Fc6393",
config.Network_Devnet: "",
config.Network_Testnet: "0x7322c24752f79c05FFD1E2a6FCB97020C1C264F1",
},
v1_0_0_RewardsPoolAddress: map[config.Network]string{
config.Network_Mainnet: "0xA3a18348e6E2d3897B6f2671bb8c120e36554802",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
v1_0_0_ClaimNodeAddress: map[config.Network]string{
config.Network_Mainnet: "0x899336A2a86053705E65dB61f52C686dcFaeF548",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
v1_0_0_ClaimTrustedNodeAddress: map[config.Network]string{
config.Network_Mainnet: "0x6af730deB0463b432433318dC8002C0A4e9315e8",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
v1_0_0_MinipoolManagerAddress: map[config.Network]string{
config.Network_Mainnet: "0x6293B8abC1F36aFB22406Be5f96D893072A8cF3a",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
v1_1_0_NetworkPricesAddress: map[config.Network]string{
config.Network_Mainnet: "0xd3f500F550F46e504A4D2153127B47e007e11166",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
v1_1_0_NodeStakingAddress: map[config.Network]string{
config.Network_Mainnet: "0x0d8D8f8541B12A0e1194B7CC4b6D954b90AB82ec",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
v1_1_0_NodeDepositAddress: map[config.Network]string{
config.Network_Mainnet: "0x1Cc9cF5586522c6F483E84A19c3C2B0B6d027bF0",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
v1_1_0_MinipoolQueueAddress: map[config.Network]string{
config.Network_Mainnet: "0x5870dA524635D1310Dc0e6F256Ce331012C9C19E",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
v1_1_0_MinipoolFactoryAddress: map[config.Network]string{
config.Network_Mainnet: "0x54705f80D7C51Fcffd9C659ce3f3C9a7dCCf5788",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
v1_2_0_NetworkPricesAddress: map[config.Network]string{
config.Network_Mainnet: "0x751826b107672360b764327631cC5764515fFC37",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
v1_2_0_NetworkBalancesAddress: map[config.Network]string{
config.Network_Mainnet: "0x07FCaBCbe4ff0d80c2b1eb42855C0131b6cba2F4",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
snapshotApiDomain: map[config.Network]string{
config.Network_Mainnet: "hub.snapshot.org",
config.Network_Devnet: "",
config.Network_Testnet: "hub.snapshot.org",
},
previousRewardsPoolAddresses: map[config.Network][]common.Address{
config.Network_Mainnet: {
common.HexToAddress("0x594Fb75D3dc2DFa0150Ad03F99F97817747dd4E1"),
common.HexToAddress("0xA805d68b61956BC92d556F2bE6d18747adAeEe82"),
},
config.Network_Devnet: {},
config.Network_Testnet: {},
},
previousRocketDAOProtocolVerifier: map[config.Network][]common.Address{
config.Network_Mainnet: {},
config.Network_Devnet: {},
config.Network_Testnet: {},
},
optimismPriceMessengerAddress: map[config.Network]string{
config.Network_Mainnet: "0x12759f8Df234f8f2cDdb3d2Ed5604adF9ACCfc9F",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
polygonPriceMessengerAddress: map[config.Network]string{
config.Network_Mainnet: "0xb1029Ac2Be4e08516697093e2AFeC435057f3511",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
arbitrumPriceMessengerAddress: map[config.Network]string{
config.Network_Mainnet: "0x05330300f829AD3fC8f33838BC88CFC4093baD53",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
arbitrumPriceMessengerAddressV2: map[config.Network]string{
config.Network_Mainnet: "0x312FcFB03eC9B1Ea38CB7BFCd26ee7bC3b505aB1",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
zkSyncEraPriceMessengerAddress: map[config.Network]string{
config.Network_Mainnet: "0x6cf6CB29754aEBf88AF12089224429bD68b0b8c8",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
basePriceMessengerAddress: map[config.Network]string{
config.Network_Mainnet: "0x64A5856869C06B0188C84A5F83d712bbAc03517d",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
scrollPriceMessengerAddress: map[config.Network]string{
config.Network_Mainnet: "0x0f22dc9b9c03757d4676539203d7549c8f22c15c",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
scrollFeeEstimatorAddress: map[config.Network]string{
config.Network_Mainnet: "0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B",
config.Network_Devnet: "",
config.Network_Testnet: "",
},
rplTwapPoolAddress: map[config.Network]string{
config.Network_Mainnet: "0xe42318ea3b998e8355a3da364eb9d48ec725eb45",
config.Network_Devnet: "0x0ca239d8AC5E49E3203d60eaf86Baa6712E5b454",
config.Network_Testnet: "0x0ca239d8AC5E49E3203d60eaf86Baa6712E5b454",
},
multicallAddress: map[config.Network]string{
config.Network_Mainnet: "0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696",
config.Network_Devnet: "0xc5fA61aA6Ec012d1A2Ea38f31ADAf4D06c8725E7",
config.Network_Testnet: "0xc5fA61aA6Ec012d1A2Ea38f31ADAf4D06c8725E7",
},
balancebatcherAddress: map[config.Network]string{
config.Network_Mainnet: "0xb1f8e55c7f64d203c1400b9d8555d050f94adf39",
config.Network_Devnet: "0xB80b500CF68a956b6f149F1C48E8F07EEF4486Ce",
config.Network_Testnet: "0xB80b500CF68a956b6f149F1C48E8F07EEF4486Ce",
},
flashbotsProtectUrl: map[config.Network]string{
config.Network_Mainnet: "https://rpc.flashbots.net/",
config.Network_Devnet: "",
config.Network_Testnet: "https://rpc-hoodi.flashbots.net/",
},
}
}
// Get the parameters for this config
func (cfg *SmartnodeConfig) GetParameters() []*config.Parameter {
return []*config.Parameter{
&cfg.Network,
&cfg.ProjectName,
&cfg.DataPath,
&cfg.ManualMaxFee,
&cfg.PriorityFee,
&cfg.AutoTxGasThreshold,
&cfg.DistributeThreshold,
&cfg.VerifyProposals,
&cfg.AutoInitVPThreshold,
&cfg.RewardsTreeMode,
&cfg.PriceBalanceSubmissionReferenceTimestamp,
&cfg.RewardsTreeCustomUrl,
&cfg.ArchiveECUrl,
&cfg.WatchtowerMaxFeeOverride,
&cfg.WatchtowerPrioFeeOverride,
}
}
// Getters for the non-editable parameters
func (cfg *SmartnodeConfig) GetTxWatchUrl() string {
return cfg.txWatchUrl[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetStakeUrl() string {
return cfg.stakeUrl[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetChainID() uint {
return cfg.chainID[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetWalletPath() string {
if cfg.parent.IsNativeMode {
return filepath.Join(cfg.DataPath.Value.(string), "wallet")
}
return filepath.Join(DaemonDataPath, "wallet")
}
func (cfg *SmartnodeConfig) GetPasswordPath() string {
if cfg.parent.IsNativeMode {
return filepath.Join(cfg.DataPath.Value.(string), "password")
}
return filepath.Join(DaemonDataPath, "password")
}
func (cfg *SmartnodeConfig) GetValidatorKeychainPath() string {
if cfg.parent.IsNativeMode {
return filepath.Join(cfg.DataPath.Value.(string), "validators")
}
return filepath.Join(DaemonDataPath, "validators")
}
func (cfg *SmartnodeConfig) GetRecordsPath() string {
if cfg.parent.IsNativeMode {
return filepath.Join(cfg.DataPath.Value.(string), "records")
}
return filepath.Join(DaemonDataPath, "records")
}
func (cfg *SmartnodeConfig) GetVotingPath() string {
if cfg.parent.IsNativeMode {
return filepath.Join(cfg.DataPath.Value.(string), "voting", string(cfg.Network.Value.(config.Network)))
}
return filepath.Join(DaemonDataPath, "voting", string(cfg.Network.Value.(config.Network)))
}
func (cfg *SmartnodeConfig) GetWalletPathInCLI() string {
return filepath.Join(cfg.DataPath.Value.(string), "wallet")
}
func (cfg *SmartnodeConfig) GetPasswordPathInCLI() string {
return filepath.Join(cfg.DataPath.Value.(string), "password")
}
func (cfg *SmartnodeConfig) GetValidatorKeychainPathInCLI() string {
return filepath.Join(cfg.DataPath.Value.(string), "validators")
}
func (config *SmartnodeConfig) GetWatchtowerStatePath() string {
if config.parent.IsNativeMode {
return filepath.Join(config.DataPath.Value.(string), WatchtowerFolder, "state.yml")
}
return filepath.Join(DaemonDataPath, WatchtowerFolder, "state.yml")
}
func (cfg *SmartnodeConfig) GetCustomKeyPath() string {
if cfg.parent.IsNativeMode {
return filepath.Join(cfg.DataPath.Value.(string), "custom-keys")
}
return filepath.Join(DaemonDataPath, "custom-keys")
}
func (cfg *SmartnodeConfig) GetCustomKeyPasswordFilePath() string {
if cfg.parent.IsNativeMode {
return filepath.Join(cfg.DataPath.Value.(string), "custom-key-passwords")
}
return filepath.Join(DaemonDataPath, "custom-key-passwords")
}
func (cfg *SmartnodeConfig) GetStorageAddress() string {
return cfg.storageAddress[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetRocketSignerRegistryAddress() string {
return cfg.rocketSignerRegistryAddress[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetRplTokenAddress() string {
return cfg.rplTokenAddress[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetSmartnodeContainerTag() string {
return smartnodeTag
}
func (config *SmartnodeConfig) GetPruneProvisionerContainerTag() string {
return pruneProvisionerTag
}
func (cfg *SmartnodeConfig) GetSnapshotApiDomain() string {
return cfg.snapshotApiDomain[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetVotingSnapshotID() [32]byte {
// So the contract wants a Keccak'd hash of the voting ID, but Snapshot's service wants ASCII so it can display the ID in plain text; we have to do this to make it play nicely with Snapshot
buffer := [32]byte{}
idBytes := []byte(SnapshotID)
copy(buffer[0:], idBytes)
return buffer
}
func (config *SmartnodeConfig) GetSnapshotID() string {
return SnapshotID
}
// The title for the config
func (cfg *SmartnodeConfig) GetConfigTitle() string {
return cfg.Title
}
func (cfg *SmartnodeConfig) GetRethAddress() common.Address {
return common.HexToAddress(cfg.rethAddress[cfg.Network.Value.(config.Network)])
}
func getDefaultDataDir(config *RocketPoolConfig) string {
if config == nil {
// Handle tests. Eventually we'll refactor so this isn't necessary.
return ""
}
return filepath.Join(config.RocketPoolDirectory, "data")
}
func (cfg *SmartnodeConfig) GetRewardsTreeDirectory(daemon bool) string {
if daemon && !cfg.parent.IsNativeMode {
return filepath.Join(DaemonDataPath, RewardsTreesFolder)
}
return filepath.Join(cfg.DataPath.Value.(string), RewardsTreesFolder)
}
func (cfg *SmartnodeConfig) formatRewardsFilename(f string, interval uint64, extension RewardsExtension) string {
return fmt.Sprintf(f, string(cfg.Network.Value.(config.Network)), interval, string(extension))
}
func (cfg *SmartnodeConfig) GetRewardsTreeFilename(interval uint64, extension RewardsExtension) string {
return cfg.formatRewardsFilename(rewardsTreeFilenameFormat, interval, extension)
}
func (cfg *SmartnodeConfig) GetMinipoolPerformanceFilename(interval uint64) string {
return cfg.formatRewardsFilename(minipoolPerformanceFilenameFormat, interval, RewardsExtensionJSON)
}
func (cfg *SmartnodeConfig) GetRewardsTreePath(interval uint64, daemon bool, extension RewardsExtension) string {
return filepath.Join(
cfg.GetRewardsTreeDirectory(daemon),
cfg.GetRewardsTreeFilename(interval, extension),
)
}
func (cfg *SmartnodeConfig) GetMinipoolPerformancePath(interval uint64, daemon bool) string {
return filepath.Join(
cfg.GetRewardsTreeDirectory(daemon),
cfg.GetMinipoolPerformanceFilename(interval),
)
}
func (cfg *SmartnodeConfig) GetRegenerateRewardsTreeRequestPath(interval uint64, daemon bool) string {
if daemon && !cfg.parent.IsNativeMode {
return filepath.Join(DaemonDataPath, WatchtowerFolder, fmt.Sprintf(RegenerateRewardsTreeRequestFormat, interval))
}
return filepath.Join(cfg.DataPath.Value.(string), WatchtowerFolder, fmt.Sprintf(RegenerateRewardsTreeRequestFormat, interval))
}
func (cfg *SmartnodeConfig) GetWatchtowerFolder(daemon bool) string {
if daemon && !cfg.parent.IsNativeMode {
return filepath.Join(DaemonDataPath, WatchtowerFolder)
}
return filepath.Join(cfg.DataPath.Value.(string), WatchtowerFolder)
}
func (cfg *SmartnodeConfig) GetFeeRecipientFilePath() string {
if !cfg.parent.IsNativeMode {
return filepath.Join(DaemonDataPath, "validators", FeeRecipientFilename)
}
return filepath.Join(cfg.DataPath.Value.(string), "validators", NativeFeeRecipientFilename)
}
func (cfg *SmartnodeConfig) GetV100RewardsPoolAddress() common.Address {
return common.HexToAddress(cfg.v1_0_0_RewardsPoolAddress[cfg.Network.Value.(config.Network)])
}
func (cfg *SmartnodeConfig) GetV100ClaimNodeAddress() common.Address {
return common.HexToAddress(cfg.v1_0_0_ClaimNodeAddress[cfg.Network.Value.(config.Network)])
}
func (cfg *SmartnodeConfig) GetV100ClaimTrustedNodeAddress() common.Address {
return common.HexToAddress(cfg.v1_0_0_ClaimTrustedNodeAddress[cfg.Network.Value.(config.Network)])
}
func (cfg *SmartnodeConfig) GetV100MinipoolManagerAddress() common.Address {
return common.HexToAddress(cfg.v1_0_0_MinipoolManagerAddress[cfg.Network.Value.(config.Network)])
}
func (cfg *SmartnodeConfig) GetV110NetworkPricesAddress() common.Address {
return common.HexToAddress(cfg.v1_1_0_NetworkPricesAddress[cfg.Network.Value.(config.Network)])
}
func (cfg *SmartnodeConfig) GetV120NetworkPricesAddress() common.Address {
return common.HexToAddress(cfg.v1_2_0_NetworkPricesAddress[cfg.Network.Value.(config.Network)])
}
func (cfg *SmartnodeConfig) GetV120NetworkBalancesAddress() common.Address {
return common.HexToAddress(cfg.v1_2_0_NetworkBalancesAddress[cfg.Network.Value.(config.Network)])
}
func (cfg *SmartnodeConfig) GetV110NodeStakingAddress() common.Address {
return common.HexToAddress(cfg.v1_1_0_NodeStakingAddress[cfg.Network.Value.(config.Network)])
}
func (cfg *SmartnodeConfig) GetV110NodeDepositAddress() common.Address {
return common.HexToAddress(cfg.v1_1_0_NodeDepositAddress[cfg.Network.Value.(config.Network)])
}
func (cfg *SmartnodeConfig) GetV110MinipoolQueueAddress() common.Address {
return common.HexToAddress(cfg.v1_1_0_MinipoolQueueAddress[cfg.Network.Value.(config.Network)])
}
func (cfg *SmartnodeConfig) GetV110MinipoolFactoryAddress() common.Address {
return common.HexToAddress(cfg.v1_1_0_MinipoolFactoryAddress[cfg.Network.Value.(config.Network)])
}
func (cfg *SmartnodeConfig) GetPreviousRewardsPoolAddresses() []common.Address {
return cfg.previousRewardsPoolAddresses[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetPreviousRocketDAOProtocolVerifierAddresses() []common.Address {
return cfg.previousRocketDAOProtocolVerifier[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetOptimismMessengerAddress() string {
return cfg.optimismPriceMessengerAddress[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetPolygonMessengerAddress() string {
return cfg.polygonPriceMessengerAddress[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetArbitrumMessengerAddress() string {
return cfg.arbitrumPriceMessengerAddress[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetArbitrumMessengerAddressV2() string {
return cfg.arbitrumPriceMessengerAddressV2[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetZkSyncEraMessengerAddress() string {
return cfg.zkSyncEraPriceMessengerAddress[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetBaseMessengerAddress() string {
return cfg.basePriceMessengerAddress[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetScrollMessengerAddress() string {
return cfg.scrollPriceMessengerAddress[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetScrollFeeEstimatorAddress() string {
return cfg.scrollFeeEstimatorAddress[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetRplTwapPoolAddress() string {
return cfg.rplTwapPoolAddress[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetMulticallAddress() string {
return cfg.multicallAddress[cfg.Network.Value.(config.Network)]
}
func (cfg *SmartnodeConfig) GetBalanceBatcherAddress() string {
return cfg.balancebatcherAddress[cfg.Network.Value.(config.Network)]
}
// Utility function to get the state manager contracts
func (cfg *SmartnodeConfig) GetStateManagerContracts() StateManagerContracts {
return StateManagerContracts{
Multicaller: common.HexToAddress(cfg.GetMulticallAddress()),
BalanceBatcher: common.HexToAddress(cfg.GetBalanceBatcherAddress()),
}
}
func (cfg *SmartnodeConfig) GetFlashbotsProtectUrl() string {
return cfg.flashbotsProtectUrl[cfg.Network.Value.(config.Network)]
}
func getNetworkOptions() []config.ParameterOption {
options := []config.ParameterOption{
{
Name: "Ethereum Mainnet",
Description: "This is the real Ethereum main network, using real ETH and real RPL to make real validators.",
Value: config.Network_Mainnet,
}, {
Name: "Hoodi Testnet",
Description: "This is the Hoodi test network, which is the next generation of long-lived testnets for Ethereum. It uses free fake ETH and free fake RPL to make fake validators.\nUse this if you want to practice running the Smartnode in a free, safe environment before moving to Mainnet.",
Value: config.Network_Testnet,
},
}
if strings.HasSuffix(shared.RocketPoolVersion, "-dev") {
options = append(options, config.ParameterOption{
Name: "Devnet",
Description: "This is a development network used by Rocket Pool engineers to test new features and contract upgrades before they are promoted to a Testnet for staging. You should not use this network unless invited to do so by the developers.",
Value: config.Network_Devnet,
})
}
return options
}