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

add lodestar VCs with --distributed flag #114

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
87 changes: 87 additions & 0 deletions compose-lodestar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Docker compose file to aid developers to test lodestar VCs in a distributed validator cluster.
version: "3.8"

services:
# _ _ _
# | | ___ __| | ___ ___| |_ __ _ _ __
# | |/ _ \ / _` |/ _ \/ __| __/ _` | '__|
# | | (_) | (_| | __/\__ \ || (_| | |
# |_|\___/ \__,_|\___||___/\__\__,_|_|
vc0-lodestar:
image: nflaig/lodestar:dvt-compatible
entrypoint: /opt/lodestar/run.sh
networks: [ cluster ]
depends_on: [ node0 ]
restart: unless-stopped
environment:
BEACON_NODE_ADDRESS: http://node0:3600
ETH2_NETWORK: ${ETH2_NETWORK:-goerli}
volumes:
Copy link

Choose a reason for hiding this comment

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

I would recommend to add a persistent volume for dataDir, this can be specified by setting --dataDir lodestar cli option, see Lodestar CLI docs for further reference

- ./lodestar/run.sh:/opt/lodestar/run.sh
- .charon/cluster/node0/validator_keys:/home/charon/validator_keys

vc1-lodestar:
image: nflaig/lodestar:dvt-compatible
entrypoint: /opt/lodestar/run.sh
networks: [ cluster ]
depends_on: [ node1 ]
restart: unless-stopped
environment:
BEACON_NODE_ADDRESS: http://node1:3600
ETH2_NETWORK: ${ETH2_NETWORK:-goerli}
volumes:
- ./lodestar/run.sh:/opt/lodestar/run.sh
- .charon/cluster/node1/validator_keys:/home/charon/validator_keys

vc2-lodestar:
image: nflaig/lodestar:dvt-compatible
entrypoint: /opt/lodestar/run.sh
networks: [ cluster ]
depends_on: [ node2 ]
restart: unless-stopped
environment:
BEACON_NODE_ADDRESS: http://node2:3600
ETH2_NETWORK: ${ETH2_NETWORK:-goerli}
volumes:
- ./lodestar/run.sh:/opt/lodestar/run.sh
- .charon/cluster/node2/validator_keys:/home/charon/validator_keys

vc3-lodestar:
image: nflaig/lodestar:dvt-compatible
entrypoint: /opt/lodestar/run.sh
networks: [ cluster ]
depends_on: [ node3 ]
restart: unless-stopped
environment:
BEACON_NODE_ADDRESS: http://node3:3600
ETH2_NETWORK: ${ETH2_NETWORK:-goerli}
volumes:
- ./lodestar/run.sh:/opt/lodestar/run.sh
- .charon/cluster/node3/validator_keys:/home/charon/validator_keys

vc4-lodestar:
image: nflaig/lodestar:dvt-compatible
entrypoint: /opt/lodestar/run.sh
networks: [ cluster ]
depends_on: [ node4 ]
restart: unless-stopped
environment:
BEACON_NODE_ADDRESS: http://node4:3600
ETH2_NETWORK: ${ETH2_NETWORK:-goerli}
volumes:
- ./lodestar/run.sh:/opt/lodestar/run.sh
- .charon/cluster/node4/validator_keys:/home/charon/validator_keys

vc5-lodestar:
image: nflaig/lodestar:dvt-compatible
entrypoint: /opt/lodestar/run.sh
networks: [ cluster ]
depends_on: [ node5 ]
restart: unless-stopped
environment:
BEACON_NODE_ADDRESS: http://node5:3600
ETH2_NETWORK: ${ETH2_NETWORK:-goerli}
volumes:
- ./lodestar/run.sh:/opt/lodestar/run.sh
- .charon/cluster/node5/validator_keys:/home/charon/validator_keys

34 changes: 34 additions & 0 deletions lodestar/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

tmpkeys="/home/validator_keys/tmpkeys"
mkdir -p ${tmpkeys}

for f in /home/charon/validator_keys/keystore-*.json; do
echo "Importing key ${f}"

# Copy keystore file to tmpkeys/ directory.
cp "${f}" "${tmpkeys}"

# Import keystore with password.
node /usr/app/packages/cli/bin/lodestar validator import \
--network="$ETH2_NETWORK" \
--importKeystores="/home/charon/validator_keys" \
--importKeystoresPassword="${f//json/txt}"

# Delete tmpkeys/keystore-*.json file that was copied before.
filename="$(basename ${f})"
rm "${tmpkeys}/${filename}"
done

# Delete the tmpkeys/ directory since it's no longer needed.
rm -r ${tmpkeys}

echo "Imported all keys"

node /usr/app/packages/cli/bin/lodestar validator \
--network="$ETH2_NETWORK" \
--metrics=true \
--metrics.address="0.0.0.0" \
--metrics.port=5064 \
--beaconNodes="$BEACON_NODE_ADDRESS" \
--distributed