Skip to content

Commit

Permalink
Support for Prysm voluntary exit
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdowne committed Oct 16, 2020
1 parent aa7a0f2 commit 0c2742c
Show file tree
Hide file tree
Showing 16 changed files with 158 additions and 47 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,21 @@ directoy (`cd ~/eth2-docker` by default):
* `sudo docker-compose build --no-cache beacon` (go for a 30 minute walk)
* `sudo docker-compose down`
* !! If coming from Lighthouse v0.2.x, make changes as per notes for [v0.1.6](#v016-2020-10-09)
* !! If coming from Prysm alpha.29 or earlier, make changes as per notes for [v0.1.7](#v017-2020-10-15)
* `sudo docker-compose up -d eth2`

## v0.1.7 2020-10-15

* Added "validator-voluntary-exit" to Prysm, see [readme](README.md#addendum-voluntary-client-exit)
* Default restart policy is now "unless-stopped" and can be changed via `.env`
* Preliminary work to support Prysm Web UI, not yet functional
* Changed testnet parameter for Prysm to conform with alpha.29
* Use `--blst` with Prysm by default for faster sync speed
* Handles Terms Of Service for Prysm, user is prompted during validator-import, and choice is remembered
* If you are upgrading this project and you are using Prysm, please run `sudo docker-compose run validator`
and accept the terms of use. You can then Ctrl-C that process and start up normally again. This step
is not necessary if you are starting from scratch.

## v0.1.6 2020-10-09

* Support for Lighthouse v0.3.0, drop support for v0.2.x
Expand Down
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# eth2-docker v0.1.6
# eth2-docker v0.1.7
Unofficial and experimental docker build instructions for eth2 clients

## Acknowledgements
Expand Down Expand Up @@ -155,6 +155,7 @@ the link gets you to, use Ctrl-a to select all and Ctrl-C to copy), click "Load"
- For Teku, you can use the grafana.com URL instead of raw JSON.

- [Lighthouse Dashboard JSON](https://raw.githubusercontent.com/sigp/lighthouse-metrics/master/dashboards/Summary.json)
- [Metanull's Prysm Dashboard JSON](https://raw.githubusercontent.com/metanull-operator/eth2-grafana/master/eth2-grafana-dashboard-single-source.json)
- [Prysm Dashboard JSON](https://raw.githubusercontent.com/GuillaumeMiralles/prysm-grafana-dashboard/master/less_10_validators.json)
- [Prysm Dashboard JSON for more than 10 validators](https://raw.githubusercontent.com/GuillaumeMiralles/prysm-grafana-dashboard/master/more_10_validators.json)
- [Nimbus Dashboard JSON](https://raw.githubusercontent.com/SomerEsat/ethereum-staking-guide/master/NimbusGrafana.json)
Expand Down Expand Up @@ -237,7 +238,41 @@ Then restart the client:<br />
If you did not store the wallet password with the validator, come up
[more manually](#start-the-client) instead.

# Addendum: Troubleshooting
## Addendum: Voluntary client exit

Ethereum 2.0 has a concept of "voluntary client exit", which will remove the
validator from attesting duties. Locked eth could be withdrawn in phase 2,
and not sooner.

Currently, Prysm supports voluntary exit. This requires a fully synced
Prysm client.

To exit, run `sudo docker-compose run validator-voluntary-exit` and follow the
prompts.

If you wish to exit validators that were running on other clients, you can do this
as follows:

- Stop the other client(s), and wait 10 minutes
- Copy all `keystore-m` JSON files into `.eth2/validator_keys` in this project
directory.
- Stop the Prysm client in this project, `sudo docker-compose down`
- Import the new keys via `sudo docker-compose run validator-import`. Note
that Prysm assumes they all have the same password. If that's not the case,
maybe work in batches.
- Verify once more that the old client is down, has been for 10 minutes, and
can't come back up. **If both the old client and this Prysm run at the same time,
you will slash yourself**
- Bring the Prysm client up: `sudo docker-compose up -d eth2`
- Check logs until the beacon is synced: `sudo docker-compose logs -f beacon`
- Initiate voluntary exit and follow the prompts: `sudo docker-compose run validator-voluntary-exit`

> Note you will need to continue running your validator until the exit
> has been processed by the chain, if you wish to avoid incurring offline
> penalties. You can check the status of your validator with tools such
> as beaconcha.in and beaconscan.
## Addendum: Troubleshooting

A few useful commands if you run into issues. As always, `sudo` is a Linux-ism and may not be needed on MacOS.

Expand Down
14 changes: 10 additions & 4 deletions SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,13 @@ ports directly via "iptables" for all ports that are public on the host.

## Time synchronization on Linux

The blockchain requires precise time-keeping. Configure [ntpd](https://en.wikipedia.org/wiki/Network_Time_Protocol)
to synchronize time on your Linux server.
The blockchain requires precise time-keeping. You can use systemd-timesyncd if your system offers it,
or [ntpd](https://en.wikipedia.org/wiki/Network_Time_Protocol) to synchronize time on your Linux server.
systemd-timesyncd uses a single ntp server as source, and ntpd uses several, typically a pool.
My recommendation is to use ntpd for better redundancy.

For Ubuntu, first we switch off the built-in, less precise synchronization and verify it is off. You should see
`NTP service: inactive`.
For Ubuntu, first switch off the built-in, less redundant synchronization and verify it is off.
You should see `NTP service: inactive`.

```
sudo timedatectl set-ntp no
Expand All @@ -180,6 +182,10 @@ Then install the ntp package. It will start automatically.<br />
Check that ntp is running correctly: Run `ntpq -p` , you expect to see a number of ntp time servers with
IP addresses in their `refid`, and several servers with a refid of `.POOL.`

If you wish to stay with systemd-timesyncd, check that `NTP service: active` via
`timedatectl`, and switch it on with `sudo timedatectl set-ntp yes` if it isn't. You can check
time sync with `timedatectl timesync-status --all`.

## SSH key authentication with Linux

This is for logging into your node server, assuming that node server runs Linux. You will start
Expand Down
4 changes: 2 additions & 2 deletions default.env
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ ETH1_NODE=http://geth:8545
GRAFFITI=eth2-docker
# Number of validators to create with deposit-cli
NUMVAL=1
# Restart policy: Set to no if you do not want services to automatically restart
RESTART=unless-stopped
# If you want debug logs, set this to debug instead of info
LOG_LEVEL=info
# Uncomment this if you need to restrict teku to just 4 GiB of RAM
Expand All @@ -20,8 +22,6 @@ LOG_LEVEL=info
NIM_METRICS=NIMFLAGS="-d:insecure"
# Testnet to use for eth2.
TESTNET=medalla
# Specific to Prysm, testnet that's NOT medalla
#PRYSM_NONSTD_TESTNET=--zinken

# Ports you will forward to your staking node. Adjust here if you are
# going to use something other than defaults.
Expand Down
2 changes: 1 addition & 1 deletion geth.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
geth:
restart: "no"
restart: "${RESTART}"
user: ${LOCAL_UID}:${LOCAL_UID}
build:
context: ./geth
Expand Down
4 changes: 2 additions & 2 deletions lh-base.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
beacon:
restart: "no"
restart: "${RESTART}"
user: ${LOCAL_UID}:${LOCAL_UID}
build:
context: ./lighthouse
Expand Down Expand Up @@ -33,7 +33,7 @@ services:
- ${ETH1_NODE}
- --debug-level=${LOG_LEVEL}
validator:
restart: "no"
restart: "${RESTART}"
user: ${LOCAL_UID}:${LOCAL_UID}
build:
context: ./lighthouse
Expand Down
6 changes: 3 additions & 3 deletions lh-grafana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
- --metrics-address
- 0.0.0.0
prometheus:
restart: "no"
restart: "${RESTART}"
build:
context: ./prometheus
image: prometheus
Expand All @@ -25,12 +25,12 @@ services:
- validator
- node-exporter
node-exporter:
restart: "no"
restart: "${RESTART}"
image: prom/node-exporter
expose:
- 9100/tcp
grafana:
restart: "no"
restart: "${RESTART}"
image: grafana/grafana
volumes:
- grafana-data:/var/lib/grafana
Expand Down
2 changes: 1 addition & 1 deletion nimbus-base.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
beacon:
restart: "no"
restart: "${RESTART}"
user: ${LOCAL_UID}:${LOCAL_UID}
build:
context: ./nimbus
Expand Down
6 changes: 3 additions & 3 deletions nimbus-grafana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
- --metrics-port=8008
- --metrics-address=0.0.0.0
prometheus:
restart: "no"
restart: "${RESTART}"
build:
context: ./prometheus
image: prometheus
Expand All @@ -24,12 +24,12 @@ services:
- beacon
- node-exporter
node-exporter:
restart: "no"
restart: "${RESTART}"
image: prom/node-exporter
expose:
- 9100/tcp
grafana:
restart: "no"
restart: "${RESTART}"
image: grafana/grafana
volumes:
- grafana-data:/var/lib/grafana
Expand Down
4 changes: 4 additions & 0 deletions prometheus/prysm-prom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ scrape_configs:
- job_name: 'beacon node'
static_configs:
- targets: ['beacon:8080']
# Target for metanull's dashboard
- job_name: 'beacon'
static_configs:
- targets: ['beacon:8080']
- job_name: 'node_exporter'
static_configs:
- targets: ['node-exporter:9100']
61 changes: 45 additions & 16 deletions prysm-base.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
beacon:
restart: "no"
restart: "${RESTART}"
user: ${LOCAL_UID}:${LOCAL_UID}
build:
context: ./prysm
Expand All @@ -17,15 +17,12 @@ services:
- ${PRYSM_UDP_PORT}:${PRYSM_UDP_PORT}/udp
expose:
- 4000
- 8080
entrypoint:
- beacon-chain
- --datadir
- /var/lib/prysm/
- --rpc-host
- 0.0.0.0
- --monitoring-host
- 0.0.0.0
- --http-web3provider
- ${ETH1_NODE}
- --p2p-tcp-port
Expand All @@ -34,9 +31,11 @@ services:
- ${PRYSM_UDP_PORT}
- --verbosity
- ${LOG_LEVEL}
command: ${PRYSM_NONSTD_TESTNET}
- --blst
- --${TESTNET}
- --accept-terms-of-use
validator:
restart: "no"
restart: "${RESTART}"
user: ${LOCAL_UID}:${LOCAL_UID}
build:
context: ./prysm
Expand All @@ -47,22 +46,23 @@ services:
image: prysm
volumes:
- prysmvalidator-data:/var/lib/prysm
expose:
- 8081
entrypoint: wait-for-beacon.sh beacon:4000 validator --datadir /var/lib/prysm --wallet-dir /var/lib/prysm/
command:
- --monitoring-host
- 0.0.0.0
entrypoint:
- validator
- --datadir
- /var/lib/prysm
- --wallet-dir
- /var/lib/prysm/
- --beacon-rpc-provider
- beacon:4000
- --graffiti
- ${GRAFFITI}
- --verbosity
- ${LOG_LEVEL}
- --blst
- --${TESTNET}
# If you chose not to store the wallet password during import, comment out the two following lines
- --wallet-password-file
- /var/lib/prysm/password.txt
- ${PRYSM_NONSTD_TESTNET}
depends_on:
- beacon
validator-import:
Expand All @@ -81,15 +81,44 @@ services:
entrypoint: create-prysm-validator-wallet.sh
command:
- validator
- --verbosity
- ${LOG_LEVEL}
- --datadir
- /var/lib/prysm
- --wallet-dir
- /var/lib/prysm/
- accounts-v2
- import
- --wallet-dir
- /var/lib/prysm/
- --keys-dir
- /var/lib/prysm/validator_keys
- ${PRYSM_NONSTD_TESTNET}
- --${TESTNET}
validator-voluntary-exit:
restart: "no"
user: ${LOCAL_UID}:${LOCAL_UID}
image: prysm
build:
context: ./prysm
args:
- BUILD_TARGET=${PRYSM_BUILD_TARGET}
- USER=${PRYSM_USER}
- UID=${LOCAL_UID}
volumes:
- prysmvalidator-data:/var/lib/prysm
entrypoint:
- validator
- --verbosity
- ${LOG_LEVEL}
- --datadir
- /var/lib/prysm
- accounts-v2
- voluntary-exit
- --wallet-dir
- /var/lib/prysm/
- --beacon-rpc-provider
- beacon:4000
- --wallet-password-file
- /var/lib/prysm/password.txt
- --${TESTNET}
deposit-cli:
restart: "no"
user: ${LOCAL_UID}:${LOCAL_UID}
Expand Down
30 changes: 27 additions & 3 deletions prysm-grafana.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
version: "3"
services:
beacon:
expose:
- 3500
- 8080
command:
- --monitoring-host
- 0.0.0.0
- --grpc-gateway-host
- 0.0.0.0
validator:
ports:
- 4242:4242/tcp
expose:
- 8081
command:
- --monitoring-host
- 0.0.0.0
- --web
- --web-host
- 0.0.0.0
- --beacon-rpc-gateway-provider
- beacon:3500
- --grpc-gateway-host
- 0.0.0.0
prometheus:
restart: "no"
restart: "${RESTART}"
build:
context: ./prometheus
image: prometheus
Expand All @@ -18,12 +42,12 @@ services:
- validator
- node-exporter
node-exporter:
restart: "no"
restart: "${RESTART}"
image: prom/node-exporter
expose:
- 9100/tcp
grafana:
restart: "no"
restart: "${RESTART}"
image: grafana/grafana
volumes:
- grafana-data:/var/lib/grafana
Expand Down
Loading

0 comments on commit 0c2742c

Please sign in to comment.