diff --git a/client/client.go b/client/client.go index 7b61f44ba..271addf28 100644 --- a/client/client.go +++ b/client/client.go @@ -26,7 +26,7 @@ type ApiClient struct { // Creates a new API client instance func NewApiClient(apiUrl *url.URL, logger *slog.Logger, tracer *httptrace.ClientTrace) *ApiClient { - context := client.NewNetworkRequesterContext(apiUrl, logger, tracer) + context := client.NewNetworkRequesterContext(apiUrl, logger, tracer, nil) client := &ApiClient{ context: context, diff --git a/go.mod b/go.mod index 5fc7a5713..f855ee5ad 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,15 @@ module github.com/rocket-pool/smartnode/v2 -go 1.21 +go 1.22 -toolchain go1.21.1 +toolchain go1.22.7 require ( github.com/alessio/shellescape v1.4.2 github.com/blang/semver/v4 v4.0.0 - github.com/docker/docker v26.0.0+incompatible + github.com/docker/docker v27.3.1+incompatible github.com/dustin/go-humanize v1.0.1 - github.com/ethereum/go-ethereum v1.14.3 + github.com/ethereum/go-ethereum v1.14.11 github.com/fatih/color v1.16.0 github.com/gdamore/tcell/v2 v2.7.4 github.com/go-openapi/errors v0.22.0 @@ -22,13 +22,13 @@ require ( github.com/hashicorp/go-version v1.6.0 github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-datastore v0.6.0 - github.com/klauspost/compress v1.17.7 + github.com/klauspost/compress v1.17.8 github.com/mitchellh/go-homedir v1.1.0 github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 - github.com/prometheus/client_golang v1.19.0 - github.com/prysmaticlabs/prysm/v5 v5.0.3 + github.com/prometheus/client_golang v1.19.1 + github.com/prysmaticlabs/prysm/v5 v5.1.0 github.com/rivo/tview v0.0.0-20230208211350-7dfff1ce7854 // DO NOT UPGRADE - github.com/rocket-pool/node-manager-core v0.5.0 + github.com/rocket-pool/node-manager-core v0.5.2-0.20241107043357-0e1b8ab5d70f github.com/rocket-pool/rocketpool-go/v2 v2.0.0-b2.0.20240709170030-c27aeb5fb99b github.com/shirou/gopsutil/v3 v3.24.3 github.com/tyler-smith/go-bip39 v1.1.0 @@ -38,29 +38,30 @@ require ( github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.4.1 github.com/wealdtech/go-merkletree v1.0.1-0.20190605192610-2bb163c2ea2a golang.org/x/sync v0.7.0 - golang.org/x/term v0.19.0 + golang.org/x/term v0.20.0 gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 ) require ( - github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/Microsoft/go-winio v0.6.2 // indirect github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.13.0 // indirect github.com/btcsuite/btcd v0.24.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/btcsuite/btcd/btcutil v1.1.5 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/crackcomm/go-gitignore v0.0.0-20231225121904-e25f5bc08668 // indirect github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect + github.com/d4l3k/messagediff v1.2.1 // indirect github.com/deckarep/golang-set/v2 v2.6.0 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/distribution/reference v0.6.0 // indirect github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect @@ -81,11 +82,11 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/gorilla/mux v1.8.1 - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect - github.com/herumi/bls-eth-go-binary v1.33.0 // indirect - github.com/holiman/uint256 v1.2.4 // indirect + github.com/herumi/bls-eth-go-binary v1.36.1 // indirect + github.com/holiman/uint256 v1.3.1 // indirect github.com/ipfs/bbloom v0.0.4 // indirect github.com/ipfs/boxo v0.18.0 github.com/ipfs/go-bitfield v1.1.0 // indirect @@ -125,12 +126,12 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/polydawn/refmt v0.89.0 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect - github.com/prometheus/client_model v0.6.0 // indirect + github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.51.1 // indirect github.com/prometheus/procfs v0.13.0 // indirect - github.com/prysmaticlabs/fastssz v0.0.0-20221107182844-78142813af44 // indirect - github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 // indirect - github.com/prysmaticlabs/gohashtree v0.0.4-beta // indirect + github.com/prysmaticlabs/fastssz v0.0.0-20240620202422-a981b8ef89d3 // indirect + github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e // indirect + github.com/prysmaticlabs/gohashtree v0.0.4-beta.0.20240624100937-73632381301b // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/rocket-pool/batch-query v1.0.0 github.com/rs/cors v1.10.1 // indirect @@ -139,7 +140,7 @@ require ( github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/supranational/blst v0.3.11 // indirect + github.com/supranational/blst v0.3.13 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e // indirect github.com/tklauser/go-sysconf v0.3.13 // indirect @@ -157,22 +158,24 @@ require ( go.opentelemetry.io/otel/trace v1.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.22.0 // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/text v0.14.0 - golang.org/x/tools v0.20.0 // indirect + golang.org/x/crypto v0.23.0 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sys v0.22.0 // indirect + golang.org/x/text v0.15.0 google.golang.org/api v0.171.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240325203815-454cdb8f5daa // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240325203815-454cdb8f5daa // indirect google.golang.org/grpc v1.62.1 // indirect - google.golang.org/protobuf v1.33.0 + google.golang.org/protobuf v1.34.2 gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) -replace github.com/wealdtech/go-merkletree v1.0.1-0.20190605192610-2bb163c2ea2a => github.com/rocket-pool/go-merkletree v1.0.1-0.20220406020931-c262d9b976dd +require ( + github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect + github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect + golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect +) -//replace github.com/rocket-pool/node-manager-core => ../node-manager-core +replace github.com/wealdtech/go-merkletree v1.0.1-0.20190605192610-2bb163c2ea2a => github.com/rocket-pool/go-merkletree v1.0.1-0.20220406020931-c262d9b976dd diff --git a/go.sum b/go.sum index 88f992faf..66d18e1a1 100644 --- a/go.sum +++ b/go.sum @@ -7,8 +7,8 @@ github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8 github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= @@ -36,8 +36,8 @@ github.com/btcsuite/btcd v0.24.0 h1:gL3uHE/IaFj6fcZSu03SvqPMSx7s/dPzfpG/atRwWdo= github.com/btcsuite/btcd v0.24.0/go.mod h1:K4IDc1593s8jKXIF7yS7yCTSxrknB9z0STzc2j6XgE4= github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= -github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= -github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8= @@ -59,17 +59,19 @@ github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqy github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cespare/cp v1.1.1 h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU= github.com/cespare/cp v1.1.1/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= -github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= +github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= +github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= -github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= +github.com/cockroachdb/pebble v1.1.2 h1:CUh2IPtR4swHlEj48Rhfzw6l/d0qA31fItcIszQVIsA= +github.com/cockroachdb/pebble v1.1.2/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= @@ -85,8 +87,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lV github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/crackcomm/go-gitignore v0.0.0-20231225121904-e25f5bc08668 h1:ZFUue+PNxmHlu7pYv+IYMtqlaO/0VwaGEqKepZf9JpA= github.com/crackcomm/go-gitignore v0.0.0-20231225121904-e25f5bc08668/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE= -github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUpz1KBmiF9bWrjEMacUEREV6MBi2ODnrfQ= -github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= +github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c h1:uQYC5Z1mdLRPrZhHjHxufI8+2UG/i25QG92j0Er9p6I= +github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI= github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= @@ -105,13 +107,13 @@ github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/docker v26.0.0+incompatible h1:Ng2qi+gdKADUa/VM+6b6YaY2nlZhk/lVJiKR/2bMudU= -github.com/docker/docker v26.0.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v27.3.1+incompatible h1:KttF0XoteNTicmUtBO0L2tP+J7FGRFTjaEF4k6WdhfI= +github.com/docker/docker v27.3.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -120,16 +122,16 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/ethereum/c-kzg-4844 v1.0.1 h1:pGixCbGizcVKSwoV70ge48+PrbB+iSKs2rjgfE4yJmQ= github.com/ethereum/c-kzg-4844 v1.0.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.14.3 h1:5zvnAqLtnCZrU9uod1JCvHWJbPMURzYFHfc2eHz4PHA= -github.com/ethereum/go-ethereum v1.14.3/go.mod h1:1STrq471D0BQbCX9He0hUj4bHxX2k6mt5nOQJhDNOJ8= +github.com/ethereum/go-ethereum v1.14.11 h1:8nFDCUUE67rPc6AKxFj7JKaOa2W/W1Rse3oS6LvvxEY= +github.com/ethereum/go-ethereum v1.14.11/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= +github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ60YRB8ChToFTUzl8awsc3cJ8CbLjGIl/A= +github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/ferranbt/fastssz v0.1.3 h1:ZI+z3JH05h4kgmFXdHuR1aWYsgrg7o+Fw7/NCzM16Mo= github.com/ferranbt/fastssz v0.1.3/go.mod h1:0Y9TEd/9XuFlh7mskMPfXiI2Dkw4Ddg9EyXt1W7MRvE= -github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA= -github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= @@ -143,14 +145,12 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE= -github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= github.com/gdamore/tcell/v2 v2.7.4 h1:sg6/UnTM9jGpZU+oFYAsDahfchWAFW8Xx2yFinNSAYU= github.com/gdamore/tcell/v2 v2.7.4/go.mod h1:dSXtXTSK0VsW1biw65DZLZ2NKr7j0qP/0J7ONmsraWg= -github.com/getsentry/sentry-go v0.25.0 h1:q6Eo+hS+yoJlTO3uu/azhQadsD8V+jQn2D8VvX1eOyI= -github.com/getsentry/sentry-go v0.25.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= +github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/glendc/go-external-ip v0.1.0 h1:iX3xQ2Q26atAmLTbd++nUce2P5ht5P4uD4V7caSY/xg= github.com/glendc/go-external-ip v0.1.0/go.mod h1:CNx312s2FLAJoWNdJWZ2Fpf5O4oLsMFwuYviHjS4uJE= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -233,8 +233,8 @@ github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORR github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0QDGLKzqOmktBjT+Is= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHgRbTWrTHu6tqPeKxEQv15giM= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= @@ -245,14 +245,14 @@ github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iP github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -github.com/herumi/bls-eth-go-binary v1.33.0 h1:fHoysK+WbL/FQIJoVGECGd2lBLa2De7YjAGZljI2vzQ= -github.com/herumi/bls-eth-go-binary v1.33.0/go.mod h1:luAnRm3OsMQeokhGzpYmc0ZKwawY7o87PUEP11Z7r7U= +github.com/herumi/bls-eth-go-binary v1.36.1 h1:SfLjxbO1fWkKtKS7J3Ezd1/5QXrcaTZgWynxdSe10hQ= +github.com/herumi/bls-eth-go-binary v1.36.1/go.mod h1:luAnRm3OsMQeokhGzpYmc0ZKwawY7o87PUEP11Z7r7U= github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6wn4Ej8vjuVGxeHdan+bRb2ebyv4= github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= -github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= +github.com/holiman/uint256 v1.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs= +github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= @@ -312,8 +312,8 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= -github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= +github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0= @@ -331,8 +331,8 @@ github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7 github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= -github.com/libp2p/go-libp2p v0.33.1 h1:tvJl9b9M6nSLBtZSXSguq+/lRhRj2oLRkyhBmQNMFLA= -github.com/libp2p/go-libp2p v0.33.1/go.mod h1:zOUTMjG4I7TXwMndNyOBn/CNtVBLlvBlnxfi+8xzx+E= +github.com/libp2p/go-libp2p v0.35.2 h1:287oHbuplkrLdAF+syB0n/qDgd50AUBtEODqS0e0HDs= +github.com/libp2p/go-libp2p v0.35.2/go.mod h1:RKCDNt30IkFipGL0tl8wQW/3zVWEGFUZo8g2gAKxwjU= github.com/libp2p/go-libp2p-asn-util v0.4.1 h1:xqL7++IKD9TBFMgnLPZR6/6iYhawHKHl950SO9L6n94= github.com/libp2p/go-libp2p-asn-util v0.4.1/go.mod h1:d/NI6XZ9qxw67b4e+NgpQexCIiFYJjErASrYW4PFDN8= github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0= @@ -391,8 +391,8 @@ github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aG github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= -github.com/multiformats/go-multiaddr v0.12.2 h1:9G9sTY/wCYajKa9lyfWPmpZAwe6oV+Wb1zcmMS1HG24= -github.com/multiformats/go-multiaddr v0.12.2/go.mod h1:GKyaTYjZRdcUhyOetrxTk9z0cW+jA/YrnqTOvKgi44M= +github.com/multiformats/go-multiaddr v0.12.4 h1:rrKqpY9h+n80EwhhC/kkcunCZZ7URIF8yN1WEUt2Hvc= +github.com/multiformats/go-multiaddr v0.12.4/go.mod h1:sBXrNzucqkFJhvKOiwwLyqamGa/P5EIXNPLovyhQCII= github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= @@ -439,6 +439,38 @@ github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaR github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= +github.com/pion/datachannel v1.5.6 h1:1IxKJntfSlYkpUj8LlYRSWpYiTTC02nUrOE8T3DqGeg= +github.com/pion/datachannel v1.5.6/go.mod h1:1eKT6Q85pRnr2mHiWHxJwO50SfZRtWHTsNIVb/NfGW4= +github.com/pion/dtls/v2 v2.2.11 h1:9U/dpCYl1ySttROPWJgqWKEylUdT0fXp/xst6JwY5Ks= +github.com/pion/dtls/v2 v2.2.11/go.mod h1:d9SYc9fch0CqK90mRk1dC7AkzzpwJj6u2GU3u+9pqFE= +github.com/pion/ice/v2 v2.3.25 h1:M5rJA07dqhi3nobJIg+uPtcVjFECTrhcR3n0ns8kDZs= +github.com/pion/ice/v2 v2.3.25/go.mod h1:KXJJcZK7E8WzrBEYnV4UtqEZsGeWfHxsNqhVcVvgjxw= +github.com/pion/interceptor v0.1.29 h1:39fsnlP1U8gw2JzOFWdfCU82vHvhW9o0rZnZF56wF+M= +github.com/pion/interceptor v0.1.29/go.mod h1:ri+LGNjRUc5xUNtDEPzfdkmSqISixVTBF/z/Zms/6T4= +github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= +github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= +github.com/pion/mdns v0.0.12 h1:CiMYlY+O0azojWDmxdNr7ADGrnZ+V6Ilfner+6mSVK8= +github.com/pion/mdns v0.0.12/go.mod h1:VExJjv8to/6Wqm1FXK+Ii/Z9tsVk/F5sD/N70cnYFbk= +github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA= +github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8= +github.com/pion/rtcp v1.2.14 h1:KCkGV3vJ+4DAJmvP0vaQShsb0xkRfWkO540Gy102KyE= +github.com/pion/rtcp v1.2.14/go.mod h1:sn6qjxvnwyAkkPzPULIbVqSKI5Dv54Rv7VG0kNxh9L4= +github.com/pion/rtp v1.8.6 h1:MTmn/b0aWWsAzux2AmP8WGllusBVw4NPYPVFFd7jUPw= +github.com/pion/rtp v1.8.6/go.mod h1:pBGHaFt/yW7bf1jjWAoUjpSNoDnw98KTMg+jWWvziqU= +github.com/pion/sctp v1.8.16 h1:PKrMs+o9EMLRvFfXq59WFsC+V8mN1wnKzqrv+3D/gYY= +github.com/pion/sctp v1.8.16/go.mod h1:P6PbDVA++OJMrVNg2AL3XtYHV4uD6dvfyOovCgMs0PE= +github.com/pion/sdp/v3 v3.0.9 h1:pX++dCHoHUwq43kuwf3PyJfHlwIj4hXA7Vrifiq0IJY= +github.com/pion/sdp/v3 v3.0.9/go.mod h1:B5xmvENq5IXJimIO4zfp6LAe1fD9N+kFv+V/1lOdz8M= +github.com/pion/srtp/v2 v2.0.18 h1:vKpAXfawO9RtTRKZJbG4y0v1b11NZxQnxRl85kGuUlo= +github.com/pion/srtp/v2 v2.0.18/go.mod h1:0KJQjA99A6/a0DOVTu1PhDSw0CXF2jTkqOoMg3ODqdA= +github.com/pion/stun v0.6.1 h1:8lp6YejULeHBF8NmV8e2787BogQhduZugh5PdhDyyN4= +github.com/pion/stun v0.6.1/go.mod h1:/hO7APkX4hZKu/D0f2lHzNyvdkTGtIy3NDmLR7kSz/8= +github.com/pion/transport/v2 v2.2.5 h1:iyi25i/21gQck4hfRhomF6SktmUQjRsRW4WJdhfc3Kc= +github.com/pion/transport/v2 v2.2.5/go.mod h1:q2U/tf9FEfnSBGSW6w5Qp5PFWRLRj3NjLhCCgpRK4p0= +github.com/pion/turn/v2 v2.1.6 h1:Xr2niVsiPTB0FPtt+yAWKFUkU1eotQbGgpTIld4x1Gc= +github.com/pion/turn/v2 v2.1.6/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY= +github.com/pion/webrtc/v3 v3.2.40 h1:Wtfi6AZMQg+624cvCXUuSmrKWepSB7zfgYDOYqsSOVU= +github.com/pion/webrtc/v3 v3.2.40/go.mod h1:M1RAe3TNTD1tzyvqHrbVODfwdPGSXOUo/OgpoGGJqFY= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -449,30 +481,30 @@ github.com/polydawn/refmt v0.89.0/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= -github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= -github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= -github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= +github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= +github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.51.1 h1:eIjN50Bwglz6a/c3hAgSMcofL3nD+nFQkV6Dd4DsQCw= github.com/prometheus/common v0.51.1/go.mod h1:lrWtQx+iDfn2mbH5GUzlH9TSHyfZpHkSiG1W7y3sF2Q= github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o= github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g= -github.com/prysmaticlabs/fastssz v0.0.0-20221107182844-78142813af44 h1:c3p3UzV4vFA7xaCDphnDWOjpxcadrQ26l5b+ypsvyxo= -github.com/prysmaticlabs/fastssz v0.0.0-20221107182844-78142813af44/go.mod h1:MA5zShstUwCQaE9faGHgCGvEWUbG87p4SAXINhmCkvg= -github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 h1:0tVE4tdWQK9ZpYygoV7+vS6QkDvQVySboMVEIxBJmXw= -github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7/go.mod h1:wmuf/mdK4VMD+jA9ThwcUKjg3a2XWM9cVfFYjDyY4j4= -github.com/prysmaticlabs/gohashtree v0.0.4-beta h1:H/EbCuXPeTV3lpKeXGPpEV9gsUpkqOOVnWapUyeWro4= -github.com/prysmaticlabs/gohashtree v0.0.4-beta/go.mod h1:BFdtALS+Ffhg3lGQIHv9HDWuHS8cTvHZzrHWxwOtGOs= +github.com/prysmaticlabs/fastssz v0.0.0-20240620202422-a981b8ef89d3 h1:0LZAwwHnsZFfXm4IK4rzFV4N5IVSKZKLmuBMA4kAlFk= +github.com/prysmaticlabs/fastssz v0.0.0-20240620202422-a981b8ef89d3/go.mod h1:h2OlIZD/M6wFvV3YMZbW16lFgh3Rsye00G44J2cwLyU= +github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e h1:ATgOe+abbzfx9kCPeXIW4fiWyDdxlwHw07j8UGhdTd4= +github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e/go.mod h1:wmuf/mdK4VMD+jA9ThwcUKjg3a2XWM9cVfFYjDyY4j4= +github.com/prysmaticlabs/gohashtree v0.0.4-beta.0.20240624100937-73632381301b h1:VK7thFOnhxAZ/5aolr5Os4beiubuD08WiuiHyRqgwks= +github.com/prysmaticlabs/gohashtree v0.0.4-beta.0.20240624100937-73632381301b/go.mod h1:HRuvtXLZ4WkaB1MItToVH2e8ZwKwZPY5/Rcby+CvvLY= github.com/prysmaticlabs/protoc-gen-go-cast v0.0.0-20230228205207-28762a7b9294 h1:q9wE0ZZRdTUAAeyFP/w0SwBEnCqlVy2+on6X2/e+eAU= github.com/prysmaticlabs/protoc-gen-go-cast v0.0.0-20230228205207-28762a7b9294/go.mod h1:ZVEbRdnMkGhp/pu35zq4SXxtvUwWK0J1MATtekZpH2Y= -github.com/prysmaticlabs/prysm/v5 v5.0.3 h1:hUi0gu6v7aXmMQkl2GbrLoWcMhDNIbkVxRwrZchKbxU= -github.com/prysmaticlabs/prysm/v5 v5.0.3/go.mod h1:v5Oz4A4cWljfxUmW7SDk/VBzoYnei+lzwJogvSqUZVs= +github.com/prysmaticlabs/prysm/v5 v5.1.0 h1:TY9A6tm0v7bI1z9YH+xkDh7XH7qm4ZK8sTeyckxbj4A= +github.com/prysmaticlabs/prysm/v5 v5.1.0/go.mod h1:SWb5kE/FhtQrLS2yt+IDj+leB7IhXrcOv6lhDnU1nBY= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= -github.com/quic-go/quic-go v0.42.0 h1:uSfdap0eveIl8KXnipv9K7nlwZ5IqLlYOpJ58u5utpM= -github.com/quic-go/quic-go v0.42.0/go.mod h1:132kz4kL3F9vxhW3CtQJLDVwcFe5wdWeJXXijhsO57M= -github.com/quic-go/webtransport-go v0.6.0 h1:CvNsKqc4W2HljHJnoT+rMmbRJybShZ0YPFDD3NxaZLY= -github.com/quic-go/webtransport-go v0.6.0/go.mod h1:9KjU4AEBqEQidGHNDkZrb8CAa1abRaosM2yGOyiikEc= +github.com/quic-go/quic-go v0.44.0 h1:So5wOr7jyO4vzL2sd8/pD9Kesciv91zSk8BoFngItQ0= +github.com/quic-go/quic-go v0.44.0/go.mod h1:z4cx/9Ny9UtGITIPzmPTXh1ULfOyWh4qGQlpnPcWmek= +github.com/quic-go/webtransport-go v0.8.0 h1:HxSrwun11U+LlmwpgM1kEqIqH90IT4N8auv/cD7QFJg= +github.com/quic-go/webtransport-go v0.8.0/go.mod h1:N99tjprW432Ut5ONql/aUhSLT0YVSlwHohQsuac9WaM= github.com/rivo/tview v0.0.0-20230208211350-7dfff1ce7854 h1:/IIOjnKLbuO5YtZUZaJVw9fc062ChPlaGWEBmJ6jyGY= github.com/rivo/tview v0.0.0-20230208211350-7dfff1ce7854/go.mod h1:lBUy/T5kyMudFzWUH/C2moN+NlU5qF505vzOyINXuUQ= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= @@ -483,8 +515,8 @@ github.com/rocket-pool/batch-query v1.0.0 h1:5HejmT1n1fIdLIqUhTNwbkG2PGOPl3IVjCp github.com/rocket-pool/batch-query v1.0.0/go.mod h1:d1CmxShzk0fioJ4yX0eFGhz2an1odnW/LZ2cp3eDGIQ= github.com/rocket-pool/go-merkletree v1.0.1-0.20220406020931-c262d9b976dd h1:p9KuetSKB9nte9I/MkkiM3pwKFVQgqxxPTQ0y56Ff6s= github.com/rocket-pool/go-merkletree v1.0.1-0.20220406020931-c262d9b976dd/go.mod h1:UE9fof8P7iESVtLn1K9CTSkNRYVFHZHlf96RKbU33kA= -github.com/rocket-pool/node-manager-core v0.5.0 h1:98PnHb67mgOKTHMQlRql5KINYM+5NGYV3n4GYChZuec= -github.com/rocket-pool/node-manager-core v0.5.0/go.mod h1:Clii5aca9PvR4HoAlUs8dh2OsJbDDnJ4yL5EaQE1gSo= +github.com/rocket-pool/node-manager-core v0.5.2-0.20241107043357-0e1b8ab5d70f h1:CVIgrV128AFlc7EjRD0VpPqpBy0y+gFFL1RDARD2WV0= +github.com/rocket-pool/node-manager-core v0.5.2-0.20241107043357-0e1b8ab5d70f/go.mod h1:/FFOK81WO/FZO+Y/9LeBRkVE17VkyyerAb9oBh9fpag= github.com/rocket-pool/rocketpool-go/v2 v2.0.0-b2.0.20240709170030-c27aeb5fb99b h1:39UmJzNR71/OMIzblEY9wq+3nojGa/gQOJJpLBa6XcE= github.com/rocket-pool/rocketpool-go/v2 v2.0.0-b2.0.20240709170030-c27aeb5fb99b/go.mod h1:pcY43H/m5pjr7zacrsKVaXnXfKKi1UV08VDPUwxbJkc= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= @@ -527,8 +559,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= -github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/supranational/blst v0.3.13 h1:AYeSxdOMacwu7FBmpfloBz5pbFXDmJL33RuwnKtmTjk= +github.com/supranational/blst v0.3.13/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= @@ -616,10 +648,10 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= -golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 h1:aAcj0Da7eBAtrTp03QXWvm88pSyOt+UgdZw2BFZ+lEw= -golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -644,8 +676,8 @@ golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -691,22 +723,23 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= -golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= +golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -719,8 +752,8 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= -golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= +golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= +golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -744,8 +777,8 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/install/deploy/networks/devnet.yml b/install/deploy/networks/devnet.yml new file mode 100644 index 000000000..ee5651a48 --- /dev/null +++ b/install/deploy/networks/devnet.yml @@ -0,0 +1,41 @@ +key: devnet +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. +networkResources: + ethNetworkName: holesky + chainID: 17000 + genesisForkVersion: 0x01017000 + multicallAddress: 0x0540b786f03c9491f3a2ab4b0e3ae4ecd4f63ce7 + balanceBatcherAddress: 0xfAa2e7C84eD801dd9D27Ac1ed957274530796140 + txWatchUrl: https://holesky.etherscan.io/tx + flashbotsProtectUrl: https://rpc-holesky.flashbots.net/ +smartNodeResources: + stakeUrl: TBD + storageAddress: 0xf04de123993761Bb9F08c9C39112b0E0b0eccE50 + rethAddress: 0x4be7161080b5d890500194cee2c40B1428002Bd3 + rplTokenAddress: 0x59A1a7AebCbF103B3C4f85261fbaC166117E1979 + v1_0_0_RewardsPoolAddress: null + v1_0_0_ClaimNodeAddress: null + v1_0_0_ClaimTrustedNodeAddress: null + v1_0_0_MinipoolManagerAddress: null + v1_1_0_NetworkPricesAddress: null + v1_1_0_NodeStakingAddress: null + v1_1_0_NodeDepositAddress: null + v1_1_0_MinipoolQueueAddress: null + v1_1_0_MinipoolFactoryAddress: null + v1_2_0_NetworkPricesAddress: 0xBba3FBCD4Bdbfc79118B1B31218602E5A71B426c + v1_2_0_NetworkBalancesAddress: 0xBe8Dc8CA5f339c196Aef634DfcDFbA61E30DC743 + snapshotDelegationAddress: null + snapshotApiDomain: "" + previousRewardsPoolAddresses: + - 0x4d581a552490fb6fce5F978e66560C8b7E481818 + previousProtocolDaoVerifierAddresses: [] + optimismPriceMessengerAddress: null + polygonPriceMessengerAddress: null + arbitrumPriceMessengerAddress: null + arbitrumPriceMessengerAddressV2: null + zkSyncEraPriceMessengerAddress: null + basePriceMessengerAddress: null + scrollPriceMessengerAddress: null + scrollFeeEstimatorAddress: null + rplTwapPoolAddress: 0x7bb10d2a3105ed5cc150c099a06cafe43d8aa15d \ No newline at end of file diff --git a/install/deploy/networks/holesky.yml b/install/deploy/networks/holesky.yml new file mode 100644 index 000000000..58b472853 --- /dev/null +++ b/install/deploy/networks/holesky.yml @@ -0,0 +1,41 @@ +key: holesky +name: Holesky Testnet +description: This is the Holešky (Holešovice) 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 Smart Node in a free, safe environment before moving to Mainnet. +networkResources: + ethNetworkName: holesky + chainID: 17000 + genesisForkVersion: 0x01017000 + multicallAddress: 0x0540b786f03c9491f3a2ab4b0e3ae4ecd4f63ce7 + balanceBatcherAddress: 0xfAa2e7C84eD801dd9D27Ac1ed957274530796140 + txWatchUrl: https://holesky.etherscan.io/tx + flashbotsProtectUrl: https://rpc-holesky.flashbots.net/ +smartNodeResources: + stakeUrl: "https://testnet.rocketpool.net" + storageAddress: 0x594Fb75D3dc2DFa0150Ad03F99F97817747dd4E1 + rethAddress: 0x7322c24752f79c05FFD1E2a6FCB97020C1C264F1 + rplTokenAddress: 0x1Cc9cF5586522c6F483E84A19c3C2B0B6d027bF0 + v1_0_0_RewardsPoolAddress: null + v1_0_0_ClaimNodeAddress: null + v1_0_0_ClaimTrustedNodeAddress: null + v1_0_0_MinipoolManagerAddress: null + v1_1_0_NetworkPricesAddress: null + v1_1_0_NodeStakingAddress: null + v1_1_0_NodeDepositAddress: null + v1_1_0_MinipoolQueueAddress: null + v1_1_0_MinipoolFactoryAddress: null + v1_2_0_NetworkPricesAddress: 0x029d946F28F93399a5b0D09c879FC8c94E596AEb + v1_2_0_NetworkBalancesAddress: 0x9294Fc6F03c64Cc217f5BE8697EA3Ed2De77e2F8 + snapshotDelegationAddress: null + snapshotApiDomain: "" + previousRewardsPoolAddresses: + - 0x4a625C617a44E60F74E3fe3bf6d6333b63766e91 + previousProtocolDaoVerifierAddresses: [] + optimismPriceMessengerAddress: null + polygonPriceMessengerAddress: null + arbitrumPriceMessengerAddress: null + arbitrumPriceMessengerAddressV2: null + zkSyncEraPriceMessengerAddress: null + basePriceMessengerAddress: null + scrollPriceMessengerAddress: null + scrollFeeEstimatorAddress: null + rplTwapPoolAddress: 0x7bb10d2a3105ed5cc150c099a06cafe43d8aa15d \ No newline at end of file diff --git a/install/deploy/networks/mainnet.yml b/install/deploy/networks/mainnet.yml new file mode 100644 index 000000000..c8e0a1ab3 --- /dev/null +++ b/install/deploy/networks/mainnet.yml @@ -0,0 +1,41 @@ +key: mainnet +name: Ethereum Mainnet +description: This is the real Ethereum main network, using real ETH and real RPL to make real validators. +networkResources: + ethNetworkName: mainnet + chainID: 1 + genesisForkVersion: 0x00000000 + multicallAddress: 0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696 + balanceBatcherAddress: 0xb1f8e55c7f64d203c1400b9d8555d050f94adf39 + txWatchUrl: https://etherscan.io/tx + flashbotsProtectUrl: https://rpc.flashbots.net/ +smartNodeResources: + stakeUrl: "https://stake.rocketpool.net" + storageAddress: 0x1d8f8f00cfa6758d7bE78336684788Fb0ee0Fa46 + rethAddress: 0xae78736Cd615f374D3085123A210448E74Fc6393 + rplTokenAddress: 0xD33526068D116cE69F19A9ee46F0bd304F21A51f + v1_0_0_RewardsPoolAddress: 0xA3a18348e6E2d3897B6f2671bb8c120e36554802 + v1_0_0_ClaimNodeAddress: 0x899336A2a86053705E65dB61f52C686dcFaeF548 + v1_0_0_ClaimTrustedNodeAddress: 0x6af730deB0463b432433318dC8002C0A4e9315e8 + v1_0_0_MinipoolManagerAddress: 0x6293B8abC1F36aFB22406Be5f96D893072A8cF3a + v1_1_0_NetworkPricesAddress: 0xd3f500F550F46e504A4D2153127B47e007e11166 + v1_1_0_NodeStakingAddress: 0xA73ec45Fe405B5BFCdC0bF4cbc9014Bb32a01cd2 + v1_1_0_NodeDepositAddress: 0x1Cc9cF5586522c6F483E84A19c3C2B0B6d027bF0 + v1_1_0_MinipoolQueueAddress: 0x5870dA524635D1310Dc0e6F256Ce331012C9C19E + v1_1_0_MinipoolFactoryAddress: 0x54705f80D7C51Fcffd9C659ce3f3C9a7dCCf5788 + v1_2_0_NetworkPricesAddress: 0x751826b107672360b764327631cC5764515fFC37 + v1_2_0_NetworkBalancesAddress: 0x07FCaBCbe4ff0d80c2b1eb42855C0131b6cba2F4 + snapshotDelegationAddress: 0x469788fE6E9E9681C6ebF3bF78e7Fd26Fc015446 + snapshotApiDomain: "hub.snapshot.org" + previousRewardsPoolAddresses: + - 0x594Fb75D3dc2DFa0150Ad03F99F97817747dd4E1 + previousProtocolDaoVerifierAddresses: [] + optimismPriceMessengerAddress: 0xdddcf2c25d50ec22e67218e873d46938650d03a7 + polygonPriceMessengerAddress: 0xb1029Ac2Be4e08516697093e2AFeC435057f3511 + arbitrumPriceMessengerAddress: 0x05330300f829AD3fC8f33838BC88CFC4093baD53 + arbitrumPriceMessengerAddressV2: 0x312FcFB03eC9B1Ea38CB7BFCd26ee7bC3b505aB1 + zkSyncEraPriceMessengerAddress: 0x6cf6CB29754aEBf88AF12089224429bD68b0b8c8 + basePriceMessengerAddress: 0x64A5856869C06B0188C84A5F83d712bbAc03517d + scrollPriceMessengerAddress: 0x0f22dc9b9c03757d4676539203d7549c8f22c15c + scrollFeeEstimatorAddress: 0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B + rplTwapPoolAddress: 0xe42318ea3b998e8355a3da364eb9d48ec725eb45 \ No newline at end of file diff --git a/install/deploy/templates/eth2.tmpl b/install/deploy/templates/eth2.tmpl index d755a2f34..6d60df263 100644 --- a/install/deploy/templates/eth2.tmpl +++ b/install/deploy/templates/eth2.tmpl @@ -48,7 +48,7 @@ services: - BITFLY_NODE_METRICS_ENDPOINT={{.Metrics.BitflyNodeMetrics.Endpoint}} - BITFLY_NODE_METRICS_MACHINE_NAME={{.Metrics.BitflyNodeMetrics.MachineName}} - MEV_BOOST_URL={{.MevBoostUrl}} - - RETH_ADDRESS={{.GetRocketPoolResources.RethAddress.Hex}} + - RETH_ADDRESS={{.GetResources.RethAddress.Hex}} {{- /* Client-specific values */}} {{- if eq .LocalBeaconClient.BeaconNode.String "teku"}} - TEKU_JVM_HEAP_SIZE={{.LocalBeaconClient.Teku.JvmHeapSize}} diff --git a/install/deploy/templates/node.tmpl b/install/deploy/templates/node.tmpl index 2227bf0b4..37726f7d6 100644 --- a/install/deploy/templates/node.tmpl +++ b/install/deploy/templates/node.tmpl @@ -19,6 +19,8 @@ services: command: - --user-dir - "{{.RocketPoolDirectory}}" + - --settings-folder + - "/usr/share/rocketpool/networks" - --ip - "0.0.0.0" # Open to all Docker traffic - --port diff --git a/rocketpool-cli/client/config.go b/rocketpool-cli/client/config.go index 20cdd76ee..8b36468cc 100644 --- a/rocketpool-cli/client/config.go +++ b/rocketpool-cli/client/config.go @@ -27,13 +27,13 @@ func (c *Client) LoadConfig() (*config.SmartNodeConfig, bool, error) { return c.cfg, c.isNewCfg, nil } + // Load the config settingsFilePath := filepath.Join(c.Context.ConfigPath, SettingsFile) expandedPath, err := homedir.Expand(settingsFilePath) if err != nil { return nil, false, fmt.Errorf("error expanding settings file path: %w", err) } - - cfg, err := LoadConfigFromFile(expandedPath) + cfg, err := LoadConfigFromFile(expandedPath, c.Context.NetworkSettings) if err != nil { return nil, false, err } @@ -45,7 +45,11 @@ func (c *Client) LoadConfig() (*config.SmartNodeConfig, bool, error) { } // Config wasn't loaded, but there was no error- we should create one. - c.cfg = config.NewSmartNodeConfig(c.Context.ConfigPath, c.Context.NativeMode) + cfg, err = config.NewSmartNodeConfig(c.Context.ConfigPath, c.Context.NativeMode, c.Context.NetworkSettings) + if err != nil { + return nil, false, fmt.Errorf("error creating new Smart Node config: %w", err) + } + c.cfg = cfg c.isNewCfg = true return c.cfg, true, nil } @@ -58,7 +62,7 @@ func (c *Client) LoadBackupConfig() (*config.SmartNodeConfig, error) { return nil, fmt.Errorf("error expanding backup settings file path: %w", err) } - return LoadConfigFromFile(expandedPath) + return LoadConfigFromFile(expandedPath, c.Context.NetworkSettings) } // Save the config diff --git a/rocketpool-cli/client/utils.go b/rocketpool-cli/client/utils.go index bb8fcf6c1..189267f67 100644 --- a/rocketpool-cli/client/utils.go +++ b/rocketpool-cli/client/utils.go @@ -21,13 +21,13 @@ func SyncRatioToPercent(in float64) float64 { } // Loads a config without updating it if it exists -func LoadConfigFromFile(path string) (*config.SmartNodeConfig, error) { +func LoadConfigFromFile(path string, networks []*config.SmartNodeSettings) (*config.SmartNodeConfig, error) { _, err := os.Stat(path) if os.IsNotExist(err) { return nil, nil } - cfg, err := config.LoadFromFile(path) + cfg, err := config.LoadFromFile(path, networks) if err != nil { return nil, err } diff --git a/rocketpool-cli/commands/node/set-primary-withdrawal-address.go b/rocketpool-cli/commands/node/set-primary-withdrawal-address.go index f340c6b56..5f3691f33 100644 --- a/rocketpool-cli/commands/node/set-primary-withdrawal-address.go +++ b/rocketpool-cli/commands/node/set-primary-withdrawal-address.go @@ -125,8 +125,12 @@ func setPrimaryWithdrawalAddress(c *cli.Context, withdrawalAddressOrENS string) stakeUrl := "" config, _, err := rp.LoadConfig() if err == nil { - rs := config.GetRocketPoolResources() - stakeUrl = rs.StakeUrl + res, err := config.GetResources() + if err != nil { + fmt.Printf("Warning: couldn't read resources from config file so the stake URL will be unavailable (%s).\n", err.Error()) + } else { + stakeUrl = res.StakeUrl + } } if stakeUrl != "" { fmt.Printf("The node's primary withdrawal address update to %s is now pending.\n"+ diff --git a/rocketpool-cli/commands/node/set-rpl-withdrawal-address.go b/rocketpool-cli/commands/node/set-rpl-withdrawal-address.go index c5cedc55e..fb8a50e45 100644 --- a/rocketpool-cli/commands/node/set-rpl-withdrawal-address.go +++ b/rocketpool-cli/commands/node/set-rpl-withdrawal-address.go @@ -141,8 +141,12 @@ func setRplWithdrawalAddress(c *cli.Context, withdrawalAddressOrEns string) erro stakeUrl := "" config, _, err := rp.LoadConfig() if err == nil { - rs := config.GetRocketPoolResources() - stakeUrl = rs.StakeUrl + res, err := config.GetResources() + if err != nil { + fmt.Printf("Warning: couldn't read resources from config file so the stake URL will be unavailable (%s).\n", err.Error()) + } else { + stakeUrl = res.StakeUrl + } } if stakeUrl != "" { fmt.Printf("The node's RPL withdrawal address update to %s is now pending.\n"+ diff --git a/rocketpool-cli/commands/service/commands.go b/rocketpool-cli/commands/service/commands.go index 6bc112ca5..9593469c1 100644 --- a/rocketpool-cli/commands/service/commands.go +++ b/rocketpool-cli/commands/service/commands.go @@ -111,9 +111,9 @@ func createFlagsFromConfigParams(prefix string, section config.IConfigSection, c } // Register commands -func RegisterCommands(app *cli.App, name string, aliases []string) { +func RegisterCommands(app *cli.App, name string, aliases []string, networkSettings []*snCfg.SmartNodeSettings) { // Create config flags from parameters - cfgTemplate := snCfg.NewSmartNodeConfig("", false) + cfgTemplate, _ := snCfg.NewSmartNodeConfig("", false, networkSettings) network := cfgTemplate.Network.Value configFlags := createFlagsFromConfigParams("", cfgTemplate, []cli.Flag{ installUpdateDefaultsFlag, diff --git a/rocketpool-cli/commands/service/get-config-yaml.go b/rocketpool-cli/commands/service/get-config-yaml.go index e02e0f5ef..87136cef5 100644 --- a/rocketpool-cli/commands/service/get-config-yaml.go +++ b/rocketpool-cli/commands/service/get-config-yaml.go @@ -10,7 +10,7 @@ import ( // Generate a YAML file that shows the current configuration schema, including all of the parameters and their descriptions func getConfigYaml(c *cli.Context) error { - cfg := config.NewSmartNodeConfig("", false) + cfg, _ := config.NewSmartNodeConfig("", false, []*config.SmartNodeSettings{}) bytes, err := yaml.Marshal(cfg) if err != nil { return fmt.Errorf("error serializing configuration schema: %w", err) diff --git a/rocketpool-cli/rocketpool-cli.go b/rocketpool-cli/rocketpool-cli.go index dadff1d6b..f30f4fbb4 100644 --- a/rocketpool-cli/rocketpool-cli.go +++ b/rocketpool-cli/rocketpool-cli.go @@ -19,6 +19,7 @@ import ( "github.com/rocket-pool/smartnode/v2/rocketpool-cli/commands/wallet" "github.com/rocket-pool/smartnode/v2/rocketpool-cli/settings" "github.com/rocket-pool/smartnode/v2/rocketpool-cli/utils" + "github.com/rocket-pool/smartnode/v2/shared/config" ) // allowRootFlag is the only one this file deals with- simply so it can exit early. @@ -97,6 +98,14 @@ func newCliApp() *cli.App { // Set utility flags app.Flags = utils.AppendFlags(app.Flags) + // Load the network settings + systemSettings := settings.NewSystemSettings() + networkSettings, err := config.LoadSettingsFiles(systemSettings.NetworksDir) + if err != nil { + fmt.Fprintf(os.Stderr, "Error loading network settings from path [%s]: %s", systemSettings.NetworksDir, err.Error()) + os.Exit(1) + } + // Register commands auction.RegisterCommands(app, "auction", []string{"a"}) minipool.RegisterCommands(app, "minipool", []string{"m"}) @@ -106,7 +115,7 @@ func newCliApp() *cli.App { pdao.RegisterCommands(app, "pdao", []string{"p"}) queue.RegisterCommands(app, "queue", []string{"q"}) security.RegisterCommands(app, "security", []string{"c"}) - service.RegisterCommands(app, "service", []string{"s"}) + service.RegisterCommands(app, "service", []string{"s"}, networkSettings) wallet.RegisterCommands(app, "wallet", []string{"w"}) var snSettings *settings.SmartNodeSettings @@ -119,14 +128,13 @@ func newCliApp() *cli.App { } var err error - snSettings, err = settings.NewSmartNodeSettings(c) + snSettings, err = settings.NewSmartNodeSettings(c, systemSettings, networkSettings) if err != nil { fmt.Fprint(os.Stderr, err.Error()) os.Exit(1) } return nil } - app.After = func(c *cli.Context) error { // Close http tracer if any was created snSettings = settings.GetSmartNodeSettings(c) diff --git a/rocketpool-cli/rocketpool-cli_test.go b/rocketpool-cli/rocketpool-cli_test.go index 52c9a7a0f..cadc7bad6 100644 --- a/rocketpool-cli/rocketpool-cli_test.go +++ b/rocketpool-cli/rocketpool-cli_test.go @@ -4,11 +4,13 @@ import ( "bytes" "errors" "fmt" + "io" "os" "path/filepath" "strings" "testing" + "github.com/prysmaticlabs/prysm/v5/testing/require" "github.com/rocket-pool/smartnode/v2/rocketpool-cli/settings" "github.com/urfave/cli/v2" ) @@ -34,6 +36,42 @@ func TestGlobalFlagsDefaults(t *testing.T) { "--help", ) + // Make a system path + systemPath := filepath.Join(tempPath, "rocketpool") + err := os.MkdirAll(systemPath, 0755) + require.NoError(t, err) + + // Emulating a (partial) installation by deploying a networks folder + // Other installation files can be copied here later if necessary + networkSettingsPath := filepath.Join(systemPath, "networks") + err = os.MkdirAll(networkSettingsPath, 0755) + require.NoError(t, err) + + // Copy the settings files + networksSource := filepath.Join("..", "install", "deploy", "networks") + entries, err := os.ReadDir(networksSource) + require.NoError(t, err) + for _, file := range entries { + fileName := file.Name() + + sourceFile, err := os.Open(filepath.Join(networksSource, fileName)) + require.NoError(t, err) + defer sourceFile.Close() + + targetFile, err := os.Create(filepath.Join(networkSettingsPath, fileName)) + require.NoError(t, err) + defer targetFile.Close() + + _, err = io.Copy(targetFile, sourceFile) + require.NoError(t, err) + err = targetFile.Sync() + require.NoError(t, err) + } + + // Set the install dir env var + err = os.Setenv(settings.TestSystemDirEnvVar, systemPath) + require.NoError(t, err) + app := newCliApp() // Capture stdout diff --git a/rocketpool-cli/settings/smartnode_settings.go b/rocketpool-cli/settings/smartnode_settings.go index 664c93895..0f24fc818 100644 --- a/rocketpool-cli/settings/smartnode_settings.go +++ b/rocketpool-cli/settings/smartnode_settings.go @@ -73,6 +73,8 @@ const ( // Context for global settings type SmartNodeSettings struct { + *SystemSettings + // The path to the configuration file ConfigPath string @@ -99,6 +101,9 @@ type SmartNodeSettings struct { // The HTTP trace file if tracing is enabled HttpTraceFile *os.File + + // The list of networks options and corresponding settings + NetworkSettings []*config.SmartNodeSettings } // Get the Smart Node settings from a CLI context @@ -123,13 +128,15 @@ func AppendSmartNodeSettingsFlags(flags []cli.Flag) []cli.Flag { ) } -// Validate the global flags -func NewSmartNodeSettings(c *cli.Context) (*SmartNodeSettings, error) { +// Creates a new Smart Node settings instance +func NewSmartNodeSettings(c *cli.Context, systemSettings *SystemSettings, networkSettings []*config.SmartNodeSettings) (*SmartNodeSettings, error) { snSettings := &SmartNodeSettings{ - MaxFee: c.Float64(maxFeeFlag.Name), - MaxPriorityFee: c.Float64(maxPriorityFeeFlag.Name), - DebugEnabled: c.Bool(debugFlag.Name), - SecureSession: c.Bool(secureSessionFlag.Name), + SystemSettings: systemSettings, + MaxFee: c.Float64(maxFeeFlag.Name), + MaxPriorityFee: c.Float64(maxPriorityFeeFlag.Name), + DebugEnabled: c.Bool(debugFlag.Name), + SecureSession: c.Bool(secureSessionFlag.Name), + NetworkSettings: networkSettings, } // If set, validate custom nonce @@ -171,7 +178,6 @@ func NewSmartNodeSettings(c *cli.Context) (*SmartNodeSettings, error) { } c.App.Metadata[contextMetadataName] = snSettings - return snSettings, nil } diff --git a/rocketpool-cli/settings/system_settings.go b/rocketpool-cli/settings/system_settings.go new file mode 100644 index 000000000..c236402cf --- /dev/null +++ b/rocketpool-cli/settings/system_settings.go @@ -0,0 +1,55 @@ +package settings + +import ( + "os" + "path/filepath" + "runtime" +) + +const ( + // Environment variable to set the system path for unit tests + TestSystemDirEnvVar string = "SMARTNODE_TEST_SYSTEM_DIR" + + // System dir path for Linux + linuxSystemDir string = "/usr/share/rocketpool" + + // Subfolders under the system dir + scriptsDir string = "scripts" + templatesDir string = "templates" + overrideSourceDir string = "override" + networksDir string = "networks" +) + +// Holds the location of various Smart Node system directories +type SystemSettings struct { + // The system path for Smart Node scripts used in the Docker containers + ScriptsDir string + + // The system path for Smart Node templates + TemplatesDir string + + // The system path for the source files to put in the user's override directory + OverrideSourceDir string + + // The system path for built-in network settings and resource definitions + NetworksDir string +} + +func NewSystemSettings() *SystemSettings { + systemDir := os.Getenv(TestSystemDirEnvVar) + if systemDir == "" { + switch runtime.GOOS { + // This is where to add different paths for different OS's like macOS + default: + // By default just use the Linux path + systemDir = linuxSystemDir + } + } + + return &SystemSettings{ + ScriptsDir: filepath.Join(systemDir, scriptsDir), + TemplatesDir: filepath.Join(systemDir, templatesDir), + OverrideSourceDir: filepath.Join(systemDir, overrideSourceDir), + NetworksDir: filepath.Join(systemDir, networksDir), + } +} diff --git a/rocketpool-cli/utils/utils.go b/rocketpool-cli/utils/utils.go index 55b450c60..afb3120f5 100644 --- a/rocketpool-cli/utils/utils.go +++ b/rocketpool-cli/utils/utils.go @@ -92,17 +92,21 @@ func printTransactionHashImpl(rp *client.Client, hash common.Hash, finalMessage func getTxWatchUrl(rp *client.Client) string { cfg, isNew, err := rp.LoadConfig() if err != nil { - fmt.Printf("Warning: couldn't read config file so the transaction URL will be unavailable (%s).\n", err) + fmt.Printf("Warning: couldn't read config file so the transaction URL will be unavailable (%s).\n", err.Error()) return "" } if isNew { - fmt.Print("Settings file not found. Please run `rocketpool service config` to set up your Smartnode.") + fmt.Print("Settings file not found. Please run `rocketpool service config` to set up your Smart Node.") return "" } - rs := cfg.GetNetworkResources() - return rs.TxWatchUrl + res, err := cfg.GetResources() + if err != nil { + fmt.Printf("Warning: couldn't read resources from config file so the transaction URL will be unavailable (%s).\n", err.Error()) + return "" + } + return res.TxWatchUrl } // Convert a Unix datetime to a string, or `---` if it's zero diff --git a/rocketpool-daemon/api/auction/bid-lot.go b/rocketpool-daemon/api/auction/bid-lot.go index a76d230a9..bacf6f8ef 100644 --- a/rocketpool-daemon/api/auction/bid-lot.go +++ b/rocketpool-daemon/api/auction/bid-lot.go @@ -41,7 +41,7 @@ func (f *auctionBidContextFactory) Create(args url.Values) (*auctionBidContext, func (f *auctionBidContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*auctionBidContext, api.AuctionBidOnLotData]( - router, "lots/bid", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "lots/bid", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/auction/claim-lot.go b/rocketpool-daemon/api/auction/claim-lot.go index 674f79b0a..4bb241f55 100644 --- a/rocketpool-daemon/api/auction/claim-lot.go +++ b/rocketpool-daemon/api/auction/claim-lot.go @@ -44,7 +44,7 @@ func (f *auctionClaimContextFactory) Create(args url.Values) (*auctionClaimConte func (f *auctionClaimContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*auctionClaimContext, types.DataBatch[api.AuctionClaimFromLotData]]( - router, "lots/claim", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "lots/claim", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/auction/create-lot.go b/rocketpool-daemon/api/auction/create-lot.go index 084dc8a6d..0418d50bd 100644 --- a/rocketpool-daemon/api/auction/create-lot.go +++ b/rocketpool-daemon/api/auction/create-lot.go @@ -36,7 +36,7 @@ func (f *auctionCreateContextFactory) Create(args url.Values) (*auctionCreateCon func (f *auctionCreateContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*auctionCreateContext, api.AuctionCreateLotData]( - router, "lots/create", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "lots/create", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/auction/handler.go b/rocketpool-daemon/api/auction/handler.go index 97d2d24bc..3784b9a5c 100644 --- a/rocketpool-daemon/api/auction/handler.go +++ b/rocketpool-daemon/api/auction/handler.go @@ -13,11 +13,11 @@ import ( type AuctionHandler struct { logger *log.Logger ctx context.Context - serviceProvider *services.ServiceProvider + serviceProvider services.ISmartNodeServiceProvider factories []server.IContextFactory } -func NewAuctionHandler(logger *log.Logger, ctx context.Context, serviceProvider *services.ServiceProvider) *AuctionHandler { +func NewAuctionHandler(logger *log.Logger, ctx context.Context, serviceProvider services.ISmartNodeServiceProvider) *AuctionHandler { h := &AuctionHandler{ logger: logger, ctx: ctx, diff --git a/rocketpool-daemon/api/auction/lots.go b/rocketpool-daemon/api/auction/lots.go index 37717d9a2..1462e7b88 100644 --- a/rocketpool-daemon/api/auction/lots.go +++ b/rocketpool-daemon/api/auction/lots.go @@ -34,7 +34,7 @@ func (f *auctionLotContextFactory) Create(args url.Values) (*auctionLotContext, func (f *auctionLotContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*auctionLotContext, api.AuctionLotsData]( - router, "lots", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "lots", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/auction/recover-lot.go b/rocketpool-daemon/api/auction/recover-lot.go index d81c48c6c..a764b0457 100644 --- a/rocketpool-daemon/api/auction/recover-lot.go +++ b/rocketpool-daemon/api/auction/recover-lot.go @@ -43,7 +43,7 @@ func (f *auctionRecoverContextFactory) Create(args url.Values) (*auctionRecoverC func (f *auctionRecoverContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*auctionRecoverContext, types.DataBatch[api.AuctionRecoverRplFromLotData]]( - router, "lots/recover", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "lots/recover", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/auction/status.go b/rocketpool-daemon/api/auction/status.go index 07850cce8..bf54ee72e 100644 --- a/rocketpool-daemon/api/auction/status.go +++ b/rocketpool-daemon/api/auction/status.go @@ -37,7 +37,7 @@ func (f *auctionStatusContextFactory) Create(args url.Values) (*auctionStatusCon func (f *auctionStatusContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*auctionStatusContext, api.AuctionStatusData]( - router, "status", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "status", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/minipool/begin-reduce-bond.go b/rocketpool-daemon/api/minipool/begin-reduce-bond.go index c91511b49..21580a4ce 100644 --- a/rocketpool-daemon/api/minipool/begin-reduce-bond.go +++ b/rocketpool-daemon/api/minipool/begin-reduce-bond.go @@ -37,7 +37,7 @@ func (f *minipoolBeginReduceBondContextFactory) Create(args url.Values) (*minipo func (f *minipoolBeginReduceBondContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*minipoolBeginReduceBondContext, types.BatchTxInfoData]( - router, "begin-reduce-bond", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "begin-reduce-bond", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/minipool/can-change-withdrawal-creds.go b/rocketpool-daemon/api/minipool/can-change-withdrawal-creds.go index 374ad64e6..84d7ca416 100644 --- a/rocketpool-daemon/api/minipool/can-change-withdrawal-creds.go +++ b/rocketpool-daemon/api/minipool/can-change-withdrawal-creds.go @@ -46,7 +46,7 @@ func (f *minipoolCanChangeCredsContextFactory) Create(args url.Values) (*minipoo func (f *minipoolCanChangeCredsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*minipoolCanChangeCredsContext, api.MinipoolCanChangeWithdrawalCredentialsData]( - router, "change-withdrawal-creds/verify", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "change-withdrawal-creds/verify", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/minipool/change-withdrawal-creds.go b/rocketpool-daemon/api/minipool/change-withdrawal-creds.go index 62eab80d6..1dd8206b9 100644 --- a/rocketpool-daemon/api/minipool/change-withdrawal-creds.go +++ b/rocketpool-daemon/api/minipool/change-withdrawal-creds.go @@ -43,7 +43,7 @@ func (f *minipoolChangeCredsContextFactory) Create(args url.Values) (*minipoolCh func (f *minipoolChangeCredsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*minipoolChangeCredsContext, types.SuccessData]( - router, "change-withdrawal-creds", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "change-withdrawal-creds", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/minipool/close-details.go b/rocketpool-daemon/api/minipool/close-details.go index c6b519020..50fbcf9a4 100644 --- a/rocketpool-daemon/api/minipool/close-details.go +++ b/rocketpool-daemon/api/minipool/close-details.go @@ -1,7 +1,9 @@ package minipool import ( + "context" "fmt" + "log/slog" "math/big" "net/url" @@ -15,6 +17,7 @@ import ( "github.com/rocket-pool/rocketpool-go/v2/node" "github.com/rocket-pool/rocketpool-go/v2/rocketpool" rptypes "github.com/rocket-pool/rocketpool-go/v2/types" + "github.com/rocket-pool/smartnode/v2/rocketpool-daemon/common/services" "github.com/rocket-pool/smartnode/v2/shared/types/api" ) @@ -26,15 +29,17 @@ type minipoolCloseDetailsContextFactory struct { handler *MinipoolHandler } -func (f *minipoolCloseDetailsContextFactory) Create(args url.Values) (*minipoolCloseDetailsContext, error) { - c := &minipoolCloseDetailsContext{ - handler: f.handler, +func (f *minipoolCloseDetailsContextFactory) Create(args url.Values) (*MinipoolCloseDetailsContext, error) { + c := &MinipoolCloseDetailsContext{ + ServiceProvider: f.handler.serviceProvider, + Logger: f.handler.logger.Logger, + Context: f.handler.ctx, } return c, nil } func (f *minipoolCloseDetailsContextFactory) RegisterRoute(router *mux.Router) { - RegisterMinipoolRoute[*minipoolCloseDetailsContext, api.MinipoolCloseDetailsData]( + RegisterMinipoolRoute[*MinipoolCloseDetailsContext, api.MinipoolCloseDetailsData]( router, "close/details", f, f.handler.ctx, f.handler.logger, f.handler.serviceProvider, ) } @@ -43,29 +48,34 @@ func (f *minipoolCloseDetailsContextFactory) RegisterRoute(router *mux.Router) { // === Context === // =============== -type minipoolCloseDetailsContext struct { - handler *MinipoolHandler - rp *rocketpool.RocketPool - bc beacon.IBeaconClient +type MinipoolCloseDetailsContext struct { + // Dependencies + ServiceProvider services.ISmartNodeServiceProvider + Logger *slog.Logger + Context context.Context + + // Services + rp *rocketpool.RocketPool + bc beacon.IBeaconClient } -func (c *minipoolCloseDetailsContext) Initialize() (types.ResponseStatus, error) { - sp := c.handler.serviceProvider +func (c *MinipoolCloseDetailsContext) Initialize() (types.ResponseStatus, error) { + sp := c.ServiceProvider c.rp = sp.GetRocketPool() c.bc = sp.GetBeaconClient() return types.ResponseStatus_Success, nil } -func (c *minipoolCloseDetailsContext) GetState(node *node.Node, mc *batch.MultiCaller) { +func (c *MinipoolCloseDetailsContext) GetState(node *node.Node, mc *batch.MultiCaller) { node.IsFeeDistributorInitialized.AddToQuery(mc) } -func (c *minipoolCloseDetailsContext) CheckState(node *node.Node, response *api.MinipoolCloseDetailsData) bool { - response.IsFeeDistributorInitialized = node.IsFeeDistributorInitialized.Get() - return response.IsFeeDistributorInitialized +func (c *MinipoolCloseDetailsContext) CheckState(node *node.Node, data *api.MinipoolCloseDetailsData) bool { + data.IsFeeDistributorInitialized = node.IsFeeDistributorInitialized.Get() + return data.IsFeeDistributorInitialized } -func (c *minipoolCloseDetailsContext) GetMinipoolDetails(mc *batch.MultiCaller, mp minipool.IMinipool, index int) { +func (c *MinipoolCloseDetailsContext) GetMinipoolDetails(mc *batch.MultiCaller, mp minipool.IMinipool, index int) { mpCommon := mp.Common() eth.AddQueryablesToMulticall(mc, mpCommon.NodeAddress, @@ -81,8 +91,9 @@ func (c *minipoolCloseDetailsContext) GetMinipoolDetails(mc *batch.MultiCaller, } } -func (c *minipoolCloseDetailsContext) PrepareData(addresses []common.Address, mps []minipool.IMinipool, data *api.MinipoolCloseDetailsData) (types.ResponseStatus, error) { - ctx := c.handler.ctx +func (c *MinipoolCloseDetailsContext) PrepareData(addresses []common.Address, mps []minipool.IMinipool, data *api.MinipoolCloseDetailsData) (types.ResponseStatus, error) { + ctx := c.Context + // Get the current ETH balances of each minipool balances, err := c.rp.BalanceBatcher.GetEthBalances(addresses, nil) if err != nil { diff --git a/rocketpool-daemon/api/minipool/dissolve.go b/rocketpool-daemon/api/minipool/dissolve.go index 0c6c563d0..135bb1ef5 100644 --- a/rocketpool-daemon/api/minipool/dissolve.go +++ b/rocketpool-daemon/api/minipool/dissolve.go @@ -34,7 +34,7 @@ func (f *minipoolDissolveContextFactory) Create(args url.Values) (*minipoolDisso func (f *minipoolDissolveContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*minipoolDissolveContext, types.BatchTxInfoData]( - router, "dissolve", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "dissolve", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/minipool/distribute.go b/rocketpool-daemon/api/minipool/distribute.go index 5d57a8a84..da4d9ff28 100644 --- a/rocketpool-daemon/api/minipool/distribute.go +++ b/rocketpool-daemon/api/minipool/distribute.go @@ -35,7 +35,7 @@ func (f *minipoolDistributeContextFactory) Create(args url.Values) (*minipoolDis func (f *minipoolDistributeContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*minipoolDistributeContext, types.BatchTxInfoData]( - router, "distribute", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "distribute", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/minipool/exit.go b/rocketpool-daemon/api/minipool/exit.go index beae44c42..d48ca7118 100644 --- a/rocketpool-daemon/api/minipool/exit.go +++ b/rocketpool-daemon/api/minipool/exit.go @@ -43,7 +43,7 @@ func (f *minipoolExitContextFactory) Create(args url.Values) (*minipoolExitConte func (f *minipoolExitContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*minipoolExitContext, types.SuccessData]( - router, "exit", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "exit", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/minipool/handler.go b/rocketpool-daemon/api/minipool/handler.go index 42a94f18e..bedc0fe8c 100644 --- a/rocketpool-daemon/api/minipool/handler.go +++ b/rocketpool-daemon/api/minipool/handler.go @@ -13,11 +13,11 @@ import ( type MinipoolHandler struct { logger *log.Logger ctx context.Context - serviceProvider *services.ServiceProvider + serviceProvider services.ISmartNodeServiceProvider factories []server.IContextFactory } -func NewMinipoolHandler(logger *log.Logger, ctx context.Context, serviceProvider *services.ServiceProvider) *MinipoolHandler { +func NewMinipoolHandler(logger *log.Logger, ctx context.Context, serviceProvider services.ISmartNodeServiceProvider) *MinipoolHandler { h := &MinipoolHandler{ logger: logger, ctx: ctx, diff --git a/rocketpool-daemon/api/minipool/import-key.go b/rocketpool-daemon/api/minipool/import-key.go index 6b43db339..4d930deff 100644 --- a/rocketpool-daemon/api/minipool/import-key.go +++ b/rocketpool-daemon/api/minipool/import-key.go @@ -45,7 +45,7 @@ func (f *minipoolImportKeyContextFactory) Create(args url.Values) (*minipoolImpo func (f *minipoolImportKeyContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*minipoolImportKeyContext, types.SuccessData]( - router, "import-key", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "import-key", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/minipool/minipool-context.go b/rocketpool-daemon/api/minipool/minipool-context.go index 6613ffcc8..f303055df 100644 --- a/rocketpool-daemon/api/minipool/minipool-context.go +++ b/rocketpool-daemon/api/minipool/minipool-context.go @@ -58,7 +58,7 @@ func RegisterMinipoolRoute[ContextType IMinipoolCallContext[DataType], DataType factory IMinipoolCallContextFactory[ContextType, DataType], ctx context.Context, logger *log.Logger, - serviceProvider *services.ServiceProvider, + serviceProvider services.ISmartNodeServiceProvider, ) { router.HandleFunc(fmt.Sprintf("/%s", functionName), func(w http.ResponseWriter, r *http.Request) { var err error @@ -97,7 +97,7 @@ func RegisterMinipoolRoute[ContextType IMinipoolCallContext[DataType], DataType } // Create a scaffolded generic minipool query, with caller-specific functionality where applicable -func runMinipoolRoute[DataType any](ctx context.Context, mpContext IMinipoolCallContext[DataType], serviceProvider *services.ServiceProvider) (types.ResponseStatus, *types.ApiResponse[DataType], error) { +func runMinipoolRoute[DataType any](ctx context.Context, mpContext IMinipoolCallContext[DataType], serviceProvider services.ISmartNodeServiceProvider) (types.ResponseStatus, *types.ApiResponse[DataType], error) { // Get the services w := serviceProvider.GetWallet() q := serviceProvider.GetQueryManager() diff --git a/rocketpool-daemon/api/minipool/promote.go b/rocketpool-daemon/api/minipool/promote.go index e615bd414..59b16db9e 100644 --- a/rocketpool-daemon/api/minipool/promote.go +++ b/rocketpool-daemon/api/minipool/promote.go @@ -35,7 +35,7 @@ func (f *minipoolPromoteContextFactory) Create(args url.Values) (*minipoolPromot func (f *minipoolPromoteContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*minipoolPromoteContext, types.BatchTxInfoData]( - router, "promote", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "promote", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/minipool/reduce-bond.go b/rocketpool-daemon/api/minipool/reduce-bond.go index 9a3ea7f0b..2dd79fab6 100644 --- a/rocketpool-daemon/api/minipool/reduce-bond.go +++ b/rocketpool-daemon/api/minipool/reduce-bond.go @@ -35,7 +35,7 @@ func (f *minipoolReduceBondContextFactory) Create(args url.Values) (*minipoolRed func (f *minipoolReduceBondContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*minipoolReduceBondContext, types.BatchTxInfoData]( - router, "reduce-bond", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "reduce-bond", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/minipool/refund.go b/rocketpool-daemon/api/minipool/refund.go index 6cc7d4682..9465e652c 100644 --- a/rocketpool-daemon/api/minipool/refund.go +++ b/rocketpool-daemon/api/minipool/refund.go @@ -34,7 +34,7 @@ func (f *minipoolRefundContextFactory) Create(args url.Values) (*minipoolRefundC func (f *minipoolRefundContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*minipoolRefundContext, types.BatchTxInfoData]( - router, "refund", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "refund", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/minipool/rescue-dissolved.go b/rocketpool-daemon/api/minipool/rescue-dissolved.go index 087b47b47..4fd90e9ae 100644 --- a/rocketpool-daemon/api/minipool/rescue-dissolved.go +++ b/rocketpool-daemon/api/minipool/rescue-dissolved.go @@ -12,7 +12,6 @@ import ( "github.com/rocket-pool/node-manager-core/api/server" "github.com/rocket-pool/node-manager-core/api/types" beacon "github.com/rocket-pool/node-manager-core/beacon" - "github.com/rocket-pool/node-manager-core/config" "github.com/rocket-pool/node-manager-core/eth" nmc_validator "github.com/rocket-pool/node-manager-core/node/validator" "github.com/rocket-pool/node-manager-core/node/wallet" @@ -21,6 +20,7 @@ import ( "github.com/rocket-pool/rocketpool-go/v2/minipool" "github.com/rocket-pool/rocketpool-go/v2/rocketpool" "github.com/rocket-pool/smartnode/v2/rocketpool-daemon/common/validator" + "github.com/rocket-pool/smartnode/v2/shared/config" ) // =============== @@ -44,7 +44,7 @@ func (f *minipoolRescueDissolvedContextFactory) Create(args url.Values) (*minipo func (f *minipoolRescueDissolvedContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*minipoolRescueDissolvedContext, types.BatchTxInfoData]( - router, "rescue-dissolved", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "rescue-dissolved", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -60,7 +60,7 @@ type minipoolRescueDissolvedContext struct { w *wallet.Wallet vMgr *validator.ValidatorManager bc beacon.IBeaconClient - rs *config.NetworkResources + res *config.MergedResources mpMgr *minipool.MinipoolManager } @@ -76,7 +76,7 @@ func (c *minipoolRescueDissolvedContext) PrepareData(data *types.BatchTxInfoData c.vMgr = sp.GetValidatorManager() c.w = sp.GetWallet() c.bc = sp.GetBeaconClient() - c.rs = sp.GetNetworkResources() + c.res = sp.GetResources() // Requirements status, err := sp.RequireNodeRegistered(c.handler.ctx) @@ -140,7 +140,7 @@ func (c *minipoolRescueDissolvedContext) getDepositTx(minipoolAddress common.Add // Get validator deposit data amountGwei := big.NewInt(0).Div(amount, big.NewInt(1e9)).Uint64() - depositData, err := nmc_validator.GetDepositData(validatorKey, withdrawalCredentials, c.rs.GenesisForkVersion, amountGwei, c.rs.EthNetworkName) + depositData, err := nmc_validator.GetDepositData(c.handler.logger.Logger, validatorKey, withdrawalCredentials, c.res.GenesisForkVersion, amountGwei, c.res.EthNetworkName) if err != nil { return nil, err } diff --git a/rocketpool-daemon/api/minipool/rollback-delegates.go b/rocketpool-daemon/api/minipool/rollback-delegates.go index 5599ced74..374d9168a 100644 --- a/rocketpool-daemon/api/minipool/rollback-delegates.go +++ b/rocketpool-daemon/api/minipool/rollback-delegates.go @@ -34,7 +34,7 @@ func (f *minipoolRollbackDelegatesContextFactory) Create(args url.Values) (*mini func (f *minipoolRollbackDelegatesContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*minipoolRollbackDelegatesContext, types.BatchTxInfoData]( - router, "delegate/rollback", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "delegate/rollback", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/minipool/set-use-latest-delegates.go b/rocketpool-daemon/api/minipool/set-use-latest-delegates.go index ad01e9a48..3a2ddce6f 100644 --- a/rocketpool-daemon/api/minipool/set-use-latest-delegates.go +++ b/rocketpool-daemon/api/minipool/set-use-latest-delegates.go @@ -35,7 +35,7 @@ func (f *minipoolSetUseLatestDelegatesContextFactory) Create(args url.Values) (* func (f *minipoolSetUseLatestDelegatesContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*minipoolSetUseLatestDelegatesContext, types.BatchTxInfoData]( - router, "delegate/set-use-latest", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "delegate/set-use-latest", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/minipool/stake.go b/rocketpool-daemon/api/minipool/stake.go index bdb4a92bc..47e860a5a 100644 --- a/rocketpool-daemon/api/minipool/stake.go +++ b/rocketpool-daemon/api/minipool/stake.go @@ -39,7 +39,7 @@ func (f *minipoolStakeContextFactory) Create(args url.Values) (*minipoolStakeCon func (f *minipoolStakeContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*minipoolStakeContext, types.BatchTxInfoData]( - router, "stake", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "stake", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -56,7 +56,7 @@ func (c *minipoolStakeContext) PrepareData(data *types.BatchTxInfoData, opts *bi sp := c.handler.serviceProvider rp := sp.GetRocketPool() vMgr := sp.GetValidatorManager() - rs := sp.GetNetworkResources() + rs := sp.GetResources() // Requirements status, err := sp.RequireNodeRegistered(c.handler.ctx) @@ -116,7 +116,7 @@ func (c *minipoolStakeContext) PrepareData(data *types.BatchTxInfoData, opts *bi } // Get validator deposit data - depositData, err := nmc_validator.GetDepositData(validatorKey, withdrawalCredentials, rs.GenesisForkVersion, depositAmount, rs.EthNetworkName) + depositData, err := nmc_validator.GetDepositData(c.handler.logger.Logger, validatorKey, withdrawalCredentials, rs.GenesisForkVersion, depositAmount, rs.EthNetworkName) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error getting deposit data for validator %s: %w", pubkey.Hex(), err) } diff --git a/rocketpool-daemon/api/minipool/status.go b/rocketpool-daemon/api/minipool/status.go index 1f799dc1b..02105da64 100644 --- a/rocketpool-daemon/api/minipool/status.go +++ b/rocketpool-daemon/api/minipool/status.go @@ -1,7 +1,9 @@ package minipool import ( + "context" "fmt" + "log/slog" "math/big" "net/url" "time" @@ -14,7 +16,6 @@ import ( batch "github.com/rocket-pool/batch-query" "github.com/rocket-pool/node-manager-core/api/types" "github.com/rocket-pool/node-manager-core/beacon" - rpbeacon "github.com/rocket-pool/node-manager-core/beacon" "github.com/rocket-pool/node-manager-core/eth" "github.com/rocket-pool/rocketpool-go/v2/core" "github.com/rocket-pool/rocketpool-go/v2/dao/oracle" @@ -24,6 +25,7 @@ import ( "github.com/rocket-pool/rocketpool-go/v2/rocketpool" "github.com/rocket-pool/rocketpool-go/v2/tokens" rptypes "github.com/rocket-pool/rocketpool-go/v2/types" + "github.com/rocket-pool/smartnode/v2/rocketpool-daemon/common/services" "github.com/rocket-pool/smartnode/v2/shared/types/api" ) @@ -35,15 +37,17 @@ type minipoolStatusContextFactory struct { handler *MinipoolHandler } -func (f *minipoolStatusContextFactory) Create(args url.Values) (*minipoolStatusContext, error) { - c := &minipoolStatusContext{ - handler: f.handler, +func (f *minipoolStatusContextFactory) Create(args url.Values) (*MinipoolStatusContext, error) { + c := &MinipoolStatusContext{ + ServiceProvider: f.handler.serviceProvider, + Logger: f.handler.logger.Logger, + Context: f.handler.ctx, } return c, nil } func (f *minipoolStatusContextFactory) RegisterRoute(router *mux.Router) { - RegisterMinipoolRoute[*minipoolStatusContext, api.MinipoolStatusData]( + RegisterMinipoolRoute[*MinipoolStatusContext, api.MinipoolStatusData]( router, "status", f, f.handler.ctx, f.handler.logger, f.handler.serviceProvider, ) } @@ -52,29 +56,35 @@ func (f *minipoolStatusContextFactory) RegisterRoute(router *mux.Router) { // === Context === // =============== -type minipoolStatusContext struct { - handler *MinipoolHandler - rp *rocketpool.RocketPool - bc beacon.IBeaconClient - - delegate *core.Contract - pSettings *protocol.ProtocolDaoSettings - oSettings *oracle.OracleDaoSettings - reth *tokens.TokenReth - rpl *tokens.TokenRpl - fsrpl *tokens.TokenRplFixedSupply +type MinipoolStatusContext struct { + // Dependencies + ServiceProvider services.ISmartNodeServiceProvider + Logger *slog.Logger + Context context.Context + + // Services + rp *rocketpool.RocketPool + bc beacon.IBeaconClient + delegate *core.Contract + pSettings *protocol.ProtocolDaoSettings + oSettings *oracle.OracleDaoSettings + reth *tokens.TokenReth + rpl *tokens.TokenRpl + fsrpl *tokens.TokenRplFixedSupply + + // On-chain data rethBalances []*big.Int rplBalances []*big.Int fsrplBalances []*big.Int } -func (c *minipoolStatusContext) Initialize() (types.ResponseStatus, error) { - sp := c.handler.serviceProvider +func (c *MinipoolStatusContext) Initialize() (types.ResponseStatus, error) { + sp := c.ServiceProvider c.rp = sp.GetRocketPool() c.bc = sp.GetBeaconClient() // Requirements - err := sp.RequireBeaconClientSynced(c.handler.ctx) + err := sp.RequireBeaconClientSynced(c.Context) if err != nil { return types.ResponseStatus_ClientsNotSynced, err } @@ -109,7 +119,7 @@ func (c *minipoolStatusContext) Initialize() (types.ResponseStatus, error) { return types.ResponseStatus_Success, nil } -func (c *minipoolStatusContext) GetState(node *node.Node, mc *batch.MultiCaller) { +func (c *MinipoolStatusContext) GetState(node *node.Node, mc *batch.MultiCaller) { eth.AddQueryablesToMulticall(mc, c.pSettings.Minipool.LaunchTimeout, c.oSettings.Minipool.ScrubPeriod, @@ -117,7 +127,7 @@ func (c *minipoolStatusContext) GetState(node *node.Node, mc *batch.MultiCaller) ) } -func (c *minipoolStatusContext) CheckState(node *node.Node, response *api.MinipoolStatusData) bool { +func (c *MinipoolStatusContext) CheckState(node *node.Node, response *api.MinipoolStatusData) bool { // Provision the token balance counts minipoolCount := node.MinipoolCount.Formatted() c.rethBalances = make([]*big.Int, minipoolCount) @@ -126,7 +136,7 @@ func (c *minipoolStatusContext) CheckState(node *node.Node, response *api.Minipo return true } -func (c *minipoolStatusContext) GetMinipoolDetails(mc *batch.MultiCaller, mp minipool.IMinipool, index int) { +func (c *MinipoolStatusContext) GetMinipoolDetails(mc *batch.MultiCaller, mp minipool.IMinipool, index int) { address := mp.Common().Address eth.QueryAllFields(mp, mc) c.reth.BalanceOf(mc, &c.rethBalances[index], address) @@ -134,8 +144,8 @@ func (c *minipoolStatusContext) GetMinipoolDetails(mc *batch.MultiCaller, mp min c.fsrpl.BalanceOf(mc, &c.fsrplBalances[index], address) } -func (c *minipoolStatusContext) PrepareData(addresses []common.Address, mps []minipool.IMinipool, data *api.MinipoolStatusData) (types.ResponseStatus, error) { - ctx := c.handler.ctx +func (c *MinipoolStatusContext) PrepareData(addresses []common.Address, mps []minipool.IMinipool, data *api.MinipoolStatusData) (types.ResponseStatus, error) { + ctx := c.Context // Data var wg1 errgroup.Group var eth2Config beacon.Eth2Config @@ -189,7 +199,7 @@ func (c *minipoolStatusContext) PrepareData(addresses []common.Address, mps []mi promotionScrubPeriod := c.oSettings.Minipool.PromotionScrubPeriod.Formatted() // Get the statuses on Beacon - pubkeys := make([]rpbeacon.ValidatorPubkey, 0, len(addresses)) + pubkeys := make([]beacon.ValidatorPubkey, 0, len(addresses)) for _, mp := range mps { mpCommon := mp.Common() status := mpCommon.Status.Formatted() diff --git a/rocketpool-daemon/api/minipool/upgrade-delegates.go b/rocketpool-daemon/api/minipool/upgrade-delegates.go index 2d4c85c30..813666240 100644 --- a/rocketpool-daemon/api/minipool/upgrade-delegates.go +++ b/rocketpool-daemon/api/minipool/upgrade-delegates.go @@ -34,7 +34,7 @@ func (f *minipoolUpgradeDelegatesContextFactory) Create(args url.Values) (*minip func (f *minipoolUpgradeDelegatesContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*minipoolUpgradeDelegatesContext, types.BatchTxInfoData]( - router, "delegate/upgrade", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "delegate/upgrade", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/minipool/utils.go b/rocketpool-daemon/api/minipool/utils.go index 686bd38f8..bdbb3c9bc 100644 --- a/rocketpool-daemon/api/minipool/utils.go +++ b/rocketpool-daemon/api/minipool/utils.go @@ -18,7 +18,7 @@ const ( ) // Get transaction info for an operation on all of the provided minipools, using the common minipool API (for version-agnostic functions) -func prepareMinipoolBatchTxData(ctx context.Context, sp *services.ServiceProvider, minipoolAddresses []common.Address, data *types.BatchTxInfoData, txCreator func(mp minipool.IMinipool, opts *bind.TransactOpts) (types.ResponseStatus, *eth.TransactionInfo, error), txName string) (types.ResponseStatus, error) { +func prepareMinipoolBatchTxData(ctx context.Context, sp services.ISmartNodeServiceProvider, minipoolAddresses []common.Address, data *types.BatchTxInfoData, txCreator func(mp minipool.IMinipool, opts *bind.TransactOpts) (types.ResponseStatus, *eth.TransactionInfo, error), txName string) (types.ResponseStatus, error) { // Requirements status, err := sp.RequireNodeRegistered(ctx) if err != nil { diff --git a/rocketpool-daemon/api/minipool/vanity.go b/rocketpool-daemon/api/minipool/vanity.go index 7640dd793..ebc8e4a7b 100644 --- a/rocketpool-daemon/api/minipool/vanity.go +++ b/rocketpool-daemon/api/minipool/vanity.go @@ -42,7 +42,7 @@ func (f *minipoolVanityContextFactory) Create(args url.Values) (*minipoolVanityC func (f *minipoolVanityContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*minipoolVanityContext, api.MinipoolVanityArtifactsData]( - router, "vanity-artifacts", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "vanity-artifacts", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/network/dao-proposals.go b/rocketpool-daemon/api/network/dao-proposals.go index bf8c394f1..88b47a747 100644 --- a/rocketpool-daemon/api/network/dao-proposals.go +++ b/rocketpool-daemon/api/network/dao-proposals.go @@ -34,7 +34,7 @@ func (f *networkProposalContextFactory) Create(args url.Values) (*networkProposa func (f *networkProposalContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*networkProposalContext, api.NetworkDaoProposalsData]( - router, "dao-proposals", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "dao-proposals", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -50,6 +50,7 @@ func (c *networkProposalContext) PrepareData(data *api.NetworkDaoProposalsData, sp := c.handler.serviceProvider rp := sp.GetRocketPool() cfg := sp.GetConfig() + res := sp.GetResources() nodeAddress, _ := sp.GetWallet().GetAddress() snapshot := sp.GetSnapshotDelegation() @@ -75,7 +76,7 @@ func (c *networkProposalContext) PrepareData(data *api.NetworkDaoProposalsData, } // Get snapshot proposals - snapshotResponse, err := voting.GetSnapshotProposals(cfg, data.AccountAddress, data.VotingDelegate, true) + snapshotResponse, err := voting.GetSnapshotProposals(cfg, res, data.AccountAddress, data.VotingDelegate, true) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error getting snapshot proposals: %w", err) } diff --git a/rocketpool-daemon/api/network/delegate.go b/rocketpool-daemon/api/network/delegate.go index 67c57b4e9..2f66a63a6 100644 --- a/rocketpool-daemon/api/network/delegate.go +++ b/rocketpool-daemon/api/network/delegate.go @@ -29,7 +29,7 @@ func (f *networkDelegateContextFactory) Create(args url.Values) (*networkDelegat func (f *networkDelegateContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*networkDelegateContext, api.NetworkLatestDelegateData]( - router, "latest-delegate", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "latest-delegate", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/network/deposit-contract-info.go b/rocketpool-daemon/api/network/deposit-contract-info.go index ee30a583d..115d57d23 100644 --- a/rocketpool-daemon/api/network/deposit-contract-info.go +++ b/rocketpool-daemon/api/network/deposit-contract-info.go @@ -34,7 +34,7 @@ func (f *networkDepositInfoContextFactory) Create(args url.Values) (*networkDepo func (f *networkDepositInfoContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*networkDepositInfoContext, api.NetworkDepositContractInfoData]( - router, "deposit-contract-info", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "deposit-contract-info", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -51,6 +51,7 @@ func (c *networkDepositInfoContext) PrepareData(data *api.NetworkDepositContract sp := c.handler.serviceProvider rp := sp.GetRocketPool() cfg := sp.GetConfig() + res := sp.GetResources() bc := sp.GetBeaconClient() ctx := c.handler.ctx @@ -70,7 +71,7 @@ func (c *networkDepositInfoContext) PrepareData(data *api.NetworkDepositContract } // Get the deposit contract info - info, err := rputils.GetDepositContractInfo(ctx, rp, cfg, bc) + info, err := rputils.GetDepositContractInfo(ctx, rp, cfg, res, bc) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error getting deposit contract info: %w", err) } diff --git a/rocketpool-daemon/api/network/download-rewards.go b/rocketpool-daemon/api/network/download-rewards.go index 894bd1063..79f948cb0 100644 --- a/rocketpool-daemon/api/network/download-rewards.go +++ b/rocketpool-daemon/api/network/download-rewards.go @@ -33,7 +33,7 @@ func (f *networkDownloadRewardsContextFactory) Create(args url.Values) (*network func (f *networkDownloadRewardsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*networkDownloadRewardsContext, types.SuccessData]( - router, "download-rewards-file", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "download-rewards-file", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -51,6 +51,7 @@ func (c *networkDownloadRewardsContext) PrepareData(data *types.SuccessData, opt sp := c.handler.serviceProvider rp := sp.GetRocketPool() cfg := sp.GetConfig() + res := sp.GetResources() nodeAddress, _ := sp.GetWallet().GetAddress() // Requirements @@ -60,7 +61,7 @@ func (c *networkDownloadRewardsContext) PrepareData(data *types.SuccessData, opt } // Get the event info for the interval - intervalInfo, err := rewards.GetIntervalInfo(rp, cfg, nodeAddress, c.interval, nil) + intervalInfo, err := rewards.GetIntervalInfo(rp, cfg, res, nodeAddress, c.interval, nil) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error getting interval %d info: %w", c.interval, err) } diff --git a/rocketpool-daemon/api/network/generate-rewards.go b/rocketpool-daemon/api/network/generate-rewards.go index 1e718ae3c..8f1543297 100644 --- a/rocketpool-daemon/api/network/generate-rewards.go +++ b/rocketpool-daemon/api/network/generate-rewards.go @@ -33,7 +33,7 @@ func (f *networkGenerateRewardsContextFactory) Create(args url.Values) (*network func (f *networkGenerateRewardsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*networkGenerateRewardsContext, types.SuccessData]( - router, "generate-rewards-tree", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "generate-rewards-tree", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/network/handler.go b/rocketpool-daemon/api/network/handler.go index 2c1a41716..430e08df3 100644 --- a/rocketpool-daemon/api/network/handler.go +++ b/rocketpool-daemon/api/network/handler.go @@ -13,11 +13,11 @@ import ( type NetworkHandler struct { logger *log.Logger ctx context.Context - serviceProvider *services.ServiceProvider + serviceProvider services.ISmartNodeServiceProvider factories []server.IContextFactory } -func NewNetworkHandler(logger *log.Logger, ctx context.Context, serviceProvider *services.ServiceProvider) *NetworkHandler { +func NewNetworkHandler(logger *log.Logger, ctx context.Context, serviceProvider services.ISmartNodeServiceProvider) *NetworkHandler { h := &NetworkHandler{ logger: logger, ctx: ctx, diff --git a/rocketpool-daemon/api/network/node-fee.go b/rocketpool-daemon/api/network/node-fee.go index 4d9e9db00..9818b65db 100644 --- a/rocketpool-daemon/api/network/node-fee.go +++ b/rocketpool-daemon/api/network/node-fee.go @@ -34,7 +34,7 @@ func (f *networkFeeContextFactory) Create(args url.Values) (*networkFeeContext, func (f *networkFeeContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*networkFeeContext, api.NetworkNodeFeeData]( - router, "node-fee", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "node-fee", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/network/rewards-file-info.go b/rocketpool-daemon/api/network/rewards-file-info.go index 37e105c41..d83292f51 100644 --- a/rocketpool-daemon/api/network/rewards-file-info.go +++ b/rocketpool-daemon/api/network/rewards-file-info.go @@ -38,7 +38,7 @@ func (f *networkRewardsFileContextFactory) Create(args url.Values) (*networkRewa func (f *networkRewardsFileContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*networkRewardsFileContext, api.NetworkRewardsFileData]( - router, "rewards-file-info", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "rewards-file-info", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/network/rpl-price.go b/rocketpool-daemon/api/network/rpl-price.go index 5f9a7e0f2..a12300cac 100644 --- a/rocketpool-daemon/api/network/rpl-price.go +++ b/rocketpool-daemon/api/network/rpl-price.go @@ -35,7 +35,7 @@ func (f *networkPriceContextFactory) Create(args url.Values) (*networkPriceConte func (f *networkPriceContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*networkPriceContext, api.NetworkRplPriceData]( - router, "rpl-price", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "rpl-price", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/network/stats.go b/rocketpool-daemon/api/network/stats.go index 9a97f454b..17513cc0f 100644 --- a/rocketpool-daemon/api/network/stats.go +++ b/rocketpool-daemon/api/network/stats.go @@ -40,7 +40,7 @@ func (f *networkStatsContextFactory) Create(args url.Values) (*networkStatsConte func (f *networkStatsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*networkStatsContext, api.NetworkStatsData]( - router, "stats", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "stats", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/network/timezones.go b/rocketpool-daemon/api/network/timezones.go index 1ad858782..a1ace3cbf 100644 --- a/rocketpool-daemon/api/network/timezones.go +++ b/rocketpool-daemon/api/network/timezones.go @@ -33,7 +33,7 @@ func (f *networkTimezoneContextFactory) Create(args url.Values) (*networkTimezon func (f *networkTimezoneContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*networkTimezoneContext, api.NetworkTimezonesData]( - router, "timezone-map", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "timezone-map", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/balance.go b/rocketpool-daemon/api/node/balance.go index b367a7dfb..28225ff9c 100644 --- a/rocketpool-daemon/api/node/balance.go +++ b/rocketpool-daemon/api/node/balance.go @@ -28,7 +28,7 @@ func (f *nodeBalanceContextFactory) Create(args url.Values) (*nodeBalanceContext func (f *nodeBalanceContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*nodeBalanceContext, api.NodeBalanceData]( - router, "balance", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "balance", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/burn.go b/rocketpool-daemon/api/node/burn.go index c42d03cd8..a277a03f2 100644 --- a/rocketpool-daemon/api/node/burn.go +++ b/rocketpool-daemon/api/node/burn.go @@ -40,7 +40,7 @@ func (f *nodeBurnContextFactory) Create(args url.Values) (*nodeBurnContext, erro func (f *nodeBurnContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeBurnContext, api.NodeBurnData]( - router, "burn", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "burn", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/check-collateral.go b/rocketpool-daemon/api/node/check-collateral.go index b5ed3e6c3..3b94f4c34 100644 --- a/rocketpool-daemon/api/node/check-collateral.go +++ b/rocketpool-daemon/api/node/check-collateral.go @@ -30,7 +30,7 @@ func (f *nodeCheckCollateralContextFactory) Create(args url.Values) (*nodeCheckC func (f *nodeCheckCollateralContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*nodeCheckCollateralContext, api.NodeCheckCollateralData]( - router, "check-collateral", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "check-collateral", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/claim-and-stake.go b/rocketpool-daemon/api/node/claim-and-stake.go index 796e5eecf..87b00dcb5 100644 --- a/rocketpool-daemon/api/node/claim-and-stake.go +++ b/rocketpool-daemon/api/node/claim-and-stake.go @@ -43,7 +43,7 @@ func (f *nodeClaimAndStakeContextFactory) Create(args url.Values) (*nodeClaimAnd func (f *nodeClaimAndStakeContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*nodeClaimAndStakeContext, types.TxInfoData]( - router, "claim-and-stake", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "claim-and-stake", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -62,6 +62,7 @@ func (c *nodeClaimAndStakeContext) PrepareData(data *types.TxInfoData, opts *bin sp := c.handler.serviceProvider rp := sp.GetRocketPool() cfg := sp.GetConfig() + res := sp.GetResources() nodeAddress, _ := sp.GetWallet().GetAddress() // Requirements @@ -83,7 +84,7 @@ func (c *nodeClaimAndStakeContext) PrepareData(data *types.TxInfoData, opts *bin // Populate the interval info for each one for _, index := range c.indices { - intervalInfo, err := rprewards.GetIntervalInfo(rp, cfg, nodeAddress, index.Uint64(), nil) + intervalInfo, err := rprewards.GetIntervalInfo(rp, cfg, res, nodeAddress, index.Uint64(), nil) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error getting interval info for interval %d: %w", index, err) } diff --git a/rocketpool-daemon/api/node/clear-snapshot-delegate.go b/rocketpool-daemon/api/node/clear-snapshot-delegate.go index e7373ab23..6f8100c48 100644 --- a/rocketpool-daemon/api/node/clear-snapshot-delegate.go +++ b/rocketpool-daemon/api/node/clear-snapshot-delegate.go @@ -28,7 +28,7 @@ func (f *nodeClearSnapshotDelegateContextFactory) Create(args url.Values) (*node func (f *nodeClearSnapshotDelegateContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*nodeClearSnapshotDelegateContext, types.TxInfoData]( - router, "snapshot-delegate/clear", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "snapshot-delegate/clear", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/confirm-primary-withdrawal-address.go b/rocketpool-daemon/api/node/confirm-primary-withdrawal-address.go index 3ed1119d6..d9ced83ea 100644 --- a/rocketpool-daemon/api/node/confirm-primary-withdrawal-address.go +++ b/rocketpool-daemon/api/node/confirm-primary-withdrawal-address.go @@ -32,7 +32,7 @@ func (f *nodeConfirmPrimaryWithdrawalAddressContextFactory) Create(args url.Valu func (f *nodeConfirmPrimaryWithdrawalAddressContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeConfirmPrimaryWithdrawalAddressContext, api.NodeConfirmPrimaryWithdrawalAddressData]( - router, "primary-withdrawal-address/confirm", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "primary-withdrawal-address/confirm", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/confirm-rpl-withdrawal-address.go b/rocketpool-daemon/api/node/confirm-rpl-withdrawal-address.go index 2e21bff54..08135dc23 100644 --- a/rocketpool-daemon/api/node/confirm-rpl-withdrawal-address.go +++ b/rocketpool-daemon/api/node/confirm-rpl-withdrawal-address.go @@ -32,7 +32,7 @@ func (f *nodeConfirmRplWithdrawalAddressContextFactory) Create(args url.Values) func (f *nodeConfirmRplWithdrawalAddressContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeConfirmRplWithdrawalAddressContext, api.NodeConfirmRplWithdrawalAddressData]( - router, "rpl-withdrawal-address/confirm", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "rpl-withdrawal-address/confirm", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/create-vacant-minipool.go b/rocketpool-daemon/api/node/create-vacant-minipool.go index 3de0b2d77..f825704e7 100644 --- a/rocketpool-daemon/api/node/create-vacant-minipool.go +++ b/rocketpool-daemon/api/node/create-vacant-minipool.go @@ -49,7 +49,7 @@ func (f *nodeCreateVacantMinipoolContextFactory) Create(args url.Values) (*nodeC func (f *nodeCreateVacantMinipoolContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeCreateVacantMinipoolContext, api.NodeCreateVacantMinipoolData]( - router, "create-vacant-minipool", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "create-vacant-minipool", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -60,6 +60,7 @@ func (f *nodeCreateVacantMinipoolContextFactory) RegisterRoute(router *mux.Route type nodeCreateVacantMinipoolContext struct { handler *NodeHandler cfg *config.SmartNodeConfig + res *config.MergedResources rp *rocketpool.RocketPool bc beacon.IBeaconClient @@ -76,6 +77,7 @@ type nodeCreateVacantMinipoolContext struct { func (c *nodeCreateVacantMinipoolContext) Initialize() (types.ResponseStatus, error) { sp := c.handler.serviceProvider c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.rp = sp.GetRocketPool() c.bc = sp.GetBeaconClient() nodeAddress, _ := sp.GetWallet().GetAddress() @@ -162,7 +164,7 @@ func (c *nodeCreateVacantMinipoolContext) PrepareData(data *api.NodeCreateVacant return types.ResponseStatus_Success, nil } // Make sure the BN is on the correct chain - depositContractInfo, err := rputils.GetDepositContractInfo(ctx, c.rp, c.cfg, c.bc) + depositContractInfo, err := rputils.GetDepositContractInfo(ctx, c.rp, c.cfg, c.res, c.bc) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error verifying the EL and BC are on the same chain: %w", err) } diff --git a/rocketpool-daemon/api/node/deposit.go b/rocketpool-daemon/api/node/deposit.go index dc12d9f03..bac9c28d0 100644 --- a/rocketpool-daemon/api/node/deposit.go +++ b/rocketpool-daemon/api/node/deposit.go @@ -53,7 +53,7 @@ func (f *nodeDepositContextFactory) Create(args url.Values) (*nodeDepositContext func (f *nodeDepositContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeDepositContext, api.NodeDepositData]( - router, "deposit", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "deposit", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -64,6 +64,7 @@ func (f *nodeDepositContextFactory) RegisterRoute(router *mux.Router) { type nodeDepositContext struct { handler *NodeHandler cfg *config.SmartNodeConfig + res *config.MergedResources rp *rocketpool.RocketPool bc beacon.IBeaconClient w *nodewallet.Wallet @@ -82,6 +83,7 @@ type nodeDepositContext struct { func (c *nodeDepositContext) Initialize() (types.ResponseStatus, error) { sp := c.handler.serviceProvider c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.rp = sp.GetRocketPool() c.bc = sp.GetBeaconClient() c.w = sp.GetWallet() @@ -135,7 +137,8 @@ func (c *nodeDepositContext) GetState(mc *batch.MultiCaller) { func (c *nodeDepositContext) PrepareData(data *api.NodeDepositData, opts *bind.TransactOpts) (types.ResponseStatus, error) { ctx := c.handler.ctx - rs := c.cfg.GetNetworkResources() + sp := c.handler.serviceProvider + rs := sp.GetResources() // Initial population data.CreditBalance = c.node.UsableCreditAndDonatedBalance.Get() @@ -196,7 +199,7 @@ func (c *nodeDepositContext) PrepareData(data *api.NodeDepositData, opts *bind.T } // Make sure ETH2 is on the correct chain - depositContractInfo, err := rputils.GetDepositContractInfo(ctx, c.rp, c.cfg, c.bc) + depositContractInfo, err := rputils.GetDepositContractInfo(ctx, c.rp, c.cfg, c.res, c.bc) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error verifying the EL and BC are on the same chain: %w", err) } @@ -251,7 +254,7 @@ func (c *nodeDepositContext) PrepareData(data *api.NodeDepositData, opts *bind.T // Get validator deposit data and associated parameters // NOTE: validation is done in the NMC now depositAmount := uint64(1e9) // 1 ETH in gwei - depositData, err := validator.GetDepositData(validatorKey, withdrawalCredentials, rs.GenesisForkVersion, depositAmount, rs.EthNetworkName) + depositData, err := validator.GetDepositData(c.handler.logger.Logger, validatorKey, withdrawalCredentials, rs.GenesisForkVersion, depositAmount, rs.EthNetworkName) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error getting deposit data: %w", err) } diff --git a/rocketpool-daemon/api/node/distribute.go b/rocketpool-daemon/api/node/distribute.go index 125ae2161..826595001 100644 --- a/rocketpool-daemon/api/node/distribute.go +++ b/rocketpool-daemon/api/node/distribute.go @@ -35,7 +35,7 @@ func (f *nodeDistributeContextFactory) Create(args url.Values) (*nodeDistributeC func (f *nodeDistributeContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeDistributeContext, api.NodeDistributeData]( - router, "distribute", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "distribute", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/get-rewards-info.go b/rocketpool-daemon/api/node/get-rewards-info.go index 7a9ec981e..242aa0472 100644 --- a/rocketpool-daemon/api/node/get-rewards-info.go +++ b/rocketpool-daemon/api/node/get-rewards-info.go @@ -39,7 +39,7 @@ func (f *nodeGetRewardsInfoContextFactory) Create(args url.Values) (*nodeGetRewa func (f *nodeGetRewardsInfoContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeGetRewardsInfoContext, api.NodeGetRewardsInfoData]( - router, "get-rewards-info", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "get-rewards-info", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -50,6 +50,7 @@ func (f *nodeGetRewardsInfoContextFactory) RegisterRoute(router *mux.Router) { type nodeGetRewardsInfoContext struct { handler *NodeHandler cfg *config.SmartNodeConfig + res *config.MergedResources rp *rocketpool.RocketPool node *node.Node @@ -61,6 +62,7 @@ type nodeGetRewardsInfoContext struct { func (c *nodeGetRewardsInfoContext) Initialize() (types.ResponseStatus, error) { sp := c.handler.serviceProvider c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.rp = sp.GetRocketPool() nodeAddress, _ := sp.GetWallet().GetAddress() @@ -119,7 +121,7 @@ func (c *nodeGetRewardsInfoContext) PrepareData(data *api.NodeGetRewardsInfoData // Get the info for each unclaimed interval for _, unclaimedInterval := range claimStatus.Unclaimed { - intervalInfo, err := rprewards.GetIntervalInfo(c.rp, c.cfg, c.node.Address, unclaimedInterval, nil) + intervalInfo, err := rprewards.GetIntervalInfo(c.rp, c.cfg, c.res, c.node.Address, unclaimedInterval, nil) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error getting interval %d info: %w", unclaimedInterval, err) } diff --git a/rocketpool-daemon/api/node/get-snapshot-proposals.go b/rocketpool-daemon/api/node/get-snapshot-proposals.go index 8615fddbf..8615b684e 100644 --- a/rocketpool-daemon/api/node/get-snapshot-proposals.go +++ b/rocketpool-daemon/api/node/get-snapshot-proposals.go @@ -37,7 +37,7 @@ func (f *nodeGetSnapshotProposalsContextFactory) Create(args url.Values) (*nodeG func (f *nodeGetSnapshotProposalsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*nodeGetSnapshotProposalsContext, api.NodeGetSnapshotProposalsData]( - router, "get-snapshot-proposals", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "get-snapshot-proposals", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -54,6 +54,7 @@ type nodeGetSnapshotProposalsContext struct { func (c *nodeGetSnapshotProposalsContext) PrepareData(data *api.NodeGetSnapshotProposalsData, opts *bind.TransactOpts) (types.ResponseStatus, error) { sp := c.handler.serviceProvider cfg := sp.GetConfig() + res := sp.GetResources() rp := sp.GetRocketPool() snapshot := sp.GetSnapshotDelegation() nodeAddress, _ := sp.GetWallet().GetAddress() @@ -77,6 +78,6 @@ func (c *nodeGetSnapshotProposalsContext) PrepareData(data *api.NodeGetSnapshotP return types.ResponseStatus_Error, fmt.Errorf("error getting snapshot delegate: %w", err) } - data.Proposals, err = voting.GetSnapshotProposals(cfg, nodeAddress, delegate, c.activeOnly) + data.Proposals, err = voting.GetSnapshotProposals(cfg, res, nodeAddress, delegate, c.activeOnly) return types.ResponseStatus_Success, err } diff --git a/rocketpool-daemon/api/node/get-snapshot-voting-power.go b/rocketpool-daemon/api/node/get-snapshot-voting-power.go index 5156479db..b2450508b 100644 --- a/rocketpool-daemon/api/node/get-snapshot-voting-power.go +++ b/rocketpool-daemon/api/node/get-snapshot-voting-power.go @@ -29,7 +29,7 @@ func (f *nodeGetSnapshotVotingPowerContextFactory) Create(args url.Values) (*nod func (f *nodeGetSnapshotVotingPowerContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*nodeGetSnapshotVotingPowerContext, api.NodeGetSnapshotVotingPowerData]( - router, "get-snapshot-voting-power", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "get-snapshot-voting-power", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -44,6 +44,7 @@ type nodeGetSnapshotVotingPowerContext struct { func (c *nodeGetSnapshotVotingPowerContext) PrepareData(data *api.NodeGetSnapshotVotingPowerData, opts *bind.TransactOpts) (types.ResponseStatus, error) { sp := c.handler.serviceProvider cfg := sp.GetConfig() + res := sp.GetResources() nodeAddress, _ := sp.GetWallet().GetAddress() // Requirements @@ -56,7 +57,7 @@ func (c *nodeGetSnapshotVotingPowerContext) PrepareData(data *api.NodeGetSnapsho return types.ResponseStatus_InvalidChainState, err } - data.VotingPower, err = voting.GetSnapshotVotingPower(cfg, nodeAddress) + data.VotingPower, err = voting.GetSnapshotVotingPower(cfg, res, nodeAddress) if err != nil { return types.ResponseStatus_Error, err } diff --git a/rocketpool-daemon/api/node/handler.go b/rocketpool-daemon/api/node/handler.go index bfe73f81a..2315b155d 100644 --- a/rocketpool-daemon/api/node/handler.go +++ b/rocketpool-daemon/api/node/handler.go @@ -13,11 +13,11 @@ import ( type NodeHandler struct { logger *log.Logger ctx context.Context - serviceProvider *services.ServiceProvider + serviceProvider services.ISmartNodeServiceProvider factories []server.IContextFactory } -func NewNodeHandler(logger *log.Logger, ctx context.Context, serviceProvider *services.ServiceProvider) *NodeHandler { +func NewNodeHandler(logger *log.Logger, ctx context.Context, serviceProvider services.ISmartNodeServiceProvider) *NodeHandler { h := &NodeHandler{ logger: logger, ctx: ctx, diff --git a/rocketpool-daemon/api/node/initialize-fee-distributor.go b/rocketpool-daemon/api/node/initialize-fee-distributor.go index 197e95478..76996c3fb 100644 --- a/rocketpool-daemon/api/node/initialize-fee-distributor.go +++ b/rocketpool-daemon/api/node/initialize-fee-distributor.go @@ -33,7 +33,7 @@ func (f *nodeInitializeFeeDistributorContextFactory) Create(args url.Values) (*n func (f *nodeInitializeFeeDistributorContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeInitializeFeeDistributorContext, api.NodeInitializeFeeDistributorData]( - router, "initialize-fee-distributor", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "initialize-fee-distributor", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/register.go b/rocketpool-daemon/api/node/register.go index 2bcab7384..00f8d7c54 100644 --- a/rocketpool-daemon/api/node/register.go +++ b/rocketpool-daemon/api/node/register.go @@ -39,7 +39,7 @@ func (f *nodeRegisterContextFactory) Create(args url.Values) (*nodeRegisterConte func (f *nodeRegisterContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeRegisterContext, api.NodeRegisterData]( - router, "register", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "register", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/resolve-ens.go b/rocketpool-daemon/api/node/resolve-ens.go index a84464ee4..f5d2f636a 100644 --- a/rocketpool-daemon/api/node/resolve-ens.go +++ b/rocketpool-daemon/api/node/resolve-ens.go @@ -37,7 +37,7 @@ func (f *nodeResolveEnsContextFactory) Create(args url.Values) (*nodeResolveEnsC func (f *nodeResolveEnsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*nodeResolveEnsContext, api.NodeResolveEnsData]( - router, "resolve-ens", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "resolve-ens", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/rewards.go b/rocketpool-daemon/api/node/rewards.go index 289d561cb..f8ee9e96e 100644 --- a/rocketpool-daemon/api/node/rewards.go +++ b/rocketpool-daemon/api/node/rewards.go @@ -44,7 +44,7 @@ func (f *nodeRewardsContextFactory) Create(args url.Values) (*nodeRewardsContext func (f *nodeRewardsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*nodeRewardsContext, api.NodeRewardsData]( - router, "rewards", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "rewards", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -59,6 +59,7 @@ type nodeRewardsContext struct { func (c *nodeRewardsContext) PrepareData(data *api.NodeRewardsData, opts *bind.TransactOpts) (types.ResponseStatus, error) { sp := c.handler.serviceProvider cfg := sp.GetConfig() + res := sp.GetResources() rp := sp.GetRocketPool() ec := sp.GetEthClient() bc := sp.GetBeaconClient() @@ -96,7 +97,7 @@ func (c *nodeRewardsContext) PrepareData(data *api.NodeRewardsData, opts *bind.T } // This thing is so complex it's easier to just get the state snapshot and go from there - stateMgr, err := state.NewNetworkStateManager(ctx, rp, cfg, ec, bc, c.handler.logger.Logger) + stateMgr, err := state.NewNetworkStateManager(ctx, rp, cfg, res, ec, bc, c.handler.logger.Logger) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error creating network state manager: %w", err) } @@ -137,7 +138,7 @@ func (c *nodeRewardsContext) PrepareData(data *api.NodeRewardsData, opts *bind.T return types.ResponseStatus_Error, fmt.Errorf("error getting rewards claim status for node %s: %w", nodeAddress.Hex(), err) } for _, claimed := range claimStatus.Claimed { - intervalInfo, err := rprewards.GetIntervalInfo(rp, cfg, nodeAddress, claimed, nil) + intervalInfo, err := rprewards.GetIntervalInfo(rp, cfg, res, nodeAddress, claimed, nil) if err != nil { return types.ResponseStatus_Error, err } @@ -149,7 +150,7 @@ func (c *nodeRewardsContext) PrepareData(data *api.NodeRewardsData, opts *bind.T claimedEthRewards.Add(claimedEthRewards, &intervalInfo.SmoothingPoolEthAmount.Int) } for _, unclaimed := range claimStatus.Unclaimed { - intervalInfo, err := rprewards.GetIntervalInfo(rp, cfg, nodeAddress, unclaimed, nil) + intervalInfo, err := rprewards.GetIntervalInfo(rp, cfg, res, nodeAddress, unclaimed, nil) if err != nil { return types.ResponseStatus_Error, err } diff --git a/rocketpool-daemon/api/node/send.go b/rocketpool-daemon/api/node/send.go index ccdcac8fb..ec19b2bc7 100644 --- a/rocketpool-daemon/api/node/send.go +++ b/rocketpool-daemon/api/node/send.go @@ -43,7 +43,7 @@ func (f *nodeSendContextFactory) Create(args url.Values) (*nodeSendContext, erro func (f *nodeSendContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*nodeSendContext, api.NodeSendData]( - router, "send", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "send", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/set-primary-withdrawal-address.go b/rocketpool-daemon/api/node/set-primary-withdrawal-address.go index 909919423..2a2c551a0 100644 --- a/rocketpool-daemon/api/node/set-primary-withdrawal-address.go +++ b/rocketpool-daemon/api/node/set-primary-withdrawal-address.go @@ -39,7 +39,7 @@ func (f *nodeSetPrimaryWithdrawalAddressContextFactory) Create(args url.Values) func (f *nodeSetPrimaryWithdrawalAddressContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeSetPrimaryWithdrawalAddressContext, api.NodeSetPrimaryWithdrawalAddressData]( - router, "primary-withdrawal-address/set", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "primary-withdrawal-address/set", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/set-rpl-locking-allowed.go b/rocketpool-daemon/api/node/set-rpl-locking-allowed.go index bfc31c496..4c94df875 100644 --- a/rocketpool-daemon/api/node/set-rpl-locking-allowed.go +++ b/rocketpool-daemon/api/node/set-rpl-locking-allowed.go @@ -38,7 +38,7 @@ func (f *nodeSetRplLockingAllowedContextFactory) Create(args url.Values) (*nodeS func (f *nodeSetRplLockingAllowedContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeSetRplLockingAllowedContext, api.NodeSetRplLockingAllowedData]( - router, "set-rpl-locking-allowed", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "set-rpl-locking-allowed", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/set-rpl-withdrawal-address.go b/rocketpool-daemon/api/node/set-rpl-withdrawal-address.go index 2cbd3b9c1..cff64677c 100644 --- a/rocketpool-daemon/api/node/set-rpl-withdrawal-address.go +++ b/rocketpool-daemon/api/node/set-rpl-withdrawal-address.go @@ -40,7 +40,7 @@ func (f *nodeSetRplWithdrawalAddressContextFactory) Create(args url.Values) (*no func (f *nodeSetRplWithdrawalAddressContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeSetRplWithdrawalAddressContext, api.NodeSetRplWithdrawalAddressData]( - router, "rpl-withdrawal-address/set", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "rpl-withdrawal-address/set", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/set-snapshot-delegate.go b/rocketpool-daemon/api/node/set-snapshot-delegate.go index 1f7671bdc..b6d1c1301 100644 --- a/rocketpool-daemon/api/node/set-snapshot-delegate.go +++ b/rocketpool-daemon/api/node/set-snapshot-delegate.go @@ -34,7 +34,7 @@ func (f *nodeSetSnapshotDelegateContextFactory) Create(args url.Values) (*nodeSe func (f *nodeSetSnapshotDelegateContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*nodeSetSnapshotDelegateContext, types.TxInfoData]( - router, "snapshot-delegate/set", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "snapshot-delegate/set", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/set-sp-registration-status.go b/rocketpool-daemon/api/node/set-sp-registration-status.go index bdf1fe250..c92d4ed32 100644 --- a/rocketpool-daemon/api/node/set-sp-registration-status.go +++ b/rocketpool-daemon/api/node/set-sp-registration-status.go @@ -39,7 +39,7 @@ func (f *nodeSetSmoothingPoolRegistrationStatusContextFactory) Create(args url.V func (f *nodeSetSmoothingPoolRegistrationStatusContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeSetSmoothingPoolRegistrationStatusContext, api.NodeSetSmoothingPoolRegistrationStatusData]( - router, "set-smoothing-pool-registration-state", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "set-smoothing-pool-registration-state", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/set-stake-rpl-for-allowed.go b/rocketpool-daemon/api/node/set-stake-rpl-for-allowed.go index 97952ec27..18fb6a66d 100644 --- a/rocketpool-daemon/api/node/set-stake-rpl-for-allowed.go +++ b/rocketpool-daemon/api/node/set-stake-rpl-for-allowed.go @@ -37,7 +37,7 @@ func (f *nodeSetStakeRplForAllowedContextFactory) Create(args url.Values) (*node func (f *nodeSetStakeRplForAllowedContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*nodeSetStakeRplForAllowedContext, api.NodeSetStakeRplForAllowedData]( - router, "set-stake-rpl-for-allowed", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "set-stake-rpl-for-allowed", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/set-timezone.go b/rocketpool-daemon/api/node/set-timezone.go index fa48887a5..fe431ab17 100644 --- a/rocketpool-daemon/api/node/set-timezone.go +++ b/rocketpool-daemon/api/node/set-timezone.go @@ -35,7 +35,7 @@ func (f *nodeSetTimezoneContextFactory) Create(args url.Values) (*nodeSetTimezon func (f *nodeSetTimezoneContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*nodeSetTimezoneContext, types.TxInfoData]( - router, "set-timezone", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "set-timezone", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/stake-rpl.go b/rocketpool-daemon/api/node/stake-rpl.go index 912044255..8bb8014f5 100644 --- a/rocketpool-daemon/api/node/stake-rpl.go +++ b/rocketpool-daemon/api/node/stake-rpl.go @@ -41,7 +41,7 @@ func (f *nodeStakeRplContextFactory) Create(args url.Values) (*nodeStakeRplConte func (f *nodeStakeRplContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeStakeRplContext, api.NodeStakeRplData]( - router, "stake-rpl", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "stake-rpl", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/status.go b/rocketpool-daemon/api/node/status.go index e289f5728..f2d44b599 100644 --- a/rocketpool-daemon/api/node/status.go +++ b/rocketpool-daemon/api/node/status.go @@ -55,7 +55,7 @@ func (f *nodeStatusContextFactory) Create(args url.Values) (*nodeStatusContext, func (f *nodeStatusContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeStatusContext, api.NodeStatusData]( - router, "status", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "status", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -66,6 +66,7 @@ func (f *nodeStatusContextFactory) RegisterRoute(router *mux.Router) { type nodeStatusContext struct { handler *NodeHandler cfg *config.SmartNodeConfig + res *config.MergedResources rp *rocketpool.RocketPool ec eth.IExecutionClient bc beacon.IBeaconClient @@ -89,6 +90,7 @@ type nodeStatusContext struct { func (c *nodeStatusContext) Initialize() (types.ResponseStatus, error) { sp := c.handler.serviceProvider c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.rp = sp.GetRocketPool() c.ec = sp.GetEthClient() c.bc = sp.GetBeaconClient() @@ -268,7 +270,7 @@ func (c *nodeStatusContext) PrepareData(data *api.NodeStatusData, opts *bind.Tra if data.SnapshotVotingDelegate != emptyAddress { data.SnapshotVotingDelegateFormatted = utils.GetFormattedAddress(c.ec, data.SnapshotVotingDelegate) } - props, err := voting.GetSnapshotProposals(c.cfg, c.node.Address, c.delegate, true) + props, err := voting.GetSnapshotProposals(c.cfg, c.res, c.node.Address, c.delegate, true) if err != nil { data.SnapshotResponse.Error = fmt.Sprintf("error getting snapshot proposals: %s", err.Error()) } else { diff --git a/rocketpool-daemon/api/node/swap-rpl.go b/rocketpool-daemon/api/node/swap-rpl.go index 8f25e42a4..b51bc4a2a 100644 --- a/rocketpool-daemon/api/node/swap-rpl.go +++ b/rocketpool-daemon/api/node/swap-rpl.go @@ -40,7 +40,7 @@ func (f *nodeSwapRplContextFactory) Create(args url.Values) (*nodeSwapRplContext func (f *nodeSwapRplContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeSwapRplContext, api.NodeSwapRplData]( - router, "swap-rpl", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "swap-rpl", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/withdraw-eth.go b/rocketpool-daemon/api/node/withdraw-eth.go index b811586b0..7dcbe59c6 100644 --- a/rocketpool-daemon/api/node/withdraw-eth.go +++ b/rocketpool-daemon/api/node/withdraw-eth.go @@ -40,7 +40,7 @@ func (f *nodeWithdrawEthContextFactory) Create(args url.Values) (*nodeWithdrawEt func (f *nodeWithdrawEthContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeWithdrawEthContext, api.NodeWithdrawEthData]( - router, "withdraw-eth", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "withdraw-eth", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/node/withdraw-rpl.go b/rocketpool-daemon/api/node/withdraw-rpl.go index 4c19c1c20..86d6fddaa 100644 --- a/rocketpool-daemon/api/node/withdraw-rpl.go +++ b/rocketpool-daemon/api/node/withdraw-rpl.go @@ -42,7 +42,7 @@ func (f *nodeWithdrawRplContextFactory) Create(args url.Values) (*nodeWithdrawRp func (f *nodeWithdrawRplContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*nodeWithdrawRplContext, api.NodeWithdrawRplData]( - router, "withdraw-rpl", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "withdraw-rpl", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/odao/cancel-proposal.go b/rocketpool-daemon/api/odao/cancel-proposal.go index b0b9aa62a..b1c3be30d 100644 --- a/rocketpool-daemon/api/odao/cancel-proposal.go +++ b/rocketpool-daemon/api/odao/cancel-proposal.go @@ -40,7 +40,7 @@ func (f *oracleDaoCancelProposalContextFactory) Create(args url.Values) (*oracle func (f *oracleDaoCancelProposalContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*oracleDaoCancelProposalContext, api.OracleDaoCancelProposalData]( - router, "proposal/execute", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "proposal/execute", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/odao/execute-proposals.go b/rocketpool-daemon/api/odao/execute-proposals.go index 515f79815..2e0e542fd 100644 --- a/rocketpool-daemon/api/odao/execute-proposals.go +++ b/rocketpool-daemon/api/odao/execute-proposals.go @@ -44,7 +44,7 @@ func (f *oracleDaoExecuteProposalsContextFactory) Create(args url.Values) (*orac func (f *oracleDaoExecuteProposalsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*oracleDaoExecuteProposalsContext, types.DataBatch[api.OracleDaoExecuteProposalData]]( - router, "proposal/execute", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "proposal/execute", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/odao/handler.go b/rocketpool-daemon/api/odao/handler.go index e5c0ecdb6..47338e2a1 100644 --- a/rocketpool-daemon/api/odao/handler.go +++ b/rocketpool-daemon/api/odao/handler.go @@ -13,11 +13,11 @@ import ( type OracleDaoHandler struct { logger *log.Logger ctx context.Context - serviceProvider *services.ServiceProvider + serviceProvider services.ISmartNodeServiceProvider factories []server.IContextFactory } -func NewOracleDaoHandler(logger *log.Logger, ctx context.Context, serviceProvider *services.ServiceProvider) *OracleDaoHandler { +func NewOracleDaoHandler(logger *log.Logger, ctx context.Context, serviceProvider services.ISmartNodeServiceProvider) *OracleDaoHandler { h := &OracleDaoHandler{ logger: logger, ctx: ctx, diff --git a/rocketpool-daemon/api/odao/join.go b/rocketpool-daemon/api/odao/join.go index f5452006c..f2663d5c6 100644 --- a/rocketpool-daemon/api/odao/join.go +++ b/rocketpool-daemon/api/odao/join.go @@ -38,7 +38,7 @@ func (f *oracleDaoJoinContextFactory) Create(args url.Values) (*oracleDaoJoinCon func (f *oracleDaoJoinContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*oracleDaoJoinContext, api.OracleDaoJoinData]( - router, "join", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "join", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/odao/leave.go b/rocketpool-daemon/api/odao/leave.go index 7ee73dea7..735671774 100644 --- a/rocketpool-daemon/api/odao/leave.go +++ b/rocketpool-daemon/api/odao/leave.go @@ -40,7 +40,7 @@ func (f *oracleDaoLeaveContextFactory) Create(args url.Values) (*oracleDaoLeaveC func (f *oracleDaoLeaveContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*oracleDaoLeaveContext, api.OracleDaoLeaveData]( - router, "leave", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "leave", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/odao/members.go b/rocketpool-daemon/api/odao/members.go index 06d0ff2b1..46847751d 100644 --- a/rocketpool-daemon/api/odao/members.go +++ b/rocketpool-daemon/api/odao/members.go @@ -32,7 +32,7 @@ func (f *oracleDaoMembersContextFactory) Create(args url.Values) (*oracleDaoMemb func (f *oracleDaoMembersContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*oracleDaoMembersContext, api.OracleDaoMembersData]( - router, "members", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "members", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/odao/proposals.go b/rocketpool-daemon/api/odao/proposals.go index 9ffbe1c4b..116fb2f92 100644 --- a/rocketpool-daemon/api/odao/proposals.go +++ b/rocketpool-daemon/api/odao/proposals.go @@ -38,7 +38,7 @@ func (f *oracleDaoProposalsContextFactory) Create(args url.Values) (*oracleDaoPr func (f *oracleDaoProposalsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*oracleDaoProposalsContext, api.OracleDaoProposalsData]( - router, "proposals", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "proposals", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/odao/propose-invite.go b/rocketpool-daemon/api/odao/propose-invite.go index d362e29d4..850554318 100644 --- a/rocketpool-daemon/api/odao/propose-invite.go +++ b/rocketpool-daemon/api/odao/propose-invite.go @@ -43,7 +43,7 @@ func (f *oracleDaoProposeInviteContextFactory) Create(args url.Values) (*oracleD func (f *oracleDaoProposeInviteContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*oracleDaoProposeInviteContext, api.OracleDaoProposeInviteData]( - router, "propose-invite", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "propose-invite", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/odao/propose-kick.go b/rocketpool-daemon/api/odao/propose-kick.go index 25665b707..15ea36b8b 100644 --- a/rocketpool-daemon/api/odao/propose-kick.go +++ b/rocketpool-daemon/api/odao/propose-kick.go @@ -43,7 +43,7 @@ func (f *oracleDaoProposeKickContextFactory) Create(args url.Values) (*oracleDao func (f *oracleDaoProposeKickContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*oracleDaoProposeKickContext, api.OracleDaoProposeKickData]( - router, "propose-kick", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "propose-kick", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/odao/propose-leave.go b/rocketpool-daemon/api/odao/propose-leave.go index 96d6c383d..931b1a2e9 100644 --- a/rocketpool-daemon/api/odao/propose-leave.go +++ b/rocketpool-daemon/api/odao/propose-leave.go @@ -35,7 +35,7 @@ func (f *oracleDaoProposeLeaveContextFactory) Create(args url.Values) (*oracleDa func (f *oracleDaoProposeLeaveContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*oracleDaoProposeLeaveContext, api.OracleDaoProposeLeaveData]( - router, "propose-leave", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "propose-leave", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/odao/propose-settings.go b/rocketpool-daemon/api/odao/propose-settings.go index 24d357ae5..3ba724363 100644 --- a/rocketpool-daemon/api/odao/propose-settings.go +++ b/rocketpool-daemon/api/odao/propose-settings.go @@ -42,7 +42,7 @@ func (f *oracleDaoProposeSettingContextFactory) Create(args url.Values) (*oracle func (f *oracleDaoProposeSettingContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*oracleDaoProposeSettingContext, api.OracleDaoProposeSettingData]( - router, "setting/propose", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "setting/propose", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/odao/settings.go b/rocketpool-daemon/api/odao/settings.go index d7386339c..3569b21a8 100644 --- a/rocketpool-daemon/api/odao/settings.go +++ b/rocketpool-daemon/api/odao/settings.go @@ -34,7 +34,7 @@ func (f *oracleDaoSettingsContextFactory) Create(args url.Values) (*oracleDaoSet func (f *oracleDaoSettingsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*oracleDaoSettingsContext, api.OracleDaoSettingsData]( - router, "settings", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "settings", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/odao/status.go b/rocketpool-daemon/api/odao/status.go index b2aa9896b..5f9a5d523 100644 --- a/rocketpool-daemon/api/odao/status.go +++ b/rocketpool-daemon/api/odao/status.go @@ -37,7 +37,7 @@ func (f *oracleDaoStatusContextFactory) Create(args url.Values) (*oracleDaoStatu func (f *oracleDaoStatusContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*oracleDaoStatusContext, api.OracleDaoStatusData]( - router, "status", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "status", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/odao/vote.go b/rocketpool-daemon/api/odao/vote.go index 6ff90f242..e32653794 100644 --- a/rocketpool-daemon/api/odao/vote.go +++ b/rocketpool-daemon/api/odao/vote.go @@ -42,7 +42,7 @@ func (f *oracleDaoVoteContextFactory) Create(args url.Values) (*oracleDaoVoteCon func (f *oracleDaoVoteContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*oracleDaoVoteContext, api.OracleDaoVoteOnProposalData]( - router, "proposal/vote", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "proposal/vote", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/pdao/claim-bonds.go b/rocketpool-daemon/api/pdao/claim-bonds.go index 9e40a5c54..9ebdde672 100644 --- a/rocketpool-daemon/api/pdao/claim-bonds.go +++ b/rocketpool-daemon/api/pdao/claim-bonds.go @@ -44,7 +44,7 @@ func (f *protocolDaoClaimBondsContextFactory) Create(body api.ProtocolDaoClaimBo func (f *protocolDaoClaimBondsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStagePost[*protocolDaoClaimBondsContext, api.ProtocolDaoClaimBondsBody, types.DataBatch[api.ProtocolDaoClaimBondsData]]( - router, "claim-bonds", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "claim-bonds", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/pdao/current-voting-delegate.go b/rocketpool-daemon/api/pdao/current-voting-delegate.go index 74a5307b1..673ee2f16 100644 --- a/rocketpool-daemon/api/pdao/current-voting-delegate.go +++ b/rocketpool-daemon/api/pdao/current-voting-delegate.go @@ -33,7 +33,7 @@ func (f *protocolDaoCurrentVotingDelegateContextFactory) Create(args url.Values) func (f *protocolDaoCurrentVotingDelegateContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoCurrentVotingDelegateContext, api.ProtocolDaoCurrentVotingDelegateData]( - router, "voting-delegate", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "voting-delegate", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/pdao/defeat-proposal.go b/rocketpool-daemon/api/pdao/defeat-proposal.go index 28383f16c..b4eb78967 100644 --- a/rocketpool-daemon/api/pdao/defeat-proposal.go +++ b/rocketpool-daemon/api/pdao/defeat-proposal.go @@ -42,7 +42,7 @@ func (f *protocolDaoDefeatProposalContextFactory) Create(args url.Values) (*prot func (f *protocolDaoDefeatProposalContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoDefeatProposalContext, api.ProtocolDaoDefeatProposalData]( - router, "proposal/defeat", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "proposal/defeat", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/pdao/execute-proposals.go b/rocketpool-daemon/api/pdao/execute-proposals.go index 3f99cc3be..f6ee01847 100644 --- a/rocketpool-daemon/api/pdao/execute-proposals.go +++ b/rocketpool-daemon/api/pdao/execute-proposals.go @@ -44,7 +44,7 @@ func (f *protocolDaoExecuteProposalsContextFactory) Create(args url.Values) (*pr func (f *protocolDaoExecuteProposalsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoExecuteProposalsContext, types.DataBatch[api.ProtocolDaoExecuteProposalData]]( - router, "proposal/execute", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "proposal/execute", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/pdao/finalize-proposal.go b/rocketpool-daemon/api/pdao/finalize-proposal.go index fa6064f30..64006b901 100644 --- a/rocketpool-daemon/api/pdao/finalize-proposal.go +++ b/rocketpool-daemon/api/pdao/finalize-proposal.go @@ -40,7 +40,7 @@ func (f *protocolDaoFinalizeProposalContextFactory) Create(args url.Values) (*pr func (f *protocolDaoFinalizeProposalContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoFinalizeProposalContext, api.ProtocolDaoFinalizeProposalData]( - router, "proposal/finalize", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "proposal/finalize", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/pdao/get-claimable-bonds.go b/rocketpool-daemon/api/pdao/get-claimable-bonds.go index 1980203cf..8e1b0e6a8 100644 --- a/rocketpool-daemon/api/pdao/get-claimable-bonds.go +++ b/rocketpool-daemon/api/pdao/get-claimable-bonds.go @@ -42,7 +42,7 @@ func (f *protocolDaoGetClaimableBondsContextFactory) Create(args url.Values) (*p func (f *protocolDaoGetClaimableBondsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoGetClaimableBondsContext, api.ProtocolDaoGetClaimableBondsData]( - router, "get-claimable-bonds", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "get-claimable-bonds", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -54,6 +54,7 @@ type protocolDaoGetClaimableBondsContext struct { handler *ProtocolDaoHandler rp *rocketpool.RocketPool cfg *config.SmartNodeConfig + res *config.MergedResources bc beacon.IBeaconClient nodeAddress common.Address @@ -64,6 +65,7 @@ func (c *protocolDaoGetClaimableBondsContext) Initialize() (types.ResponseStatus sp := c.handler.serviceProvider c.rp = sp.GetRocketPool() c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.bc = sp.GetBeaconClient() c.nodeAddress, _ = sp.GetWallet().GetAddress() @@ -136,8 +138,7 @@ func (c *protocolDaoGetClaimableBondsContext) PrepareData(data *api.ProtocolDaoG blockSpan := uint64(prop.ChallengeWindow.Formatted().Seconds()) / beaconCfg.SecondsPerSlot // The max possible number of blocks in the challenge window endBlock := big.NewInt(0).Add(startBlock, big.NewInt(int64(blockSpan))) - resources := c.cfg.GetRocketPoolResources() - challengeEvents, err := c.pdaoMgr.GetChallengeSubmittedEvents([]uint64{prop.ID}, intervalSize, startBlock, endBlock, resources.PreviousProtocolDaoVerifierAddresses, nil) + challengeEvents, err := c.pdaoMgr.GetChallengeSubmittedEvents([]uint64{prop.ID}, intervalSize, startBlock, endBlock, c.res.PreviousProtocolDaoVerifierAddresses, nil) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error scanning for proposal %d's ChallengeSubmitted events: %w", prop.ID, err) } diff --git a/rocketpool-daemon/api/pdao/handler.go b/rocketpool-daemon/api/pdao/handler.go index cae166597..8b2e19d7f 100644 --- a/rocketpool-daemon/api/pdao/handler.go +++ b/rocketpool-daemon/api/pdao/handler.go @@ -13,11 +13,11 @@ import ( type ProtocolDaoHandler struct { logger *log.Logger ctx context.Context - serviceProvider *services.ServiceProvider + serviceProvider services.ISmartNodeServiceProvider factories []server.IContextFactory } -func NewProtocolDaoHandler(logger *log.Logger, ctx context.Context, serviceProvider *services.ServiceProvider) *ProtocolDaoHandler { +func NewProtocolDaoHandler(logger *log.Logger, ctx context.Context, serviceProvider services.ISmartNodeServiceProvider) *ProtocolDaoHandler { h := &ProtocolDaoHandler{ logger: logger, ctx: ctx, diff --git a/rocketpool-daemon/api/pdao/initialize-voting.go b/rocketpool-daemon/api/pdao/initialize-voting.go index a6a8df5f8..bc7283241 100644 --- a/rocketpool-daemon/api/pdao/initialize-voting.go +++ b/rocketpool-daemon/api/pdao/initialize-voting.go @@ -40,7 +40,7 @@ func (f *protocolDaoInitializeVotingContextFactory) Create(args url.Values) (*pr func (f *protocolDaoInitializeVotingContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoInitializeVotingContext, api.ProtocolDaoInitializeVotingData]( - router, "initialize-voting", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "initialize-voting", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/pdao/invite-security.go b/rocketpool-daemon/api/pdao/invite-security.go index bd0859fc4..1471cc5b8 100644 --- a/rocketpool-daemon/api/pdao/invite-security.go +++ b/rocketpool-daemon/api/pdao/invite-security.go @@ -44,7 +44,7 @@ func (f *protocolDaoProposeInviteToSecurityCouncilContextFactory) Create(args ur func (f *protocolDaoProposeInviteToSecurityCouncilContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoProposeInviteToSecurityCouncilContext, api.ProtocolDaoProposeInviteToSecurityCouncilData]( - router, "security/invite", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "security/invite", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -56,6 +56,7 @@ type protocolDaoProposeInviteToSecurityCouncilContext struct { handler *ProtocolDaoHandler rp *rocketpool.RocketPool cfg *config.SmartNodeConfig + res *config.MergedResources bc beacon.IBeaconClient nodeAddress common.Address @@ -70,6 +71,7 @@ func (c *protocolDaoProposeInviteToSecurityCouncilContext) Initialize() (types.R sp := c.handler.serviceProvider c.rp = sp.GetRocketPool() c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.bc = sp.GetBeaconClient() c.nodeAddress, _ = sp.GetWallet().GetAddress() @@ -118,7 +120,7 @@ func (c *protocolDaoProposeInviteToSecurityCouncilContext) PrepareData(data *api // Get the tx if data.CanPropose && opts != nil { - blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.bc) + blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.res, c.bc) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error creating pollard for proposal creation: %w", err) } diff --git a/rocketpool-daemon/api/pdao/kick-multi-security.go b/rocketpool-daemon/api/pdao/kick-multi-security.go index b18c887eb..f9dabb332 100644 --- a/rocketpool-daemon/api/pdao/kick-multi-security.go +++ b/rocketpool-daemon/api/pdao/kick-multi-security.go @@ -47,7 +47,7 @@ func (f *protocolDaoProposeKickMultiFromSecurityCouncilContextFactory) Create(ar func (f *protocolDaoProposeKickMultiFromSecurityCouncilContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoProposeKickMultiFromSecurityCouncilContext, api.ProtocolDaoProposeKickMultiFromSecurityCouncilData]( - router, "security/kick-multi", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "security/kick-multi", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -59,6 +59,7 @@ type protocolDaoProposeKickMultiFromSecurityCouncilContext struct { handler *ProtocolDaoHandler rp *rocketpool.RocketPool cfg *config.SmartNodeConfig + res *config.MergedResources bc beacon.IBeaconClient nodeAddress common.Address @@ -72,6 +73,7 @@ func (c *protocolDaoProposeKickMultiFromSecurityCouncilContext) Initialize() (ty sp := c.handler.serviceProvider c.rp = sp.GetRocketPool() c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.bc = sp.GetBeaconClient() // Requirements @@ -127,7 +129,7 @@ func (c *protocolDaoProposeKickMultiFromSecurityCouncilContext) PrepareData(data // Get the tx if data.CanPropose && opts != nil { - blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.bc) + blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.res, c.bc) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error creating pollard for proposal creation: %w", err) } diff --git a/rocketpool-daemon/api/pdao/kick-security.go b/rocketpool-daemon/api/pdao/kick-security.go index 25113061e..1f75c05e8 100644 --- a/rocketpool-daemon/api/pdao/kick-security.go +++ b/rocketpool-daemon/api/pdao/kick-security.go @@ -43,7 +43,7 @@ func (f *protocolDaoProposeKickFromSecurityCouncilContextFactory) Create(args ur func (f *protocolDaoProposeKickFromSecurityCouncilContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoProposeKickFromSecurityCouncilContext, api.ProtocolDaoProposeKickFromSecurityCouncilData]( - router, "security/kick", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "security/kick", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -55,6 +55,7 @@ type protocolDaoProposeKickFromSecurityCouncilContext struct { handler *ProtocolDaoHandler rp *rocketpool.RocketPool cfg *config.SmartNodeConfig + res *config.MergedResources bc beacon.IBeaconClient nodeAddress common.Address @@ -68,6 +69,7 @@ func (c *protocolDaoProposeKickFromSecurityCouncilContext) Initialize() (types.R sp := c.handler.serviceProvider c.rp = sp.GetRocketPool() c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.bc = sp.GetBeaconClient() c.nodeAddress, _ = sp.GetWallet().GetAddress() @@ -117,7 +119,7 @@ func (c *protocolDaoProposeKickFromSecurityCouncilContext) PrepareData(data *api // Get the tx if data.CanPropose && opts != nil { - blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.bc) + blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.res, c.bc) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error creating pollard for proposal creation: %w", err) } diff --git a/rocketpool-daemon/api/pdao/one-time-spend.go b/rocketpool-daemon/api/pdao/one-time-spend.go index bb168fce0..55cb7a017 100644 --- a/rocketpool-daemon/api/pdao/one-time-spend.go +++ b/rocketpool-daemon/api/pdao/one-time-spend.go @@ -44,7 +44,7 @@ func (f *protocolDaoProposeOneTimeSpendContextFactory) Create(args url.Values) ( func (f *protocolDaoProposeOneTimeSpendContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoProposeOneTimeSpendContext, api.ProtocolDaoGeneralProposeData]( - router, "one-time-spend", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "one-time-spend", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -56,6 +56,7 @@ type protocolDaoProposeOneTimeSpendContext struct { handler *ProtocolDaoHandler rp *rocketpool.RocketPool cfg *config.SmartNodeConfig + res *config.MergedResources bc beacon.IBeaconClient nodeAddress common.Address @@ -70,6 +71,7 @@ func (c *protocolDaoProposeOneTimeSpendContext) Initialize() (types.ResponseStat sp := c.handler.serviceProvider c.rp = sp.GetRocketPool() c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.bc = sp.GetBeaconClient() c.nodeAddress, _ = sp.GetWallet().GetAddress() @@ -112,7 +114,7 @@ func (c *protocolDaoProposeOneTimeSpendContext) PrepareData(data *api.ProtocolDa // Get the tx if data.CanPropose && opts != nil { - blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.bc) + blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.res, c.bc) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error creating pollard for proposal creation: %w", err) } diff --git a/rocketpool-daemon/api/pdao/override-vote.go b/rocketpool-daemon/api/pdao/override-vote.go index 564e8da90..873aee72d 100644 --- a/rocketpool-daemon/api/pdao/override-vote.go +++ b/rocketpool-daemon/api/pdao/override-vote.go @@ -45,7 +45,7 @@ func (f *protocolDaoOverrideVoteOnProposalContextFactory) Create(args url.Values func (f *protocolDaoOverrideVoteOnProposalContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoOverrideVoteOnProposalContext, api.ProtocolDaoVoteOnProposalData]( - router, "proposal/override-vote", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "proposal/override-vote", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/pdao/proposals.go b/rocketpool-daemon/api/pdao/proposals.go index 55be2339c..88d84756a 100644 --- a/rocketpool-daemon/api/pdao/proposals.go +++ b/rocketpool-daemon/api/pdao/proposals.go @@ -39,7 +39,7 @@ func (f *protocolDaoProposalsContextFactory) Create(args url.Values) (*protocolD func (f *protocolDaoProposalsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoProposalsContext, api.ProtocolDaoProposalsData]( - router, "proposals", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "proposals", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/pdao/propose-rewards-percentages.go b/rocketpool-daemon/api/pdao/propose-rewards-percentages.go index 14d205619..1a965b98c 100644 --- a/rocketpool-daemon/api/pdao/propose-rewards-percentages.go +++ b/rocketpool-daemon/api/pdao/propose-rewards-percentages.go @@ -44,7 +44,7 @@ func (f *protocolDaoProposeRewardsPercentagesContextFactory) Create(args url.Val func (f *protocolDaoProposeRewardsPercentagesContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoProposeRewardsPercentagesContext, api.ProtocolDaoGeneralProposeData]( - router, "rewards-percentages/propose", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "rewards-percentages/propose", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -56,6 +56,7 @@ type protocolDaoProposeRewardsPercentagesContext struct { handler *ProtocolDaoHandler rp *rocketpool.RocketPool cfg *config.SmartNodeConfig + res *config.MergedResources bc beacon.IBeaconClient nodeAddress common.Address @@ -70,6 +71,7 @@ func (c *protocolDaoProposeRewardsPercentagesContext) Initialize() (types.Respon sp := c.handler.serviceProvider c.rp = sp.GetRocketPool() c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.bc = sp.GetBeaconClient() c.nodeAddress, _ = sp.GetWallet().GetAddress() @@ -121,7 +123,7 @@ func (c *protocolDaoProposeRewardsPercentagesContext) PrepareData(data *api.Prot // Get the tx if data.CanPropose && opts != nil { - blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.bc) + blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.res, c.bc) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error creating pollard for proposal creation: %w", err) } diff --git a/rocketpool-daemon/api/pdao/propose-settings.go b/rocketpool-daemon/api/pdao/propose-settings.go index 67738cb3a..c820c64cd 100644 --- a/rocketpool-daemon/api/pdao/propose-settings.go +++ b/rocketpool-daemon/api/pdao/propose-settings.go @@ -44,7 +44,7 @@ func (f *protocolDaoProposeSettingContextFactory) Create(args url.Values) (*prot func (f *protocolDaoProposeSettingContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoProposeSettingContext, api.ProtocolDaoProposeSettingData]( - router, "setting/propose", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "setting/propose", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -56,6 +56,7 @@ type protocolDaoProposeSettingContext struct { handler *ProtocolDaoHandler rp *rocketpool.RocketPool cfg *config.SmartNodeConfig + res *config.MergedResources bc beacon.IBeaconClient nodeAddress common.Address @@ -70,6 +71,7 @@ func (c *protocolDaoProposeSettingContext) Initialize() (types.ResponseStatus, e sp := c.handler.serviceProvider c.rp = sp.GetRocketPool() c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.bc = sp.GetBeaconClient() c.nodeAddress, _ = sp.GetWallet().GetAddress() @@ -146,7 +148,7 @@ func (c *protocolDaoProposeSettingContext) createProposalTx(category protocol.Se if err != nil { return false, nil, fmt.Errorf("error parsing value '%s' as bool: %w", c.valueString, err), nil } - blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.bc) + blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.res, c.bc) if err != nil { return false, nil, fmt.Errorf("error creating pollard for proposal creation: %w", err), nil } @@ -163,7 +165,7 @@ func (c *protocolDaoProposeSettingContext) createProposalTx(category protocol.Se if err != nil { return false, nil, fmt.Errorf("error parsing value '%s' as *big.Int: %w", c.valueString, err), nil } - blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.bc) + blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.res, c.bc) if err != nil { return false, nil, fmt.Errorf("error creating pollard for proposal creation: %w", err), nil } diff --git a/rocketpool-daemon/api/pdao/recurring-spend.go b/rocketpool-daemon/api/pdao/recurring-spend.go index 082752c9f..81479f719 100644 --- a/rocketpool-daemon/api/pdao/recurring-spend.go +++ b/rocketpool-daemon/api/pdao/recurring-spend.go @@ -48,7 +48,7 @@ func (f *protocolDaoProposeRecurringSpendContextFactory) Create(args url.Values) func (f *protocolDaoProposeRecurringSpendContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoProposeRecurringSpendContext, api.ProtocolDaoGeneralProposeData]( - router, "recurring-spend", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "recurring-spend", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -60,6 +60,7 @@ type protocolDaoProposeRecurringSpendContext struct { handler *ProtocolDaoHandler rp *rocketpool.RocketPool cfg *config.SmartNodeConfig + res *config.MergedResources bc beacon.IBeaconClient nodeAddress common.Address @@ -77,6 +78,7 @@ func (c *protocolDaoProposeRecurringSpendContext) Initialize() (types.ResponseSt sp := c.handler.serviceProvider c.rp = sp.GetRocketPool() c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.bc = sp.GetBeaconClient() c.nodeAddress, _ = sp.GetWallet().GetAddress() @@ -119,7 +121,7 @@ func (c *protocolDaoProposeRecurringSpendContext) PrepareData(data *api.Protocol // Get the tx if data.CanPropose && opts != nil { - blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.bc) + blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.res, c.bc) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error creating pollard for proposal creation: %w", err) } diff --git a/rocketpool-daemon/api/pdao/replace-security.go b/rocketpool-daemon/api/pdao/replace-security.go index 2c8649f34..ac05b84f8 100644 --- a/rocketpool-daemon/api/pdao/replace-security.go +++ b/rocketpool-daemon/api/pdao/replace-security.go @@ -45,7 +45,7 @@ func (f *protocolDaoProposeReplaceMemberOfSecurityCouncilContextFactory) Create( func (f *protocolDaoProposeReplaceMemberOfSecurityCouncilContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoProposeReplaceMemberOfSecurityCouncilContext, api.ProtocolDaoProposeReplaceMemberOfSecurityCouncilData]( - router, "security/replace", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "security/replace", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -57,6 +57,7 @@ type protocolDaoProposeReplaceMemberOfSecurityCouncilContext struct { handler *ProtocolDaoHandler rp *rocketpool.RocketPool cfg *config.SmartNodeConfig + res *config.MergedResources bc beacon.IBeaconClient nodeAddress common.Address @@ -73,6 +74,7 @@ func (c *protocolDaoProposeReplaceMemberOfSecurityCouncilContext) Initialize() ( sp := c.handler.serviceProvider c.rp = sp.GetRocketPool() c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.bc = sp.GetBeaconClient() c.nodeAddress, _ = sp.GetWallet().GetAddress() @@ -128,7 +130,7 @@ func (c *protocolDaoProposeReplaceMemberOfSecurityCouncilContext) PrepareData(da // Get the tx if data.CanPropose && opts != nil { - blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.bc) + blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.res, c.bc) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error creating pollard for proposal creation: %w", err) } diff --git a/rocketpool-daemon/api/pdao/rewards-percentages.go b/rocketpool-daemon/api/pdao/rewards-percentages.go index ea601ab5a..4629db0dd 100644 --- a/rocketpool-daemon/api/pdao/rewards-percentages.go +++ b/rocketpool-daemon/api/pdao/rewards-percentages.go @@ -31,7 +31,7 @@ func (f *protocolDaoRewardsPercentagesContextFactory) Create(args url.Values) (* func (f *protocolDaoRewardsPercentagesContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoRewardsPercentagesContext, api.ProtocolDaoRewardsPercentagesData]( - router, "rewards-percentages", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "rewards-percentages", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/pdao/set-voting-delegate.go b/rocketpool-daemon/api/pdao/set-voting-delegate.go index 10ebfdb1c..7753a1307 100644 --- a/rocketpool-daemon/api/pdao/set-voting-delegate.go +++ b/rocketpool-daemon/api/pdao/set-voting-delegate.go @@ -35,7 +35,7 @@ func (f *protocolDaoSetVotingDelegateContextFactory) Create(args url.Values) (*p func (f *protocolDaoSetVotingDelegateContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*protocolDaoSetSnapshotDelegateContext, types.TxInfoData]( - router, "voting-delegate/set", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "voting-delegate/set", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/pdao/settings.go b/rocketpool-daemon/api/pdao/settings.go index 00e8f738b..498cf3a53 100644 --- a/rocketpool-daemon/api/pdao/settings.go +++ b/rocketpool-daemon/api/pdao/settings.go @@ -33,7 +33,7 @@ func (f *protocolDaoSettingsContextFactory) Create(args url.Values) (*protocolDa func (f *protocolDaoSettingsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoSettingsContext, api.ProtocolDaoSettingsData]( - router, "settings", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "settings", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/pdao/status.go b/rocketpool-daemon/api/pdao/status.go index 6ec184ec2..3a13084cc 100644 --- a/rocketpool-daemon/api/pdao/status.go +++ b/rocketpool-daemon/api/pdao/status.go @@ -36,7 +36,7 @@ func (f *protocolDaoGetStatusContextFactory) Create(args url.Values) (*protocolD func (f *protocolDaoGetStatusContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*protocolDaoGetStatusContext, api.ProtocolDAOStatusResponse]( - router, "get-status", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "get-status", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -47,6 +47,7 @@ func (f *protocolDaoGetStatusContextFactory) RegisterRoute(router *mux.Router) { type protocolDaoGetStatusContext struct { handler *ProtocolDaoHandler cfg *config.SmartNodeConfig + res *config.MergedResources rp *rocketpool.RocketPool bc beacon.IBeaconClient @@ -58,6 +59,7 @@ func (c *protocolDaoGetStatusContext) PrepareData(data *api.ProtocolDAOStatusRes rp := sp.GetRocketPool() ec := sp.GetEthClient() c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.rp = sp.GetRocketPool() c.bc = sp.GetBeaconClient() ctx := c.handler.ctx @@ -75,7 +77,7 @@ func (c *protocolDaoGetStatusContext) PrepareData(data *api.ProtocolDAOStatusRes if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error creating node %s binding: %w", nodeAddress.Hex(), err) } - c.propMgr, err = proposals.NewProposalManager(ctx, c.handler.logger.Logger, c.cfg, c.rp, c.bc) + c.propMgr, err = proposals.NewProposalManager(ctx, c.handler.logger.Logger, c.cfg, c.res, c.rp, c.bc) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error creating proposal manager: %w", err) } diff --git a/rocketpool-daemon/api/pdao/update-recurring-spend.go b/rocketpool-daemon/api/pdao/update-recurring-spend.go index 0f9eadbbd..0b51ff9d3 100644 --- a/rocketpool-daemon/api/pdao/update-recurring-spend.go +++ b/rocketpool-daemon/api/pdao/update-recurring-spend.go @@ -47,7 +47,7 @@ func (f *protocolDaoProposeRecurringSpendUpdateContextFactory) Create(args url.V func (f *protocolDaoProposeRecurringSpendUpdateContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoProposeRecurringSpendUpdateContext, api.ProtocolDaoProposeRecurringSpendUpdateData]( - router, "recurring-spend-update", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "recurring-spend-update", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -59,6 +59,7 @@ type protocolDaoProposeRecurringSpendUpdateContext struct { handler *ProtocolDaoHandler rp *rocketpool.RocketPool cfg *config.SmartNodeConfig + res *config.MergedResources bc beacon.IBeaconClient nodeAddress common.Address @@ -76,6 +77,7 @@ func (c *protocolDaoProposeRecurringSpendUpdateContext) Initialize() (types.Resp sp := c.handler.serviceProvider c.rp = sp.GetRocketPool() c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.bc = sp.GetBeaconClient() c.nodeAddress, _ = sp.GetWallet().GetAddress() @@ -120,7 +122,7 @@ func (c *protocolDaoProposeRecurringSpendUpdateContext) PrepareData(data *api.Pr // Get the tx if data.CanPropose && opts != nil { - blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.bc) + blockNumber, pollard, err := createPollard(ctx, c.handler.logger.Logger, c.rp, c.cfg, c.res, c.bc) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error creating pollard for proposal creation: %w", err) } diff --git a/rocketpool-daemon/api/pdao/utils.go b/rocketpool-daemon/api/pdao/utils.go index 0d35bfd72..b1e4ef116 100644 --- a/rocketpool-daemon/api/pdao/utils.go +++ b/rocketpool-daemon/api/pdao/utils.go @@ -12,9 +12,9 @@ import ( ) // Constructs a pollard for the latest finalized block and saves it to disk -func createPollard(context context.Context, logger *slog.Logger, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, bc beacon.IBeaconClient) (uint32, []types.VotingTreeNode, error) { +func createPollard(context context.Context, logger *slog.Logger, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, res *config.MergedResources, bc beacon.IBeaconClient) (uint32, []types.VotingTreeNode, error) { // Create a proposal manager - propMgr, err := proposals.NewProposalManager(context, logger, cfg, rp, bc) + propMgr, err := proposals.NewProposalManager(context, logger, cfg, res, rp, bc) if err != nil { return 0, nil, err } diff --git a/rocketpool-daemon/api/pdao/vote-proposal.go b/rocketpool-daemon/api/pdao/vote-proposal.go index 60522cc5f..1d5a98bc2 100644 --- a/rocketpool-daemon/api/pdao/vote-proposal.go +++ b/rocketpool-daemon/api/pdao/vote-proposal.go @@ -46,7 +46,7 @@ func (f *protocolDaoVoteOnProposalContextFactory) Create(args url.Values) (*prot func (f *protocolDaoVoteOnProposalContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*protocolDaoVoteOnProposalContext, api.ProtocolDaoVoteOnProposalData]( - router, "proposal/vote", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "proposal/vote", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -57,6 +57,7 @@ func (f *protocolDaoVoteOnProposalContextFactory) RegisterRoute(router *mux.Rout type protocolDaoVoteOnProposalContext struct { handler *ProtocolDaoHandler cfg *config.SmartNodeConfig + res *config.MergedResources rp *rocketpool.RocketPool bc beacon.IBeaconClient nodeAddress common.Address @@ -73,6 +74,7 @@ type protocolDaoVoteOnProposalContext struct { func (c *protocolDaoVoteOnProposalContext) Initialize() (types.ResponseStatus, error) { sp := c.handler.serviceProvider c.cfg = sp.GetConfig() + c.res = sp.GetResources() c.rp = sp.GetRocketPool() c.bc = sp.GetBeaconClient() ctx := c.handler.ctx @@ -97,7 +99,7 @@ func (c *protocolDaoVoteOnProposalContext) Initialize() (types.ResponseStatus, e if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error creating proposal binding: %w", err) } - c.propMgr, err = proposals.NewProposalManager(ctx, c.handler.logger.Logger, c.cfg, c.rp, c.bc) + c.propMgr, err = proposals.NewProposalManager(ctx, c.handler.logger.Logger, c.cfg, c.res, c.rp, c.bc) if err != nil { return types.ResponseStatus_Error, fmt.Errorf("error creating proposal manager: %w", err) } diff --git a/rocketpool-daemon/api/queue/handler.go b/rocketpool-daemon/api/queue/handler.go index 259973d08..50accfd65 100644 --- a/rocketpool-daemon/api/queue/handler.go +++ b/rocketpool-daemon/api/queue/handler.go @@ -13,11 +13,11 @@ import ( type QueueHandler struct { logger *log.Logger ctx context.Context - serviceProvider *services.ServiceProvider + serviceProvider services.ISmartNodeServiceProvider factories []server.IContextFactory } -func NewQueueHandler(logger *log.Logger, ctx context.Context, serviceProvider *services.ServiceProvider) *QueueHandler { +func NewQueueHandler(logger *log.Logger, ctx context.Context, serviceProvider services.ISmartNodeServiceProvider) *QueueHandler { h := &QueueHandler{ logger: logger, ctx: ctx, diff --git a/rocketpool-daemon/api/queue/process.go b/rocketpool-daemon/api/queue/process.go index 40cf5744b..32c872a52 100644 --- a/rocketpool-daemon/api/queue/process.go +++ b/rocketpool-daemon/api/queue/process.go @@ -34,7 +34,7 @@ func (f *queueProcessContextFactory) Create(args url.Values) (*queueProcessConte func (f *queueProcessContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*queueProcessContext, api.QueueProcessData]( - router, "process", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "process", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/queue/status.go b/rocketpool-daemon/api/queue/status.go index 38f58d754..2d9c9d103 100644 --- a/rocketpool-daemon/api/queue/status.go +++ b/rocketpool-daemon/api/queue/status.go @@ -34,7 +34,7 @@ func (f *queueStatusContextFactory) Create(args url.Values) (*queueStatusContext func (f *queueStatusContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*queueStatusContext, api.QueueStatusData]( - router, "status", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "status", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/security/cancel-proposal.go b/rocketpool-daemon/api/security/cancel-proposal.go index a3d8e0bb0..2a4e82a66 100644 --- a/rocketpool-daemon/api/security/cancel-proposal.go +++ b/rocketpool-daemon/api/security/cancel-proposal.go @@ -41,7 +41,7 @@ func (f *securityCancelProposalContextFactory) Create(args url.Values) (*securit func (f *securityCancelProposalContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*securityCancelProposalContext, api.SecurityCancelProposalData]( - router, "proposal/cancel", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "proposal/cancel", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/security/execute-proposals.go b/rocketpool-daemon/api/security/execute-proposals.go index a560fb135..9b180ee84 100644 --- a/rocketpool-daemon/api/security/execute-proposals.go +++ b/rocketpool-daemon/api/security/execute-proposals.go @@ -44,7 +44,7 @@ func (f *securityExecuteProposalsContextFactory) Create(args url.Values) (*secur func (f *securityExecuteProposalsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*securityExecuteProposalsContext, types.DataBatch[api.SecurityExecuteProposalData]]( - router, "proposal/execute", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "proposal/execute", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/security/handler.go b/rocketpool-daemon/api/security/handler.go index dc5d62291..50aa300e6 100644 --- a/rocketpool-daemon/api/security/handler.go +++ b/rocketpool-daemon/api/security/handler.go @@ -13,11 +13,11 @@ import ( type SecurityCouncilHandler struct { logger *log.Logger ctx context.Context - serviceProvider *services.ServiceProvider + serviceProvider services.ISmartNodeServiceProvider factories []server.IContextFactory } -func NewSecurityCouncilHandler(logger *log.Logger, ctx context.Context, serviceProvider *services.ServiceProvider) *SecurityCouncilHandler { +func NewSecurityCouncilHandler(logger *log.Logger, ctx context.Context, serviceProvider services.ISmartNodeServiceProvider) *SecurityCouncilHandler { h := &SecurityCouncilHandler{ logger: logger, ctx: ctx, diff --git a/rocketpool-daemon/api/security/join.go b/rocketpool-daemon/api/security/join.go index 25af481a4..92991769b 100644 --- a/rocketpool-daemon/api/security/join.go +++ b/rocketpool-daemon/api/security/join.go @@ -36,7 +36,7 @@ func (f *securityJoinContextFactory) Create(args url.Values) (*securityJoinConte func (f *securityJoinContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*securityJoinContext, api.SecurityJoinData]( - router, "join", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "join", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/security/leave.go b/rocketpool-daemon/api/security/leave.go index e2a68ada7..7a3b009f8 100644 --- a/rocketpool-daemon/api/security/leave.go +++ b/rocketpool-daemon/api/security/leave.go @@ -37,7 +37,7 @@ func (f *securityLeaveContextFactory) Create(args url.Values) (*securityLeaveCon func (f *securityLeaveContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*securityLeaveContext, api.SecurityLeaveData]( - router, "leave", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "leave", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/security/members.go b/rocketpool-daemon/api/security/members.go index 5068201c8..5c07d786a 100644 --- a/rocketpool-daemon/api/security/members.go +++ b/rocketpool-daemon/api/security/members.go @@ -35,7 +35,7 @@ func (f *securityMembersContextFactory) Create(args url.Values) (*securityMember func (f *securityMembersContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*securityMembersContext, api.SecurityMembersData]( - router, "members", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "members", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/security/proposals.go b/rocketpool-daemon/api/security/proposals.go index d0c172da9..dfab7f3ba 100644 --- a/rocketpool-daemon/api/security/proposals.go +++ b/rocketpool-daemon/api/security/proposals.go @@ -39,7 +39,7 @@ func (f *securityProposalsContextFactory) Create(args url.Values) (*securityProp func (f *securityProposalsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*securityProposalsContext, api.SecurityProposalsData]( - router, "proposals", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "proposals", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/security/propose-leave.go b/rocketpool-daemon/api/security/propose-leave.go index dd71ca0ae..875e7d5e9 100644 --- a/rocketpool-daemon/api/security/propose-leave.go +++ b/rocketpool-daemon/api/security/propose-leave.go @@ -30,7 +30,7 @@ func (f *securityProposeLeaveContextFactory) Create(args url.Values) (*securityP func (f *securityProposeLeaveContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*securityProposeLeaveContext, types.TxInfoData]( - router, "propose-leave", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "propose-leave", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/security/propose-settings.go b/rocketpool-daemon/api/security/propose-settings.go index 3f2e42b32..3b28be4d8 100644 --- a/rocketpool-daemon/api/security/propose-settings.go +++ b/rocketpool-daemon/api/security/propose-settings.go @@ -39,7 +39,7 @@ func (f *securityProposeSettingContextFactory) Create(args url.Values) (*securit func (f *securityProposeSettingContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*securityProposeSettingContext, api.SecurityProposeSettingData]( - router, "setting/propose", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "setting/propose", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/security/status.go b/rocketpool-daemon/api/security/status.go index 812cf8a5e..df139c596 100644 --- a/rocketpool-daemon/api/security/status.go +++ b/rocketpool-daemon/api/security/status.go @@ -44,7 +44,7 @@ func (f *securityStatusContextFactory) Create(args url.Values) (*securityStatusC func (f *securityStatusContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*securityStatusContext, api.SecurityStatusData]( - router, "status", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "status", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/security/vote-proposal.go b/rocketpool-daemon/api/security/vote-proposal.go index bb8ad79cc..3ac36d9b9 100644 --- a/rocketpool-daemon/api/security/vote-proposal.go +++ b/rocketpool-daemon/api/security/vote-proposal.go @@ -42,7 +42,7 @@ func (f *securityVoteOnProposalContextFactory) Create(args url.Values) (*securit func (f *securityVoteOnProposalContextFactory) RegisterRoute(router *mux.Router) { server.RegisterSingleStageRoute[*securityVoteOnProposalContext, api.SecurityVoteOnProposalData]( - router, "proposal/vote", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "proposal/vote", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/server-manager.go b/rocketpool-daemon/api/server-manager.go index c2df8cab4..63618427e 100644 --- a/rocketpool-daemon/api/server-manager.go +++ b/rocketpool-daemon/api/server-manager.go @@ -27,7 +27,7 @@ type ServerManager struct { } // Creates a new server manager -func NewServerManager(sp *services.ServiceProvider, ip string, port uint16, stopWg *sync.WaitGroup) (*ServerManager, error) { +func NewServerManager(sp services.ISmartNodeServiceProvider, ip string, port uint16, stopWg *sync.WaitGroup) (*ServerManager, error) { // Start the API server apiServer, err := createServer(sp, ip, port) if err != nil { @@ -55,7 +55,7 @@ func (m *ServerManager) Stop() { } // Creates a new Smart Node API server -func createServer(sp *services.ServiceProvider, ip string, port uint16) (*server.NetworkSocketApiServer, error) { +func createServer(sp services.ISmartNodeServiceProvider, ip string, port uint16) (*server.NetworkSocketApiServer, error) { apiLogger := sp.GetApiLogger() ctx := apiLogger.CreateContextWithLogger(sp.GetBaseContext()) diff --git a/rocketpool-daemon/api/service/client-status.go b/rocketpool-daemon/api/service/client-status.go index 6df9369ff..cde4e8646 100644 --- a/rocketpool-daemon/api/service/client-status.go +++ b/rocketpool-daemon/api/service/client-status.go @@ -28,7 +28,7 @@ func (f *serviceClientStatusContextFactory) Create(args url.Values) (*serviceCli func (f *serviceClientStatusContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*serviceClientStatusContext, api.ServiceClientStatusData]( - router, "client-status", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "client-status", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/service/get-config.go b/rocketpool-daemon/api/service/get-config.go index f1fc9c7d3..c27f4b7e5 100644 --- a/rocketpool-daemon/api/service/get-config.go +++ b/rocketpool-daemon/api/service/get-config.go @@ -27,7 +27,7 @@ func (f *serviceGetConfigContextFactory) Create(args url.Values) (*serviceGetCon func (f *serviceGetConfigContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*serviceGetConfigContext, api.ServiceGetConfigData]( - router, "get-config", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "get-config", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/service/handler.go b/rocketpool-daemon/api/service/handler.go index d185458da..20fb2f9f0 100644 --- a/rocketpool-daemon/api/service/handler.go +++ b/rocketpool-daemon/api/service/handler.go @@ -12,11 +12,11 @@ import ( type ServiceHandler struct { logger *log.Logger ctx context.Context - serviceProvider *services.ServiceProvider + serviceProvider services.ISmartNodeServiceProvider factories []server.IContextFactory } -func NewServiceHandler(logger *log.Logger, ctx context.Context, serviceProvider *services.ServiceProvider) *ServiceHandler { +func NewServiceHandler(logger *log.Logger, ctx context.Context, serviceProvider services.ISmartNodeServiceProvider) *ServiceHandler { h := &ServiceHandler{ logger: logger, ctx: ctx, diff --git a/rocketpool-daemon/api/service/restart-vc.go b/rocketpool-daemon/api/service/restart-vc.go index a1434eb5f..c827203de 100644 --- a/rocketpool-daemon/api/service/restart-vc.go +++ b/rocketpool-daemon/api/service/restart-vc.go @@ -29,7 +29,7 @@ func (f *serviceRestartVcContextFactory) Create(args url.Values) (*serviceRestar func (f *serviceRestartVcContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*serviceRestartVcContext, types.SuccessData]( - router, "restart-vc", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "restart-vc", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/service/terminate-data-folder.go b/rocketpool-daemon/api/service/terminate-data-folder.go index c1a434d92..2fdde71d8 100644 --- a/rocketpool-daemon/api/service/terminate-data-folder.go +++ b/rocketpool-daemon/api/service/terminate-data-folder.go @@ -36,7 +36,7 @@ func (f *serviceTerminateDataFolderContextFactory) Create(args url.Values) (*ser func (f *serviceTerminateDataFolderContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*serviceTerminateDataFolderContext, api.ServiceTerminateDataFolderData]( - router, "terminate-data-folder", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "terminate-data-folder", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/service/version.go b/rocketpool-daemon/api/service/version.go index db1390c8a..b3e194c34 100644 --- a/rocketpool-daemon/api/service/version.go +++ b/rocketpool-daemon/api/service/version.go @@ -28,7 +28,7 @@ func (f *serviceVersionContextFactory) Create(args url.Values) (*serviceVersionC func (f *serviceVersionContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*serviceVersionContext, api.ServiceVersionData]( - router, "version", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "version", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/tx/batch-sign-txs.go b/rocketpool-daemon/api/tx/batch-sign-txs.go index b1845ce08..b0adbe86d 100644 --- a/rocketpool-daemon/api/tx/batch-sign-txs.go +++ b/rocketpool-daemon/api/tx/batch-sign-txs.go @@ -48,7 +48,7 @@ func (f *txBatchSignTxsContextFactory) Create(body api.BatchSubmitTxsBody) (*txB func (f *txBatchSignTxsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessPost[*txBatchSignTxsContext, api.BatchSubmitTxsBody, api.TxBatchSignTxData]( - router, "batch-sign-txs", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "batch-sign-txs", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/tx/batch-submit-txs.go b/rocketpool-daemon/api/tx/batch-submit-txs.go index 4bac1a7cf..8afe3253e 100644 --- a/rocketpool-daemon/api/tx/batch-submit-txs.go +++ b/rocketpool-daemon/api/tx/batch-submit-txs.go @@ -47,7 +47,7 @@ func (f *txBatchSubmitTxsContextFactory) Create(body api.BatchSubmitTxsBody) (*t func (f *txBatchSubmitTxsContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessPost[*txBatchSubmitTxsContext, api.BatchSubmitTxsBody, api.BatchTxData]( - router, "batch-submit-txs", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "batch-submit-txs", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/tx/handler.go b/rocketpool-daemon/api/tx/handler.go index c78aaccf2..8cd53a023 100644 --- a/rocketpool-daemon/api/tx/handler.go +++ b/rocketpool-daemon/api/tx/handler.go @@ -13,11 +13,11 @@ import ( type TxHandler struct { logger *log.Logger ctx context.Context - serviceProvider *services.ServiceProvider + serviceProvider services.ISmartNodeServiceProvider factories []server.IContextFactory } -func NewTxHandler(logger *log.Logger, ctx context.Context, serviceProvider *services.ServiceProvider) *TxHandler { +func NewTxHandler(logger *log.Logger, ctx context.Context, serviceProvider services.ISmartNodeServiceProvider) *TxHandler { h := &TxHandler{ logger: logger, ctx: ctx, diff --git a/rocketpool-daemon/api/tx/sign-tx.go b/rocketpool-daemon/api/tx/sign-tx.go index c4270d4d4..71b657e65 100644 --- a/rocketpool-daemon/api/tx/sign-tx.go +++ b/rocketpool-daemon/api/tx/sign-tx.go @@ -44,7 +44,7 @@ func (f *txSignTxContextFactory) Create(body api.SubmitTxBody) (*txSignTxContext func (f *txSignTxContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessPost[*txSignTxContext, api.SubmitTxBody, api.TxSignTxData]( - router, "sign-tx", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "sign-tx", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/tx/submit-tx.go b/rocketpool-daemon/api/tx/submit-tx.go index a34619c90..625489a41 100644 --- a/rocketpool-daemon/api/tx/submit-tx.go +++ b/rocketpool-daemon/api/tx/submit-tx.go @@ -43,7 +43,7 @@ func (f *txSubmitTxContextFactory) Create(body api.SubmitTxBody) (*txSubmitTxCon func (f *txSubmitTxContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessPost[*txSubmitTxContext, api.SubmitTxBody, api.TxData]( - router, "submit-tx", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "submit-tx", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/tx/wait.go b/rocketpool-daemon/api/tx/wait.go index 201f3d669..c16e3a805 100644 --- a/rocketpool-daemon/api/tx/wait.go +++ b/rocketpool-daemon/api/tx/wait.go @@ -35,7 +35,7 @@ func (f *txWaitContextFactory) Create(args url.Values) (*txWaitContext, error) { func (f *txWaitContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*txWaitContext, types.SuccessData]( - router, "wait", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "wait", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/create-validator-key.go b/rocketpool-daemon/api/wallet/create-validator-key.go index f57be6520..330b1b161 100644 --- a/rocketpool-daemon/api/wallet/create-validator-key.go +++ b/rocketpool-daemon/api/wallet/create-validator-key.go @@ -35,7 +35,7 @@ func (f *walletCreateValidatorKeyContextFactory) Create(args url.Values) (*walle func (f *walletCreateValidatorKeyContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletCreateValidatorKeyContext, types.SuccessData]( - router, "create-validator-key", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "create-validator-key", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/delete-password.go b/rocketpool-daemon/api/wallet/delete-password.go index 471e66a20..35f019e42 100644 --- a/rocketpool-daemon/api/wallet/delete-password.go +++ b/rocketpool-daemon/api/wallet/delete-password.go @@ -28,7 +28,7 @@ func (f *walletDeletePasswordContextFactory) Create(args url.Values) (*walletDel func (f *walletDeletePasswordContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletDeletePasswordContext, types.SuccessData]( - router, "delete-password", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "delete-password", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/export-eth-key.go b/rocketpool-daemon/api/wallet/export-eth-key.go index 628d74d44..2f429e76d 100644 --- a/rocketpool-daemon/api/wallet/export-eth-key.go +++ b/rocketpool-daemon/api/wallet/export-eth-key.go @@ -30,7 +30,7 @@ func (f *walletExportEthKeyContextFactory) Create(args url.Values) (*walletExpor func (f *walletExportEthKeyContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletExportEthKeyContext, api.WalletExportEthKeyData]( - router, "export-eth-key", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "export-eth-key", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/export.go b/rocketpool-daemon/api/wallet/export.go index a08a3c1bc..14ab673e6 100644 --- a/rocketpool-daemon/api/wallet/export.go +++ b/rocketpool-daemon/api/wallet/export.go @@ -29,7 +29,7 @@ func (f *walletExportContextFactory) Create(args url.Values) (*walletExportConte func (f *walletExportContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletExportContext, api.WalletExportData]( - router, "export", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "export", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/handler.go b/rocketpool-daemon/api/wallet/handler.go index 93f7bf74d..08729869c 100644 --- a/rocketpool-daemon/api/wallet/handler.go +++ b/rocketpool-daemon/api/wallet/handler.go @@ -13,11 +13,11 @@ import ( type WalletHandler struct { logger *log.Logger ctx context.Context - serviceProvider *services.ServiceProvider + serviceProvider services.ISmartNodeServiceProvider factories []server.IContextFactory } -func NewWalletHandler(logger *log.Logger, ctx context.Context, serviceProvider *services.ServiceProvider) *WalletHandler { +func NewWalletHandler(logger *log.Logger, ctx context.Context, serviceProvider services.ISmartNodeServiceProvider) *WalletHandler { h := &WalletHandler{ logger: logger, ctx: ctx, diff --git a/rocketpool-daemon/api/wallet/initialize.go b/rocketpool-daemon/api/wallet/initialize.go index ed990ef1e..4d3a5998f 100644 --- a/rocketpool-daemon/api/wallet/initialize.go +++ b/rocketpool-daemon/api/wallet/initialize.go @@ -40,7 +40,7 @@ func (f *walletInitializeContextFactory) Create(args url.Values) (*walletInitial func (f *walletInitializeContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletInitializeContext, api.WalletInitializeData]( - router, "initialize", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "initialize", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/masquerade.go b/rocketpool-daemon/api/wallet/masquerade.go index 84dfae26d..a35d4ce03 100644 --- a/rocketpool-daemon/api/wallet/masquerade.go +++ b/rocketpool-daemon/api/wallet/masquerade.go @@ -33,7 +33,7 @@ func (f *walletMasqueradeContextFactory) Create(args url.Values) (*walletMasquer func (f *walletMasqueradeContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletMasqueradeContext, types.SuccessData]( - router, "masquerade", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "masquerade", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/rebuild.go b/rocketpool-daemon/api/wallet/rebuild.go index a4ac22ea1..e7f944543 100644 --- a/rocketpool-daemon/api/wallet/rebuild.go +++ b/rocketpool-daemon/api/wallet/rebuild.go @@ -29,7 +29,7 @@ func (f *walletRebuildContextFactory) Create(args url.Values) (*walletRebuildCon func (f *walletRebuildContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletRebuildContext, api.WalletRebuildData]( - router, "rebuild", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "rebuild", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/recover.go b/rocketpool-daemon/api/wallet/recover.go index eef75b4fd..87b588a65 100644 --- a/rocketpool-daemon/api/wallet/recover.go +++ b/rocketpool-daemon/api/wallet/recover.go @@ -40,7 +40,7 @@ func (f *walletRecoverContextFactory) Create(args url.Values) (*walletRecoverCon func (f *walletRecoverContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletRecoverContext, api.WalletRecoverData]( - router, "recover", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "recover", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/restore-address.go b/rocketpool-daemon/api/wallet/restore-address.go index 133a7785b..e3a60421c 100644 --- a/rocketpool-daemon/api/wallet/restore-address.go +++ b/rocketpool-daemon/api/wallet/restore-address.go @@ -27,7 +27,7 @@ func (f *walletRestoreAddressContextFactory) Create(args url.Values) (*walletRes func (f *walletRestoreAddressContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletRestoreAddressContext, types.SuccessData]( - router, "restore-address", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "restore-address", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/search-and-recover.go b/rocketpool-daemon/api/wallet/search-and-recover.go index 4eb035a5d..eb08acaf2 100644 --- a/rocketpool-daemon/api/wallet/search-and-recover.go +++ b/rocketpool-daemon/api/wallet/search-and-recover.go @@ -44,7 +44,7 @@ func (f *walletSearchAndRecoverContextFactory) Create(args url.Values) (*walletS func (f *walletSearchAndRecoverContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletSearchAndRecoverContext, api.WalletSearchAndRecoverData]( - router, "search-and-recover", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "search-and-recover", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -64,7 +64,7 @@ type walletSearchAndRecoverContext struct { func (c *walletSearchAndRecoverContext) PrepareData(data *api.WalletSearchAndRecoverData, opts *bind.TransactOpts) (types.ResponseStatus, error) { sp := c.handler.serviceProvider w := sp.GetWallet() - rs := sp.GetNetworkResources() + rs := sp.GetResources() vMgr := sp.GetValidatorManager() // Requirements diff --git a/rocketpool-daemon/api/wallet/send-message.go b/rocketpool-daemon/api/wallet/send-message.go index b3d4f2ceb..15397ebb3 100644 --- a/rocketpool-daemon/api/wallet/send-message.go +++ b/rocketpool-daemon/api/wallet/send-message.go @@ -35,7 +35,7 @@ func (f *walletSendMessageContextFactory) Create(args url.Values) (*walletSendMe func (f *walletSendMessageContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletSendMessageContext, types.TxInfoData]( - router, "send-message", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "send-message", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/set-ens-name.go b/rocketpool-daemon/api/wallet/set-ens-name.go index cc18abd22..4c8586aef 100644 --- a/rocketpool-daemon/api/wallet/set-ens-name.go +++ b/rocketpool-daemon/api/wallet/set-ens-name.go @@ -33,7 +33,7 @@ func (f *walletSetEnsNameContextFactory) Create(args url.Values) (*walletSetEnsN func (f *walletSetEnsNameContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletSetEnsNameContext, api.WalletSetEnsNameData]( - router, "set-ens-name", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "set-ens-name", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/set-password.go b/rocketpool-daemon/api/wallet/set-password.go index a7d51f312..05b8c8a3b 100644 --- a/rocketpool-daemon/api/wallet/set-password.go +++ b/rocketpool-daemon/api/wallet/set-password.go @@ -33,7 +33,7 @@ func (f *walletSetPasswordContextFactory) Create(args url.Values) (*walletSetPas func (f *walletSetPasswordContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletSetPasswordContext, types.SuccessData]( - router, "set-password", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "set-password", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/sign-message.go b/rocketpool-daemon/api/wallet/sign-message.go index 15893beaa..e81f2bd65 100644 --- a/rocketpool-daemon/api/wallet/sign-message.go +++ b/rocketpool-daemon/api/wallet/sign-message.go @@ -35,7 +35,7 @@ func (f *walletSignMessageContextFactory) Create(args url.Values) (*walletSignMe func (f *walletSignMessageContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletSignMessageContext, api.WalletSignMessageData]( - router, "sign-message", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "sign-message", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/sign-tx.go b/rocketpool-daemon/api/wallet/sign-tx.go index 610d7a5b4..a2c4e7304 100644 --- a/rocketpool-daemon/api/wallet/sign-tx.go +++ b/rocketpool-daemon/api/wallet/sign-tx.go @@ -34,7 +34,7 @@ func (f *walletSignTxContextFactory) Create(args url.Values) (*walletSignTxConte func (f *walletSignTxContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletSignTxContext, api.WalletSignTxData]( - router, "sign-tx", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "sign-tx", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/status.go b/rocketpool-daemon/api/wallet/status.go index 2fcc8632d..68562af28 100644 --- a/rocketpool-daemon/api/wallet/status.go +++ b/rocketpool-daemon/api/wallet/status.go @@ -28,7 +28,7 @@ func (f *walletStatusFactory) Create(args url.Values) (*walletStatusContext, err func (f *walletStatusFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletStatusContext, api.WalletStatusData]( - router, "status", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "status", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } diff --git a/rocketpool-daemon/api/wallet/test-recover.go b/rocketpool-daemon/api/wallet/test-recover.go index 6dff94967..8c5e9f873 100644 --- a/rocketpool-daemon/api/wallet/test-recover.go +++ b/rocketpool-daemon/api/wallet/test-recover.go @@ -39,7 +39,7 @@ func (f *walletTestRecoverContextFactory) Create(args url.Values) (*walletTestRe func (f *walletTestRecoverContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletTestRecoverContext, api.WalletRecoverData]( - router, "test-recover", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "test-recover", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -57,7 +57,7 @@ type walletTestRecoverContext struct { func (c *walletTestRecoverContext) PrepareData(data *api.WalletRecoverData, opts *bind.TransactOpts) (types.ResponseStatus, error) { sp := c.handler.serviceProvider - rs := sp.GetNetworkResources() + rs := sp.GetResources() vMgr := sp.GetValidatorManager() if !c.skipValidatorKeyRecovery { diff --git a/rocketpool-daemon/api/wallet/test-search-and-recover.go b/rocketpool-daemon/api/wallet/test-search-and-recover.go index 6d4cd708a..4f64d2d94 100644 --- a/rocketpool-daemon/api/wallet/test-search-and-recover.go +++ b/rocketpool-daemon/api/wallet/test-search-and-recover.go @@ -38,7 +38,7 @@ func (f *walletTestSearchAndRecoverContextFactory) Create(args url.Values) (*wal func (f *walletTestSearchAndRecoverContextFactory) RegisterRoute(router *mux.Router) { server.RegisterQuerylessGet[*walletTestSearchAndRecoverContext, api.WalletSearchAndRecoverData]( - router, "test-search-and-recover", f, f.handler.logger.Logger, f.handler.serviceProvider.ServiceProvider, + router, "test-search-and-recover", f, f.handler.logger.Logger, f.handler.serviceProvider, ) } @@ -55,7 +55,7 @@ type walletTestSearchAndRecoverContext struct { func (c *walletTestSearchAndRecoverContext) PrepareData(data *api.WalletSearchAndRecoverData, opts *bind.TransactOpts) (types.ResponseStatus, error) { sp := c.handler.serviceProvider - rs := sp.GetNetworkResources() + rs := sp.GetResources() vMgr := sp.GetValidatorManager() if !c.skipValidatorKeyRecovery { diff --git a/rocketpool-daemon/common/eth1/eth1.go b/rocketpool-daemon/common/eth1/eth1.go index ce6d3e2ee..921a64293 100644 --- a/rocketpool-daemon/common/eth1/eth1.go +++ b/rocketpool-daemon/common/eth1/eth1.go @@ -17,9 +17,8 @@ import ( ) // Determines if the primary EC can be used for historical queries, or if the Archive EC is required -func GetBestApiClient(primary *rocketpool.RocketPool, cfg *config.SmartNodeConfig, logger *slog.Logger, blockNumber *big.Int) (*rocketpool.RocketPool, error) { +func GetBestApiClient(primary *rocketpool.RocketPool, cfg *config.SmartNodeConfig, resources *config.MergedResources, logger *slog.Logger, blockNumber *big.Int) (*rocketpool.RocketPool, error) { client := primary - resources := cfg.GetRocketPoolResources() // Try getting the rETH address as a canary to see if the block is available opts := &bind.CallOpts{ diff --git a/rocketpool-daemon/common/proposals/proposal-manager.go b/rocketpool-daemon/common/proposals/proposal-manager.go index df68e4b3b..0fda1cdd8 100644 --- a/rocketpool-daemon/common/proposals/proposal-manager.go +++ b/rocketpool-daemon/common/proposals/proposal-manager.go @@ -28,7 +28,7 @@ type ProposalManager struct { bc beacon.IBeaconClient } -func NewProposalManager(context context.Context, logger *slog.Logger, cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, bc beacon.IBeaconClient) (*ProposalManager, error) { +func NewProposalManager(context context.Context, logger *slog.Logger, cfg *config.SmartNodeConfig, res *config.MergedResources, rp *rocketpool.RocketPool, bc beacon.IBeaconClient) (*ProposalManager, error) { viSnapshotMgr, err := NewVotingInfoSnapshotManager(logger, cfg, rp) if err != nil { return nil, fmt.Errorf("error creating voting info manager: %w", err) @@ -44,7 +44,7 @@ func NewProposalManager(context context.Context, logger *slog.Logger, cfg *confi return nil, fmt.Errorf("error creating node tree manager: %w", err) } - stateMgr, err := state.NewNetworkStateManager(context, rp, cfg, rp.Client, bc, logger) + stateMgr, err := state.NewNetworkStateManager(context, rp, cfg, res, rp.Client, bc, logger) if err != nil { return nil, fmt.Errorf("error creating network state manager: %w", err) } diff --git a/rocketpool-daemon/common/rewards/generator-impl-v8-rolling.go b/rocketpool-daemon/common/rewards/generator-impl-v8-rolling.go index 5bd2c2231..d9396940c 100644 --- a/rocketpool-daemon/common/rewards/generator-impl-v8-rolling.go +++ b/rocketpool-daemon/common/rewards/generator-impl-v8-rolling.go @@ -33,6 +33,7 @@ type treeGeneratorImpl_v8_rolling struct { logger *slog.Logger rp *rocketpool.RocketPool cfg *config.SmartNodeConfig + res *config.MergedResources bc beacon.IBeaconClient opts *bind.CallOpts smoothingPoolBalance *big.Int @@ -96,12 +97,13 @@ func (r *treeGeneratorImpl_v8_rolling) getRulesetVersion() uint64 { return r.rewardsFile.RulesetVersion } -func (r *treeGeneratorImpl_v8_rolling) generateTree(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, bc beacon.IBeaconClient) (sharedtypes.IRewardsFile, error) { +func (r *treeGeneratorImpl_v8_rolling) generateTree(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, res *config.MergedResources, bc beacon.IBeaconClient) (sharedtypes.IRewardsFile, error) { r.logger.Info("Started rewards tree generation.", slog.Uint64(keys.RulesetKey, r.rewardsFile.RulesetVersion)) // Provision some struct params r.rp = rp r.cfg = cfg + r.res = res r.bc = bc r.validNetworkCache = map[uint64]bool{ 0: true, @@ -166,11 +168,12 @@ func (r *treeGeneratorImpl_v8_rolling) generateTree(context context.Context, rp // Quickly calculates an approximate of the staker's share of the smoothing pool balance without processing Beacon performance // Used for approximate returns in the rETH ratio update -func (r *treeGeneratorImpl_v8_rolling) approximateStakerShareOfSmoothingPool(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, bc beacon.IBeaconClient) (*big.Int, error) { +func (r *treeGeneratorImpl_v8_rolling) approximateStakerShareOfSmoothingPool(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, res *config.MergedResources, bc beacon.IBeaconClient) (*big.Int, error) { r.logger.Info("Approximating rewards tree.", slog.Uint64(keys.RulesetKey, r.rewardsFile.RulesetVersion)) r.rp = rp r.cfg = cfg + r.res = res r.bc = bc r.validNetworkCache = map[uint64]bool{ 0: true, diff --git a/rocketpool-daemon/common/rewards/generator-impl-v8.go b/rocketpool-daemon/common/rewards/generator-impl-v8.go index 2a634dedd..4ba338353 100644 --- a/rocketpool-daemon/common/rewards/generator-impl-v8.go +++ b/rocketpool-daemon/common/rewards/generator-impl-v8.go @@ -36,6 +36,7 @@ type treeGeneratorImpl_v8 struct { logger *slog.Logger rp *rocketpool.RocketPool cfg *config.SmartNodeConfig + res *config.MergedResources bc beacon.IBeaconClient opts *bind.CallOpts nodeDetails []*NodeSmoothingDetails @@ -103,12 +104,13 @@ func (r *treeGeneratorImpl_v8) getRulesetVersion() uint64 { return r.rewardsFile.RulesetVersion } -func (r *treeGeneratorImpl_v8) generateTree(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, bc beacon.IBeaconClient) (sharedtypes.IRewardsFile, error) { +func (r *treeGeneratorImpl_v8) generateTree(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, res *config.MergedResources, bc beacon.IBeaconClient) (sharedtypes.IRewardsFile, error) { r.logger.Info("Started rewards tree generation.", slog.Uint64(keys.RulesetKey, r.rewardsFile.RulesetVersion)) // Provision some struct params r.rp = rp r.cfg = cfg + r.res = res r.bc = bc r.validNetworkCache = map[uint64]bool{ 0: true, @@ -174,11 +176,12 @@ func (r *treeGeneratorImpl_v8) generateTree(context context.Context, rp *rocketp // Quickly calculates an approximate of the staker's share of the smoothing pool balance without processing Beacon performance // Used for approximate returns in the rETH ratio update -func (r *treeGeneratorImpl_v8) approximateStakerShareOfSmoothingPool(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, bc beacon.IBeaconClient) (*big.Int, error) { +func (r *treeGeneratorImpl_v8) approximateStakerShareOfSmoothingPool(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, res *config.MergedResources, bc beacon.IBeaconClient) (*big.Int, error) { r.logger.Info("Approximating rewards tree.", slog.Uint64(keys.RulesetKey, r.rewardsFile.RulesetVersion)) r.rp = rp r.cfg = cfg + r.res = res r.bc = bc r.validNetworkCache = map[uint64]bool{ 0: true, @@ -524,7 +527,7 @@ func (r *treeGeneratorImpl_v8) calculateEthRewards(context context.Context, chec // Get the start time of this interval based on the event from the previous one //previousIntervalEvent, err := GetRewardSnapshotEvent(r.rp, r.cfg, r.rewardsFile.Index-1, r.opts) // This is immutable so querying at the head is fine and mitigates issues around calls for pruned EL state - previousIntervalEvent, err := GetRewardSnapshotEvent(r.rp, r.cfg, r.rewardsFile.Index-1, nil) + previousIntervalEvent, err := GetRewardSnapshotEvent(r.rp, r.cfg, r.res, r.rewardsFile.Index-1, nil) if err != nil { return err } diff --git a/rocketpool-daemon/common/rewards/generator.go b/rocketpool-daemon/common/rewards/generator.go index ebc0291d7..bef9044c5 100644 --- a/rocketpool-daemon/common/rewards/generator.go +++ b/rocketpool-daemon/common/rewards/generator.go @@ -53,6 +53,7 @@ type TreeGenerator struct { logger *slog.Logger rp *rocketpool.RocketPool cfg *config.SmartNodeConfig + res *config.MergedResources bc beacon.IBeaconClient index uint64 startTime time.Time @@ -65,16 +66,17 @@ type TreeGenerator struct { } type treeGeneratorImpl interface { - generateTree(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, bc beacon.IBeaconClient) (sharedtypes.IRewardsFile, error) - approximateStakerShareOfSmoothingPool(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, bc beacon.IBeaconClient) (*big.Int, error) + generateTree(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, res *config.MergedResources, bc beacon.IBeaconClient) (sharedtypes.IRewardsFile, error) + approximateStakerShareOfSmoothingPool(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, res *config.MergedResources, bc beacon.IBeaconClient) (*big.Int, error) getRulesetVersion() uint64 } -func NewTreeGenerator(logger *slog.Logger, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, bc beacon.IBeaconClient, index uint64, startTime time.Time, endTime time.Time, consensusBlock uint64, elSnapshotHeader *types.Header, intervalsPassed uint64, state *state.NetworkState, rollingRecord *RollingRecord) (*TreeGenerator, error) { +func NewTreeGenerator(logger *slog.Logger, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, res *config.MergedResources, bc beacon.IBeaconClient, index uint64, startTime time.Time, endTime time.Time, consensusBlock uint64, elSnapshotHeader *types.Header, intervalsPassed uint64, state *state.NetworkState, rollingRecord *RollingRecord) (*TreeGenerator, error) { t := &TreeGenerator{ logger: logger, rp: rp, cfg: cfg, + res: res, bc: bc, index: index, startTime: startTime, @@ -196,11 +198,11 @@ func NewTreeGenerator(logger *slog.Logger, rp *rocketpool.RocketPool, cfg *confi } func (t *TreeGenerator) GenerateTree(context context.Context) (sharedtypes.IRewardsFile, error) { - return t.generatorImpl.generateTree(context, t.rp, t.cfg, t.bc) + return t.generatorImpl.generateTree(context, t.rp, t.cfg, t.res, t.bc) } func (t *TreeGenerator) ApproximateStakerShareOfSmoothingPool(context context.Context) (*big.Int, error) { - return t.approximatorImpl.approximateStakerShareOfSmoothingPool(context, t.rp, t.cfg, t.bc) + return t.approximatorImpl.approximateStakerShareOfSmoothingPool(context, t.rp, t.cfg, t.res, t.bc) } func (t *TreeGenerator) GetGeneratorRulesetVersion() uint64 { @@ -220,7 +222,7 @@ func (t *TreeGenerator) GenerateTreeWithRuleset(context context.Context, ruleset if info.generator == nil { return nil, fmt.Errorf("ruleset v%d is obsolete and no longer supported by this Smart Node", ruleset) } - return info.generator.generateTree(context, t.rp, t.cfg, t.bc) + return info.generator.generateTree(context, t.rp, t.cfg, t.res, t.bc) } func (t *TreeGenerator) ApproximateStakerShareOfSmoothingPoolWithRuleset(context context.Context, ruleset uint64) (*big.Int, error) { @@ -232,7 +234,7 @@ func (t *TreeGenerator) ApproximateStakerShareOfSmoothingPoolWithRuleset(context if info.generator == nil { return nil, fmt.Errorf("ruleset v%d is obsolete and no longer supported by this Smart Node", ruleset) } - return info.generator.approximateStakerShareOfSmoothingPool(context, t.rp, t.cfg, t.bc) + return info.generator.approximateStakerShareOfSmoothingPool(context, t.rp, t.cfg, t.res, t.bc) } // Gets the ruleset to use for rewards calculation and rewards approximation respectively for a given interval diff --git a/rocketpool-daemon/common/rewards/rolling-manager.go b/rocketpool-daemon/common/rewards/rolling-manager.go index a35a8e93f..81187ba14 100644 --- a/rocketpool-daemon/common/rewards/rolling-manager.go +++ b/rocketpool-daemon/common/rewards/rolling-manager.go @@ -41,6 +41,7 @@ type RollingRecordManager struct { logger *slog.Logger cfg *config.SmartNodeConfig + res *config.MergedResources rp *rocketpool.RocketPool bc beacon.IBeaconClient mgr *state.NetworkStateManager @@ -55,7 +56,7 @@ type RollingRecordManager struct { } // Creates a new manager for rolling records. -func NewRollingRecordManager(logger *slog.Logger, cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, bc beacon.IBeaconClient, mgr *state.NetworkStateManager, startSlot uint64, beaconCfg beacon.Eth2Config, rewardsInterval uint64) (*RollingRecordManager, error) { +func NewRollingRecordManager(logger *slog.Logger, cfg *config.SmartNodeConfig, res *config.MergedResources, rp *rocketpool.RocketPool, bc beacon.IBeaconClient, mgr *state.NetworkStateManager, startSlot uint64, beaconCfg beacon.Eth2Config, rewardsInterval uint64) (*RollingRecordManager, error) { // Get the Beacon genesis time genesisTime := time.Unix(int64(beaconCfg.GenesisTime), 0) @@ -94,6 +95,7 @@ func NewRollingRecordManager(logger *slog.Logger, cfg *config.SmartNodeConfig, r logger: sublogger, cfg: cfg, + res: res, rp: rp, bc: bc, mgr: mgr, @@ -619,8 +621,7 @@ func (r *RollingRecordManager) createNewRecord(context context.Context, state *s currentIndex := rewardsPool.RewardIndex.Formatted() // Get the last rewards event and starting epoch - resources := r.cfg.GetRocketPoolResources() - found, event, err := rewardsPool.GetRewardsEvent(r.rp, currentIndex-1, resources.PreviousRewardsPoolAddresses, nil) + found, event, err := rewardsPool.GetRewardsEvent(r.rp, currentIndex-1, r.res.PreviousRewardsPoolAddresses, nil) if err != nil { return fmt.Errorf("error getting event for rewards interval %d: %w", currentIndex-1, err) } diff --git a/rocketpool-daemon/common/rewards/utils.go b/rocketpool-daemon/common/rewards/utils.go index 470229fd8..c93500a9f 100644 --- a/rocketpool-daemon/common/rewards/utils.go +++ b/rocketpool-daemon/common/rewards/utils.go @@ -95,12 +95,12 @@ func GetClaimStatus(rp *rocketpool.RocketPool, nodeAddress common.Address, curre } // Gets the information for an interval including the file status, the validity, and the node's rewards -func GetIntervalInfo(rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, nodeAddress common.Address, interval uint64, opts *bind.CallOpts) (info sharedtypes.IntervalInfo, err error) { +func GetIntervalInfo(rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, resources *config.MergedResources, nodeAddress common.Address, interval uint64, opts *bind.CallOpts) (info sharedtypes.IntervalInfo, err error) { info.Index = interval var event rewards.RewardsEvent // Get the event details for this interval - event, err = GetRewardSnapshotEvent(rp, cfg, interval, opts) + event, err = GetRewardSnapshotEvent(rp, cfg, resources, interval, opts) if err != nil { return } @@ -161,8 +161,7 @@ func GetIntervalInfo(rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, nod } // Get the event for a rewards snapshot -func GetRewardSnapshotEvent(rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, interval uint64, opts *bind.CallOpts) (rewards.RewardsEvent, error) { - resources := cfg.GetRocketPoolResources() +func GetRewardSnapshotEvent(rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, resources *config.MergedResources, interval uint64, opts *bind.CallOpts) (rewards.RewardsEvent, error) { rewardsPool, err := rewards.NewRewardsPool(rp) if err != nil { return rewards.RewardsEvent{}, fmt.Errorf("error getting rewards pool binding: %w", err) diff --git a/rocketpool-daemon/common/services/requirements.go b/rocketpool-daemon/common/services/requirements.go index f26560adf..a1f56789d 100644 --- a/rocketpool-daemon/common/services/requirements.go +++ b/rocketpool-daemon/common/services/requirements.go @@ -50,20 +50,20 @@ var ( // === Requirements === // ==================== -func (sp *ServiceProvider) RequireRocketPoolContracts(ctx context.Context) (types.ResponseStatus, error) { - err := sp.RequireEthClientSynced(ctx) +func (p *SmartNodeServiceProvider) RequireRocketPoolContracts(ctx context.Context) (types.ResponseStatus, error) { + err := p.RequireEthClientSynced(ctx) if err != nil { return types.ResponseStatus_ClientsNotSynced, err } - err = sp.RefreshRocketPoolContracts() + err = p.RefreshRocketPoolContracts() if err != nil { return types.ResponseStatus_Error, err } return types.ResponseStatus_Success, nil } -func (sp *ServiceProvider) RequireEthClientSynced(ctx context.Context) error { - synced, _, err := sp.checkExecutionClientStatus(ctx) +func (p *SmartNodeServiceProvider) RequireEthClientSynced(ctx context.Context) error { + synced, _, err := p.checkExecutionClientStatus(ctx) if err != nil { return err } @@ -73,8 +73,8 @@ func (sp *ServiceProvider) RequireEthClientSynced(ctx context.Context) error { return errors.New("The Execution client is currently syncing. Please try again later.") } -func (sp *ServiceProvider) RequireBeaconClientSynced(ctx context.Context) error { - synced, err := sp.checkBeaconClientStatus(ctx) +func (p *SmartNodeServiceProvider) RequireBeaconClientSynced(ctx context.Context) error { + synced, err := p.checkBeaconClientStatus(ctx) if err != nil { return err } @@ -85,19 +85,19 @@ func (sp *ServiceProvider) RequireBeaconClientSynced(ctx context.Context) error } // Wait for the Executon client to sync; timeout of 0 indicates no timeout -func (sp *ServiceProvider) WaitEthClientSynced(ctx context.Context, verbose bool) error { - _, err := sp.waitEthClientSynced(ctx, verbose) +func (p *SmartNodeServiceProvider) WaitEthClientSynced(ctx context.Context, verbose bool) error { + _, err := p.waitEthClientSynced(ctx, verbose) return err } // Wait for the Beacon client to sync; timeout of 0 indicates no timeout -func (sp *ServiceProvider) WaitBeaconClientSynced(ctx context.Context, verbose bool) error { - _, err := sp.waitBeaconClientSynced(ctx, verbose) +func (p *SmartNodeServiceProvider) WaitBeaconClientSynced(ctx context.Context, verbose bool) error { + _, err := p.waitBeaconClientSynced(ctx, verbose) return err } -func (sp *ServiceProvider) RequireNodeAddress() error { - status, err := sp.GetWallet().GetStatus() +func (p *SmartNodeServiceProvider) RequireNodeAddress() error { + status, err := p.GetWallet().GetStatus() if err != nil { return err } @@ -107,22 +107,22 @@ func (sp *ServiceProvider) RequireNodeAddress() error { return nil } -func (sp *ServiceProvider) RequireWalletReady() error { - status, err := sp.GetWallet().GetStatus() +func (p *SmartNodeServiceProvider) RequireWalletReady() error { + status, err := p.GetWallet().GetStatus() if err != nil { return err } return utils.CheckIfWalletReady(status) } -func (sp *ServiceProvider) RequireNodeRegistered(ctx context.Context) (types.ResponseStatus, error) { - if err := sp.RequireNodeAddress(); err != nil { +func (p *SmartNodeServiceProvider) RequireNodeRegistered(ctx context.Context) (types.ResponseStatus, error) { + if err := p.RequireNodeAddress(); err != nil { return types.ResponseStatus_AddressNotPresent, err } - if status, err := sp.RequireRocketPoolContracts(ctx); err != nil { + if status, err := p.RequireRocketPoolContracts(ctx); err != nil { return status, err } - nodeRegistered, err := sp.getNodeRegistered() + nodeRegistered, err := p.getNodeRegistered() if err != nil { return types.ResponseStatus_Error, err } @@ -132,22 +132,22 @@ func (sp *ServiceProvider) RequireNodeRegistered(ctx context.Context) (types.Res return types.ResponseStatus_Success, nil } -func (sp *ServiceProvider) RequireSnapshot() error { - if sp.snapshotDelegation == nil { - network := string(sp.cfg.Network.Value) +func (p *SmartNodeServiceProvider) RequireSnapshot() error { + if p.snapshotDelegation == nil { + network := string(p.cfg.Network.Value) return fmt.Errorf("Snapshot voting is not available on the %s network.", network) } return nil } -func (sp *ServiceProvider) RequireOnOracleDao(ctx context.Context) (types.ResponseStatus, error) { - if err := sp.RequireNodeAddress(); err != nil { +func (p *SmartNodeServiceProvider) RequireOnOracleDao(ctx context.Context) (types.ResponseStatus, error) { + if err := p.RequireNodeAddress(); err != nil { return types.ResponseStatus_AddressNotPresent, err } - if status, err := sp.RequireRocketPoolContracts(ctx); err != nil { + if status, err := p.RequireRocketPoolContracts(ctx); err != nil { return status, err } - nodeTrusted, err := sp.isMemberOfOracleDao() + nodeTrusted, err := p.isMemberOfOracleDao() if err != nil { return types.ResponseStatus_Error, err } @@ -157,14 +157,14 @@ func (sp *ServiceProvider) RequireOnOracleDao(ctx context.Context) (types.Respon return types.ResponseStatus_Success, nil } -func (sp *ServiceProvider) RequireOnSecurityCouncil(ctx context.Context) (types.ResponseStatus, error) { - if err := sp.RequireNodeAddress(); err != nil { +func (p *SmartNodeServiceProvider) RequireOnSecurityCouncil(ctx context.Context) (types.ResponseStatus, error) { + if err := p.RequireNodeAddress(); err != nil { return types.ResponseStatus_AddressNotPresent, err } - if status, err := sp.RequireRocketPoolContracts(ctx); err != nil { + if status, err := p.RequireRocketPoolContracts(ctx); err != nil { return status, err } - nodeTrusted, err := sp.isMemberOfSecurityCouncil() + nodeTrusted, err := p.isMemberOfSecurityCouncil() if err != nil { return types.ResponseStatus_Error, err } @@ -178,7 +178,7 @@ func (sp *ServiceProvider) RequireOnSecurityCouncil(ctx context.Context) (types. // === Service Synchronization === // =============================== -func (sp *ServiceProvider) WaitNodeAddress(ctx context.Context, verbose bool) error { +func (p *SmartNodeServiceProvider) WaitNodeAddress(ctx context.Context, verbose bool) error { // Get the logger logger, exists := log.FromContext(ctx) if !exists { @@ -186,7 +186,7 @@ func (sp *ServiceProvider) WaitNodeAddress(ctx context.Context, verbose bool) er } for { - status, err := sp.GetWallet().GetStatus() + status, err := p.GetWallet().GetStatus() if err != nil { return err } @@ -207,7 +207,7 @@ func (sp *ServiceProvider) WaitNodeAddress(ctx context.Context, verbose bool) er } } -func (sp *ServiceProvider) WaitWalletReady(ctx context.Context, verbose bool) error { +func (p *SmartNodeServiceProvider) WaitWalletReady(ctx context.Context, verbose bool) error { // Get the logger logger, exists := log.FromContext(ctx) if !exists { @@ -215,7 +215,7 @@ func (sp *ServiceProvider) WaitWalletReady(ctx context.Context, verbose bool) er } for { - status, err := sp.GetWallet().GetStatus() + status, err := p.GetWallet().GetStatus() if err != nil { return err } @@ -249,7 +249,7 @@ func (sp *ServiceProvider) WaitWalletReady(ctx context.Context, verbose bool) er } // Wait until the node has been registered with the Rocket Pool network -func (sp *ServiceProvider) WaitNodeRegistered(ctx context.Context, verbose bool) error { +func (p *SmartNodeServiceProvider) WaitNodeRegistered(ctx context.Context, verbose bool) error { // Get the logger logger, exists := log.FromContext(ctx) if !exists { @@ -258,7 +258,7 @@ func (sp *ServiceProvider) WaitNodeRegistered(ctx context.Context, verbose bool) contractRefreshTime := time.Now() for { - nodeRegistered, err := sp.getNodeRegistered() + nodeRegistered, err := p.getNodeRegistered() if err != nil { return err } @@ -274,7 +274,7 @@ func (sp *ServiceProvider) WaitNodeRegistered(ctx context.Context, verbose bool) // Refresh the contracts if needed to make sure we're polling the latest ones if time.Since(contractRefreshTime) > contractRefreshInterval { - if err := sp.RefreshRocketPoolContracts(); err != nil { + if err := p.RefreshRocketPoolContracts(); err != nil { return fmt.Errorf("error refreshing contract bindings: %w", err) } contractRefreshTime = time.Now() @@ -287,9 +287,9 @@ func (sp *ServiceProvider) WaitNodeRegistered(ctx context.Context, verbose bool) // =============== // Check if the node is registered -func (sp *ServiceProvider) getNodeRegistered() (bool, error) { - rp := sp.rocketPool - address, _ := sp.GetWallet().GetAddress() +func (p *SmartNodeServiceProvider) getNodeRegistered() (bool, error) { + rp := p.rocketPool + address, _ := p.GetWallet().GetAddress() // Create a node binding node, err := node.NewNode(rp, address) @@ -306,9 +306,9 @@ func (sp *ServiceProvider) getNodeRegistered() (bool, error) { } // Check if the node is a member of the oracle DAO -func (sp *ServiceProvider) isMemberOfOracleDao() (bool, error) { - rp := sp.rocketPool - address, _ := sp.GetWallet().GetAddress() +func (p *SmartNodeServiceProvider) isMemberOfOracleDao() (bool, error) { + rp := p.rocketPool + address, _ := p.GetWallet().GetAddress() // Create the bindings node, err := node.NewNode(rp, address) @@ -329,9 +329,9 @@ func (sp *ServiceProvider) isMemberOfOracleDao() (bool, error) { } // Check if the node is a member of the security council -func (sp *ServiceProvider) isMemberOfSecurityCouncil() (bool, error) { - rp := sp.rocketPool - address, _ := sp.GetWallet().GetAddress() +func (p *SmartNodeServiceProvider) isMemberOfSecurityCouncil() (bool, error) { + rp := p.rocketPool + address, _ := p.GetWallet().GetAddress() // Create the bindings node, err := node.NewNode(rp, address) @@ -353,9 +353,9 @@ func (sp *ServiceProvider) isMemberOfSecurityCouncil() (bool, error) { // Check if the primary and fallback Execution clients are synced // TODO: Move this into ec-manager and stop exposing the primary and fallback directly... -func (sp *ServiceProvider) checkExecutionClientStatus(ctx context.Context) (bool, eth.IExecutionClient, error) { +func (p *SmartNodeServiceProvider) checkExecutionClientStatus(ctx context.Context) (bool, eth.IExecutionClient, error) { // Check the EC status - ecMgr := sp.GetEthClient() + ecMgr := p.GetEthClient() mgrStatus := ecMgr.CheckStatus(ctx, true) if ecMgr.IsPrimaryReady() { return true, nil, nil @@ -400,9 +400,9 @@ func (sp *ServiceProvider) checkExecutionClientStatus(ctx context.Context) (bool } // Check if the primary and fallback Beacon clients are synced -func (sp *ServiceProvider) checkBeaconClientStatus(ctx context.Context) (bool, error) { +func (p *SmartNodeServiceProvider) checkBeaconClientStatus(ctx context.Context) (bool, error) { // Check the BC status - bcMgr := sp.GetBeaconClient() + bcMgr := p.GetBeaconClient() mgrStatus := bcMgr.CheckStatus(ctx, true) if bcMgr.IsPrimaryReady() { return true, nil @@ -447,12 +447,12 @@ func (sp *ServiceProvider) checkBeaconClientStatus(ctx context.Context) (bool, e } // Wait for the primary or fallback Execution client to be synced -func (sp *ServiceProvider) waitEthClientSynced(ctx context.Context, verbose bool) (bool, error) { +func (p *SmartNodeServiceProvider) waitEthClientSynced(ctx context.Context, verbose bool) (bool, error) { // Prevent multiple waiting goroutines from requesting sync progress ethClientSyncLock.Lock() defer ethClientSyncLock.Unlock() - synced, clientToCheck, err := sp.checkExecutionClientStatus(ctx) + synced, clientToCheck, err := p.checkExecutionClientStatus(ctx) if err != nil { return false, err } @@ -473,7 +473,7 @@ func (sp *ServiceProvider) waitEthClientSynced(ctx context.Context, verbose bool } // Make an alerter - alerter := alerting.NewAlerter(sp.GetConfig(), logger) + alerter := alerting.NewAlerter(p.GetConfig(), logger) // Wait for sync for { @@ -481,7 +481,7 @@ func (sp *ServiceProvider) waitEthClientSynced(ctx context.Context, verbose bool if time.Since(ecRefreshTime) > ethClientStatusRefreshInterval { logger.Info("Refreshing primary / fallback execution client status...") ecRefreshTime = time.Now() - synced, clientToCheck, err = sp.checkExecutionClientStatus(ctx) + synced, clientToCheck, err = p.checkExecutionClientStatus(ctx) if err != nil { return false, err } @@ -529,12 +529,12 @@ func (sp *ServiceProvider) waitEthClientSynced(ctx context.Context, verbose bool } // Wait for the primary or fallback Beacon client to be synced -func (sp *ServiceProvider) waitBeaconClientSynced(ctx context.Context, verbose bool) (bool, error) { +func (p *SmartNodeServiceProvider) waitBeaconClientSynced(ctx context.Context, verbose bool) (bool, error) { // Prevent multiple waiting goroutines from requesting sync progress beaconClientSyncLock.Lock() defer beaconClientSyncLock.Unlock() - synced, err := sp.checkBeaconClientStatus(ctx) + synced, err := p.checkBeaconClientStatus(ctx) if err != nil { return false, err } @@ -555,7 +555,7 @@ func (sp *ServiceProvider) waitBeaconClientSynced(ctx context.Context, verbose b } // Make an alerter - alerter := alerting.NewAlerter(sp.GetConfig(), logger) + alerter := alerting.NewAlerter(p.GetConfig(), logger) // Wait for sync for { @@ -563,7 +563,7 @@ func (sp *ServiceProvider) waitBeaconClientSynced(ctx context.Context, verbose b if time.Since(bcRefreshTime) > ethClientStatusRefreshInterval { logger.Info("Refreshing primary / fallback Beacon Node status...") bcRefreshTime = time.Now() - synced, err = sp.checkBeaconClientStatus(ctx) + synced, err = p.checkBeaconClientStatus(ctx) if err != nil { return false, err } @@ -574,7 +574,7 @@ func (sp *ServiceProvider) waitBeaconClientSynced(ctx context.Context, verbose b } // Get sync status - syncStatus, err := sp.GetBeaconClient().GetSyncStatus(ctx) + syncStatus, err := p.GetBeaconClient().GetSyncStatus(ctx) if err != nil { return false, err } diff --git a/rocketpool-daemon/common/services/service-provider.go b/rocketpool-daemon/common/services/service-provider.go index 6e91b57be..963d2cf58 100644 --- a/rocketpool-daemon/common/services/service-provider.go +++ b/rocketpool-daemon/common/services/service-provider.go @@ -1,12 +1,15 @@ package services import ( + "context" "fmt" + "io" "os" "path/filepath" "sync" "github.com/hashicorp/go-version" + "github.com/rocket-pool/node-manager-core/api/types" "github.com/rocket-pool/node-manager-core/log" "github.com/rocket-pool/node-manager-core/node/services" "github.com/rocket-pool/rocketpool-go/v2/rocketpool" @@ -17,12 +20,122 @@ import ( "github.com/rocket-pool/smartnode/v2/shared/config" ) +// ================== +// === Interfaces === +// ================== + +// Provides access to the Rocket Pool binding and a contract address refreshing method +type IRocketPoolProvider interface { + // Gets the Rocket Pool binding + GetRocketPool() *rocketpool.RocketPool + + // Refreshes the Rocket Pool contracts if they've been updated on-chain since they were last loaded by the daemon + RefreshRocketPoolContracts() error +} + +// Provides the Smart Node's configuration +type ISmartNodeConfigProvider interface { + // Gets the Smart Node's configuration + GetConfig() *config.SmartNodeConfig + + // Gets the Smart Node's list of resources + GetResources() *config.MergedResources +} + +// Provides the Smart Node's validator manager +type IValidatorManagerProvider interface { + // Gets the Smart Node's validator manager + GetValidatorManager() *validator.ValidatorManager +} + +// Provides a binding for Snapshot's delegation contract +type ISnapshotDelegationProvider interface { + // Gets the Snapshot delegation binding + GetSnapshotDelegation() *contracts.SnapshotDelegation +} + +// Provides access to the Smart Node's loggers +type ILoggerProvider interface { + services.ILoggerProvider + + // Gets the Smart Node's watchtower logger + GetWatchtowerLogger() *log.Logger +} + +// Provides methods for requiring or waiting for various conditions to be met +type IRequirementsProvider interface { + // Require that the Rocket Pool contracts are loaded + RequireRocketPoolContracts(ctx context.Context) (types.ResponseStatus, error) + + // Require that the Ethereum client is synced + RequireEthClientSynced(ctx context.Context) error + + // Require that the Beacon chain client is synced + RequireBeaconClientSynced(ctx context.Context) error + + // Require the Smart Node has a node address set + RequireNodeAddress() error + + // Require the Smart Node has a wallet that's loaded and ready for transactions + RequireWalletReady() error + + // Require the node has been registered with the Rocket Pool contracts + RequireNodeRegistered(ctx context.Context) (types.ResponseStatus, error) + + // Require the selected network has a binding for the Snapshot delegation contract + RequireSnapshot() error + + // Require the node is a member of the Oracle DAO + RequireOnOracleDao(ctx context.Context) (types.ResponseStatus, error) + + // Require the node is a member of the Security Council + RequireOnSecurityCouncil(ctx context.Context) (types.ResponseStatus, error) + + // Wait for the Ethereum client to be synced + WaitEthClientSynced(ctx context.Context, verbose bool) error + + // Wait for the Beacon chain client to be synced + WaitBeaconClientSynced(ctx context.Context, verbose bool) error + + // Wait for the node to have a node address set + WaitNodeAddress(ctx context.Context, verbose bool) error + + // Wait for the node to have a wallet loaded and ready for transactions + WaitWalletReady(ctx context.Context, verbose bool) error + + // Wait for the node to be registered with the Rocket Pool contracts + WaitNodeRegistered(ctx context.Context, verbose bool) error +} + +// Provides access to all the services used by the Smart Node +type ISmartNodeServiceProvider interface { + IRocketPoolProvider + ISmartNodeConfigProvider + IValidatorManagerProvider + ISnapshotDelegationProvider + ILoggerProvider + IRequirementsProvider + + // Forwarded from the base provider + services.IEthClientProvider + services.IBeaconClientProvider + services.IDockerProvider + services.IWalletProvider + services.IContextProvider + io.Closer +} + +// ======================= +// === ServiceProvider === +// ======================= + // A container for all of the various services used by the Smartnode -type ServiceProvider struct { - *services.ServiceProvider +type SmartNodeServiceProvider struct { + services.IServiceProvider // Services cfg *config.SmartNodeConfig + resources *config.MergedResources rocketPool *rocketpool.RocketPool validatorManager *validator.ValidatorManager snapshotDelegation *contracts.SnapshotDelegation @@ -35,10 +148,16 @@ type ServiceProvider struct { } // Creates a new ServiceProvider instance -func NewServiceProvider(userDir string) (*ServiceProvider, error) { +func NewServiceProvider(userDir string, resourcesDir string) (ISmartNodeServiceProvider, error) { + // Load the network settings + settingsList, err := config.LoadSettingsFiles(resourcesDir) + if err != nil { + return nil, fmt.Errorf("error loading network settings: %w", err) + } + // Config cfgPath := filepath.Join(userDir, config.ConfigFilename) - cfg, err := client.LoadConfigFromFile(os.ExpandEnv(cfgPath)) + cfg, err := client.LoadConfigFromFile(os.ExpandEnv(cfgPath), settingsList) if err != nil { return nil, fmt.Errorf("error loading Smart Node config: %w", err) } @@ -46,8 +165,24 @@ func NewServiceProvider(userDir string) (*ServiceProvider, error) { return nil, fmt.Errorf("smart node config settings file [%s] not found", cfgPath) } + // Get the resources from the selected network + var selectedResources *config.MergedResources + for _, network := range settingsList { + if network.Key == cfg.Network.Value { + selectedResources = &config.MergedResources{ + NetworkResources: network.NetworkResources, + SmartNodeResources: network.SmartNodeResources, + } + break + } + } + if selectedResources == nil { + return nil, fmt.Errorf("no resources found for selected network [%s]", cfg.Network.Value) + } + // Make the core provider - sp, err := services.NewServiceProvider(cfg, config.ClientTimeout) + opts := services.ServiceProviderOptions{} + sp, err := services.NewServiceProvider(cfg, selectedResources.NetworkResources, config.ClientTimeout, opts) if err != nil { return nil, fmt.Errorf("error creating core service provider: %w", err) } @@ -70,11 +205,11 @@ func NewServiceProvider(userDir string) (*ServiceProvider, error) { } } - return CreateServiceProviderFromComponents(cfg, sp) + return CreateServiceProviderFromComponents(cfg, selectedResources, sp) } // Creates a ServiceProvider instance from a core service provider and Smart Node config -func CreateServiceProviderFromComponents(cfg *config.SmartNodeConfig, sp *services.ServiceProvider) (*ServiceProvider, error) { +func CreateServiceProviderFromComponents(cfg *config.SmartNodeConfig, resources *config.MergedResources, sp services.IServiceProvider) (ISmartNodeServiceProvider, error) { // Make the watchtower log loggerOpts := cfg.GetLoggerOptions() watchtowerLogger, err := log.NewLogger(cfg.GetWatchtowerLogFilePath(), loggerOpts) @@ -84,7 +219,6 @@ func CreateServiceProviderFromComponents(cfg *config.SmartNodeConfig, sp *servic // Rocket Pool ecManager := sp.GetEthClient() - resources := cfg.GetRocketPoolResources() rp, err := rocketpool.NewRocketPool( ecManager, resources.StorageAddress, @@ -112,10 +246,11 @@ func CreateServiceProviderFromComponents(cfg *config.SmartNodeConfig, sp *servic // Create the provider defaultVersion, _ := version.NewSemver("0.0.0") - provider := &ServiceProvider{ + provider := &SmartNodeServiceProvider{ userDir: cfg.RocketPoolDirectory(), - ServiceProvider: sp, + IServiceProvider: sp, cfg: cfg, + resources: resources, rocketPool: rp, validatorManager: vMgr, snapshotDelegation: snapshotDelegation, @@ -130,37 +265,33 @@ func CreateServiceProviderFromComponents(cfg *config.SmartNodeConfig, sp *servic // === Getters === // =============== -func (p *ServiceProvider) GetServiceProvider() *services.ServiceProvider { - return p.ServiceProvider -} - -func (p *ServiceProvider) GetUserDir() string { - return p.userDir +func (p *SmartNodeServiceProvider) GetConfig() *config.SmartNodeConfig { + return p.cfg } -func (p *ServiceProvider) GetConfig() *config.SmartNodeConfig { - return p.cfg +func (p *SmartNodeServiceProvider) GetResources() *config.MergedResources { + return p.resources } -func (p *ServiceProvider) GetRocketPool() *rocketpool.RocketPool { +func (p *SmartNodeServiceProvider) GetRocketPool() *rocketpool.RocketPool { return p.rocketPool } -func (p *ServiceProvider) GetValidatorManager() *validator.ValidatorManager { +func (p *SmartNodeServiceProvider) GetValidatorManager() *validator.ValidatorManager { return p.validatorManager } -func (p *ServiceProvider) GetSnapshotDelegation() *contracts.SnapshotDelegation { +func (p *SmartNodeServiceProvider) GetSnapshotDelegation() *contracts.SnapshotDelegation { return p.snapshotDelegation } -func (p *ServiceProvider) GetWatchtowerLogger() *log.Logger { +func (p *SmartNodeServiceProvider) GetWatchtowerLogger() *log.Logger { return p.watchtowerLog } -func (p *ServiceProvider) Close() { +func (p *SmartNodeServiceProvider) Close() error { p.watchtowerLog.Close() - p.ServiceProvider.Close() + return p.IServiceProvider.Close() } // ============= @@ -168,7 +299,7 @@ func (p *ServiceProvider) Close() { // ============= // Refresh the Rocket Pool contracts if they've been updated since they were last loaded -func (p *ServiceProvider) RefreshRocketPoolContracts() error { +func (p *SmartNodeServiceProvider) RefreshRocketPoolContracts() error { p.refreshLock.Lock() defer p.refreshLock.Unlock() diff --git a/rocketpool-daemon/common/state/manager.go b/rocketpool-daemon/common/state/manager.go index 0784abb55..f186ff381 100644 --- a/rocketpool-daemon/common/state/manager.go +++ b/rocketpool-daemon/common/state/manager.go @@ -18,6 +18,7 @@ import ( type NetworkStateManager struct { cfg *config.SmartNodeConfig + res *config.MergedResources rp *rocketpool.RocketPool ec eth.IExecutionClient bc beacon.IBeaconClient @@ -29,19 +30,17 @@ type NetworkStateManager struct { } // Create a new manager for the network state -func NewNetworkStateManager(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, ec eth.IExecutionClient, bc beacon.IBeaconClient, logger *slog.Logger) (*NetworkStateManager, error) { - // Make a resource list - resources := cfg.GetNetworkResources() - +func NewNetworkStateManager(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, res *config.MergedResources, ec eth.IExecutionClient, bc beacon.IBeaconClient, logger *slog.Logger) (*NetworkStateManager, error) { // Create the manager m := &NetworkStateManager{ cfg: cfg, + res: res, rp: rp, ec: ec, bc: bc, logger: logger, Network: cfg.Network.Value, - ChainID: resources.ChainID, + ChainID: res.ChainID, } // Get the Beacon config info @@ -139,7 +138,7 @@ func (m *NetworkStateManager) GetLatestProposedBeaconBlock(context context.Conte // Get the state of the network at the provided Beacon slot func (m *NetworkStateManager) getState(context context.Context, slotNumber uint64) (*NetworkState, error) { - state, err := CreateNetworkState(m.cfg, m.rp, m.ec, m.bc, m.logger, slotNumber, m.BeaconConfig, context) + state, err := CreateNetworkState(m.cfg, m.res, m.rp, m.ec, m.bc, m.logger, slotNumber, m.BeaconConfig, context) if err != nil { return nil, err } @@ -148,7 +147,7 @@ func (m *NetworkStateManager) getState(context context.Context, slotNumber uint6 // Get the state of the network for a specific node only at the provided Beacon slot func (m *NetworkStateManager) getStateForNode(context context.Context, nodeAddress common.Address, slotNumber uint64, calculateTotalEffectiveStake bool) (*NetworkState, *big.Int, error) { - state, totalEffectiveStake, err := CreateNetworkStateForNode(m.cfg, m.rp, m.ec, m.bc, m.logger, slotNumber, m.BeaconConfig, nodeAddress, calculateTotalEffectiveStake, context) + state, totalEffectiveStake, err := CreateNetworkStateForNode(m.cfg, m.res, m.rp, m.ec, m.bc, m.logger, slotNumber, m.BeaconConfig, nodeAddress, calculateTotalEffectiveStake, context) if err != nil { return nil, nil, err } diff --git a/rocketpool-daemon/common/state/network-state.go b/rocketpool-daemon/common/state/network-state.go index d5f338862..b21886c7b 100644 --- a/rocketpool-daemon/common/state/network-state.go +++ b/rocketpool-daemon/common/state/network-state.go @@ -65,11 +65,10 @@ type NetworkState struct { } // Creates a snapshot of the entire Rocket Pool network state, on both the Execution and Consensus layers -func CreateNetworkState(cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, ec eth.IExecutionClient, bc beacon.IBeaconClient, logger *slog.Logger, slotNumber uint64, beaconConfig beacon.Eth2Config, context context.Context) (*NetworkState, error) { +func CreateNetworkState(cfg *config.SmartNodeConfig, res *config.MergedResources, rp *rocketpool.RocketPool, ec eth.IExecutionClient, bc beacon.IBeaconClient, logger *slog.Logger, slotNumber uint64, beaconConfig beacon.Eth2Config, context context.Context) (*NetworkState, error) { // Get the relevant network contracts - resources := cfg.GetNetworkResources() - multicallerAddress := resources.MulticallAddress - balanceBatcherAddress := resources.BalanceBatcherAddress + multicallerAddress := res.MulticallAddress + balanceBatcherAddress := res.BalanceBatcherAddress // Get the execution block for the given slot beaconBlock, exists, err := bc.GetBeaconBlock(context, fmt.Sprintf("%d", slotNumber)) @@ -194,16 +193,15 @@ func CreateNetworkState(cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, // Creates a snapshot of the Rocket Pool network, but only for a single node // Also gets the total effective RPL stake of the network for convenience since this is required by several node routines -func CreateNetworkStateForNode(cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, ec eth.IExecutionClient, bc beacon.IBeaconClient, logger *slog.Logger, slotNumber uint64, beaconConfig beacon.Eth2Config, nodeAddress common.Address, calculateTotalEffectiveStake bool, context context.Context) (*NetworkState, *big.Int, error) { +func CreateNetworkStateForNode(cfg *config.SmartNodeConfig, res *config.MergedResources, rp *rocketpool.RocketPool, ec eth.IExecutionClient, bc beacon.IBeaconClient, logger *slog.Logger, slotNumber uint64, beaconConfig beacon.Eth2Config, nodeAddress common.Address, calculateTotalEffectiveStake bool, context context.Context) (*NetworkState, *big.Int, error) { steps := 6 if calculateTotalEffectiveStake { steps++ } // Get the relevant network contracts - resources := cfg.GetNetworkResources() - multicallerAddress := resources.MulticallAddress - balanceBatcherAddress := resources.BalanceBatcherAddress + multicallerAddress := res.MulticallAddress + balanceBatcherAddress := res.BalanceBatcherAddress // Get the execution block for the given slot beaconBlock, exists, err := bc.GetBeaconBlock(context, fmt.Sprintf("%d", slotNumber)) diff --git a/rocketpool-daemon/common/tx/utils.go b/rocketpool-daemon/common/tx/utils.go index 908f10643..225b1dd6c 100644 --- a/rocketpool-daemon/common/tx/utils.go +++ b/rocketpool-daemon/common/tx/utils.go @@ -19,14 +19,13 @@ import ( const TimeoutSafetyFactor time.Duration = 2 // Prints a TX's details to the logger and waits for it to validated. -func PrintAndWaitForTransaction(cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, logger *slog.Logger, txInfo *eth.TransactionInfo, opts *bind.TransactOpts) error { +func PrintAndWaitForTransaction(cfg *config.SmartNodeConfig, res *config.MergedResources, rp *rocketpool.RocketPool, logger *slog.Logger, txInfo *eth.TransactionInfo, opts *bind.TransactOpts) error { tx, err := rp.ExecuteTransaction(txInfo, opts) if err != nil { return fmt.Errorf("error submitting transaction: %w", err) } - resources := cfg.GetRocketPoolResources() - txWatchUrl := resources.TxWatchUrl + txWatchUrl := res.TxWatchUrl hashString := tx.Hash().String() logger.Info("Transaction has been submitted.", slog.String(keys.HashKey, hashString)) if txWatchUrl != "" { @@ -45,7 +44,7 @@ func PrintAndWaitForTransaction(cfg *config.SmartNodeConfig, rp *rocketpool.Rock } // Prints a TX's details to the logger and waits for it to validated. -func PrintAndWaitForTransactionBatch(cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, logger *slog.Logger, submissions []*eth.TransactionSubmission, callbacks []func(err error), opts *bind.TransactOpts) error { +func PrintAndWaitForTransactionBatch(cfg *config.SmartNodeConfig, res *config.MergedResources, rp *rocketpool.RocketPool, logger *slog.Logger, submissions []*eth.TransactionSubmission, callbacks []func(err error), opts *bind.TransactOpts) error { txs, err := rp.BatchExecuteTransactions(submissions, opts) if err != nil { return fmt.Errorf("error submitting transactions: %w", err) @@ -59,8 +58,7 @@ func PrintAndWaitForTransactionBatch(cfg *config.SmartNodeConfig, rp *rocketpool } } - resources := cfg.GetRocketPoolResources() - txWatchUrl := resources.TxWatchUrl + txWatchUrl := res.TxWatchUrl if txWatchUrl != "" { logger.Info("Transactions have been submitted. You may follow them progress by visiting:") for _, tx := range txs { diff --git a/rocketpool-daemon/common/utils/deposit-contract.go b/rocketpool-daemon/common/utils/deposit-contract.go index 534182af7..bd5efb57e 100644 --- a/rocketpool-daemon/common/utils/deposit-contract.go +++ b/rocketpool-daemon/common/utils/deposit-contract.go @@ -17,10 +17,9 @@ type DepositContractInfo struct { BeaconDepositContract common.Address } -func GetDepositContractInfo(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, bc beacon.IBeaconClient) (*DepositContractInfo, error) { +func GetDepositContractInfo(context context.Context, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, res *config.MergedResources, bc beacon.IBeaconClient) (*DepositContractInfo, error) { info := &DepositContractInfo{} - resources := cfg.GetRocketPoolResources() - info.RPNetwork = uint64(resources.ChainID) + info.RPNetwork = uint64(res.ChainID) // Get the deposit contract address Rocket Pool will deposit to rpDepositContract, err := rp.GetContract(rocketpool.ContractName_CasperDeposit) diff --git a/rocketpool-daemon/common/validator/validator-manager.go b/rocketpool-daemon/common/validator/validator-manager.go index e891b09d9..6a13d1034 100644 --- a/rocketpool-daemon/common/validator/validator-manager.go +++ b/rocketpool-daemon/common/validator/validator-manager.go @@ -2,6 +2,7 @@ package validator import ( "bytes" + "context" "fmt" "github.com/rocket-pool/node-manager-core/beacon" @@ -40,7 +41,7 @@ type ValidatorManager struct { func NewValidatorManager(cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, walletImpl *wallet.Wallet, queryMgr *eth.QueryManager) (*ValidatorManager, error) { // Make a validator manager - validatorManager := validator.NewValidatorManager(cfg.GetValidatorsFolderPath()) + validatorManager := validator.NewValidatorManager(cfg.GetValidatorsFolderPath(), nil) // Make a new mgr mgr := &ValidatorManager{ @@ -84,7 +85,7 @@ func (m *ValidatorManager) GetValidatorKeyAt(index uint64) (*eth2types.BLSPrivat // Stores a validator key into all of the wallet's keystores func (m *ValidatorManager) StoreValidatorKey(key *eth2types.BLSPrivateKey, path string) error { - return m.keystoreManager.StoreKey(key, path) + return m.keystoreManager.StoreKey(context.Background(), nil, key, path, nil, false) } // Loads a validator key from the wallet's keystores @@ -160,7 +161,7 @@ func (m *ValidatorManager) SaveValidatorKey(key ValidatorKey) error { } // Update keystores - err := m.keystoreManager.StoreKey(key.PrivateKey, key.DerivationPath) + err := m.keystoreManager.StoreKey(context.Background(), nil, key.PrivateKey, key.DerivationPath, nil, false) if err != nil { return fmt.Errorf("could not store validator %s key: %w", key.PublicKey.HexWithPrefix(), err) } @@ -206,7 +207,7 @@ func (m *ValidatorManager) RecoverValidatorKey(pubkey beacon.ValidatorPubkey, st } // Update keystores - err = m.keystoreManager.StoreKey(validatorKey, derivationPath) + err = m.keystoreManager.StoreKey(context.Background(), nil, validatorKey, derivationPath, nil, false) if err != nil { return 0, fmt.Errorf("error storing validator %s key: %w", pubkey.HexWithPrefix(), err) } diff --git a/rocketpool-daemon/common/voting/utils.go b/rocketpool-daemon/common/voting/utils.go index 97c4abfa7..655a4a1ca 100644 --- a/rocketpool-daemon/common/voting/utils.go +++ b/rocketpool-daemon/common/voting/utils.go @@ -113,10 +113,9 @@ type snapshotProposalsResponse struct { // === Utils === // ============= -func GetSnapshotVotingPower(cfg *config.SmartNodeConfig, address common.Address) (float64, error) { +func GetSnapshotVotingPower(cfg *config.SmartNodeConfig, res *config.MergedResources, address common.Address) (float64, error) { client := getHttpClientWithTimeout() - resources := cfg.GetRocketPoolResources() - apiDomain := resources.SnapshotApiDomain + apiDomain := res.SnapshotApiDomain id := config.SnapshotID if apiDomain == "" { return 0, nil @@ -149,10 +148,9 @@ func GetSnapshotVotingPower(cfg *config.SmartNodeConfig, address common.Address) return vp, nil } -func GetSnapshotProposals(cfg *config.SmartNodeConfig, address common.Address, delegate common.Address, activeOnly bool) ([]*sharedtypes.SnapshotProposal, error) { +func GetSnapshotProposals(cfg *config.SmartNodeConfig, res *config.MergedResources, address common.Address, delegate common.Address, activeOnly bool) ([]*sharedtypes.SnapshotProposal, error) { client := getHttpClientWithTimeout() - resources := cfg.GetRocketPoolResources() - apiDomain := resources.SnapshotApiDomain + apiDomain := res.SnapshotApiDomain id := config.SnapshotID if apiDomain == "" { return nil, nil diff --git a/rocketpool-daemon/node/collectors/beacon-collector.go b/rocketpool-daemon/node/collectors/beacon-collector.go index 1ae58c1a5..15378e9a7 100644 --- a/rocketpool-daemon/node/collectors/beacon-collector.go +++ b/rocketpool-daemon/node/collectors/beacon-collector.go @@ -32,7 +32,7 @@ type BeaconCollector struct { ctx context.Context // The Smartnode service provider - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider // The logger logger *slog.Logger @@ -42,7 +42,7 @@ type BeaconCollector struct { } // Create a new BeaconCollector instance -func NewBeaconCollector(logger *log.Logger, ctx context.Context, sp *services.ServiceProvider, stateLocker *StateLocker) *BeaconCollector { +func NewBeaconCollector(logger *log.Logger, ctx context.Context, sp services.ISmartNodeServiceProvider, stateLocker *StateLocker) *BeaconCollector { subsystem := "beacon" sublogger := logger.With(slog.String(keys.TaskKey, "Beacon Collector")) return &BeaconCollector{ diff --git a/rocketpool-daemon/node/collectors/demand-collector.go b/rocketpool-daemon/node/collectors/demand-collector.go index 72eee2056..74531b63e 100644 --- a/rocketpool-daemon/node/collectors/demand-collector.go +++ b/rocketpool-daemon/node/collectors/demand-collector.go @@ -30,7 +30,7 @@ type DemandCollector struct { queueLength *prometheus.Desc // The Smartnode service provider - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider // The logger logger *slog.Logger @@ -40,7 +40,7 @@ type DemandCollector struct { } // Create a new DemandCollector instance -func NewDemandCollector(logger *log.Logger, sp *services.ServiceProvider, stateLocker *StateLocker) *DemandCollector { +func NewDemandCollector(logger *log.Logger, sp services.ISmartNodeServiceProvider, stateLocker *StateLocker) *DemandCollector { subsystem := "demand" sublogger := logger.With(slog.String(keys.TaskKey, "Demand Collector")) return &DemandCollector{ diff --git a/rocketpool-daemon/node/collectors/node-collector.go b/rocketpool-daemon/node/collectors/node-collector.go index 362e6518a..c2e5fb4b0 100644 --- a/rocketpool-daemon/node/collectors/node-collector.go +++ b/rocketpool-daemon/node/collectors/node-collector.go @@ -94,7 +94,7 @@ type NodeCollector struct { ctx context.Context // The Smartnode service provider - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider // The logger logger *slog.Logger @@ -116,7 +116,7 @@ type NodeCollector struct { } // Create a new NodeCollector instance -func NewNodeCollector(logger *log.Logger, ctx context.Context, sp *services.ServiceProvider, stateLocker *StateLocker) *NodeCollector { +func NewNodeCollector(logger *log.Logger, ctx context.Context, sp services.ISmartNodeServiceProvider, stateLocker *StateLocker) *NodeCollector { subsystem := "node" sublogger := logger.With(slog.String(keys.TaskKey, "Node Collector")) return &NodeCollector{ @@ -243,6 +243,7 @@ func (c *NodeCollector) Collect(channel chan<- prometheus.Metric) { // Get services rp := c.sp.GetRocketPool() cfg := c.sp.GetConfig() + res := c.sp.GetResources() ec := c.sp.GetEthClient() bc := c.sp.GetBeaconClient() nodeAddress, hasNodeAddress := c.sp.GetWallet().GetAddress() @@ -306,7 +307,7 @@ func (c *NodeCollector) Collect(channel chan<- prometheus.Metric) { previousRewardIndex = previousRewardIndex - 1 } - previousInterval, err := rprewards.GetIntervalInfo(rp, cfg, nodeAddress, previousRewardIndex, nil) + previousInterval, err := rprewards.GetIntervalInfo(rp, cfg, res, nodeAddress, previousRewardIndex, nil) if err != nil { return err } @@ -321,7 +322,7 @@ func (c *NodeCollector) Collect(channel chan<- prometheus.Metric) { for _, claimedInterval := range status.Claimed { _, exists := c.handledIntervals[claimedInterval] if !exists { - intervalInfo, err := rprewards.GetIntervalInfo(rp, cfg, nodeAddress, claimedInterval, nil) + intervalInfo, err := rprewards.GetIntervalInfo(rp, cfg, res, nodeAddress, claimedInterval, nil) if err != nil { return err } @@ -336,7 +337,7 @@ func (c *NodeCollector) Collect(channel chan<- prometheus.Metric) { } // Get the unclaimed rewards for _, unclaimedInterval := range status.Unclaimed { - intervalInfo, err := rprewards.GetIntervalInfo(rp, cfg, nodeAddress, unclaimedInterval, nil) + intervalInfo, err := rprewards.GetIntervalInfo(rp, cfg, res, nodeAddress, unclaimedInterval, nil) if err != nil { return err } diff --git a/rocketpool-daemon/node/collectors/odao-collector.go b/rocketpool-daemon/node/collectors/odao-collector.go index aeff5bca8..4e3bcdbb0 100644 --- a/rocketpool-daemon/node/collectors/odao-collector.go +++ b/rocketpool-daemon/node/collectors/odao-collector.go @@ -24,7 +24,7 @@ type OdaoCollector struct { latestReportableBlock *prometheus.Desc // The Smartnode service provider - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider // The logger logger *slog.Logger @@ -34,7 +34,7 @@ type OdaoCollector struct { } // Create a new OdaoCollector instance -func NewOdaoCollector(logger *log.Logger, sp *services.ServiceProvider, stateLocker *StateLocker) *OdaoCollector { +func NewOdaoCollector(logger *log.Logger, sp services.ISmartNodeServiceProvider, stateLocker *StateLocker) *OdaoCollector { subsystem := "odao" sublogger := logger.With(slog.String(keys.TaskKey, "ODAO Collector")) return &OdaoCollector{ diff --git a/rocketpool-daemon/node/collectors/performance-collector.go b/rocketpool-daemon/node/collectors/performance-collector.go index 19b1bb16e..9258c011b 100644 --- a/rocketpool-daemon/node/collectors/performance-collector.go +++ b/rocketpool-daemon/node/collectors/performance-collector.go @@ -31,7 +31,7 @@ type PerformanceCollector struct { rethContractBalance *prometheus.Desc // The Smartnode service provider - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider // The logger logger *slog.Logger @@ -41,7 +41,7 @@ type PerformanceCollector struct { } // Create a new PerformanceCollector instance -func NewPerformanceCollector(logger *log.Logger, sp *services.ServiceProvider, stateLocker *StateLocker) *PerformanceCollector { +func NewPerformanceCollector(logger *log.Logger, sp services.ISmartNodeServiceProvider, stateLocker *StateLocker) *PerformanceCollector { subsystem := "performance" sublogger := logger.With(slog.String(keys.TaskKey, "Performance Collector")) return &PerformanceCollector{ diff --git a/rocketpool-daemon/node/collectors/rpl-collector.go b/rocketpool-daemon/node/collectors/rpl-collector.go index bb120ff49..872ee4503 100644 --- a/rocketpool-daemon/node/collectors/rpl-collector.go +++ b/rocketpool-daemon/node/collectors/rpl-collector.go @@ -25,7 +25,7 @@ type RplCollector struct { checkpointTime *prometheus.Desc // The Smartnode service provider - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider // The logger logger *slog.Logger @@ -35,7 +35,7 @@ type RplCollector struct { } // Create a new RplCollector instance -func NewRplCollector(logger *log.Logger, sp *services.ServiceProvider, stateLocker *StateLocker) *RplCollector { +func NewRplCollector(logger *log.Logger, sp services.ISmartNodeServiceProvider, stateLocker *StateLocker) *RplCollector { subsystem := "rpl" sublogger := logger.With(slog.String(keys.TaskKey, "RPL Collector")) return &RplCollector{ diff --git a/rocketpool-daemon/node/collectors/smoothing-pool-collector.go b/rocketpool-daemon/node/collectors/smoothing-pool-collector.go index cebd19c22..9fbbca509 100644 --- a/rocketpool-daemon/node/collectors/smoothing-pool-collector.go +++ b/rocketpool-daemon/node/collectors/smoothing-pool-collector.go @@ -16,7 +16,7 @@ type SmoothingPoolCollector struct { ethBalanceOnSmoothingPool *prometheus.Desc // The Smartnode service provider - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider // The logger logger *slog.Logger @@ -26,7 +26,7 @@ type SmoothingPoolCollector struct { } // Create a new SmoothingPoolCollector instance -func NewSmoothingPoolCollector(logger *log.Logger, sp *services.ServiceProvider, stateLocker *StateLocker) *SmoothingPoolCollector { +func NewSmoothingPoolCollector(logger *log.Logger, sp services.ISmartNodeServiceProvider, stateLocker *StateLocker) *SmoothingPoolCollector { subsystem := "smoothing_pool" sublogger := logger.With(slog.String(keys.TaskKey, "SP Collector")) return &SmoothingPoolCollector{ diff --git a/rocketpool-daemon/node/collectors/snapshot-collector.go b/rocketpool-daemon/node/collectors/snapshot-collector.go index a09be1628..d908640bf 100644 --- a/rocketpool-daemon/node/collectors/snapshot-collector.go +++ b/rocketpool-daemon/node/collectors/snapshot-collector.go @@ -40,7 +40,7 @@ type SnapshotCollector struct { delegateVotingPower *prometheus.Desc // The Smartnode service provider - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider // The logger logger *slog.Logger @@ -58,7 +58,7 @@ type SnapshotCollector struct { } // Create a new SnapshotCollector instance -func NewSnapshotCollector(logger *log.Logger, sp *services.ServiceProvider) *SnapshotCollector { +func NewSnapshotCollector(logger *log.Logger, sp services.ISmartNodeServiceProvider) *SnapshotCollector { subsystem := "snapshot" sublogger := logger.With(slog.String(keys.TaskKey, "Snapshot Collector")) return &SnapshotCollector{ @@ -114,6 +114,7 @@ func (c *SnapshotCollector) Collect(channel chan<- prometheus.Metric) { // Services rp := c.sp.GetRocketPool() cfg := c.sp.GetConfig() + res := c.sp.GetResources() snapshotID := cfg.GetVotingSnapshotID() nodeAddress, hasNodeAddress := c.sp.GetWallet().GetAddress() if !hasNodeAddress { @@ -136,7 +137,7 @@ func (c *SnapshotCollector) Collect(channel chan<- prometheus.Metric) { // Get the number of Snapshot proposals and votes wg.Go(func() error { - proposals, err := voting.GetSnapshotProposals(cfg, nodeAddress, delegateAddress, false) + proposals, err := voting.GetSnapshotProposals(cfg, res, nodeAddress, delegateAddress, false) if err != nil { return fmt.Errorf("error getting Snapshot proposals: %w", err) } @@ -165,7 +166,7 @@ func (c *SnapshotCollector) Collect(channel chan<- prometheus.Metric) { // Get the node's voting power wg.Go(func() error { - votingPower, err := voting.GetSnapshotVotingPower(cfg, nodeAddress) + votingPower, err := voting.GetSnapshotVotingPower(cfg, res, nodeAddress) if err != nil { return fmt.Errorf("Error getting Snapshot voted proposals for node address: %w", err) } @@ -175,7 +176,7 @@ func (c *SnapshotCollector) Collect(channel chan<- prometheus.Metric) { // Get the delegate's voting power wg.Go(func() error { - delegateVotingPower, err := voting.GetSnapshotVotingPower(cfg, delegateAddress) + delegateVotingPower, err := voting.GetSnapshotVotingPower(cfg, res, delegateAddress) if err != nil { return fmt.Errorf("Error getting Snapshot voted proposals for delegate address: %w", err) } diff --git a/rocketpool-daemon/node/collectors/supply-collector.go b/rocketpool-daemon/node/collectors/supply-collector.go index 86f798312..43c5e2c4b 100644 --- a/rocketpool-daemon/node/collectors/supply-collector.go +++ b/rocketpool-daemon/node/collectors/supply-collector.go @@ -28,7 +28,7 @@ type SupplyCollector struct { activeMinipools *prometheus.Desc // The Smartnode service provider - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider // The logger logger *slog.Logger @@ -38,7 +38,7 @@ type SupplyCollector struct { } // Create a new PerformanceCollector instance -func NewSupplyCollector(logger *log.Logger, sp *services.ServiceProvider, stateLocker *StateLocker) *SupplyCollector { +func NewSupplyCollector(logger *log.Logger, sp services.ISmartNodeServiceProvider, stateLocker *StateLocker) *SupplyCollector { subsystem := "supply" sublogger := logger.With(slog.String(keys.TaskKey, "Supply Collector")) return &SupplyCollector{ diff --git a/rocketpool-daemon/node/collectors/trusted-node-collector.go b/rocketpool-daemon/node/collectors/trusted-node-collector.go index 0d6cdff89..bab6d56b4 100644 --- a/rocketpool-daemon/node/collectors/trusted-node-collector.go +++ b/rocketpool-daemon/node/collectors/trusted-node-collector.go @@ -36,7 +36,7 @@ type TrustedNodeCollector struct { pricesParticipation *prometheus.Desc // The Smartnode service provider - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider // The logger logger *slog.Logger @@ -48,7 +48,7 @@ type TrustedNodeCollector struct { } // Create a new TrustedNodeCollector instance -func NewTrustedNodeCollector(logger *log.Logger, sp *services.ServiceProvider, stateLocker *StateLocker) *TrustedNodeCollector { +func NewTrustedNodeCollector(logger *log.Logger, sp services.ISmartNodeServiceProvider, stateLocker *StateLocker) *TrustedNodeCollector { subsystem := "trusted_node" sublogger := logger.With(slog.String(keys.TaskKey, "ODAO Stats Collector")) return &TrustedNodeCollector{ diff --git a/rocketpool-daemon/node/defend-pdao-props.go b/rocketpool-daemon/node/defend-pdao-props.go index 242098d0b..0a0b8a080 100644 --- a/rocketpool-daemon/node/defend-pdao-props.go +++ b/rocketpool-daemon/node/defend-pdao-props.go @@ -32,13 +32,13 @@ type defendableProposal struct { type DefendPdaoProps struct { ctx context.Context - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet rp *rocketpool.RocketPool bc beacon.IBeaconClient - rs *config.RocketPoolResources gasThreshold float64 maxFee *big.Int maxPriorityFee *big.Int @@ -52,8 +52,9 @@ type DefendPdaoProps struct { intervalSize *big.Int } -func NewDefendPdaoProps(ctx context.Context, sp *services.ServiceProvider, logger *log.Logger) *DefendPdaoProps { +func NewDefendPdaoProps(ctx context.Context, sp services.ISmartNodeServiceProvider, logger *log.Logger) *DefendPdaoProps { cfg := sp.GetConfig() + res := sp.GetResources() log := logger.With(slog.String(keys.TaskKey, "Defend PDAO Proposals")) maxFee, maxPriorityFee := getAutoTxInfo(cfg, log) return &DefendPdaoProps{ @@ -61,10 +62,10 @@ func NewDefendPdaoProps(ctx context.Context, sp *services.ServiceProvider, logge sp: sp, logger: log, cfg: cfg, + res: res, w: sp.GetWallet(), rp: sp.GetRocketPool(), bc: sp.GetBeaconClient(), - rs: cfg.GetRocketPoolResources(), gasThreshold: cfg.AutoTxGasThreshold.Value, maxFee: maxFee, maxPriorityFee: maxPriorityFee, @@ -78,7 +79,7 @@ func (t *DefendPdaoProps) Run(state *state.NetworkState) error { t.nodeAddress, _ = t.w.GetAddress() // Bindings - propMgr, err := proposals.NewProposalManager(t.ctx, t.logger, t.cfg, t.rp, t.bc) + propMgr, err := proposals.NewProposalManager(t.ctx, t.logger, t.cfg, t.res, t.rp, t.bc) if err != nil { return fmt.Errorf("error creating proposal manager: %w", err) } @@ -166,7 +167,7 @@ func (t *DefendPdaoProps) getDefendableProposals(state *state.NetworkState, opts } // Get any challenges issued for the proposals - challengeEvents, err := t.pdaoMgr.GetChallengeSubmittedEvents(ids, t.intervalSize, startBlock, endBlock, t.rs.PreviousProtocolDaoVerifierAddresses, opts) + challengeEvents, err := t.pdaoMgr.GetChallengeSubmittedEvents(ids, t.intervalSize, startBlock, endBlock, t.res.PreviousProtocolDaoVerifierAddresses, opts) if err != nil { return nil, fmt.Errorf("error scanning for ChallengeSubmitted events: %w", err) } @@ -244,7 +245,7 @@ func (t *DefendPdaoProps) defendProposal(prop defendableProposal) error { opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(t.cfg, t.rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(t.cfg, t.res, t.rp, t.logger, txInfo, opts) if err != nil { return err } diff --git a/rocketpool-daemon/node/distribute-minipools.go b/rocketpool-daemon/node/distribute-minipools.go index 382bc75f4..85002b89a 100644 --- a/rocketpool-daemon/node/distribute-minipools.go +++ b/rocketpool-daemon/node/distribute-minipools.go @@ -27,10 +27,11 @@ import ( // Distribute minipools task type DistributeMinipools struct { - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger alerter *alerting.Alerter cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet rp *rocketpool.RocketPool bc beacon.IBeaconClient @@ -44,8 +45,9 @@ type DistributeMinipools struct { } // Create distribute minipools task -func NewDistributeMinipools(sp *services.ServiceProvider, logger *log.Logger) *DistributeMinipools { +func NewDistributeMinipools(sp services.ISmartNodeServiceProvider, logger *log.Logger) *DistributeMinipools { cfg := sp.GetConfig() + res := sp.GetResources() log := logger.With(slog.String(keys.TaskKey, "Distribute Minipools")) maxFee, maxPriorityFee := getAutoTxInfo(cfg, log) gasThreshold := cfg.AutoTxGasThreshold.Value @@ -70,6 +72,7 @@ func NewDistributeMinipools(sp *services.ServiceProvider, logger *log.Logger) *D logger: log, alerter: alerting.NewAlerter(cfg, logger), cfg: cfg, + res: res, w: sp.GetWallet(), rp: sp.GetRocketPool(), bc: sp.GetBeaconClient(), @@ -225,7 +228,7 @@ func (t *DistributeMinipools) distributeMinipools(submissions []*eth.Transaction } // Print TX info and wait for them to be included in a block - err = tx.PrintAndWaitForTransactionBatch(t.cfg, t.rp, t.logger, submissions, callbacks, opts) + err = tx.PrintAndWaitForTransactionBatch(t.cfg, t.res, t.rp, t.logger, submissions, callbacks, opts) if err != nil { return err } diff --git a/rocketpool-daemon/node/download-reward-trees.go b/rocketpool-daemon/node/download-reward-trees.go index 6ea9a18a6..b487e612d 100644 --- a/rocketpool-daemon/node/download-reward-trees.go +++ b/rocketpool-daemon/node/download-reward-trees.go @@ -16,18 +16,20 @@ import ( // Manage download rewards trees task type DownloadRewardsTrees struct { - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger cfg *config.SmartNodeConfig + res *config.MergedResources rp *rocketpool.RocketPool } // Create manage fee recipient task -func NewDownloadRewardsTrees(sp *services.ServiceProvider, logger *log.Logger) *DownloadRewardsTrees { +func NewDownloadRewardsTrees(sp services.ISmartNodeServiceProvider, logger *log.Logger) *DownloadRewardsTrees { return &DownloadRewardsTrees{ sp: sp, logger: logger.With(slog.String(keys.TaskKey, "Rewards Tree Download")), cfg: sp.GetConfig(), + res: sp.GetResources(), rp: sp.GetRocketPool(), } } @@ -67,7 +69,7 @@ func (t *DownloadRewardsTrees) Run(state *state.NetworkState) error { // Download missing intervals for _, missingInterval := range missingIntervals { t.logger.Info("Downloading file... ", slog.Uint64(keys.IntervalKey, missingInterval)) - intervalInfo, err := rprewards.GetIntervalInfo(t.rp, t.cfg, nodeAddress, missingInterval, nil) + intervalInfo, err := rprewards.GetIntervalInfo(t.rp, t.cfg, t.res, nodeAddress, missingInterval, nil) if err != nil { return fmt.Errorf("error getting interval %d info: %w", missingInterval, err) } diff --git a/rocketpool-daemon/node/manage-fee-recipient.go b/rocketpool-daemon/node/manage-fee-recipient.go index 9b6a74fe8..253c83f4e 100644 --- a/rocketpool-daemon/node/manage-fee-recipient.go +++ b/rocketpool-daemon/node/manage-fee-recipient.go @@ -30,7 +30,7 @@ const ( // Manage fee recipient task type ManageFeeRecipient struct { ctx context.Context - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider cfg *config.SmartNodeConfig logger *slog.Logger alerter *alerting.Alerter @@ -39,7 +39,7 @@ type ManageFeeRecipient struct { } // Create manage fee recipient task -func NewManageFeeRecipient(ctx context.Context, sp *services.ServiceProvider, logger *log.Logger) *ManageFeeRecipient { +func NewManageFeeRecipient(ctx context.Context, sp services.ISmartNodeServiceProvider, logger *log.Logger) *ManageFeeRecipient { return &ManageFeeRecipient{ ctx: ctx, sp: sp, diff --git a/rocketpool-daemon/node/metrics-exporter.go b/rocketpool-daemon/node/metrics-exporter.go index 6608ceb54..d452a26f9 100644 --- a/rocketpool-daemon/node/metrics-exporter.go +++ b/rocketpool-daemon/node/metrics-exporter.go @@ -19,7 +19,7 @@ import ( "github.com/rocket-pool/smartnode/v2/shared/keys" ) -func runMetricsServer(ctx context.Context, sp *services.ServiceProvider, logger *log.Logger, stateLocker *collectors.StateLocker, wg *sync.WaitGroup, +func runMetricsServer(ctx context.Context, sp services.ISmartNodeServiceProvider, logger *log.Logger, stateLocker *collectors.StateLocker, wg *sync.WaitGroup, scrubCollector *wc.ScrubCollector, bondReductionCollector *wc.BondReductionCollector, soloMigrationCollector *wc.SoloMigrationCollector) *http.Server { // Get services cfg := sp.GetConfig() diff --git a/rocketpool-daemon/node/node.go b/rocketpool-daemon/node/node.go index 0242dcc88..859049b94 100644 --- a/rocketpool-daemon/node/node.go +++ b/rocketpool-daemon/node/node.go @@ -55,9 +55,10 @@ type TaskLoop struct { logger *log.Logger alerter *alerting.Alerter ctx context.Context - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider wg *sync.WaitGroup cfg *config.SmartNodeConfig + res *config.MergedResources rp *rocketpool.RocketPool ec eth.IExecutionClient bc beacon.IBeaconClient @@ -88,7 +89,7 @@ type TaskLoop struct { secondsDelta float64 } -func NewTaskLoop(sp *services.ServiceProvider, wg *sync.WaitGroup) *TaskLoop { +func NewTaskLoop(sp services.ISmartNodeServiceProvider, wg *sync.WaitGroup) *TaskLoop { logger := sp.GetTasksLogger() ctx := logger.CreateContextWithLogger(sp.GetBaseContext()) t := &TaskLoop{ @@ -98,6 +99,7 @@ func NewTaskLoop(sp *services.ServiceProvider, wg *sync.WaitGroup) *TaskLoop { ctx: ctx, wg: wg, cfg: sp.GetConfig(), + res: sp.GetResources(), rp: sp.GetRocketPool(), ec: sp.GetEthClient(), bc: sp.GetBeaconClient(), @@ -140,7 +142,7 @@ func (t *TaskLoop) Run() error { } // Handle the initial fee recipient file deployment - err := deployDefaultFeeRecipientFile(t.cfg) + err := deployDefaultFeeRecipientFile(t.cfg, t.res) if err != nil { return err } @@ -248,7 +250,7 @@ func (t *TaskLoop) waitUntilReady() waitUntilReadyResult { // Create the network state manager if t.stateMgr == nil { - t.stateMgr, err = state.NewNetworkStateManager(t.ctx, t.rp, t.cfg, t.ec, t.bc, t.logger.Logger) + t.stateMgr, err = state.NewNetworkStateManager(t.ctx, t.rp, t.cfg, t.res, t.ec, t.bc, t.logger.Logger) if err != nil { t.logger.Error("Error creating network state manager", log.Err(err)) return t.sleepAndReturnReadyResult() @@ -405,7 +407,7 @@ func (t *TaskLoop) runTasks() bool { } // Copy the default fee recipient file into the proper location -func deployDefaultFeeRecipientFile(cfg *config.SmartNodeConfig) error { +func deployDefaultFeeRecipientFile(cfg *config.SmartNodeConfig, rs *config.MergedResources) error { feeRecipientPath := cfg.GetFeeRecipientFilePath() _, err := os.Stat(feeRecipientPath) if os.IsNotExist(err) { @@ -417,7 +419,6 @@ func deployDefaultFeeRecipientFile(cfg *config.SmartNodeConfig) error { } // Create the file - rs := cfg.GetRocketPoolResources() var defaultFeeRecipientFileContents string if cfg.IsNativeMode { // Native mode needs an environment variable definition diff --git a/rocketpool-daemon/node/promote-minipools.go b/rocketpool-daemon/node/promote-minipools.go index 4d88192b3..f34217edf 100644 --- a/rocketpool-daemon/node/promote-minipools.go +++ b/rocketpool-daemon/node/promote-minipools.go @@ -27,10 +27,11 @@ import ( // Promote minipools task type PromoteMinipools struct { - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger alerter *alerting.Alerter cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet rp *rocketpool.RocketPool mpMgr *minipool.MinipoolManager @@ -40,7 +41,7 @@ type PromoteMinipools struct { } // Create promote minipools task -func NewPromoteMinipools(sp *services.ServiceProvider, logger *log.Logger) *PromoteMinipools { +func NewPromoteMinipools(sp services.ISmartNodeServiceProvider, logger *log.Logger) *PromoteMinipools { cfg := sp.GetConfig() log := logger.With(slog.String(keys.TaskKey, "Promote Minipools")) maxFee, maxPriorityFee := getAutoTxInfo(cfg, log) @@ -49,6 +50,7 @@ func NewPromoteMinipools(sp *services.ServiceProvider, logger *log.Logger) *Prom logger: log, alerter: alerting.NewAlerter(cfg, logger), cfg: cfg, + res: sp.GetResources(), w: sp.GetWallet(), rp: sp.GetRocketPool(), gasThreshold: cfg.AutoTxGasThreshold.Value, @@ -219,7 +221,7 @@ func (t *PromoteMinipools) promoteMinipools(submissions []*eth.TransactionSubmis } // Print TX info and wait for them to be included in a block - err = tx.PrintAndWaitForTransactionBatch(t.cfg, t.rp, t.logger, submissions, callbacks, opts) + err = tx.PrintAndWaitForTransactionBatch(t.cfg, t.res, t.rp, t.logger, submissions, callbacks, opts) if err != nil { return err } diff --git a/rocketpool-daemon/node/reduce-bonds.go b/rocketpool-daemon/node/reduce-bonds.go index 319c4fde5..d9b344ff2 100644 --- a/rocketpool-daemon/node/reduce-bonds.go +++ b/rocketpool-daemon/node/reduce-bonds.go @@ -35,10 +35,11 @@ const ( // Reduce bonds task type ReduceBonds struct { - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger alerter *alerting.Alerter cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet rp *rocketpool.RocketPool mpMgr *minipool.MinipoolManager @@ -48,7 +49,7 @@ type ReduceBonds struct { } // Create reduce bonds task -func NewReduceBonds(sp *services.ServiceProvider, logger *log.Logger) *ReduceBonds { +func NewReduceBonds(sp services.ISmartNodeServiceProvider, logger *log.Logger) *ReduceBonds { cfg := sp.GetConfig() log := logger.With(slog.String(keys.TaskKey, "Reduce Bonds")) maxFee, maxPriorityFee := getAutoTxInfo(cfg, log) @@ -63,6 +64,7 @@ func NewReduceBonds(sp *services.ServiceProvider, logger *log.Logger) *ReduceBon logger: log, alerter: alerting.NewAlerter(cfg, logger), cfg: cfg, + res: sp.GetResources(), w: sp.GetWallet(), rp: sp.GetRocketPool(), gasThreshold: gasThreshold, @@ -230,7 +232,7 @@ func (t *ReduceBonds) forceFeeDistribution(state *state.NetworkState) (bool, err opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(t.cfg, t.rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(t.cfg, t.res, t.rp, t.logger, txInfo, opts) if err != nil { return false, err } @@ -371,7 +373,7 @@ func (t *ReduceBonds) reduceBonds(submissions []*eth.TransactionSubmission, mini } // Print TX info and wait for them to be included in a block - err = tx.PrintAndWaitForTransactionBatch(t.cfg, t.rp, t.logger, submissions, callbacks, opts) + err = tx.PrintAndWaitForTransactionBatch(t.cfg, t.res, t.rp, t.logger, submissions, callbacks, opts) if err != nil { return err } diff --git a/rocketpool-daemon/node/stake-prelaunch-minipools.go b/rocketpool-daemon/node/stake-prelaunch-minipools.go index a6856396b..56e3f4215 100644 --- a/rocketpool-daemon/node/stake-prelaunch-minipools.go +++ b/rocketpool-daemon/node/stake-prelaunch-minipools.go @@ -31,10 +31,11 @@ import ( // Stake prelaunch minipools task type StakePrelaunchMinipools struct { - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger alerter *alerting.Alerter cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet vMgr *validator.ValidatorManager rp *rocketpool.RocketPool @@ -47,7 +48,7 @@ type StakePrelaunchMinipools struct { } // Create stake prelaunch minipools task -func NewStakePrelaunchMinipools(sp *services.ServiceProvider, logger *log.Logger) *StakePrelaunchMinipools { +func NewStakePrelaunchMinipools(sp services.ISmartNodeServiceProvider, logger *log.Logger) *StakePrelaunchMinipools { cfg := sp.GetConfig() log := logger.With(slog.String(keys.TaskKey, "Prelaunch Stake")) maxFee, maxPriorityFee := getAutoTxInfo(cfg, log) @@ -56,6 +57,7 @@ func NewStakePrelaunchMinipools(sp *services.ServiceProvider, logger *log.Logger logger: log, alerter: alerting.NewAlerter(cfg, logger), cfg: sp.GetConfig(), + res: sp.GetResources(), w: sp.GetWallet(), vMgr: sp.GetValidatorManager(), rp: sp.GetRocketPool(), @@ -191,8 +193,7 @@ func (t *StakePrelaunchMinipools) createStakeMinipoolTx(mpd *rpstate.NativeMinip } // Get validator deposit data - rs := t.cfg.GetNetworkResources() - depositData, err := nmc_validator.GetDepositData(validatorKey, withdrawalCredentials, rs.GenesisForkVersion, depositAmount, rs.EthNetworkName) + depositData, err := nmc_validator.GetDepositData(t.logger, validatorKey, withdrawalCredentials, t.res.GenesisForkVersion, depositAmount, t.res.EthNetworkName) if err != nil { return nil, err } @@ -274,7 +275,7 @@ func (t *StakePrelaunchMinipools) stakeMinipools(submissions []*eth.TransactionS } // Print TX info and wait for them to be included in a block - err = tx.PrintAndWaitForTransactionBatch(t.cfg, t.rp, t.logger, submissions, callbacks, opts) + err = tx.PrintAndWaitForTransactionBatch(t.cfg, t.res, t.rp, t.logger, submissions, callbacks, opts) if err != nil { return false, err } diff --git a/rocketpool-daemon/node/verify-pdao-props.go b/rocketpool-daemon/node/verify-pdao-props.go index 776b9cba1..820afc08c 100644 --- a/rocketpool-daemon/node/verify-pdao-props.go +++ b/rocketpool-daemon/node/verify-pdao-props.go @@ -40,9 +40,10 @@ type defeat struct { type VerifyPdaoProps struct { ctx context.Context - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet rp *rocketpool.RocketPool bc beacon.IBeaconClient @@ -60,7 +61,7 @@ type VerifyPdaoProps struct { intervalSize *big.Int } -func NewVerifyPdaoProps(ctx context.Context, sp *services.ServiceProvider, logger *log.Logger) *VerifyPdaoProps { +func NewVerifyPdaoProps(ctx context.Context, sp services.ISmartNodeServiceProvider, logger *log.Logger) *VerifyPdaoProps { cfg := sp.GetConfig() log := logger.With(slog.String(keys.TaskKey, "Verify PDAO Proposals")) maxFee, maxPriorityFee := getAutoTxInfo(cfg, log) @@ -69,6 +70,7 @@ func NewVerifyPdaoProps(ctx context.Context, sp *services.ServiceProvider, logge sp: sp, logger: log, cfg: cfg, + res: sp.GetResources(), w: sp.GetWallet(), rp: sp.GetRocketPool(), bc: sp.GetBeaconClient(), @@ -86,7 +88,7 @@ func NewVerifyPdaoProps(ctx context.Context, sp *services.ServiceProvider, logge func (t *VerifyPdaoProps) Run(state *state.NetworkState) error { // Bindings t.nodeAddress, _ = t.w.GetAddress() - propMgr, err := proposals.NewProposalManager(t.ctx, t.logger, t.cfg, t.rp, t.bc) + propMgr, err := proposals.NewProposalManager(t.ctx, t.logger, t.cfg, t.res, t.rp, t.bc) if err != nil { return fmt.Errorf("error creating proposal manager: %w", err) } @@ -238,7 +240,7 @@ func (t *VerifyPdaoProps) getChallengesandDefeats(state *state.NetworkState, opt } // Get and cache all root submissions for the proposals - rs := t.cfg.GetRocketPoolResources() + rs := t.sp.GetResources() rootSubmissionEvents, err := t.pdaoMgr.GetRootSubmittedEvents(ids, t.intervalSize, startBlock, endBlock, rs.PreviousProtocolDaoVerifierAddresses, opts) if err != nil { return nil, nil, fmt.Errorf("error scanning for RootSubmitted events: %w", err) @@ -418,7 +420,7 @@ func (t *VerifyPdaoProps) submitTxs(submissions []*eth.TransactionSubmission) er } // Print TX info and wait for them to be included in a block - err = tx.PrintAndWaitForTransactionBatch(t.cfg, t.rp, t.logger, submissions, nil, opts) + err = tx.PrintAndWaitForTransactionBatch(t.cfg, t.res, t.rp, t.logger, submissions, nil, opts) if err != nil { return err } diff --git a/rocketpool-daemon/rocketpool-daemon.go b/rocketpool-daemon/rocketpool-daemon.go index 19f8f1242..87cfdd4ce 100644 --- a/rocketpool-daemon/rocketpool-daemon.go +++ b/rocketpool-daemon/rocketpool-daemon.go @@ -54,6 +54,12 @@ func main() { Usage: "The path of the user data directory, which contains the configuration file to load and all of the user's runtime data", Required: true, } + settingsFolderFlag := &cli.StringFlag{ + Name: "settings-folder", + Aliases: []string{"s"}, + Usage: "The path to the folder containing the network settings files", + Required: true, + } ipFlag := &cli.StringFlag{ Name: "ip", Aliases: []string{"i"}, @@ -70,6 +76,7 @@ func main() { // Set application flags app.Flags = []cli.Flag{ userDirFlag, + settingsFolderFlag, ipFlag, portFlag, } @@ -85,11 +92,23 @@ func main() { os.Exit(1) } + // Get the settings file path + settingsFolder := c.String(settingsFolderFlag.Name) + if settingsFolder == "" { + fmt.Println("No settings folder provided.") + os.Exit(1) + } + _, err = os.Stat(settingsFolder) + if errors.Is(err, fs.ErrNotExist) { + fmt.Printf("Settings folder not found at [%s].", settingsFolder) + os.Exit(1) + } + // Wait group to handle graceful stopping stopWg := new(sync.WaitGroup) // Create the service provider - sp, err := services.NewServiceProvider(userDir) + sp, err := services.NewServiceProvider(userDir, settingsFolder) if err != nil { return fmt.Errorf("error creating service provider: %w", err) } diff --git a/rocketpool-daemon/watchtower/cancel-bond-reductions.go b/rocketpool-daemon/watchtower/cancel-bond-reductions.go index 5589994f9..5dce52824 100644 --- a/rocketpool-daemon/watchtower/cancel-bond-reductions.go +++ b/rocketpool-daemon/watchtower/cancel-bond-reductions.go @@ -33,9 +33,10 @@ const ( type CancelBondReductions struct { ctx context.Context - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet rp *rocketpool.RocketPool ec eth.IExecutionClient @@ -46,13 +47,14 @@ type CancelBondReductions struct { } // Create cancel bond reductions task -func NewCancelBondReductions(ctx context.Context, sp *services.ServiceProvider, logger *log.Logger, coll *collectors.BondReductionCollector) *CancelBondReductions { +func NewCancelBondReductions(ctx context.Context, sp services.ISmartNodeServiceProvider, logger *log.Logger, coll *collectors.BondReductionCollector) *CancelBondReductions { lock := &sync.Mutex{} return &CancelBondReductions{ ctx: ctx, sp: sp, logger: logger.With(slog.String(keys.TaskKey, "Bond Reduction")), cfg: sp.GetConfig(), + res: sp.GetResources(), w: sp.GetWallet(), rp: sp.GetRocketPool(), ec: sp.GetEthClient(), @@ -234,7 +236,7 @@ func (t *CancelBondReductions) cancelBondReduction(state *state.NetworkState, ad opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(t.cfg, t.rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(t.cfg, t.res, t.rp, t.logger, txInfo, opts) if err != nil { mpLogger.Error("Error waiting for cancel transaction", log.Err(err)) return diff --git a/rocketpool-daemon/watchtower/check-solo-migrations.go b/rocketpool-daemon/watchtower/check-solo-migrations.go index 27d124d04..b6dbe3a6b 100644 --- a/rocketpool-daemon/watchtower/check-solo-migrations.go +++ b/rocketpool-daemon/watchtower/check-solo-migrations.go @@ -36,9 +36,10 @@ const ( type CheckSoloMigrations struct { ctx context.Context - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet rp *rocketpool.RocketPool ec eth.IExecutionClient @@ -50,13 +51,14 @@ type CheckSoloMigrations struct { } // Create check solo migrations task -func NewCheckSoloMigrations(ctx context.Context, sp *services.ServiceProvider, logger *log.Logger, coll *collectors.SoloMigrationCollector) *CheckSoloMigrations { +func NewCheckSoloMigrations(ctx context.Context, sp services.ISmartNodeServiceProvider, logger *log.Logger, coll *collectors.SoloMigrationCollector) *CheckSoloMigrations { lock := &sync.Mutex{} return &CheckSoloMigrations{ ctx: ctx, sp: sp, logger: logger.With(slog.String(keys.TaskKey, "Solo Migration")), cfg: sp.GetConfig(), + res: sp.GetResources(), w: sp.GetWallet(), rp: sp.GetRocketPool(), ec: sp.GetEthClient(), @@ -271,7 +273,7 @@ func (t *CheckSoloMigrations) scrubVacantMinipool(state *state.NetworkState, add opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(t.cfg, t.rp, mpLogger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(t.cfg, t.res, t.rp, mpLogger, txInfo, opts) if err != nil { mpLogger.Error("Error waiting for scrub transaction", log.Err(err)) return diff --git a/rocketpool-daemon/watchtower/dissolve-timed-out-minipools.go b/rocketpool-daemon/watchtower/dissolve-timed-out-minipools.go index 480078e1a..44f7bc091 100644 --- a/rocketpool-daemon/watchtower/dissolve-timed-out-minipools.go +++ b/rocketpool-daemon/watchtower/dissolve-timed-out-minipools.go @@ -26,9 +26,10 @@ const MinipoolStatusBatchSize = 20 // Dissolve timed out minipools task type DissolveTimedOutMinipools struct { - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet rp *rocketpool.RocketPool ec eth.IExecutionClient @@ -36,10 +37,11 @@ type DissolveTimedOutMinipools struct { } // Create dissolve timed out minipools task -func NewDissolveTimedOutMinipools(sp *services.ServiceProvider, logger *log.Logger) *DissolveTimedOutMinipools { +func NewDissolveTimedOutMinipools(sp services.ISmartNodeServiceProvider, logger *log.Logger) *DissolveTimedOutMinipools { return &DissolveTimedOutMinipools{ sp: sp, cfg: sp.GetConfig(), + res: sp.GetResources(), w: sp.GetWallet(), rp: sp.GetRocketPool(), ec: sp.GetEthClient(), @@ -141,7 +143,7 @@ func (t *DissolveTimedOutMinipools) dissolveMinipool(mp minipool.IMinipool) erro opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(t.cfg, t.rp, mpLogger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(t.cfg, t.res, t.rp, mpLogger, txInfo, opts) if err != nil { return err } diff --git a/rocketpool-daemon/watchtower/finalize-pdao-proposals.go b/rocketpool-daemon/watchtower/finalize-pdao-proposals.go index ea7b6d568..33591fbba 100644 --- a/rocketpool-daemon/watchtower/finalize-pdao-proposals.go +++ b/rocketpool-daemon/watchtower/finalize-pdao-proposals.go @@ -22,19 +22,21 @@ import ( // Finalize PDAO proposals task type FinalizePdaoProposals struct { - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet ec eth.IExecutionClient rp *rocketpool.RocketPool } // Create finalize PDAO proposals task task -func NewFinalizePdaoProposals(sp *services.ServiceProvider, logger *log.Logger) *FinalizePdaoProposals { +func NewFinalizePdaoProposals(sp services.ISmartNodeServiceProvider, logger *log.Logger) *FinalizePdaoProposals { return &FinalizePdaoProposals{ sp: sp, cfg: sp.GetConfig(), + res: sp.GetResources(), w: sp.GetWallet(), ec: sp.GetEthClient(), rp: sp.GetRocketPool(), @@ -117,7 +119,7 @@ func (t *FinalizePdaoProposals) finalizeProposal(propID uint64) error { opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(t.cfg, t.rp, propLogger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(t.cfg, t.res, t.rp, propLogger, txInfo, opts) if err != nil { return err } diff --git a/rocketpool-daemon/watchtower/generate-rewards-tree.go b/rocketpool-daemon/watchtower/generate-rewards-tree.go index d9302cfa8..2697e1bdd 100644 --- a/rocketpool-daemon/watchtower/generate-rewards-tree.go +++ b/rocketpool-daemon/watchtower/generate-rewards-tree.go @@ -32,9 +32,10 @@ import ( // Generate rewards Merkle Tree task type GenerateRewardsTree struct { ctx context.Context - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger cfg *config.SmartNodeConfig + res *config.MergedResources rp *rocketpool.RocketPool ec eth.IExecutionClient bc beacon.IBeaconClient @@ -43,13 +44,14 @@ type GenerateRewardsTree struct { } // Create generate rewards Merkle Tree task -func NewGenerateRewardsTree(ctx context.Context, sp *services.ServiceProvider, logger *log.Logger) *GenerateRewardsTree { +func NewGenerateRewardsTree(ctx context.Context, sp services.ISmartNodeServiceProvider, logger *log.Logger) *GenerateRewardsTree { lock := &sync.Mutex{} return &GenerateRewardsTree{ ctx: ctx, sp: sp, logger: logger.With(slog.String(keys.TaskKey, "Generate Rewards Tree")), cfg: sp.GetConfig(), + res: sp.GetResources(), rp: sp.GetRocketPool(), ec: sp.GetEthClient(), bc: sp.GetBeaconClient(), @@ -121,7 +123,7 @@ func (t *GenerateRewardsTree) generateRewardsTree(index uint64) { logger.Info("Starting generation of Merkle rewards tree.") // Find the event for this interval - rewardsEvent, err := rprewards.GetRewardSnapshotEvent(t.rp, t.cfg, index, nil) + rewardsEvent, err := rprewards.GetRewardSnapshotEvent(t.rp, t.cfg, t.res, index, nil) if err != nil { t.handleError(fmt.Errorf("Error getting event: %w", err), logger) return @@ -138,7 +140,7 @@ func (t *GenerateRewardsTree) generateRewardsTree(index uint64) { var stateManager *state.NetworkStateManager // Try getting the rETH address as a canary to see if the block is available - rs := t.cfg.GetRocketPoolResources() + rs := t.sp.GetResources() client := t.rp opts := &bind.CallOpts{ BlockNumber: elBlockHeader.Number, @@ -150,7 +152,7 @@ func (t *GenerateRewardsTree) generateRewardsTree(index uint64) { }, opts) if err == nil { // Create the state manager with using the primary or fallback (not necessarily archive) EC - stateManager, err = state.NewNetworkStateManager(t.ctx, client, t.cfg, t.rp.Client, t.bc, logger) + stateManager, err = state.NewNetworkStateManager(t.ctx, client, t.cfg, t.res, t.rp.Client, t.bc, logger) if err != nil { t.handleError(fmt.Errorf("error creating new NetworkStateManager with Archive EC: %w", err), logger) return @@ -189,7 +191,7 @@ func (t *GenerateRewardsTree) generateRewardsTree(index uint64) { return } // Create the state manager with the archive EC - stateManager, err = state.NewNetworkStateManager(t.ctx, client, t.cfg, ec, t.bc, logger) + stateManager, err = state.NewNetworkStateManager(t.ctx, client, t.cfg, t.res, ec, t.bc, logger) if err != nil { t.handleError(fmt.Errorf("error creating new NetworkStateManager with Archive EC: %w", err), logger) return @@ -224,7 +226,7 @@ func (t *GenerateRewardsTree) generateRewardsTree(index uint64) { func (t *GenerateRewardsTree) generateRewardsTreeImpl(logger *slog.Logger, rp *rocketpool.RocketPool, index uint64, rewardsEvent rewards.RewardsEvent, elBlockHeader *types.Header, state *state.NetworkState) { // Generate the rewards file start := time.Now() - treegen, err := rprewards.NewTreeGenerator(t.logger, rp, t.cfg, t.bc, index, rewardsEvent.IntervalStartTime, rewardsEvent.IntervalEndTime, rewardsEvent.ConsensusBlock.Uint64(), elBlockHeader, rewardsEvent.IntervalsPassed.Uint64(), state, nil) + treegen, err := rprewards.NewTreeGenerator(t.logger, rp, t.cfg, t.res, t.bc, index, rewardsEvent.IntervalStartTime, rewardsEvent.IntervalEndTime, rewardsEvent.ConsensusBlock.Uint64(), elBlockHeader, rewardsEvent.IntervalsPassed.Uint64(), state, nil) if err != nil { t.handleError(fmt.Errorf("Error creating Merkle tree generator: %w", err), logger) return diff --git a/rocketpool-daemon/watchtower/respond-challenges.go b/rocketpool-daemon/watchtower/respond-challenges.go index 62d81c3f0..b41775f19 100644 --- a/rocketpool-daemon/watchtower/respond-challenges.go +++ b/rocketpool-daemon/watchtower/respond-challenges.go @@ -21,18 +21,20 @@ import ( // Respond to challenges task type RespondChallenges struct { - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet rp *rocketpool.RocketPool logger *slog.Logger } // Create respond to challenges task -func NewRespondChallenges(sp *services.ServiceProvider, logger *log.Logger, m *state.NetworkStateManager) *RespondChallenges { +func NewRespondChallenges(sp services.ISmartNodeServiceProvider, logger *log.Logger, m *state.NetworkStateManager) *RespondChallenges { return &RespondChallenges{ sp: sp, cfg: sp.GetConfig(), + res: sp.GetResources(), w: sp.GetWallet(), rp: sp.GetRocketPool(), logger: logger.With(slog.String(keys.TaskKey, "Respond to Challenges")), @@ -95,7 +97,7 @@ func (t *RespondChallenges) Run() error { opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(t.cfg, t.rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(t.cfg, t.res, t.rp, t.logger, txInfo, opts) if err != nil { return err } diff --git a/rocketpool-daemon/watchtower/submit-network-balances.go b/rocketpool-daemon/watchtower/submit-network-balances.go index 64db327be..478eb222b 100644 --- a/rocketpool-daemon/watchtower/submit-network-balances.go +++ b/rocketpool-daemon/watchtower/submit-network-balances.go @@ -41,9 +41,10 @@ const ( // Submit network balances task type SubmitNetworkBalances struct { ctx context.Context - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet ec eth.IExecutionClient rp *rocketpool.RocketPool @@ -72,13 +73,14 @@ type minipoolBalanceDetails struct { } // Create submit network balances task -func NewSubmitNetworkBalances(ctx context.Context, sp *services.ServiceProvider, logger *log.Logger) *SubmitNetworkBalances { +func NewSubmitNetworkBalances(ctx context.Context, sp services.ISmartNodeServiceProvider, logger *log.Logger) *SubmitNetworkBalances { lock := &sync.Mutex{} return &SubmitNetworkBalances{ ctx: ctx, sp: sp, logger: logger.With(slog.String(keys.TaskKey, "Balance Report")), cfg: sp.GetConfig(), + res: sp.GetResources(), w: sp.GetWallet(), ec: sp.GetEthClient(), rp: sp.GetRocketPool(), @@ -252,13 +254,13 @@ func (t *SubmitNetworkBalances) hasSubmittedSpecificBlockBalances(nodeAddress co // Get the network balances at a specific block func (t *SubmitNetworkBalances) getNetworkBalances(elBlockHeader *types.Header, elBlock *big.Int, beaconBlock uint64, slotTime time.Time) (networkBalances, error) { // Get a client with the block number available - client, err := eth1.GetBestApiClient(t.rp, t.cfg, t.logger, elBlock) + client, err := eth1.GetBestApiClient(t.rp, t.cfg, t.res, t.logger, elBlock) if err != nil { return networkBalances{}, err } // Create a new state gen manager - mgr, err := state.NewNetworkStateManager(t.ctx, client, t.cfg, client.Client, t.bc, t.logger) + mgr, err := state.NewNetworkStateManager(t.ctx, client, t.cfg, t.res, client.Client, t.bc, t.logger) if err != nil { return networkBalances{}, fmt.Errorf("error creating network state manager for EL block %s, Beacon slot %d: %w", elBlock, beaconBlock, err) } @@ -315,7 +317,7 @@ func (t *SubmitNetworkBalances) getNetworkBalances(elBlockHeader *types.Header, // Approximate the staker's share of the smoothing pool balance // NOTE: this will use the "vanilla" variant of treegen, without rolling records, to retain parity with other Oracle DAO nodes that aren't using rolling records - treegen, err := rprewards.NewTreeGenerator(t.logger, client, t.cfg, t.bc, currentIndex, startTime, endTime, beaconBlock, elBlockHeader, uint64(intervalsPassed), state, nil) + treegen, err := rprewards.NewTreeGenerator(t.logger, client, t.cfg, t.res, t.bc, currentIndex, startTime, endTime, beaconBlock, elBlockHeader, uint64(intervalsPassed), state, nil) if err != nil { return fmt.Errorf("error creating merkle tree generator to approximate share of smoothing pool: %w", err) } @@ -490,7 +492,7 @@ func (t *SubmitNetworkBalances) submitBalances(balances networkBalances, isHoust opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(t.cfg, t.rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(t.cfg, t.res, t.rp, t.logger, txInfo, opts) if err != nil { return fmt.Errorf("error waiting for transaction: %w", err) } diff --git a/rocketpool-daemon/watchtower/submit-rewards-tree-rolling.go b/rocketpool-daemon/watchtower/submit-rewards-tree-rolling.go index b8a2cb531..c4aebaf9e 100644 --- a/rocketpool-daemon/watchtower/submit-rewards-tree-rolling.go +++ b/rocketpool-daemon/watchtower/submit-rewards-tree-rolling.go @@ -39,9 +39,10 @@ import ( // Process balances and rewards task type SubmitRewardsTree_Rolling struct { ctx context.Context - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet ec eth.IExecutionClient rp *rocketpool.RocketPool @@ -56,9 +57,10 @@ type SubmitRewardsTree_Rolling struct { } // Create submit rewards tree with rolling record support -func NewSubmitRewardsTree_Rolling(ctx context.Context, sp *services.ServiceProvider, logger *log.Logger, stateMgr *state.NetworkStateManager) (*SubmitRewardsTree_Rolling, error) { +func NewSubmitRewardsTree_Rolling(ctx context.Context, sp services.ISmartNodeServiceProvider, logger *log.Logger, stateMgr *state.NetworkStateManager) (*SubmitRewardsTree_Rolling, error) { // Get services cfg := sp.GetConfig() + res := sp.GetResources() rp := sp.GetRocketPool() bc := sp.GetBeaconClient() rewardsPool, err := rewards.NewRewardsPool(rp) @@ -86,8 +88,7 @@ func NewSubmitRewardsTree_Rolling(ctx context.Context, sp *services.ServiceProvi } // Get the previous RocketRewardsPool addresses - rs := cfg.GetRocketPoolResources() - prevAddresses := rs.PreviousRewardsPoolAddresses + prevAddresses := res.PreviousRewardsPoolAddresses // Get the last rewards event and starting epoch found, event, err := rewardsPool.GetRewardsEvent(rp, currentIndex-1, prevAddresses, nil) @@ -111,6 +112,7 @@ func NewSubmitRewardsTree_Rolling(ctx context.Context, sp *services.ServiceProvi sp: sp, logger: logger.With(), cfg: cfg, + res: res, w: sp.GetWallet(), ec: sp.GetEthClient(), rp: sp.GetRocketPool(), @@ -122,7 +124,7 @@ func NewSubmitRewardsTree_Rolling(ctx context.Context, sp *services.ServiceProvi } // Make a new rolling manager - recordMgr, err := rprewards.NewRollingRecordManager(task.logger, cfg, rp, bc, stateMgr, startSlot, beaconCfg, currentIndex) + recordMgr, err := rprewards.NewRollingRecordManager(task.logger, cfg, res, rp, bc, stateMgr, startSlot, beaconCfg, currentIndex) if err != nil { return nil, fmt.Errorf("error creating rolling record manager: %w", err) } @@ -259,14 +261,14 @@ func (t *SubmitRewardsTree_Rolling) Run(headState *state.NetworkState) error { // Get an appropriate client that has access to the target state - this is required if the state gets pruned by the local EC and the // archive EC is required - client, err := eth1.GetBestApiClient(t.rp, t.cfg, t.logger, big.NewInt(0).SetUint64(elBlockNumber)) + client, err := eth1.GetBestApiClient(t.rp, t.cfg, t.res, t.logger, big.NewInt(0).SetUint64(elBlockNumber)) if err != nil { t.handleError(fmt.Errorf("error getting best API client during rewards submission: %w", err)) return } // Generate the rewards state - stateMgr, err := state.NewNetworkStateManager(t.ctx, client, t.cfg, client.Client, t.bc, t.logger) + stateMgr, err := state.NewNetworkStateManager(t.ctx, client, t.cfg, t.res, client.Client, t.bc, t.logger) if err != nil { t.handleError(fmt.Errorf("error creating state manager for rewards slot: %w", err)) return @@ -509,7 +511,7 @@ func (t *SubmitRewardsTree_Rolling) generateTree(rp *rocketpool.RocketPool, stat t.logger.Info("Rewards checkpoint has passed, starting Merkle tree generation in the background.", slog.Uint64(keys.IntervalKey, currentIndex), slog.Uint64(keys.SlotKey, snapshotBeaconBlock), slog.Uint64(keys.BlockKey, elBlockIndex), slog.Time(keys.StartKey, startTime), slog.Time(keys.EndKey, endTime)) // Generate the rewards file - treegen, err := rprewards.NewTreeGenerator(t.logger, rp, t.cfg, t.bc, currentIndex, startTime, endTime, snapshotBeaconBlock, snapshotElBlockHeader, uint64(intervalsPassed), state, t.recordMgr.Record) + treegen, err := rprewards.NewTreeGenerator(t.logger, rp, t.cfg, t.res, t.bc, currentIndex, startTime, endTime, snapshotBeaconBlock, snapshotElBlockHeader, uint64(intervalsPassed), state, t.recordMgr.Record) if err != nil { return fmt.Errorf("error creating Merkle tree generator: %w", err) } @@ -654,7 +656,7 @@ func (t *SubmitRewardsTree_Rolling) submitRewardsSnapshot(index *big.Int, consen opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(t.cfg, t.rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(t.cfg, t.res, t.rp, t.logger, txInfo, opts) if err != nil { return err } diff --git a/rocketpool-daemon/watchtower/submit-rewards-tree-stateless.go b/rocketpool-daemon/watchtower/submit-rewards-tree-stateless.go index e0b6e9b9d..cf299cdb1 100644 --- a/rocketpool-daemon/watchtower/submit-rewards-tree-stateless.go +++ b/rocketpool-daemon/watchtower/submit-rewards-tree-stateless.go @@ -40,9 +40,10 @@ import ( // Submit rewards Merkle Tree task type SubmitRewardsTree_Stateless struct { ctx context.Context - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet rp *rocketpool.RocketPool ec eth.IExecutionClient @@ -54,13 +55,14 @@ type SubmitRewardsTree_Stateless struct { } // Create submit rewards Merkle Tree task -func NewSubmitRewardsTree_Stateless(ctx context.Context, sp *services.ServiceProvider, logger *log.Logger, m *state.NetworkStateManager) *SubmitRewardsTree_Stateless { +func NewSubmitRewardsTree_Stateless(ctx context.Context, sp services.ISmartNodeServiceProvider, logger *log.Logger, m *state.NetworkStateManager) *SubmitRewardsTree_Stateless { lock := &sync.Mutex{} return &SubmitRewardsTree_Stateless{ ctx: ctx, sp: sp, logger: logger.With(slog.String(keys.TaskKey, "Merkle Tree")), cfg: sp.GetConfig(), + res: sp.GetResources(), w: sp.GetWallet(), rp: sp.GetRocketPool(), ec: sp.GetEthClient(), @@ -270,7 +272,7 @@ func (t *SubmitRewardsTree_Stateless) generateTree(intervalsPassed time.Duration t.lock.Unlock() // Get an appropriate client - client, err := eth1.GetBestApiClient(t.rp, t.cfg, t.logger, snapshotElBlockHeader.Number) + client, err := eth1.GetBestApiClient(t.rp, t.cfg, t.res, t.logger, snapshotElBlockHeader.Number) if err != nil { t.handleError(err) return @@ -297,7 +299,7 @@ func (t *SubmitRewardsTree_Stateless) generateTreeImpl(rp *rocketpool.RocketPool t.logger.Info("Rewards checkpoint has passed, starting Merkle tree generation in the background.", slog.Uint64(keys.IntervalKey, currentIndex), slog.Uint64(keys.SlotKey, snapshotBeaconBlock), slog.Uint64(keys.BlockKey, elBlockIndex), slog.Time(keys.StartKey, startTime), slog.Time(keys.EndKey, endTime)) // Create a new state gen manager - mgr, err := state.NewNetworkStateManager(t.ctx, rp, t.cfg, rp.Client, t.bc, t.logger) + mgr, err := state.NewNetworkStateManager(t.ctx, rp, t.cfg, t.res, rp.Client, t.bc, t.logger) if err != nil { return fmt.Errorf("error creating network state manager for EL block %d, Beacon slot %d: %w", elBlockIndex, snapshotBeaconBlock, err) } @@ -309,7 +311,7 @@ func (t *SubmitRewardsTree_Stateless) generateTreeImpl(rp *rocketpool.RocketPool } // Generate the rewards file - treegen, err := rprewards.NewTreeGenerator(t.logger, rp, t.cfg, t.bc, currentIndex, startTime, endTime, snapshotBeaconBlock, snapshotElBlockHeader, uint64(intervalsPassed), state, nil) + treegen, err := rprewards.NewTreeGenerator(t.logger, rp, t.cfg, t.res, t.bc, currentIndex, startTime, endTime, snapshotBeaconBlock, snapshotElBlockHeader, uint64(intervalsPassed), state, nil) if err != nil { return fmt.Errorf("error creating Merkle tree generator: %w", err) } @@ -458,7 +460,7 @@ func (t *SubmitRewardsTree_Stateless) submitRewardsSnapshot(index *big.Int, cons opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(t.cfg, t.rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(t.cfg, t.res, t.rp, t.logger, txInfo, opts) if err != nil { return err } diff --git a/rocketpool-daemon/watchtower/submit-rpl-price.go b/rocketpool-daemon/watchtower/submit-rpl-price.go index 427557ec0..366ea6d07 100644 --- a/rocketpool-daemon/watchtower/submit-rpl-price.go +++ b/rocketpool-daemon/watchtower/submit-rpl-price.go @@ -42,9 +42,10 @@ const ( // Submit RPL price task type SubmitRplPrice struct { ctx context.Context - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger cfg *config.SmartNodeConfig + res *config.MergedResources ec eth.IExecutionClient w *wallet.Wallet rp *rocketpool.RocketPool @@ -55,13 +56,14 @@ type SubmitRplPrice struct { } // Create submit RPL price task -func NewSubmitRplPrice(ctx context.Context, sp *services.ServiceProvider, logger *log.Logger) *SubmitRplPrice { +func NewSubmitRplPrice(ctx context.Context, sp services.ISmartNodeServiceProvider, logger *log.Logger) *SubmitRplPrice { lock := &sync.Mutex{} return &SubmitRplPrice{ ctx: ctx, sp: sp, logger: logger.With(slog.String(keys.TaskKey, "Price Report")), cfg: sp.GetConfig(), + res: sp.GetResources(), ec: sp.GetEthClient(), w: sp.GetWallet(), rp: sp.GetRocketPool(), @@ -215,14 +217,14 @@ func (t *SubmitRplPrice) getRplTwap(blockNumber uint64) (*big.Int, error) { BlockNumber: big.NewInt(int64(blockNumber)), } - rs := t.cfg.GetRocketPoolResources() + rs := t.sp.GetResources() poolAddress := rs.RplTwapPoolAddress if poolAddress == nil { return nil, fmt.Errorf("RPL TWAP pool contract not deployed on this network") } // Get a client with the block number available - client, err := eth1.GetBestApiClient(t.rp, t.cfg, t.logger, opts.BlockNumber) + client, err := eth1.GetBestApiClient(t.rp, t.cfg, t.res, t.logger, opts.BlockNumber) if err != nil { return nil, err } @@ -304,7 +306,7 @@ func (t *SubmitRplPrice) submitRplPrice(blockNumber uint64, slotTimestamp uint64 opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(t.cfg, t.rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(t.cfg, t.res, t.rp, t.logger, txInfo, opts) if err != nil { return err } @@ -320,56 +322,56 @@ func (t *SubmitRplPrice) submitRplPrice(blockNumber uint64, slotTimestamp uint64 func (t *SubmitRplPrice) updateL2Prices(state *state.NetworkState) error { // Get services cfg := t.sp.GetConfig() + res := t.sp.GetResources() rp := t.sp.GetRocketPool() ec := t.sp.GetEthClient() txMgr := t.sp.GetTransactionManager() - rs := cfg.GetRocketPoolResources() // Create bindings errs := []error{} - optimismMessengerAddress := rs.OptimismPriceMessengerAddress + optimismMessengerAddress := res.OptimismPriceMessengerAddress var optimismMessenger *contracts.OptimismMessenger if optimismMessengerAddress != nil { var err error optimismMessenger, err = contracts.NewOptimismMessenger(*optimismMessengerAddress, ec, txMgr) errs = append(errs, err) } - polygonMessengerAddress := rs.PolygonPriceMessengerAddress + polygonMessengerAddress := res.PolygonPriceMessengerAddress var polygonMessenger *contracts.PolygonMessenger if polygonMessengerAddress != nil { var err error polygonMessenger, err = contracts.NewPolygonMessenger(*polygonMessengerAddress, ec, txMgr) errs = append(errs, err) } - arbitrumMessengerAddress := rs.ArbitrumPriceMessengerAddress + arbitrumMessengerAddress := res.ArbitrumPriceMessengerAddress var arbitrumMessenger *contracts.ArbitrumMessenger if arbitrumMessengerAddress != nil { var err error arbitrumMessenger, err = contracts.NewArbitrumMessenger(*arbitrumMessengerAddress, ec, txMgr) errs = append(errs, err) } - arbitrumMessengerV2Address := rs.ArbitrumPriceMessengerAddressV2 + arbitrumMessengerV2Address := res.ArbitrumPriceMessengerAddressV2 var arbitrumMessengerV2 *contracts.ArbitrumMessenger if arbitrumMessengerV2Address != nil { var err error arbitrumMessengerV2, err = contracts.NewArbitrumMessenger(*arbitrumMessengerV2Address, ec, txMgr) errs = append(errs, err) } - zksyncEraMessengerAddress := rs.ZkSyncEraPriceMessengerAddress + zksyncEraMessengerAddress := res.ZkSyncEraPriceMessengerAddress var zkSyncEraMessenger *contracts.ZkSyncEraMessenger if zksyncEraMessengerAddress != nil { var err error zkSyncEraMessenger, err = contracts.NewZkSyncEraMessenger(*zksyncEraMessengerAddress, ec, txMgr) errs = append(errs, err) } - baseMessengerAddress := rs.BasePriceMessengerAddress + baseMessengerAddress := res.BasePriceMessengerAddress var baseMessenger *contracts.OptimismMessenger // Base uses the same contract as Optimism if baseMessengerAddress != nil { var err error baseMessenger, err = contracts.NewOptimismMessenger(*baseMessengerAddress, ec, txMgr) errs = append(errs, err) } - scrollMessengerAddress := rs.ScrollPriceMessengerAddress + scrollMessengerAddress := res.ScrollPriceMessengerAddress var scrollMessenger *contracts.ScrollMessenger var scrollEstimator *contracts.ScrollFeeEstimator if scrollMessengerAddress != nil { @@ -377,7 +379,7 @@ func (t *SubmitRplPrice) updateL2Prices(state *state.NetworkState) error { scrollMessenger, err = contracts.NewScrollMessenger(*scrollMessengerAddress, ec, txMgr) errs = append(errs, err) - scrollEstimator, err = contracts.NewScrollFeeEstimator(*rs.ScrollFeeEstimatorAddress, ec) + scrollEstimator, err = contracts.NewScrollFeeEstimator(*res.ScrollFeeEstimatorAddress, ec) errs = append(errs, err) } if err := errors.Join(errs...); err != nil { @@ -459,25 +461,25 @@ func (t *SubmitRplPrice) updateL2Prices(state *state.NetworkState) error { if index == indexToSubmit { errs := []error{} if optimismStale { - errs = append(errs, t.updateOptimism(cfg, rp, optimismMessenger, blockNumber, opts)) + errs = append(errs, t.updateOptimism(cfg, res, rp, optimismMessenger, blockNumber, opts)) } if polygonStale { - errs = append(errs, t.updatePolygon(cfg, rp, polygonMessenger, blockNumber, opts)) + errs = append(errs, t.updatePolygon(cfg, res, rp, polygonMessenger, blockNumber, opts)) } if arbitrumStale { - errs = append(errs, t.updateArbitrum(cfg, rp, arbitrumMessenger, "V1", blockNumber, opts)) + errs = append(errs, t.updateArbitrum(cfg, res, rp, arbitrumMessenger, "V1", blockNumber, opts)) } if arbitrumV2Stale { - errs = append(errs, t.updateArbitrum(cfg, rp, arbitrumMessengerV2, "V2", blockNumber, opts)) + errs = append(errs, t.updateArbitrum(cfg, res, rp, arbitrumMessengerV2, "V2", blockNumber, opts)) } if zkSyncEraStale { - errs = append(errs, t.updateZkSyncEra(cfg, rp, zkSyncEraMessenger, blockNumber, opts)) + errs = append(errs, t.updateZkSyncEra(cfg, res, rp, zkSyncEraMessenger, blockNumber, opts)) } if baseStale { - errs = append(errs, t.updateBase(cfg, rp, baseMessenger, blockNumber, opts)) + errs = append(errs, t.updateBase(cfg, res, rp, baseMessenger, blockNumber, opts)) } if scrollStale { - errs = append(errs, t.updateScroll(cfg, rp, ec, scrollMessenger, scrollEstimator, blockNumber, opts)) + errs = append(errs, t.updateScroll(cfg, res, rp, ec, scrollMessenger, scrollEstimator, blockNumber, opts)) } return errors.Join(errs...) } @@ -485,7 +487,7 @@ func (t *SubmitRplPrice) updateL2Prices(state *state.NetworkState) error { } // Submit a price update to Optimism -func (t *SubmitRplPrice) updateOptimism(cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, optimismMessenger *contracts.OptimismMessenger, blockNumber uint64, opts *bind.TransactOpts) error { +func (t *SubmitRplPrice) updateOptimism(cfg *config.SmartNodeConfig, res *config.MergedResources, rp *rocketpool.RocketPool, optimismMessenger *contracts.OptimismMessenger, blockNumber uint64, opts *bind.TransactOpts) error { t.logger.Info("Submitting rate to Optimism...") txInfo, err := optimismMessenger.SubmitRate(opts) if err != nil { @@ -507,7 +509,7 @@ func (t *SubmitRplPrice) updateOptimism(cfg *config.SmartNodeConfig, rp *rocketp opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(cfg, rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(cfg, res, rp, t.logger, txInfo, opts) if err != nil { return err } @@ -518,7 +520,7 @@ func (t *SubmitRplPrice) updateOptimism(cfg *config.SmartNodeConfig, rp *rocketp } // Submit a price update to Polygon -func (t *SubmitRplPrice) updatePolygon(cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, polygonmMessenger *contracts.PolygonMessenger, blockNumber uint64, opts *bind.TransactOpts) error { +func (t *SubmitRplPrice) updatePolygon(cfg *config.SmartNodeConfig, res *config.MergedResources, rp *rocketpool.RocketPool, polygonmMessenger *contracts.PolygonMessenger, blockNumber uint64, opts *bind.TransactOpts) error { t.logger.Info("Submitting rate to Polygon...") txInfo, err := polygonmMessenger.SubmitRate(opts) if err != nil { @@ -540,7 +542,7 @@ func (t *SubmitRplPrice) updatePolygon(cfg *config.SmartNodeConfig, rp *rocketpo opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(cfg, rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(cfg, res, rp, t.logger, txInfo, opts) if err != nil { return err } @@ -551,7 +553,7 @@ func (t *SubmitRplPrice) updatePolygon(cfg *config.SmartNodeConfig, rp *rocketpo } // Submit a price update to Arbitrum -func (t *SubmitRplPrice) updateArbitrum(cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, arbitrumMessenger *contracts.ArbitrumMessenger, version string, blockNumber uint64, opts *bind.TransactOpts) error { +func (t *SubmitRplPrice) updateArbitrum(cfg *config.SmartNodeConfig, res *config.MergedResources, rp *rocketpool.RocketPool, arbitrumMessenger *contracts.ArbitrumMessenger, version string, blockNumber uint64, opts *bind.TransactOpts) error { t.logger.Info("Submitting rate to Arbitrum...") // Get the current network recommended max fee @@ -600,7 +602,7 @@ func (t *SubmitRplPrice) updateArbitrum(cfg *config.SmartNodeConfig, rp *rocketp opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(cfg, rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(cfg, res, rp, t.logger, txInfo, opts) if err != nil { return err } @@ -611,7 +613,7 @@ func (t *SubmitRplPrice) updateArbitrum(cfg *config.SmartNodeConfig, rp *rocketp } // Submit a price update to zkSync Era -func (t *SubmitRplPrice) updateZkSyncEra(cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, zkSyncEraMessenger *contracts.ZkSyncEraMessenger, blockNumber uint64, opts *bind.TransactOpts) error { +func (t *SubmitRplPrice) updateZkSyncEra(cfg *config.SmartNodeConfig, res *config.MergedResources, rp *rocketpool.RocketPool, zkSyncEraMessenger *contracts.ZkSyncEraMessenger, blockNumber uint64, opts *bind.TransactOpts) error { t.logger.Info("Submitting rate to zkSync Era...") // Constants for zkSync Era l1GasPerPubdataByte := big.NewInt(17) @@ -652,7 +654,7 @@ func (t *SubmitRplPrice) updateZkSyncEra(cfg *config.SmartNodeConfig, rp *rocket opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(cfg, rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(cfg, res, rp, t.logger, txInfo, opts) if err != nil { return err } @@ -663,7 +665,7 @@ func (t *SubmitRplPrice) updateZkSyncEra(cfg *config.SmartNodeConfig, rp *rocket } // Submit a price update to Base -func (t *SubmitRplPrice) updateBase(cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, baseMessenger *contracts.OptimismMessenger, blockNumber uint64, opts *bind.TransactOpts) error { +func (t *SubmitRplPrice) updateBase(cfg *config.SmartNodeConfig, res *config.MergedResources, rp *rocketpool.RocketPool, baseMessenger *contracts.OptimismMessenger, blockNumber uint64, opts *bind.TransactOpts) error { t.logger.Info("Submitting rate to Base...") txInfo, err := baseMessenger.SubmitRate(opts) if err != nil { @@ -685,7 +687,7 @@ func (t *SubmitRplPrice) updateBase(cfg *config.SmartNodeConfig, rp *rocketpool. opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(cfg, rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(cfg, res, rp, t.logger, txInfo, opts) if err != nil { return err } @@ -696,7 +698,7 @@ func (t *SubmitRplPrice) updateBase(cfg *config.SmartNodeConfig, rp *rocketpool. } // Submit a price update to Scroll -func (t *SubmitRplPrice) updateScroll(cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, ec eth.IExecutionClient, scrollMessenger *contracts.ScrollMessenger, scrollEstimator *contracts.ScrollFeeEstimator, blockNumber uint64, opts *bind.TransactOpts) error { +func (t *SubmitRplPrice) updateScroll(cfg *config.SmartNodeConfig, res *config.MergedResources, rp *rocketpool.RocketPool, ec eth.IExecutionClient, scrollMessenger *contracts.ScrollMessenger, scrollEstimator *contracts.ScrollFeeEstimator, blockNumber uint64, opts *bind.TransactOpts) error { t.logger.Info("Submitting rate to Scroll...") maxFee := eth.GweiToWei(utils.GetWatchtowerMaxFee(cfg)) @@ -734,7 +736,7 @@ func (t *SubmitRplPrice) updateScroll(cfg *config.SmartNodeConfig, rp *rocketpoo opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(cfg, rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(cfg, res, rp, t.logger, txInfo, opts) if err != nil { return err } diff --git a/rocketpool-daemon/watchtower/submit-scrub-minipools.go b/rocketpool-daemon/watchtower/submit-scrub-minipools.go index 252ed5d75..82f5bb4f3 100644 --- a/rocketpool-daemon/watchtower/submit-scrub-minipools.go +++ b/rocketpool-daemon/watchtower/submit-scrub-minipools.go @@ -42,9 +42,10 @@ const MinScrubSafetyTime = time.Duration(0) * time.Hour // Submit scrub minipools task type SubmitScrubMinipools struct { - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider logger *slog.Logger cfg *config.SmartNodeConfig + res *config.MergedResources w *wallet.Wallet rp *rocketpool.RocketPool ec eth.IExecutionClient @@ -85,12 +86,13 @@ type minipoolDetails struct { } // Create submit scrub minipools task -func NewSubmitScrubMinipools(sp *services.ServiceProvider, logger *log.Logger, coll *collectors.ScrubCollector) *SubmitScrubMinipools { +func NewSubmitScrubMinipools(sp services.ISmartNodeServiceProvider, logger *log.Logger, coll *collectors.ScrubCollector) *SubmitScrubMinipools { lock := &sync.Mutex{} return &SubmitScrubMinipools{ sp: sp, logger: logger.With(slog.String(keys.TaskKey, "Minipool Scrub")), cfg: sp.GetConfig(), + res: sp.GetResources(), w: sp.GetWallet(), rp: sp.GetRocketPool(), ec: sp.GetEthClient(), @@ -520,7 +522,7 @@ func (t *SubmitScrubMinipools) submitVoteScrubMinipool(mp minipool.IMinipool) er opts.GasLimit = txInfo.SimulationResult.SafeGasLimit // Print TX info and wait for it to be included in a block - err = tx.PrintAndWaitForTransaction(t.cfg, t.rp, t.logger, txInfo, opts) + err = tx.PrintAndWaitForTransaction(t.cfg, t.res, t.rp, t.logger, txInfo, opts) if err != nil { return err } diff --git a/rocketpool-daemon/watchtower/watchtower.go b/rocketpool-daemon/watchtower/watchtower.go index de7f6e856..8e998c843 100644 --- a/rocketpool-daemon/watchtower/watchtower.go +++ b/rocketpool-daemon/watchtower/watchtower.go @@ -27,7 +27,7 @@ type TaskManager struct { // Services logger *log.Logger ctx context.Context - sp *services.ServiceProvider + sp services.ISmartNodeServiceProvider cfg *config.SmartNodeConfig rp *rocketpool.RocketPool bc beacon.IBeaconClient @@ -56,7 +56,7 @@ type TaskManager struct { } func NewTaskManager( - sp *services.ServiceProvider, + sp services.ISmartNodeServiceProvider, stateMgr *state.NetworkStateManager, scrubCollector *collectors.ScrubCollector, bondReductionCollector *collectors.BondReductionCollector, diff --git a/shared/config/ids/ids.go b/shared/config/ids/ids.go index 47898e220..9df35ef06 100644 --- a/shared/config/ids/ids.go +++ b/shared/config/ids/ids.go @@ -2,9 +2,10 @@ package ids const ( // Root IDs - VersionID string = "version" - IsNativeKey string = "isNative" - SmartNodeID string = "smartNode" + VersionID string = "version" + IsNativeKey string = "isNative" + SmartNodeID string = "smartNode" + EthNetworkNameID string = "ethNetworkName" // Smart Node parameter IDs NetworkID string = "network" diff --git a/shared/config/resources.go b/shared/config/resources.go index 7ecd123ec..c4e0a3dc3 100644 --- a/shared/config/resources.go +++ b/shared/config/resources.go @@ -1,141 +1,54 @@ package config import ( + "errors" "fmt" + "io/fs" + "os" + "path/filepath" "github.com/ethereum/go-ethereum/common" "github.com/rocket-pool/node-manager-core/config" + "gopkg.in/yaml.v3" ) -// A collection of network-specific resources and getters for them -type RocketPoolResources struct { - *config.NetworkResources - - // The URL to use for staking rETH - StakeUrl string - - // The contract address of RocketStorage - StorageAddress common.Address - - // The contract address of rETH - RethAddress common.Address - - // The contract address of the RPL token - RplTokenAddress common.Address - - // The contract address of rocketRewardsPool from v1.0.0 - V1_0_0_RewardsPoolAddress *common.Address - - // The contract address of rocketClaimNode from v1.0.0 - V1_0_0_ClaimNodeAddress *common.Address - - // The contract address of rocketClaimTrustedNode from v1.0.0 - V1_0_0_ClaimTrustedNodeAddress *common.Address - - // The contract address of rocketMinipoolManager from v1.0.0 - V1_0_0_MinipoolManagerAddress *common.Address - - // The contract address of rocketNetworkPrices from v1.1.0 - V1_1_0_NetworkPricesAddress *common.Address - - // The contract address of rocketNodeStaking from v1.1.0 - V1_1_0_NodeStakingAddress *common.Address - - // The contract address of rocketNodeDeposit from v1.1.0 - V1_1_0_NodeDepositAddress *common.Address - - // The contract address of rocketMinipoolQueue from v1.1.0 - V1_1_0_MinipoolQueueAddress *common.Address - - // The contract address of rocketMinipoolFactory from v1.1.0 - V1_1_0_MinipoolFactoryAddress *common.Address - - // The contract address of rocketNetworkPrices from v1.2.0 - V1_2_0_NetworkPricesAddress *common.Address - - // The contract address of rocketNetworkBalances from v1.2.0 - V1_2_0_NetworkBalancesAddress *common.Address - - // The contract address for Snapshot delegation - SnapshotDelegationAddress *common.Address - - // The Snapshot API domain - SnapshotApiDomain string - - // Addresses for RocketRewardsPool that have been upgraded during development - PreviousRewardsPoolAddresses []common.Address - - // Addresses for RocketDAOProtocolVerifier that have been upgraded during development - PreviousProtocolDaoVerifierAddresses []common.Address - - // The RocketOvmPriceMessenger Optimism address for each network - OptimismPriceMessengerAddress *common.Address - - // The RocketPolygonPriceMessenger Polygon address for each network - PolygonPriceMessengerAddress *common.Address - - // The RocketArbitumPriceMessenger Arbitrum address for each network - ArbitrumPriceMessengerAddress *common.Address - - // The RocketArbitumPriceMessengerV2 Arbitrum address for each network - ArbitrumPriceMessengerAddressV2 *common.Address - - // The RocketZkSyncPriceMessenger zkSyncEra address for each network - ZkSyncEraPriceMessengerAddress *common.Address - - // The RocketBasePriceMessenger Base address for each network - BasePriceMessengerAddress *common.Address - - // The RocketScrollPriceMessenger Scroll address for each network - ScrollPriceMessengerAddress *common.Address - - // The Scroll L2 message fee estimator address for each network - ScrollFeeEstimatorAddress *common.Address - - // The UniswapV3 pool address for each network (used for RPL price TWAP info) - RplTwapPoolAddress *common.Address -} - -// Creates a new resource collection for the given network -func newRocketPoolResources(network config.Network) *RocketPoolResources { - // Mainnet - mainnetResources := &RocketPoolResources{ - NetworkResources: config.NewResources(config.Network_Mainnet), +var ( + // Mainnet resources for reference in testing + MainnetResourcesReference *SmartNodeResources = &SmartNodeResources{ StakeUrl: "https://stake.rocketpool.net", StorageAddress: common.HexToAddress("0x1d8f8f00cfa6758d7bE78336684788Fb0ee0Fa46"), RethAddress: common.HexToAddress("0xae78736Cd615f374D3085123A210448E74Fc6393"), RplTokenAddress: common.HexToAddress("0xD33526068D116cE69F19A9ee46F0bd304F21A51f"), - V1_0_0_RewardsPoolAddress: hexToAddressPtr("0xA3a18348e6E2d3897B6f2671bb8c120e36554802"), - V1_0_0_ClaimNodeAddress: hexToAddressPtr("0x899336A2a86053705E65dB61f52C686dcFaeF548"), - V1_0_0_ClaimTrustedNodeAddress: hexToAddressPtr("0x6af730deB0463b432433318dC8002C0A4e9315e8"), - V1_0_0_MinipoolManagerAddress: hexToAddressPtr("0x6293B8abC1F36aFB22406Be5f96D893072A8cF3a"), - V1_1_0_NetworkPricesAddress: hexToAddressPtr("0xd3f500F550F46e504A4D2153127B47e007e11166"), - V1_1_0_NodeStakingAddress: hexToAddressPtr("0xA73ec45Fe405B5BFCdC0bF4cbc9014Bb32a01cd2"), - V1_1_0_NodeDepositAddress: hexToAddressPtr("0x1Cc9cF5586522c6F483E84A19c3C2B0B6d027bF0"), - V1_1_0_MinipoolQueueAddress: hexToAddressPtr("0x5870dA524635D1310Dc0e6F256Ce331012C9C19E"), - V1_1_0_MinipoolFactoryAddress: hexToAddressPtr("0x54705f80D7C51Fcffd9C659ce3f3C9a7dCCf5788"), - V1_2_0_NetworkPricesAddress: hexToAddressPtr("0x751826b107672360b764327631cC5764515fFC37"), - V1_2_0_NetworkBalancesAddress: hexToAddressPtr("0x07FCaBCbe4ff0d80c2b1eb42855C0131b6cba2F4"), - SnapshotDelegationAddress: hexToAddressPtr("0x469788fE6E9E9681C6ebF3bF78e7Fd26Fc015446"), + V1_0_0_RewardsPoolAddress: config.HexToAddressPtr("0xA3a18348e6E2d3897B6f2671bb8c120e36554802"), + V1_0_0_ClaimNodeAddress: config.HexToAddressPtr("0x899336A2a86053705E65dB61f52C686dcFaeF548"), + V1_0_0_ClaimTrustedNodeAddress: config.HexToAddressPtr("0x6af730deB0463b432433318dC8002C0A4e9315e8"), + V1_0_0_MinipoolManagerAddress: config.HexToAddressPtr("0x6293B8abC1F36aFB22406Be5f96D893072A8cF3a"), + V1_1_0_NetworkPricesAddress: config.HexToAddressPtr("0xd3f500F550F46e504A4D2153127B47e007e11166"), + V1_1_0_NodeStakingAddress: config.HexToAddressPtr("0xA73ec45Fe405B5BFCdC0bF4cbc9014Bb32a01cd2"), + V1_1_0_NodeDepositAddress: config.HexToAddressPtr("0x1Cc9cF5586522c6F483E84A19c3C2B0B6d027bF0"), + V1_1_0_MinipoolQueueAddress: config.HexToAddressPtr("0x5870dA524635D1310Dc0e6F256Ce331012C9C19E"), + V1_1_0_MinipoolFactoryAddress: config.HexToAddressPtr("0x54705f80D7C51Fcffd9C659ce3f3C9a7dCCf5788"), + V1_2_0_NetworkPricesAddress: config.HexToAddressPtr("0x751826b107672360b764327631cC5764515fFC37"), + V1_2_0_NetworkBalancesAddress: config.HexToAddressPtr("0x07FCaBCbe4ff0d80c2b1eb42855C0131b6cba2F4"), + SnapshotDelegationAddress: config.HexToAddressPtr("0x469788fE6E9E9681C6ebF3bF78e7Fd26Fc015446"), SnapshotApiDomain: "hub.snapshot.org", PreviousRewardsPoolAddresses: []common.Address{ common.HexToAddress("0x594Fb75D3dc2DFa0150Ad03F99F97817747dd4E1"), }, PreviousProtocolDaoVerifierAddresses: []common.Address{}, - OptimismPriceMessengerAddress: hexToAddressPtr("0xdddcf2c25d50ec22e67218e873d46938650d03a7"), - PolygonPriceMessengerAddress: hexToAddressPtr("0xb1029Ac2Be4e08516697093e2AFeC435057f3511"), - ArbitrumPriceMessengerAddress: hexToAddressPtr("0x05330300f829AD3fC8f33838BC88CFC4093baD53"), - ArbitrumPriceMessengerAddressV2: hexToAddressPtr("0x312FcFB03eC9B1Ea38CB7BFCd26ee7bC3b505aB1"), - ZkSyncEraPriceMessengerAddress: hexToAddressPtr("0x6cf6CB29754aEBf88AF12089224429bD68b0b8c8"), - BasePriceMessengerAddress: hexToAddressPtr("0x64A5856869C06B0188C84A5F83d712bbAc03517d"), - ScrollPriceMessengerAddress: hexToAddressPtr("0x0f22dc9b9c03757d4676539203d7549c8f22c15c"), - ScrollFeeEstimatorAddress: hexToAddressPtr("0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B"), - RplTwapPoolAddress: hexToAddressPtr("0xe42318ea3b998e8355a3da364eb9d48ec725eb45"), + OptimismPriceMessengerAddress: config.HexToAddressPtr("0xdddcf2c25d50ec22e67218e873d46938650d03a7"), + PolygonPriceMessengerAddress: config.HexToAddressPtr("0xb1029Ac2Be4e08516697093e2AFeC435057f3511"), + ArbitrumPriceMessengerAddress: config.HexToAddressPtr("0x05330300f829AD3fC8f33838BC88CFC4093baD53"), + ArbitrumPriceMessengerAddressV2: config.HexToAddressPtr("0x312FcFB03eC9B1Ea38CB7BFCd26ee7bC3b505aB1"), + ZkSyncEraPriceMessengerAddress: config.HexToAddressPtr("0x6cf6CB29754aEBf88AF12089224429bD68b0b8c8"), + BasePriceMessengerAddress: config.HexToAddressPtr("0x64A5856869C06B0188C84A5F83d712bbAc03517d"), + ScrollPriceMessengerAddress: config.HexToAddressPtr("0x0f22dc9b9c03757d4676539203d7549c8f22c15c"), + ScrollFeeEstimatorAddress: config.HexToAddressPtr("0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B"), + RplTwapPoolAddress: config.HexToAddressPtr("0xe42318ea3b998e8355a3da364eb9d48ec725eb45"), } - // Holesky - holeskyResources := &RocketPoolResources{ - NetworkResources: config.NewResources(config.Network_Holesky), + // Holesky resources for reference in testing + HoleskyResourcesReference *SmartNodeResources = &SmartNodeResources{ StakeUrl: "https://testnet.rocketpool.net", StorageAddress: common.HexToAddress("0x594Fb75D3dc2DFa0150Ad03F99F97817747dd4E1"), RethAddress: common.HexToAddress("0x7322c24752f79c05FFD1E2a6FCB97020C1C264F1"), @@ -149,8 +62,8 @@ func newRocketPoolResources(network config.Network) *RocketPoolResources { V1_1_0_NodeDepositAddress: nil, V1_1_0_MinipoolQueueAddress: nil, V1_1_0_MinipoolFactoryAddress: nil, - V1_2_0_NetworkPricesAddress: hexToAddressPtr("0x029d946F28F93399a5b0D09c879FC8c94E596AEb"), - V1_2_0_NetworkBalancesAddress: hexToAddressPtr("0x9294Fc6F03c64Cc217f5BE8697EA3Ed2De77e2F8"), + V1_2_0_NetworkPricesAddress: config.HexToAddressPtr("0x029d946F28F93399a5b0D09c879FC8c94E596AEb"), + V1_2_0_NetworkBalancesAddress: config.HexToAddressPtr("0x9294Fc6F03c64Cc217f5BE8697EA3Ed2De77e2F8"), SnapshotDelegationAddress: nil, SnapshotApiDomain: "", PreviousRewardsPoolAddresses: []common.Address{ @@ -165,12 +78,11 @@ func newRocketPoolResources(network config.Network) *RocketPoolResources { BasePriceMessengerAddress: nil, ScrollPriceMessengerAddress: nil, ScrollFeeEstimatorAddress: nil, - RplTwapPoolAddress: hexToAddressPtr("0x7bb10d2a3105ed5cc150c099a06cafe43d8aa15d"), + RplTwapPoolAddress: config.HexToAddressPtr("0x7bb10d2a3105ed5cc150c099a06cafe43d8aa15d"), } - // Devnet - devnetResources := &RocketPoolResources{ - NetworkResources: config.NewResources(config.Network_Holesky), + // Devnet resources for reference in testing + HoleskyDevResourcesReference *SmartNodeResources = &SmartNodeResources{ StakeUrl: "TBD", StorageAddress: common.HexToAddress("0xf04de123993761Bb9F08c9C39112b0E0b0eccE50"), RethAddress: common.HexToAddress("0x4be7161080b5d890500194cee2c40B1428002Bd3"), @@ -184,8 +96,8 @@ func newRocketPoolResources(network config.Network) *RocketPoolResources { V1_1_0_NodeDepositAddress: nil, V1_1_0_MinipoolQueueAddress: nil, V1_1_0_MinipoolFactoryAddress: nil, - V1_2_0_NetworkPricesAddress: hexToAddressPtr("0xBba3FBCD4Bdbfc79118B1B31218602E5A71B426c"), - V1_2_0_NetworkBalancesAddress: hexToAddressPtr("0xBe8Dc8CA5f339c196Aef634DfcDFbA61E30DC743"), + V1_2_0_NetworkPricesAddress: config.HexToAddressPtr("0xBba3FBCD4Bdbfc79118B1B31218602E5A71B426c"), + V1_2_0_NetworkBalancesAddress: config.HexToAddressPtr("0xBe8Dc8CA5f339c196Aef634DfcDFbA61E30DC743"), SnapshotDelegationAddress: nil, SnapshotApiDomain: "", PreviousRewardsPoolAddresses: []common.Address{ @@ -200,24 +112,155 @@ func newRocketPoolResources(network config.Network) *RocketPoolResources { BasePriceMessengerAddress: nil, ScrollPriceMessengerAddress: nil, ScrollFeeEstimatorAddress: nil, - RplTwapPoolAddress: hexToAddressPtr("0x7bb10d2a3105ed5cc150c099a06cafe43d8aa15d"), - } - devnetResources.NetworkResources.Network = Network_Devnet - - switch network { - case config.Network_Mainnet: - return mainnetResources - case config.Network_Holesky: - return holeskyResources - case Network_Devnet: - return devnetResources + RplTwapPoolAddress: config.HexToAddressPtr("0x7bb10d2a3105ed5cc150c099a06cafe43d8aa15d"), } +) + +// Network settings with a field for Rocket Pool-specific settings +type SmartNodeSettings struct { + *config.NetworkSettings `yaml:",inline"` + + // Rocket Pool resources for the network + SmartNodeResources *SmartNodeResources `yaml:"smartNodeResources" json:"smartNodeResources"` +} - panic(fmt.Sprintf("network %s is not supported", network)) +// A collection of network-specific resources and getters for them +type SmartNodeResources struct { + // The URL to use for staking rETH + StakeUrl string `yaml:"stakeUrl" json:"stakeUrl"` + + // The contract address of RocketStorage + StorageAddress common.Address `yaml:"storageAddress" json:"storageAddress"` + + // The contract address of rETH + RethAddress common.Address `yaml:"rethAddress" json:"rethAddress"` + + // The contract address of the RPL token + RplTokenAddress common.Address `yaml:"rplTokenAddress" json:"rplTokenAddress"` + + // The contract address of rocketRewardsPool from v1.0.0 + V1_0_0_RewardsPoolAddress *common.Address `yaml:"v1_0_0_RewardsPoolAddress" json:"v1_0_0_RewardsPoolAddress"` + + // The contract address of rocketClaimNode from v1.0.0 + V1_0_0_ClaimNodeAddress *common.Address `yaml:"v1_0_0_ClaimNodeAddress" json:"v1_0_0_ClaimNodeAddress"` + + // The contract address of rocketClaimTrustedNode from v1.0.0 + V1_0_0_ClaimTrustedNodeAddress *common.Address `yaml:"v1_0_0_ClaimTrustedNodeAddress" json:"v1_0_0_ClaimTrustedNodeAddress"` + + // The contract address of rocketMinipoolManager from v1.0.0 + V1_0_0_MinipoolManagerAddress *common.Address `yaml:"v1_0_0_MinipoolManagerAddress" json:"v1_0_0_MinipoolManagerAddress"` + + // The contract address of rocketNetworkPrices from v1.1.0 + V1_1_0_NetworkPricesAddress *common.Address `yaml:"v1_1_0_NetworkPricesAddress" json:"v1_1_0_NetworkPricesAddress"` + + // The contract address of rocketNodeStaking from v1.1.0 + V1_1_0_NodeStakingAddress *common.Address `yaml:"v1_1_0_NodeStakingAddress" json:"v1_1_0_NodeStakingAddress"` + + // The contract address of rocketNodeDeposit from v1.1.0 + V1_1_0_NodeDepositAddress *common.Address `yaml:"v1_1_0_NodeDepositAddress" json:"v1_1_0_NodeDepositAddress"` + + // The contract address of rocketMinipoolQueue from v1.1.0 + V1_1_0_MinipoolQueueAddress *common.Address `yaml:"v1_1_0_MinipoolQueueAddress" json:"v1_1_0_MinipoolQueueAddress"` + + // The contract address of rocketMinipoolFactory from v1.1.0 + V1_1_0_MinipoolFactoryAddress *common.Address `yaml:"v1_1_0_MinipoolFactoryAddress" json:"v1_1_0_MinipoolFactoryAddress"` + + // The contract address of rocketNetworkPrices from v1.2.0 + V1_2_0_NetworkPricesAddress *common.Address `yaml:"v1_2_0_NetworkPricesAddress" json:"v1_2_0_NetworkPricesAddress"` + + // The contract address of rocketNetworkBalances from v1.2.0 + V1_2_0_NetworkBalancesAddress *common.Address `yaml:"v1_2_0_NetworkBalancesAddress" json:"v1_2_0_NetworkBalancesAddress"` + + // The contract address for Snapshot delegation + SnapshotDelegationAddress *common.Address `yaml:"snapshotDelegationAddress" json:"snapshotDelegationAddress"` + + // The Snapshot API domain + SnapshotApiDomain string `yaml:"snapshotApiDomain" json:"snapshotApiDomain"` + + // Addresses for RocketRewardsPool that have been upgraded during development + PreviousRewardsPoolAddresses []common.Address `yaml:"previousRewardsPoolAddresses" json:"previousRewardsPoolAddresses"` + + // Addresses for RocketDAOProtocolVerifier that have been upgraded during development + PreviousProtocolDaoVerifierAddresses []common.Address `yaml:"previousProtocolDaoVerifierAddresses" json:"previousProtocolDaoVerifierAddresses"` + + // The RocketOvmPriceMessenger Optimism address for each network + OptimismPriceMessengerAddress *common.Address `yaml:"optimismPriceMessengerAddress" json:"optimismPriceMessengerAddress"` + + // The RocketPolygonPriceMessenger Polygon address for each network + PolygonPriceMessengerAddress *common.Address `yaml:"polygonPriceMessengerAddress" json:"polygonPriceMessengerAddress"` + + // The RocketArbitumPriceMessenger Arbitrum address for each network + ArbitrumPriceMessengerAddress *common.Address `yaml:"arbitrumPriceMessengerAddress" json:"arbitrumPriceMessengerAddress"` + + // The RocketArbitumPriceMessengerV2 Arbitrum address for each network + ArbitrumPriceMessengerAddressV2 *common.Address `yaml:"arbitrumPriceMessengerAddressV2" json:"arbitrumPriceMessengerAddressV2"` + + // The RocketZkSyncPriceMessenger zkSyncEra address for each network + ZkSyncEraPriceMessengerAddress *common.Address `yaml:"zkSyncEraPriceMessengerAddress" json:"zkSyncEraPriceMessengerAddress"` + + // The RocketBasePriceMessenger Base address for each network + BasePriceMessengerAddress *common.Address `yaml:"basePriceMessengerAddress" json:"basePriceMessengerAddress"` + + // The RocketScrollPriceMessenger Scroll address for each network + ScrollPriceMessengerAddress *common.Address `yaml:"scrollPriceMessengerAddress" json:"scrollPriceMessengerAddress"` + + // The Scroll L2 message fee estimator address for each network + ScrollFeeEstimatorAddress *common.Address `yaml:"scrollFeeEstimatorAddress" json:"scrollFeeEstimatorAddress"` + + // The UniswapV3 pool address for each network (used for RPL price TWAP info) + RplTwapPoolAddress *common.Address `yaml:"rplTwapPoolAddress" json:"rplTwapPoolAddress"` +} + +// An aggregated collection of resources for the selected network, including Rocket Pool resources +type MergedResources struct { + // Base network resources + *config.NetworkResources + + // Rocket Pool resources + *SmartNodeResources } -// Convert a hex string to an address, wrapped in a pointer -func hexToAddressPtr(hexAddress string) *common.Address { - address := common.HexToAddress(hexAddress) - return &address +// Load network settings from a folder +func LoadSettingsFiles(sourceDir string) ([]*SmartNodeSettings, error) { + // Make sure the folder exists + _, err := os.Stat(sourceDir) + if errors.Is(err, fs.ErrNotExist) { + return nil, fmt.Errorf("network settings folder [%s] does not exist", sourceDir) + } + + // Enumerate the dir + files, err := os.ReadDir(sourceDir) + if err != nil { + return nil, fmt.Errorf("error enumerating override source folder: %w", err) + } + + settingsList := []*SmartNodeSettings{} + for _, file := range files { + // Ignore dirs and nonstandard files + if file.IsDir() || !file.Type().IsRegular() { + continue + } + + // Load the file + filename := file.Name() + ext := filepath.Ext(filename) + if ext != ".yaml" && ext != ".yml" { + // Only load YAML files + continue + } + settingsFilePath := filepath.Join(sourceDir, filename) + bytes, err := os.ReadFile(settingsFilePath) + if err != nil { + return nil, fmt.Errorf("error reading network settings file [%s]: %w", settingsFilePath, err) + } + + // Unmarshal the settings + settings := new(SmartNodeSettings) + err = yaml.Unmarshal(bytes, settings) + if err != nil { + return nil, fmt.Errorf("error unmarshalling network settings file [%s]: %w", settingsFilePath, err) + } + settingsList = append(settingsList, settings) + } + return settingsList, nil } diff --git a/shared/config/settings.go b/shared/config/settings.go index e2a9d0ff2..e5b5ab677 100644 --- a/shared/config/settings.go +++ b/shared/config/settings.go @@ -33,7 +33,8 @@ const ( MevBoostStartScript string = "start-mev-boost.sh" // HTTP - ClientTimeout time.Duration = 1 * time.Minute + ClientTimeout time.Duration = 1 * time.Minute + ExternalIPTimeout time.Duration = 3 * time.Second // Volumes ExecutionClientDataVolume string = "eth1clientdata" diff --git a/shared/config/smartnode-config.go b/shared/config/smartnode-config.go index 86d798bea..b30764e98 100644 --- a/shared/config/smartnode-config.go +++ b/shared/config/smartnode-config.go @@ -5,8 +5,8 @@ import ( "os" "path/filepath" "reflect" + "sort" "strconv" - "strings" "github.com/alessio/shellescape" "github.com/rocket-pool/node-manager-core/config" @@ -76,13 +76,14 @@ type SmartNodeConfig struct { // Internal fields Version string - rocketPoolDirectory string IsNativeMode bool - resources *RocketPoolResources + rocketPoolDirectory string + ethNetworkName string + networkSettings []*SmartNodeSettings } // Load configuration settings from a file -func LoadFromFile(path string) (*SmartNodeConfig, error) { +func LoadFromFile(path string, networks []*SmartNodeSettings) (*SmartNodeConfig, error) { // Return nil if the file doesn't exist _, err := os.Stat(path) if os.IsNotExist(err) { @@ -102,7 +103,10 @@ func LoadFromFile(path string) (*SmartNodeConfig, error) { } // Deserialize it into a config object - cfg := NewSmartNodeConfig(filepath.Dir(path), false) + cfg, err := NewSmartNodeConfig(filepath.Dir(path), false, networks) + if err != nil { + return nil, fmt.Errorf("could not create Smart Node config: %w", err) + } err = cfg.Deserialize(settings) if err != nil { return nil, fmt.Errorf("could not deserialize settings file: %w", err) @@ -112,9 +116,15 @@ func LoadFromFile(path string) (*SmartNodeConfig, error) { } // Creates a new Smart Node configuration instance -func NewSmartNodeConfig(rpDir string, isNativeMode bool) *SmartNodeConfig { +func NewSmartNodeConfig(rpDir string, isNativeMode bool, networks []*SmartNodeSettings) (*SmartNodeConfig, error) { + return NewSmartNodeConfigForNetwork(rpDir, isNativeMode, networks, config.Network_Mainnet) +} + +// Creates a new Smart Node configuration instance for a specific network +func NewSmartNodeConfigForNetwork(rpDir string, isNativeMode bool, networks []*SmartNodeSettings, selectedNetwork config.Network) (*SmartNodeConfig, error) { cfg := &SmartNodeConfig{ rocketPoolDirectory: rpDir, + networkSettings: networks, IsNativeMode: isNativeMode, Version: assets.RocketPoolVersion(), @@ -127,7 +137,7 @@ func NewSmartNodeConfig(rpDir string, isNativeMode bool) *SmartNodeConfig { CanBeBlank: false, OverwriteOnUpgrade: false, }, - Options: getNetworkOptions(), + Options: getNetworkOptions(networks), Default: map[config.Network]config.Network{ config.Network_All: config.Network_Mainnet, }, @@ -456,11 +466,22 @@ func NewSmartNodeConfig(rpDir string, isNativeMode bool) *SmartNodeConfig { cfg.MevBoost = NewMevBoostConfig(cfg) cfg.Addons = NewAddonsConfig() - // Apply the default values for mainnet - cfg.Network.Value = config.Network_Mainnet + // Provision the defaults for each network + for _, network := range networks { + err := config.SetDefaultsForNetworks(cfg, network.DefaultConfigSettings, network.Key) + if err != nil { + return nil, fmt.Errorf("could not set defaults for network %s: %w", network.Key, err) + } + if network.Key == selectedNetwork { + cfg.ethNetworkName = network.NetworkResources.EthNetworkName + } + } + + // Apply the default values for the network + cfg.Network.Value = selectedNetwork cfg.applyAllDefaults() - return cfg + return cfg, nil } // Get the title for this config @@ -520,6 +541,7 @@ func (cfg *SmartNodeConfig) Serialize() map[string]any { masterMap[ids.VersionID] = fmt.Sprintf("v%s", assets.RocketPoolVersion()) masterMap[ids.IsNativeKey] = strconv.FormatBool(cfg.IsNativeMode) masterMap[ids.SmartNodeID] = snMap + masterMap[ids.EthNetworkNameID] = cfg.ethNetworkName return masterMap } @@ -568,7 +590,10 @@ func (cfg *SmartNodeConfig) Deserialize(masterMap map[string]any) error { return fmt.Errorf("expected a native toggle parameter named [%s] but it was not found", ids.IsNativeKey) } cfg.IsNativeMode, _ = strconv.ParseBool(isNativeMode.(string)) - cfg.updateResources() + ethNetworkName, exists := masterMap[ids.EthNetworkNameID] + if exists { + cfg.ethNetworkName = ethNetworkName.(string) + } return nil } @@ -582,18 +607,25 @@ func (cfg *SmartNodeConfig) ChangeNetwork(newNetwork config.Network) { } cfg.Network.Value = newNetwork + // Change the Eth network name + for _, settings := range cfg.networkSettings { + if settings.Key == newNetwork { + cfg.ethNetworkName = settings.NetworkResources.EthNetworkName + break + } + } + // Run the changes config.ChangeNetwork(cfg, oldNetwork, newNetwork) - cfg.updateResources() } // Create a copy of this configuration. func (cfg *SmartNodeConfig) CreateCopy() *SmartNodeConfig { network := cfg.Network.Value - copy := NewSmartNodeConfig(cfg.rocketPoolDirectory, cfg.IsNativeMode) + copy, _ := NewSmartNodeConfig(cfg.rocketPoolDirectory, cfg.IsNativeMode, cfg.networkSettings) config.Clone(cfg, copy, network) - copy.updateResources() copy.Version = cfg.Version + copy.ethNetworkName = cfg.ethNetworkName return copy } @@ -733,50 +765,79 @@ func (cfg *SmartNodeConfig) Validate() []string { return errors } +// Gets the resources for the selected network +func (cfg *SmartNodeConfig) GetResources() (*MergedResources, error) { + selectedNetwork := cfg.Network.Value + for _, network := range cfg.networkSettings { + if network.Key == selectedNetwork { + return &MergedResources{ + NetworkResources: network.NetworkResources, + SmartNodeResources: network.SmartNodeResources, + }, nil + } + } + return nil, fmt.Errorf("could not find network resources for selected network %s", selectedNetwork) +} + // ===================== // === Field Helpers === // ===================== +// Get the Eth network name of the selected network +func (cfg *SmartNodeConfig) GetEthNetworkName() string { + return cfg.ethNetworkName +} + +// Get all loaded network settings +func (cfg *SmartNodeConfig) GetNetworkSettings() []*SmartNodeSettings { + return cfg.networkSettings +} + // Applies all of the defaults to all of the settings that have them defined func (cfg *SmartNodeConfig) applyAllDefaults() { network := cfg.Network.Value config.ApplyDefaults(cfg, network) - cfg.updateResources() -} - -// Update the config's resource cache -func (cfg *SmartNodeConfig) updateResources() { - cfg.resources = newRocketPoolResources(cfg.Network.Value) } // Get the list of options for networks to run on -func getNetworkOptions() []*config.ParameterOption[config.Network] { - options := []*config.ParameterOption[config.Network]{ - { - ParameterOptionCommon: &config.ParameterOptionCommon{ - 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, - }, { - ParameterOptionCommon: &config.ParameterOptionCommon{ - Name: "Holesky Testnet", - Description: "This is the Holešky (Holešovice) 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 Smart Node in a free, safe environment before moving to Mainnet.", - }, - Value: config.Network_Holesky, - }, - } - - if strings.HasSuffix(assets.RocketPoolVersion(), "-dev") { +func getNetworkOptions(networks []*SmartNodeSettings) []*config.ParameterOption[config.Network] { + // Create the options + options := []*config.ParameterOption[config.Network]{} + for _, network := range networks { options = append(options, &config.ParameterOption[config.Network]{ ParameterOptionCommon: &config.ParameterOptionCommon{ - 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.", + Name: network.Name, + Description: network.Description, }, - Value: Network_Devnet, + Value: network.Key, }) } + // Sort the options so mainnet comes first and holesky comes second + sort.SliceStable(options, func(i, j int) bool { + firstOption := options[i] + secondOption := options[j] + + // Mainnet comes first + if firstOption.Value == config.Network_Mainnet { + return true + } + if secondOption.Value == config.Network_Mainnet { + return false + } + + // Holesky comes second + if firstOption.Value == config.Network_Holesky { + return true + } + if secondOption.Value == config.Network_Holesky { + return false + } + + // The rest doesn't matter so just sort it alphabetically + return firstOption.Value < secondOption.Value + }) + return options } diff --git a/shared/config/templating.go b/shared/config/templating.go index 82aad572c..d3db6feb2 100644 --- a/shared/config/templating.go +++ b/shared/config/templating.go @@ -215,7 +215,7 @@ func (cfg *SmartNodeConfig) GetEcAdditionalFlags() (string, error) { // Used by text/template to format ec.yml func (cfg *SmartNodeConfig) GetExternalIP() string { // Get the external IP address - ip, err := config.GetExternalIP() + ip, err := config.GetExternalIP(ExternalIPTimeout) if err != nil { fmt.Println("Warning: couldn't get external IP address; if you're using Nimbus or Besu, it may have trouble finding peers:") fmt.Println(err.Error()) diff --git a/shared/config/utils.go b/shared/config/utils.go index ca034ccb4..74aa94213 100644 --- a/shared/config/utils.go +++ b/shared/config/utils.go @@ -8,14 +8,6 @@ import ( "github.com/rocket-pool/node-manager-core/log" ) -func (cfg *SmartNodeConfig) GetNetworkResources() *config.NetworkResources { - return cfg.GetRocketPoolResources().NetworkResources -} - -func (cfg *SmartNodeConfig) GetRocketPoolResources() *RocketPoolResources { - return cfg.resources -} - func (cfg *SmartNodeConfig) GetVotingPath() string { return filepath.Join(cfg.UserDataPath.Value, VotingFolder, string(cfg.Network.Value)) }