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

Draft: Add Vouch VC #19

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
.PHONY: run geth-lighthouse geth-nimbus geth-lodestar geth-prysm geth-teku charon run-charon-lighthouse run-charon-nimbus run-charon-lodestar run-charon-prysm run-charon-teku clean
.PHONY: run geth-lighthouse geth-nimbus geth-lodestar geth-prysm geth-teku charon run-charon-lighthouse run-charon-nimbus run-charon-lodestar run-charon-prysm run-charon-teku run-charon-vouch clean

# Define the composite step
geth-lighthouse-charon-lighthouse: geth-lighthouse charon run-charon-lighthouse
geth-lighthouse-charon-lodestar: geth-lighthouse charon run-charon-lodestar
geth-lighthouse-charon-teku: geth-lighthouse charon run-charon-teku
geth-lighthouse-charon-nimbus: geth-lighthouse charon run-charon-nimbus
geth-lighthouse-charon-prysm: geth-lighthouse charon run-charon-prysm
geth-lighthouse-charon-vouch: geth-lighthouse charon run-charon-vouch

geth-lodestar-charon-lighthouse: geth-lodestar charon run-charon-lighthouse
geth-lodestar-charon-lodestar: geth-lodestar charon run-charon-lodestar
geth-lodestar-charon-teku: geth-lodestar charon run-charon-teku
geth-lodestar-charon-nimbus: geth-lodestar charon run-charon-nimbus
geth-lodestar-charon-prysm: geth-lodestar charon run-charon-prysm
geth-lodestar-charon-vouch: geth-lodestar charon run-charon-vouch

geth-teku-charon-lighthouse: geth-teku charon run-charon-lighthouse
geth-teku-charon-lodestar: geth-teku charon run-charon-lodestar
geth-teku-charon-teku: geth-teku charon run-charon-teku
geth-teku-charon-nimbus: geth-teku charon run-charon-nimbus
geth-teku-charon-prysm: geth-teku charon run-charon-prysm
geth-teku-charon-vouch: geth-teku charon run-charon-vouch

geth-nimbus-charon-lighthouse: geth-nimbus charon run-charon-lighthouse
geth-nimbus-charon-lodestar: geth-nimbus charon run-charon-lodestar
Expand Down Expand Up @@ -85,6 +88,9 @@ run-charon-prysm:
run-charon-teku:
docker compose up node0 node1 node2 vc0-teku vc1-teku vc2-teku prometheus -d

run-charon-vouch:
docker compose up node0 node1 node2 vc0-vouch vc1-vouch vc2-vouch prometheus -d

exit-lighthouse:
./lighthouse/exit.sh 0
./lighthouse/exit.sh 1
Expand Down
44 changes: 43 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
x-node-base:
# Pegged charon version (update this for each release).
&node-base
image: obolnetwork/charon-local:latest
image: obolnetwork/charon:v1.1.1
restart: unless-stopped
networks: [ network1 ]
# network_mode: "host"
Expand Down Expand Up @@ -347,6 +347,48 @@ services:
- .charon/cluster/node2/validator_keys:/home/charon/validator_keys
- ./testnet/config.yaml:/home/data/config.yaml

vc0-vouch:
image: attestant/vouch:1.9.0
platform: linux/amd64
networks: [ network1 ]
depends_on: [ node0 ]
restart: unless-stopped
entrypoint: /opt/charon/vouch/run.sh
environment:
BEACON_NODE_ADDRESS: http://node0:3600
# BEACON_NODE_ADDRESS: ${BN_0:-http://172.16.4.9:4000}
volumes:
- .charon/cluster/node0/validator_keys:/opt/charon/validator_keys
- ./vouch:/opt/charon/vouch

vc1-vouch:
image: attestant/vouch:1.9.0
platform: linux/amd64
networks: [ network1 ]
depends_on: [ node1 ]
restart: unless-stopped
entrypoint: /opt/charon/vouch/run.sh
environment:
BEACON_NODE_ADDRESS: http://node1:3600
# BEACON_NODE_ADDRESS: ${BN_0:-http://172.16.4.9:4000}
volumes:
- .charon/cluster/node1/validator_keys:/opt/charon/validator_keys
- ./vouch:/opt/charon/vouch

