Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move deployments to modules #39

Merged
merged 4 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ require (
github.com/goccy/go-json v0.10.3
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/nodeset-org/hyperdrive-daemon v1.1.0-b1
github.com/nodeset-org/nodeset-client-go v1.0.0
github.com/nodeset-org/osha v0.3.0
github.com/nodeset-org/hyperdrive-daemon v1.1.0-b1.0.20241001192501-b11ba9e5209f
github.com/nodeset-org/nodeset-client-go v1.0.1-0.20240927160821-e348e05e2363
github.com/nodeset-org/osha v0.3.1-0.20240927160812-d66358d4e091
github.com/rocket-pool/batch-query v1.0.0
github.com/rocket-pool/node-manager-core v0.5.2-0.20240918224929-a9cee1201bee
github.com/rocket-pool/node-manager-core v0.5.2-0.20241001041416-40f4fb819f98
github.com/stretchr/testify v1.9.0
github.com/urfave/cli/v2 v2.27.2
github.com/wealdtech/go-eth2-types/v2 v2.8.2
Expand Down Expand Up @@ -56,7 +56,7 @@ require (
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v27.0.3+incompatible // indirect
github.com/docker/docker v27.3.1+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
github.com/docker/go-metrics v0.0.1 // indirect
Expand Down Expand Up @@ -102,6 +102,7 @@ require (
github.com/moby/sys/signal v0.7.0 // indirect
github.com/moby/sys/symlink v0.2.0 // indirect
github.com/moby/sys/user v0.1.0 // indirect
github.com/moby/sys/userns v0.1.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/morikuni/aec v1.0.0 // indirect
Expand Down
22 changes: 12 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5Qvfr
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v27.0.3+incompatible h1:aBGI9TeQ4MPlhquTQKq9XbK79rKFVwXNUAYz9aXyEBE=
github.com/docker/docker v27.0.3+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-events v0.0.0-20190806004212-e31b211e4f1c h1:+pKlWGMw7gf6bQ+oDZB4KHQFypsfjYlq/C4rfL7D3g8=
Expand Down Expand Up @@ -340,6 +340,8 @@ github.com/moby/sys/symlink v0.2.0 h1:tk1rOM+Ljp0nFmfOIBtlV3rTDlWOwFRhjEeAhZB0nZ
github.com/moby/sys/symlink v0.2.0/go.mod h1:7uZVF2dqJjG/NsClqul95CqKOBRQyYSNnJ6BMgR/gFs=
github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg=
github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU=
github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g=
github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28=
github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand Down Expand Up @@ -368,12 +370,12 @@ github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOEL
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nodeset-org/hyperdrive-daemon v1.1.0-b1 h1:F9GU8p9u7qv98VVA93Bj4UunT5hO/c662mJe1ZRkgG8=
github.com/nodeset-org/hyperdrive-daemon v1.1.0-b1/go.mod h1:jrX22jxBfFxbmFYm+4TknWPVrOG2RZL0zglG7+Mijf4=
github.com/nodeset-org/nodeset-client-go v1.0.0 h1:ZbYdP3nEFuZMT3Yt0nbBIYMdQZ4rAHMccvKjnUPZxhc=
github.com/nodeset-org/nodeset-client-go v1.0.0/go.mod h1:slpwejkJ/vYU9SKA3SYw4hIPJLzDUeQxcx+Cm04kkIA=
github.com/nodeset-org/osha v0.3.0 h1:oX9ZrFLKXhhxCWbABY4VAvsqvGUH790XNeENl46a4EY=
github.com/nodeset-org/osha v0.3.0/go.mod h1:jGCgmYNYxI97YgITz2Xwpy8689vVnCF8fDsmB4Q32F8=
github.com/nodeset-org/hyperdrive-daemon v1.1.0-b1.0.20241001192501-b11ba9e5209f h1:iAxCtnQkT8UGunXIyGNdhsVcqwQve0SefNMdoja3kCc=
github.com/nodeset-org/hyperdrive-daemon v1.1.0-b1.0.20241001192501-b11ba9e5209f/go.mod h1:KCZ/EptpaWrk/O2jYAUH2hDYt6Mrcjf68fVOeT8fuew=
github.com/nodeset-org/nodeset-client-go v1.0.1-0.20240927160821-e348e05e2363 h1:iivCknAFZlpxPwbIDjPc9E2bnj55c2STrXT9MvuMzQM=
github.com/nodeset-org/nodeset-client-go v1.0.1-0.20240927160821-e348e05e2363/go.mod h1:slpwejkJ/vYU9SKA3SYw4hIPJLzDUeQxcx+Cm04kkIA=
github.com/nodeset-org/osha v0.3.1-0.20240927160812-d66358d4e091 h1:oAs4/Yx4jnsNdWh3vTKum1sXC8VCvsY1H2VFSRRkgjc=
github.com/nodeset-org/osha v0.3.1-0.20240927160812-d66358d4e091/go.mod h1:47D6kYMuxYDTbul3w/YtE1LKA0hfzbXzCEC3M9oQlOU=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
Expand Down Expand Up @@ -441,8 +443,8 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rocket-pool/batch-query v1.0.0 h1:5HejmT1n1fIdLIqUhTNwbkG2PGOPl3IVjCpFQcQZ4I4=
github.com/rocket-pool/batch-query v1.0.0/go.mod h1:d1CmxShzk0fioJ4yX0eFGhz2an1odnW/LZ2cp3eDGIQ=
github.com/rocket-pool/node-manager-core v0.5.2-0.20240918224929-a9cee1201bee h1:iKnfrO0dz45YsB03qVFo2AN6ydG682aUwrGUpXAmWAY=
github.com/rocket-pool/node-manager-core v0.5.2-0.20240918224929-a9cee1201bee/go.mod h1:tLL93eZeU8hkwuMkMl/2ERv82cGHLNFufq8kedsrtSo=
github.com/rocket-pool/node-manager-core v0.5.2-0.20241001041416-40f4fb819f98 h1:/vmzEAVs15gRK7q8lUYi1+MJd0XhxJwPe3zMdRB+3c8=
github.com/rocket-pool/node-manager-core v0.5.2-0.20241001041416-40f4fb819f98/go.mod h1:/H1wq3skacZi4zjgnKTtnm0wBLJH7H5r0CvLtWFs19Y=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
Expand Down
4 changes: 2 additions & 2 deletions server/nodeset/upload-deposit-data.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (c *nodesetUploadDepositDataContext) PrepareData(data *swapi.NodesetUploadD
}

// Fetch status from NodeSet
response, err := hd.NodeSet_StakeWise.GetRegisteredValidators(res.Vault)
response, err := hd.NodeSet_StakeWise.GetRegisteredValidators(res.DeploymentName, res.Vault)
if err != nil {
return types.ResponseStatus_Error, fmt.Errorf("error getting registered validators from Nodeset: %w", err)
}
Expand Down Expand Up @@ -196,7 +196,7 @@ func (c *nodesetUploadDepositDataContext) PrepareData(data *swapi.NodesetUploadD
if err != nil {
return types.ResponseStatus_Error, fmt.Errorf("error generating deposit data: %w", err)
}
uploadResponse, err := hd.NodeSet_StakeWise.UploadDepositData(res.Vault, depositData)
uploadResponse, err := hd.NodeSet_StakeWise.UploadDepositData(res.DeploymentName, res.Vault, depositData)
if err != nil {
return types.ResponseStatus_Error, fmt.Errorf("error uploading deposit data: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion server/status/get-validator-statuses.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *statusGetValidatorsStatusesContext) PrepareData(data *swapi.ValidatorSt
return types.ResponseStatus_Error, err
}

nodesetStatusResponse, err := hd.NodeSet_StakeWise.GetRegisteredValidators(res.Vault)
nodesetStatusResponse, err := hd.NodeSet_StakeWise.GetRegisteredValidators(res.DeploymentName, res.Vault)
if err != nil {
return types.ResponseStatus_Error, fmt.Errorf("error getting nodeset statuses: %w", err)
}
Expand Down
3 changes: 3 additions & 0 deletions shared/config/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type StakeWiseSettings struct {

// A collection of network-specific resources and getters for them
type StakeWiseResources struct {
// The name of the deployment used by nodeset.io
DeploymentName string `yaml:"deploymentName" json:"deploymentName"`

// The address of the Stakewise v3 vault contract, the withdrawal address for all Stakewise validators on Beacon.
// It's also the address of an ERC-20 token on the EL, which is an LST for the NodeSet partner administrating the vault.
// See https://app.stakewise.io/vault/holesky/<vault_address> for details.
Expand Down
2 changes: 1 addition & 1 deletion stakewise-daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func main() {
configFactory := func(hdCfg *hdconfig.HyperdriveConfig) (*swconfig.StakeWiseConfig, error) {
return swconfig.NewStakeWiseConfig(hdCfg, settingsList)
}
sp, err := services.NewModuleServiceProvider(hyperdriveUrl, moduleDir, swconfig.ModuleName, swconfig.ClientLogName, configFactory, hdconfig.ClientTimeout)
sp, err := services.NewModuleServiceProvider(hyperdriveUrl, moduleDir, swconfig.ModuleName, swconfig.ClientLogName, configFactory)
if err != nil {
return fmt.Errorf("error creating service provider: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions tasks/send-exit-data.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (t *SendExitDataTask) Run() error {
t.logger.Info("Checking for missing signed exit data...")

// Get registered validators
resp, err := t.hd.NodeSet_StakeWise.GetRegisteredValidators(t.res.Vault)
resp, err := t.hd.NodeSet_StakeWise.GetRegisteredValidators(t.res.DeploymentName, t.res.Vault)
if err != nil {
return fmt.Errorf("error getting registered validators: %w", err)
}
Expand Down Expand Up @@ -135,7 +135,7 @@ func (t *SendExitDataTask) Run() error {

// Upload the messages to Nodeset
if len(exitData) > 0 {
_, err := t.hd.NodeSet_StakeWise.UploadSignedExits(t.res.Vault, exitData)
_, err := t.hd.NodeSet_StakeWise.UploadSignedExits(t.res.DeploymentName, t.res.Vault, exitData)
if err != nil {
return fmt.Errorf("error uploading signed exit messages to NodeSet: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions tasks/update-deposit-data.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (t *UpdateDepositDataTask) Run() error {
t.logger.Info("Checking version of NodeSet data on disk...")

// Get the version on the server
versionResponse, err := t.hd.NodeSet_StakeWise.GetDepositDataSetVersion(t.res.Vault)
versionResponse, err := t.hd.NodeSet_StakeWise.GetDepositDataSetVersion(t.res.DeploymentName, t.res.Vault)
if err != nil {
return fmt.Errorf("error getting latest deposit data version: %w", err)
}
Expand All @@ -66,7 +66,7 @@ func (t *UpdateDepositDataTask) Run() error {

// Get the new data
t.logger.Info("Deposit data is out of date retrieving latest data...", slog.Int("localVersion", localVersion), slog.Int("remoteVersion", remoteVersion))
setResponse, err := t.hd.NodeSet_StakeWise.GetDepositDataSet(t.res.Vault)
setResponse, err := t.hd.NodeSet_StakeWise.GetDepositDataSet(t.res.DeploymentName, t.res.Vault)
if err != nil {
return fmt.Errorf("error getting latest deposit data: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion testing/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (n *StakeWiseNode) CreateSubNode(hdNode *hdtesting.HyperdriveNode, address
hdClient := hdNode.GetApiClient()

// Make Constellation resources
resources := getTestResources(hdSp.GetResources())
resources := getTestResources(hdSp.GetResources(), deploymentName)
csCfg, err := swconfig.NewStakeWiseConfig(hdCfg, []*swconfig.StakeWiseSettings{})
if err != nil {
return nil, fmt.Errorf("error creating Constellation config: %v", err)
Expand Down
6 changes: 5 additions & 1 deletion testing/test-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
"github.com/rocket-pool/node-manager-core/log"
)

const (
deploymentName string = "localtest"
)

// StakeWiseTestManager for managing testing resources and services
type StakeWiseTestManager struct {
*hdtesting.HyperdriveTestManager
Expand All @@ -38,7 +42,7 @@ func NewStakeWiseTestManager() (*StakeWiseTestManager, error) {
hdClient := hdNode.GetApiClient()

// Make StakeWise resources
resources := getTestResources(hdSp.GetResources())
resources := getTestResources(hdSp.GetResources(), deploymentName)
swCfg, err := swconfig.NewStakeWiseConfig(hdCfg, []*swconfig.StakeWiseSettings{})
if err != nil {
closeTestManager(tm)
Expand Down
3 changes: 2 additions & 1 deletion testing/test-resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ const (
)

// Returns a new StakewiseResources instance with test network values
func getTestResources(hdResources *hdconfig.MergedResources) *swconfig.MergedResources {
func getTestResources(hdResources *hdconfig.MergedResources, deploymentName string) *swconfig.MergedResources {
return &swconfig.MergedResources{
MergedResources: hdResources,
StakeWiseResources: &swconfig.StakeWiseResources{
DeploymentName: deploymentName,
Vault: common.HexToAddress(StakeWiseVaultString),
FeeRecipient: common.HexToAddress(""),
SplitWarehouse: common.HexToAddress(""),
Expand Down