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

[Polkadot Wiki Migration] Upgrade Your Node #36

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
title: Upgrade Your Node
description: Instructions on how to upgrade your validator node.
dawnkelly09 marked this conversation as resolved.
Show resolved Hide resolved
---

Validators perform critical functions for the network by [backing and including blocks](https://wiki.polkadot.network/docs/learn-parachains-protocol){target=_blank}. Validators may have to go offline for short-periods of time to upgrade client software or to upgrade the host machine.
dawnkelly09 marked this conversation as resolved.
Show resolved Hide resolved
dawnkelly09 marked this conversation as resolved.
Show resolved Hide resolved
dawnkelly09 marked this conversation as resolved.
Show resolved Hide resolved

Usually, standard client upgrades will only require you to stop the service, replace the binary and
restart the service. This operation can be executed within a session.

Validators may also need to perform long-lead maintenance tasks that will span more than one
dawnkelly09 marked this conversation as resolved.
Show resolved Hide resolved
session. Under these circumstances, an active validator may chill their stash and be removed from
the active validator set. Alternatively, the validator may substitute the active validator server
with another allowing the former to undergo maintenance activities.

This guide will provide an option for validators to seamlessly substitute an active validator server
to allow for maintenance operations.

The process can take several hours, so make sure you understand the instructions first and plan
accordingly.

!!!tip "Keep an eye out on new releases from the community"
Upgrade or downgrade accordingly.
eshaben marked this conversation as resolved.
Show resolved Hide resolved


## Key Components

### Session Keys

Session keys are stored in the client and used to sign validator operations. They are what link your
validator node to your staking proxy. If you change them within a session you will have to wait for
the current session to finish and a further two sessions to elapse before they are applied.

[More info about keys in Polkadot.](https://wiki.polkadot.network/docs/learn-cryptography#keys){target=_blank}
dawnkelly09 marked this conversation as resolved.
Show resolved Hide resolved

### Keystore
dawnkelly09 marked this conversation as resolved.
Show resolved Hide resolved

Each validator server contains essential private keys in a folder called the _keystore_. These keys
are used by a validator to sign transactions at the network level. If two or more validators sign
certain transactions using the same keys, it can lead to an [equivocation slash.](https://wiki.polkadot.network/docs/learn-offenses){target=_blank}
dawnkelly09 marked this conversation as resolved.
Show resolved Hide resolved

For this reason, it is advised that validators don't clone or copy the `_keystore_` folder and
instead generate session keys for each new validator instance.

Default keystore path - `/home/polkadot/.local/share/polkadot/chains/<chain>/keystore`

## Steps

The following steps require a second validator which will be referred to as `Validator B`. The
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this meant to be a quick overview of which steps are needed with a more extensive tutorial somewhere else? If there isn't a more detailed tutorial to go with this, then some of these steps should have more detail. What commands do I use to start a second node? How do I generate session keys? etc. This section has a nice amount of "what" but almost no "how"

Copy link
Collaborator

@eshaben eshaben Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are steps they most likely (if not, someone on their team) would have already gone through when setting up the original validator.

I would just add a link to the onboarding page, which will include how to get a node up and running and how to generate session keys

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another note: I think this page will get heavily updated at some point, so I would link to other places for now where needed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I linked the "How to Validate" page, which covers this as a prerequisite. We can definitely make it flow a little better, though.

original server that is in the active set will be referred to as `Validator A`.
eshaben marked this conversation as resolved.
Show resolved Hide resolved

### Session `N`

1. Start a second node. Once it is synced, use the `--validator` flag. This is now "Validator B."
dawnkelly09 marked this conversation as resolved.
Show resolved Hide resolved
2. Generate Session keys for **Validator B**
3. Submit a `set_key` extrinsic from your staking proxy with the session key generated from
**Validator B**
4. Take note of the Session that this extrinsic was executed in
dawnkelly09 marked this conversation as resolved.
Show resolved Hide resolved
5. Allow the current session to elapse and then wait for two full sessions

**It is imperative that you keep Validator A running during this time.** `set_key` doesn't have an
immediate effect and requires two full sessions to elapse before it does. If you do switch off
Validator A too early you may risk being chilled and face a fault within the Thousand Validator
Programme.

### Session `N+3`

**Validator B** is now acting as your validator - you can safely perform operations on **Validator
A**.

When you are ready to restore **Validator A**:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as above. Do we need more how in here or will there be tutorial(s) to link out to?


1. Start **Validator A**, sync the database and ensure that it is operating with the `--validator`
flag.
2. Generate new Session keys for **Validator A**.
3. Submit a `set_key` extrinsic from your staking proxy with the session key generated from
**Validator A**.
4. Take note of the Session that this extrinsic was executed in.
dawnkelly09 marked this conversation as resolved.
Show resolved Hide resolved

**Again, it is imperative that Validator B is kept running until the current session finishes and
two further full sessions have elapsed.**

Once this time has elapsed, **Validator A** will take over. You can safely stop Validator B.

**NOTE:** To verify that the Session has changed, make sure that a block in the new Session is
dawnkelly09 marked this conversation as resolved.
Show resolved Hide resolved
finalized. You should see log messages like the ones below to confirm the change:

```
2019-10-28 21:44:13 Applying authority set change scheduled at block #450092
2019-10-28 21:44:13 Applying GRANDPA set change to new set with 20 authorities
```
dawnkelly09 marked this conversation as resolved.
Show resolved Hide resolved
Loading