vc2-vouch:
image: attestant/vouch:1.9.0
platform: linux/amd64
networks: [ network1 ]
depends_on: [ node2 ]
restart: unless-stopped
entrypoint: /opt/charon/vouch/run.sh
environment:
BEACON_NODE_ADDRESS: http://node2:3600
# BEACON_NODE_ADDRESS: ${BN_0:-http://172.16.4.9:4000}
volumes:
- .charon/cluster/node2/validator_keys:/opt/charon/validator_keys
- ./vouch:/opt/charon/vouch

# vc0-teku-exit:
# image: consensys/teku:${TEKU_VERSION:-ethpandaops/teku:master}
# networks: [ network1 ]
Expand Down
6 changes: 3 additions & 3 deletions network_params_geth_lighthouse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ network_params:
network_id: "3151908"
deposit_contract_address: "0x4242424242424242424242424242424242424242"
seconds_per_slot: 12
num_validator_keys_per_node: 600
num_validator_keys_per_node: 256
preregistered_validator_keys_mnemonic:
"giant issue aisle success illegal bike spike
question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy
very lucky have athlete"
preregistered_validator_count: 0
genesis_delay: 20
max_churn: 8
# max_churn: 8
ejection_balance: 16000000000
eth1_follow_distance: 2048
min_validator_withdrawability_delay: 256
Expand Down Expand Up @@ -96,7 +96,7 @@ snooper_enabled: false
ethereum_metrics_exporter_enabled: false
parallel_keystore_generation: false
disable_peer_scoring: false
grafana_additional_dashboards: []
# grafana_additional_dashboards: []
persistent: false
mev_type: mock
mev_params:
Expand Down
8 changes: 4 additions & 4 deletions network_params_geth_lodestar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ participants:
el_max_mem: 0
# CL
cl_type: lodestar
cl_image: chainsafe/lodestar:v1.19.0
cl_image: chainsafe/lodestar:v1.20.2
cl_log_level: ""
cl_extra_env_vars: {}
cl_extra_labels: {}
Expand Down Expand Up @@ -57,14 +57,14 @@ network_params:
network_id: "3151908"
deposit_contract_address: "0x4242424242424242424242424242424242424242"
seconds_per_slot: 12
num_validator_keys_per_node: 600
num_validator_keys_per_node: 256
preregistered_validator_keys_mnemonic:
"giant issue aisle success illegal bike spike
question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy
very lucky have athlete"
preregistered_validator_count: 0
genesis_delay: 20
max_churn: 8
# max_churn: 8
ejection_balance: 16000000000
eth1_follow_distance: 2048
min_validator_withdrawability_delay: 256
Expand Down Expand Up @@ -96,7 +96,7 @@ snooper_enabled: false
ethereum_metrics_exporter_enabled: false
parallel_keystore_generation: false
disable_peer_scoring: false
grafana_additional_dashboards: []
# grafana_additional_dashboards: []
persistent: false
mev_type: mock
mev_params:
Expand Down
2 changes: 1 addition & 1 deletion network_params_geth_nimbus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ network_params:
network_id: "3151908"
deposit_contract_address: "0x4242424242424242424242424242424242424242"
seconds_per_slot: 12
num_validator_keys_per_node: 600
num_validator_keys_per_node: 256
preregistered_validator_keys_mnemonic:
"giant issue aisle success illegal bike spike
question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy
Expand Down
2 changes: 1 addition & 1 deletion network_params_geth_prysm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ network_params:
network_id: "3151908"
deposit_contract_address: "0x4242424242424242424242424242424242424242"
seconds_per_slot: 12
num_validator_keys_per_node: 600
num_validator_keys_per_node: 256
preregistered_validator_keys_mnemonic:
"giant issue aisle success illegal bike spike
question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy
Expand Down
2 changes: 1 addition & 1 deletion network_params_geth_teku.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ network_params:
network_id: "3151908"
deposit_contract_address: "0x4242424242424242424242424242424242424242"
seconds_per_slot: 12
num_validator_keys_per_node: 600
num_validator_keys_per_node: 256
preregistered_validator_keys_mnemonic:
"giant issue aisle success illegal bike spike
question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy
Expand Down
2 changes: 1 addition & 1 deletion run_charon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ if [ -n "$genesis_time" ] && [ -n "$enr_address" ]; then
echo "BN_$i=${bnips[$i]}" >> ./.env
done
# Run the docker command with the extracted genesis_time
docker run -u $(id -u):$(id -g) --rm -v "$(pwd)/:/opt/charon" obolnetwork/charon-local:latest create cluster --fee-recipient-addresses="0x8943545177806ED17B9F23F0a21ee5948eCaa776" --nodes=3 --withdrawal-addresses="0xBc7c960C1097ef1Af0FD32407701465f3c03e407" --name=test --split-existing-keys --split-keys-dir=charon-keys --testnet-chain-id=3151908 --testnet-fork-version="0x10000038" --testnet-genesis-timestamp="$genesis_time" --testnet-name=kurtosis-testnet
docker run -u $(id -u):$(id -g) --rm -v "$(pwd)/:/opt/charon" obolnetwork/charon:v1.1.1 create cluster --fee-recipient-addresses="0x8943545177806ED17B9F23F0a21ee5948eCaa776" --nodes=3 --withdrawal-addresses="0xBc7c960C1097ef1Af0FD32407701465f3c03e407" --name=test --split-existing-keys --split-keys-dir=charon-keys --testnet-chain-id=3151908 --testnet-fork-version="0x10000038" --testnet-genesis-timestamp="$genesis_time" --testnet-name=kurtosis-testnet
else
echo "Genesis Time not found."
fi
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "kurtosis_wallet",
"type": "non-deterministic",
"uuid": "8c9b98b8-0496-48a3-96f1-4fe08ddfaae1",
"version": 1
}
1 change: 1 addition & 0 deletions vouch/8c9b98b8-0496-48a3-96f1-4fe08ddfaae1/index
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
50 changes: 50 additions & 0 deletions vouch/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash

