From db4c170374e73181ba7c28abad663f27ba074d28 Mon Sep 17 00:00:00 2001 From: Joe Clapis Date: Sun, 28 Apr 2024 21:06:41 -0400 Subject: [PATCH 1/4] Updated the v2 doc with native mode installation --- rocketpool-daemon/node/node.go | 2 +- v2.md | 46 +++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/rocketpool-daemon/node/node.go b/rocketpool-daemon/node/node.go index c4edcb3ad..0242dcc88 100644 --- a/rocketpool-daemon/node/node.go +++ b/rocketpool-daemon/node/node.go @@ -180,7 +180,7 @@ func (t *TaskLoop) Stop() error { ctx, cancel := context.WithTimeout(context.Background(), metricsShutdownTimeout) defer cancel() err := t.metricsServer.Shutdown(ctx) - if !errors.Is(err, http.ErrServerClosed) { + if err != nil && !errors.Is(err, http.ErrServerClosed) { return fmt.Errorf("Error stopping metrics server: %w", err) } } diff --git a/v2.md b/v2.md index a5efaaf69..7cfdb96d5 100644 --- a/v2.md +++ b/v2.md @@ -12,6 +12,8 @@ The following is a list of what's changed from v1 so far, in no particular order ### Installation +NOTE: for actual installation instructions, please see the [section below](#installing-v2). + - The Smart Node now comes in a `.deb` package, so users running Debian or Debian-derivative distributions can now install it via `sudo apt install rocketpool` and update it via `sudo apt update && sudo apt dist-upgrade` once the Rocket Pool repository is set up. - Packages for other distributions, such as RHEL or Fedora, will be introduced at a later date. - For now, users not on Debian-based systems can install via the traditional `rocketpool service install` command. It will still pull the necessary files from GitHub as it did before. @@ -77,7 +79,7 @@ The following is a list of what's changed from v1 so far, in no particular order - Use `rocketpool service node-logs` with `api`, `tasks`, and/or `watchtower` to view the new logs respectively. -## Installing v2 +## Installing v2 - Docker and Hybrid Mode Prior to installation, please note that Smart Node v2 will **only work with the Rocket Pool Houston upgrade**. It will not work with Atlas or any previous Rocket Pool protocol version. @@ -176,6 +178,48 @@ Development packages are uploaded with the other development artifacts on GitHub 4. Don't forget to include `-u` when running `rocketpool service config` to emulate a package upgrade! +## Installing v2 - Native Mode + +Prior to installation, please note that Smart Node v2 will **only work with the Rocket Pool Houston upgrade**. It will not work with Atlas or any previous Rocket Pool protocol version. + + +### **IMPORTANT:** Migrating from Smart Node v1 + +If you have Smart Node v1 already installed on your machine, you will need to do a little bit of cleanup before installing v2. + +First, **back up your existing Rocket Pool directory (`~/.rocketpool` by default)** somewhere safe, just in case. Next, run the following command: +``` +rm -rf ~/bin/rocketpool ~/.rocketpool/scripts ~/.rocketpool/templates ~/.rocketpool/prometheus.tmpl +``` +This will delete the old v1 CLI and some accompanying installation files that are no longer stored in your home directory. + +Now, delete the Watchtower service as it's no longer needed: +``` +sudo systemctl stop rp-watchtower + +sudo systemctl disable rp-watchtower + +sudo rm -f /etc/systemd/system/rp-watchtower.service +``` + +Next, follow the instructions below. + + +### Installing Native Mode + +The Native mode installation process is quite similar to [the process used in v1](https://docs.rocketpool.net/guides/node/native) so we recommend you use that as a starting point. + +The differences are as follows: + +1. You do *not* need to create a service for the Watchtower. You only need to create one for the Node. In v2, the Watchtower has been rolled into the Node. +2. The `ExecStart` portion of the `rp-node` service definition is now: + ``` + /usr/local/bin/rocketpoold -u /srv/rocketpool + ``` +3. Whenever you run the CLI, you should use the `-n` flag to specify native mode (i.e. `rocketpool -n service config`). If you previously used the `-d` flag, it has been removed. We recommend setting the alias `rp="rocketpool -n -c /srv/rocketpool"` now for convenience. +4. When running `rp service config`, make sure the paths to the `VC Restart Script` and the `Validator Stop Command` point to the correct locations on your filesystem as the defaults have changed in v2. + + ## Running v2 as a Node Operator Running the Smart Node is, for all practical purposes, the same as it was in `v1`. The `rocketpool service start` command will still initialize Docker compose with all of the latest container definition files and begin the service, `rocketpool service stop` will still shut it down, and so on. The primary differences are: From 027191054f27599efed094f68f51e5bc18468946 Mon Sep 17 00:00:00 2001 From: thomaspanf Date: Sun, 28 Apr 2024 19:15:17 -0700 Subject: [PATCH 2/4] Add more info to rp pdao voting-power Add more info to rp pdao voting-power Add more info to rp pdao voting-power --- rocketpool-cli/pdao/get-voting-power.go | 22 ++++++++++++ rocketpool/api/pdao/get-voting-power.go | 45 ++++++++++++++++++++++--- shared/types/api/pdao.go | 9 +++-- 3 files changed, 69 insertions(+), 7 deletions(-) diff --git a/rocketpool-cli/pdao/get-voting-power.go b/rocketpool-cli/pdao/get-voting-power.go index c9a33a341..4ce3e38fd 100644 --- a/rocketpool-cli/pdao/get-voting-power.go +++ b/rocketpool-cli/pdao/get-voting-power.go @@ -9,6 +9,11 @@ import ( "github.com/rocket-pool/smartnode/shared/services/rocketpool" ) +const ( + colorBlue string = "\033[36m" + colorReset string = "\033[0m" +) + func getVotePower(c *cli.Context) error { // Get RP client rp, err := rocketpool.NewClientFromCtx(c).WithReady() @@ -33,8 +38,25 @@ func getVotePower(c *cli.Context) error { return err } + status, err := rp.NodeStatus() + if err != nil { + return err + } + // Print Results fmt.Println("== Node Voting Power ==") + if status.IsVotingInitialized { + fmt.Println("The node has been initialized for onchain voting.") + + } else { + fmt.Println("The node has NOT been initialized for onchain voting. You need to run `rocketpool pdao initialize-voting` to participate in onchain votes.") + } + if status.OnchainVotingDelegate == status.AccountAddress { + fmt.Println("The node doesn't have a delegate, which means it can vote directly on onchain proposals.") + } else { + fmt.Printf("The node has a voting delegate of %s%s%s which can represent it when voting on Rocket Pool onchain governance proposals.\n", colorBlue, status.OnchainVotingDelegateFormatted, colorReset) + } + fmt.Printf("Your current voting power: %.10f\n", eth.WeiToEth(response.VotingPower)) return nil } diff --git a/rocketpool/api/pdao/get-voting-power.go b/rocketpool/api/pdao/get-voting-power.go index 0978f81be..3e20e12c1 100644 --- a/rocketpool/api/pdao/get-voting-power.go +++ b/rocketpool/api/pdao/get-voting-power.go @@ -4,7 +4,10 @@ import ( "context" "fmt" + "github.com/ethereum/go-ethereum/common" "github.com/urfave/cli" + "github.com/wealdtech/go-ens/v3" + "golang.org/x/sync/errgroup" "github.com/rocket-pool/rocketpool-go/network" "github.com/rocket-pool/smartnode/shared/services" @@ -36,10 +39,31 @@ func getVotePower(c *cli.Context) (*api.GetPDAOVotePowerResponse, error) { return nil, err } - // Get current block number - blockNumber, err := ec.BlockNumber(context.Background()) - if err != nil { - return nil, fmt.Errorf("Error getting block number: %w", err) + // Sync + var wg errgroup.Group + var blockNumber uint64 + + wg.Go(func() error { + var err error + response.OnchainVotingDelegate, err = network.GetCurrentVotingDelegate(rp, nodeAccount.Address, nil) + if err == nil { + response.OnchainVotingDelegateFormatted = formatResolvedAddress(c, response.OnchainVotingDelegate) + } + return err + }) + + wg.Go(func() error { + _blockNumber, err := ec.BlockNumber(context.Background()) + if err != nil { + return fmt.Errorf("Error getting block number: %w", err) + } + blockNumber = _blockNumber + return nil + }) + + // Wait for data + if err := wg.Wait(); err != nil { + return nil, err } // Cast to uint32 @@ -54,3 +78,16 @@ func getVotePower(c *cli.Context) (*api.GetPDAOVotePowerResponse, error) { // Update & return response return &response, nil } + +func formatResolvedAddress(c *cli.Context, address common.Address) string { + rp, err := services.GetRocketPool(c) + if err != nil { + return address.Hex() + } + + name, err := ens.ReverseResolve(rp.Client, address) + if err != nil { + return address.Hex() + } + return fmt.Sprintf("%s (%s)", name, address.Hex()) +} diff --git a/shared/types/api/pdao.go b/shared/types/api/pdao.go index 08d3382ad..5a6567d74 100644 --- a/shared/types/api/pdao.go +++ b/shared/types/api/pdao.go @@ -405,7 +405,10 @@ type PDAOInitializeVotingResponse struct { } type GetPDAOVotePowerResponse struct { - Status string `json:"status"` - Error string `json:"error"` - VotingPower *big.Int `json:"votingPower"` + Status string `json:"status"` + Error string `json:"error"` + VotingPower *big.Int `json:"votingPower"` + OnchainVotingDelegate common.Address `json:"onchainVotingDelegate"` + OnchainVotingDelegateFormatted string `json:"onchainVotingDelegateFormatted"` + BlockNumber uint64 `json:"blockNumber"` } From 72bcb2dc9b8ef38ca2d68d19529f4e224a0183cf Mon Sep 17 00:00:00 2001 From: Joe Clapis Date: Mon, 29 Apr 2024 10:24:01 -0400 Subject: [PATCH 3/4] Minor tweaks, updated the v2 guide --- go.mod | 4 ++-- go.sum | 8 ++++---- .../deploy/templates/alerting/alertmanager.tmpl | 2 +- install/packages/debian/debian/changelog | 4 ++-- rocketpool-cli/commands/node/deposit.go | 2 +- v2.md | 15 +++++++++++++++ 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index c171a37e6..919e4a62a 100644 --- a/go.mod +++ b/go.mod @@ -28,8 +28,8 @@ require ( github.com/prometheus/client_golang v1.19.0 github.com/prysmaticlabs/prysm/v5 v5.0.3 github.com/rivo/tview v0.0.0-20230208211350-7dfff1ce7854 // DO NOT UPGRADE - github.com/rocket-pool/node-manager-core v0.2.1-0.20240428142929-651499837522 - github.com/rocket-pool/rocketpool-go/v2 v2.0.0-20240421200135-5ec635bb7db3 + github.com/rocket-pool/node-manager-core v0.3.0 + github.com/rocket-pool/rocketpool-go/v2 v2.0.0-b1 github.com/shirou/gopsutil/v3 v3.24.3 github.com/tyler-smith/go-bip39 v1.1.0 github.com/wealdtech/go-ens/v3 v3.6.0 diff --git a/go.sum b/go.sum index 92b1d2309..e0b772b48 100644 --- a/go.sum +++ b/go.sum @@ -483,10 +483,10 @@ 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.2.1-0.20240428142929-651499837522 h1:/5QIMrOzfGfQW8RuefiIZRD5dxcnLMmPHsMlp7l86KU= -github.com/rocket-pool/node-manager-core v0.2.1-0.20240428142929-651499837522/go.mod h1:f/w3jnzi3ipXet7acZ0pQhGbolU/g3IDVrqXcNWuHw4= -github.com/rocket-pool/rocketpool-go/v2 v2.0.0-20240421200135-5ec635bb7db3 h1:71IYwGtk3IDbTrrhTeIYJoYSCBowrU+ebacgeXI3cOs= -github.com/rocket-pool/rocketpool-go/v2 v2.0.0-20240421200135-5ec635bb7db3/go.mod h1:KgToyMtgmDo9gsmJ8KFpcpLbkETDXnPi0J8M+YmUpmA= +github.com/rocket-pool/node-manager-core v0.3.0 h1:eXju+2URsEw6qaw92J3+JhqbtkHNrhE0GWNiEz7tKXo= +github.com/rocket-pool/node-manager-core v0.3.0/go.mod h1:f/w3jnzi3ipXet7acZ0pQhGbolU/g3IDVrqXcNWuHw4= +github.com/rocket-pool/rocketpool-go/v2 v2.0.0-b1 h1:eIABhMJ2yMY1+bRAgVFlZkQuE6SILD3O/pbXsFqFlY0= +github.com/rocket-pool/rocketpool-go/v2 v2.0.0-b1/go.mod h1:RFw2LxrDX8wO+ShLXR/mM9ZaIech1WvqKmFv4eJTlXI= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= diff --git a/install/deploy/templates/alerting/alertmanager.tmpl b/install/deploy/templates/alerting/alertmanager.tmpl index c58c2c382..52fa4090d 100644 --- a/install/deploy/templates/alerting/alertmanager.tmpl +++ b/install/deploy/templates/alerting/alertmanager.tmpl @@ -1,4 +1,4 @@ - Autogenerated - DO NOT MODIFY THIS FILE DIRECTLY +# Autogenerated - DO NOT MODIFY THIS FILE DIRECTLY global: # ResolveTimeout is the default value used by alertmanager if the alert does diff --git a/install/packages/debian/debian/changelog b/install/packages/debian/debian/changelog index 454525bf6..bbc4edffd 100644 --- a/install/packages/debian/debian/changelog +++ b/install/packages/debian/debian/changelog @@ -1,4 +1,4 @@ -rocketpool (2.0.0~beta.1) UNRELEASED; urgency=medium +rocketpool (2.0.0~b1) unstable; urgency=medium * Welcome to Smart Node v2! This is a completely redesigned Smart Node from the ground up, taking advantage of years of lessons learned and user feedback. The list of features and changes is far too long to list here, but here are some highlights: * Support for installing and updating via Debian's `apt` package manager (other package managers coming soon!) @@ -8,4 +8,4 @@ rocketpool (2.0.0~beta.1) UNRELEASED; urgency=medium * And much more! * To learn all about what's changed in Smart Node v2 and how to use it, take a look at our guide: https://github.com/rocket-pool/smartnode/blob/v2/v2.md - -- Rocket Pool Sun, 28 Apr 2024 16:55:22 +0000 + -- Rocket Pool Mon, 29 Apr 2024 12:41:02 +0000 diff --git a/rocketpool-cli/commands/node/deposit.go b/rocketpool-cli/commands/node/deposit.go index af53ee149..7dec52344 100644 --- a/rocketpool-cli/commands/node/deposit.go +++ b/rocketpool-cli/commands/node/deposit.go @@ -257,7 +257,7 @@ func nodeDeposit(c *cli.Context) error { // Log & return fmt.Printf("The node deposit of %.6f ETH was made successfully!\n", math.RoundDown(eth.WeiToEth(amountWei), 6)) fmt.Printf("Your new minipool's address is: %s\n", response.Data.MinipoolAddress) - fmt.Printf("The validator pubkey is: %s\n\n", response.Data.ValidatorPubkey.Hex()) + fmt.Printf("The validator pubkey is: %s\n\n", response.Data.ValidatorPubkey.HexWithPrefix()) fmt.Println("Your minipool is now in Initialized status.") fmt.Println("Once the remaining ETH has been assigned to your minipool from the staking pool, it will move to Prelaunch status.") diff --git a/v2.md b/v2.md index 7cfdb96d5..83ea19955 100644 --- a/v2.md +++ b/v2.md @@ -97,6 +97,21 @@ This will delete the old v1 CLI and some accompanying installation files that ar Now, follow the instructions in whichever of the below sections makes sense for your situation. +### Installing Docker + +Before installing the Smart Node, you'll need to have Docker's apt repository set up so your system can install Docker. If you have it set up already (i.e., from Smart Node v1), you can skip this step. + +Start by following [Docker's installation instructions](https://docs.docker.com/engine/install/) to install it for your operating system. + +Next, add your user to the group of Docker administrators: +``` +sudo usermod -aG docker $USER +``` + +Finally, exit the terminal session and start a new one (log out and back in or close and re-open SSH) for the new permissions to take effect. + + + ### Installing via `rocketpool service install` and GitHub This method was used by Smart Node v1, and is still available in v2. It is the "general purpose" method can be used for any release, including development prototypes, and will work on any system that Rocket Pool supports. At a high level it involves manually downloading the CLI, then running a command with it to install the rest of the service. From 57412d001a1282947d11d2fe7cced84ba47e798f Mon Sep 17 00:00:00 2001 From: Joe Clapis Date: Mon, 29 Apr 2024 10:24:50 -0400 Subject: [PATCH 4/4] Updated version to beta 1 --- shared/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/version.go b/shared/version.go index 59152f515..95d5bbc96 100644 --- a/shared/version.go +++ b/shared/version.go @@ -1,6 +1,6 @@ package shared -const RocketPoolVersion string = "2.0.0-dev" +const RocketPoolVersion string = "2.0.0-b1" const Logo string = `______ _ _ ______ _ | ___ \ | | | | | ___ \ | |