apt-get update && apt-get install -y jq

# Move template files to working dir
rm -rf /opt/charon/vouch_base_dir
mkdir -p /opt/charon/vouch_base_dir
cp -rf /opt/charon/vouch/vouch.yml /opt/charon/vouch_base_dir/vouch.yml
cp -rf /opt/charon/vouch/8c9b98b8-0496-48a3-96f1-4fe08ddfaae1 /opt/charon/vouch_base_dir/8c9b98b8-0496-48a3-96f1-4fe08ddfaae1

# Add keys to vouch dir
index_path="/opt/charon/vouch_base_dir/8c9b98b8-0496-48a3-96f1-4fe08ddfaae1/index"
for f in /opt/charon/validator_keys/keystore-*.json; do
echo "Importing key ${f}"

# Extract the uuid from the key
uuid=$(jq -r '.uuid' $f | tr '[:upper:]' '[:lower:]')
basen=$(basename $f)
filename=${basen%.*}

# Update indexer with the key
jq --arg uuid "$uuid" --arg name "$filename" '. += [{
"uuid": $uuid,
"name": $name
}]' /opt/charon/vouch_base_dir/8c9b98b8-0496-48a3-96f1-4fe08ddfaae1/index > $index_path.tmp
mv $index_path.tmp $index_path

# Copy the keystore file and update missing fields
new_file_path="/opt/charon/vouch_base_dir/8c9b98b8-0496-48a3-96f1-4fe08ddfaae1/$uuid"
cp $f $new_file_path

jq --arg filename "$filename" '.name += $filename' $new_file_path > $new_file_path.tmp
mv $new_file_path.tmp $new_file_path

jq --arg uuid "$uuid" '.uuid = $uuid' $new_file_path > $new_file_path.tmp
mv $new_file_path.tmp $new_file_path
done

# Add passphrases to vouch.yml
for f in /opt/charon/validator_keys/keystore-*.txt; do
line="\ \ \ \ \ \ - file://$f"
sed -i "\| passphrases:|a $line" /opt/charon/vouch_base_dir/vouch.yml
done

# Add BN address
echo $BEACON_NODE_ADDRESS
sed -i "s|beacon-node-address:|beacon-node-address: '$BEACON_NODE_ADDRESS'|" /opt/charon/vouch_base_dir/vouch.yml

# Run vouch
/app/vouch --base-dir="/opt/charon/vouch_base_dir"
11 changes: 11 additions & 0 deletions vouch/vouch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
beacon-node-address:
accountmanager:
wallet:
locations:
- /opt/charon/vouch_base_dir
accounts:
- kurtosis_wallet
passphrases:
blockrelay:
fallback-fee-recipient: '0x0000000000000000000000000000000000000001'
log-level: 'trace'