mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-28 18:23:38 +00:00
Post merge local testnets (#3807)
## Issue Addressed N/A ## Proposed Changes Modifies the local testnet scripts to start a network with genesis validators embedded into the genesis state. This allows us to start a local testnet without the need for deploying a deposit contract or depositing validators pre-genesis. This also enables us to start a local test network at any fork we want without going through fork transitions. Also adds scripts to start multiple geth clients and peer them with each other and peer the geth clients with beacon nodes to start a post merge local testnet. ## Additional info Adds a new lcli command `mnemonics-validators` that generates validator directories derived from a given mnemonic. Adds a new `derived-genesis-state` option to the `lcli new-testnet` command to generate a genesis state populated with validators derived from a mnemonic.
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
# Simple Local Testnet
|
||||
|
||||
These scripts allow for running a small local testnet with multiple beacon nodes and validator clients.
|
||||
These scripts allow for running a small local testnet with multiple beacon nodes and validator clients and a geth execution client.
|
||||
This setup can be useful for testing and development.
|
||||
|
||||
## Requirements
|
||||
|
||||
The scripts require `lcli` and `lighthouse` to be installed on `PATH`. From the
|
||||
The scripts require `lcli`, `lighthouse`, `geth`, `bootnode` to be installed on `PATH`.
|
||||
|
||||
|
||||
MacOS users need to install GNU `sed` and GNU `grep`, and add them both to `PATH` as well.
|
||||
|
||||
From the
|
||||
root of this repository, run:
|
||||
|
||||
```bash
|
||||
@@ -17,17 +22,23 @@ make install-lcli
|
||||
|
||||
Modify `vars.env` as desired.
|
||||
|
||||
Start a local eth1 anvil server plus boot node along with `BN_COUNT`
|
||||
number of beacon nodes and `VC_COUNT` validator clients.
|
||||
The testnet starts with a post-merge genesis state.
|
||||
Start a consensus layer and execution layer boot node along with `BN_COUNT`
|
||||
number of beacon nodes each connected to a geth execution client and `VC_COUNT` validator clients.
|
||||
|
||||
The `start_local_testnet.sh` script takes four options `-v VC_COUNT`, `-d DEBUG_LEVEL`, `-p` to enable builder proposals and `-h` for help. It also takes a mandatory `GENESIS_FILE` for initialising geth's state.
|
||||
A sample `genesis.json` is provided in this directory.
|
||||
|
||||
The `ETH1_BLOCK_HASH` environment variable is set to the block_hash of the genesis execution layer block which depends on the contents of `genesis.json`. Users of these scripts need to ensure that the `ETH1_BLOCK_HASH` variable is updated if genesis file is modified.
|
||||
|
||||
The `start_local_testnet.sh` script takes four options `-v VC_COUNT`, `-d DEBUG_LEVEL`, `-p` to enable builder proposals and `-h` for help.
|
||||
The options may be in any order or absent in which case they take the default value specified.
|
||||
- VC_COUNT: the number of validator clients to create, default: `BN_COUNT`
|
||||
- DEBUG_LEVEL: one of { error, warn, info, debug, trace }, default: `info`
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
./start_local_testnet.sh
|
||||
./start_local_testnet.sh genesis.json
|
||||
```
|
||||
|
||||
## Stopping the testnet
|
||||
@@ -41,31 +52,38 @@ This is not necessary before `start_local_testnet.sh` as it invokes `stop_local_
|
||||
|
||||
These scripts are used by ./start_local_testnet.sh and may be used to manually
|
||||
|
||||
Start a local eth1 anvil server
|
||||
```bash
|
||||
./anvil_test_node.sh
|
||||
```
|
||||
|
||||
Assuming you are happy with the configuration in `vars.env`, deploy the deposit contract, make deposits,
|
||||
create the testnet directory, genesis state and validator keys with:
|
||||
Assuming you are happy with the configuration in `vars.env`,
|
||||
create the testnet directory, genesis state with embedded validators and validator keys with:
|
||||
|
||||
```bash
|
||||
./setup.sh
|
||||
```
|
||||
|
||||
Generate bootnode enr and start a discv5 bootnode so that multiple beacon nodes can find each other
|
||||
Note: The generated genesis validators are embedded into the genesis state as genesis validators and hence do not require manual deposits to activate.
|
||||
|
||||
Generate bootnode enr and start an EL and CL bootnode so that multiple nodes can find each other
|
||||
```bash
|
||||
./bootnode.sh
|
||||
./el_bootnode.sh
|
||||
```
|
||||
|
||||
Start a geth node:
|
||||
```bash
|
||||
./geth.sh <DATADIR> <NETWORK-PORT> <HTTP-PORT> <AUTH-HTTP-PORT> <GENESIS_FILE>
|
||||
```
|
||||
e.g.
|
||||
```bash
|
||||
./geth.sh $HOME/.lighthouse/local-testnet/geth_1 5000 6000 7000 genesis.json
|
||||
```
|
||||
|
||||
Start a beacon node:
|
||||
|
||||
```bash
|
||||
./beacon_node.sh <DATADIR> <NETWORK-PORT> <HTTP-PORT> <OPTIONAL-DEBUG-LEVEL>
|
||||
./beacon_node.sh <DATADIR> <NETWORK-PORT> <HTTP-PORT> <EXECUTION-ENDPOINT> <EXECUTION-JWT-PATH> <OPTIONAL-DEBUG-LEVEL>
|
||||
```
|
||||
e.g.
|
||||
```bash
|
||||
./beacon_node.sh $HOME/.lighthouse/local-testnet/node_1 9000 8000
|
||||
./beacon_node.sh $HOME/.lighthouse/local-testnet/node_1 9000 8000 http://localhost:6000 ~/.lighthouse/local-testnet/geth_1/geth/jwtsecret
|
||||
```
|
||||
|
||||
In a new terminal, start the validator client which will attach to the first
|
||||
|
||||
@@ -30,6 +30,8 @@ while getopts "d:sh" flag; do
|
||||
echo " DATADIR Value for --datadir parameter"
|
||||
echo " NETWORK-PORT Value for --enr-udp-port, --enr-tcp-port and --port"
|
||||
echo " HTTP-PORT Value for --http-port"
|
||||
echo " EXECUTION-ENDPOINT Value for --execution-endpoint"
|
||||
echo " EXECUTION-JWT Value for --execution-jwt"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
@@ -39,14 +41,19 @@ done
|
||||
data_dir=${@:$OPTIND+0:1}
|
||||
network_port=${@:$OPTIND+1:1}
|
||||
http_port=${@:$OPTIND+2:1}
|
||||
execution_endpoint=${@:$OPTIND+3:1}
|
||||
execution_jwt=${@:$OPTIND+4:1}
|
||||
|
||||
exec lighthouse \
|
||||
lighthouse_binary=lighthouse
|
||||
|
||||
exec $lighthouse_binary \
|
||||
--debug-level $DEBUG_LEVEL \
|
||||
bn \
|
||||
$SUBSCRIBE_ALL_SUBNETS \
|
||||
--datadir $data_dir \
|
||||
--testnet-dir $TESTNET_DIR \
|
||||
--enable-private-discovery \
|
||||
--disable-peer-scoring \
|
||||
--staking \
|
||||
--enr-address 127.0.0.1 \
|
||||
--enr-udp-port $network_port \
|
||||
@@ -54,4 +61,6 @@ exec lighthouse \
|
||||
--port $network_port \
|
||||
--http-port $http_port \
|
||||
--disable-packet-filter \
|
||||
--target-peers $((BN_COUNT - 1))
|
||||
--target-peers $((BN_COUNT - 1)) \
|
||||
--execution-endpoint $execution_endpoint \
|
||||
--execution-jwt $execution_jwt
|
||||
|
||||
3
scripts/local_testnet/el_bootnode.sh
Executable file
3
scripts/local_testnet/el_bootnode.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
priv_key="02fd74636e96a8ffac8e7b01b0de8dea94d6bcf4989513b38cf59eb32163ff91"
|
||||
source ./vars.env
|
||||
$EL_BOOTNODE_BINARY --nodekeyhex $priv_key
|
||||
860
scripts/local_testnet/genesis.json
Normal file
860
scripts/local_testnet/genesis.json
Normal file
File diff suppressed because one or more lines are too long
54
scripts/local_testnet/geth.sh
Executable file
54
scripts/local_testnet/geth.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
set -Eeuo pipefail
|
||||
|
||||
source ./vars.env
|
||||
|
||||
# Get options
|
||||
while getopts "d:sh" flag; do
|
||||
case "${flag}" in
|
||||
d) DEBUG_LEVEL=${OPTARG};;
|
||||
s) SUBSCRIBE_ALL_SUBNETS="--subscribe-all-subnets";;
|
||||
h)
|
||||
echo "Start a geth node"
|
||||
echo
|
||||
echo "usage: $0 <Options> <DATADIR> <NETWORK-PORT> <HTTP-PORT>"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -h: this help"
|
||||
echo
|
||||
echo "Positional arguments:"
|
||||
echo " DATADIR Value for --datadir parameter"
|
||||
echo " NETWORK-PORT Value for --port"
|
||||
echo " HTTP-PORT Value for --http.port"
|
||||
echo " AUTH-PORT Value for --authrpc.port"
|
||||
echo " GENESIS_FILE Value for geth init"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Get positional arguments
|
||||
data_dir=${@:$OPTIND+0:1}
|
||||
network_port=${@:$OPTIND+1:1}
|
||||
http_port=${@:$OPTIND+2:1}
|
||||
auth_port=${@:$OPTIND+3:1}
|
||||
genesis_file=${@:$OPTIND+4:1}
|
||||
|
||||
|
||||
# Init
|
||||
$GETH_BINARY init \
|
||||
--datadir $data_dir \
|
||||
$genesis_file
|
||||
|
||||
echo "Completed init"
|
||||
|
||||
exec $GETH_BINARY \
|
||||
--datadir $data_dir \
|
||||
--ipcdisable \
|
||||
--http \
|
||||
--http.api="engine,eth,web3,net,debug" \
|
||||
--networkid=$CHAIN_ID \
|
||||
--syncmode=full \
|
||||
--bootnodes $EL_BOOTNODE_ENODE \
|
||||
--port $network_port \
|
||||
--http.port $http_port \
|
||||
--authrpc.port $auth_port
|
||||
@@ -12,7 +12,7 @@ if [ -f "$1" ]; then
|
||||
[[ -n "$pid" ]] || continue
|
||||
|
||||
echo killing $pid
|
||||
kill $pid
|
||||
kill $pid || true
|
||||
done < $1
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Deploys the deposit contract and makes deposits for $VALIDATOR_COUNT insecure deterministic validators.
|
||||
# Produces a testnet specification and a genesis state where the genesis time
|
||||
# is now + $GENESIS_DELAY.
|
||||
#
|
||||
@@ -13,11 +12,6 @@ set -o nounset -o errexit -o pipefail
|
||||
|
||||
source ./vars.env
|
||||
|
||||
lcli \
|
||||
deploy-deposit-contract \
|
||||
--eth1-http http://localhost:8545 \
|
||||
--confirmations 1 \
|
||||
--validator-count $VALIDATOR_COUNT
|
||||
|
||||
NOW=`date +%s`
|
||||
GENESIS_TIME=`expr $NOW + $GENESIS_DELAY`
|
||||
@@ -32,14 +26,20 @@ lcli \
|
||||
--genesis-delay $GENESIS_DELAY \
|
||||
--genesis-fork-version $GENESIS_FORK_VERSION \
|
||||
--altair-fork-epoch $ALTAIR_FORK_EPOCH \
|
||||
--bellatrix-fork-epoch $BELLATRIX_FORK_EPOCH \
|
||||
--capella-fork-epoch $CAPELLA_FORK_EPOCH \
|
||||
--ttd $TTD \
|
||||
--eth1-block-hash $ETH1_BLOCK_HASH \
|
||||
--eth1-id $CHAIN_ID \
|
||||
--eth1-follow-distance 1 \
|
||||
--seconds-per-slot $SECONDS_PER_SLOT \
|
||||
--seconds-per-eth1-block $SECONDS_PER_ETH1_BLOCK \
|
||||
--proposer-score-boost "$PROPOSER_SCORE_BOOST" \
|
||||
--validator-count $GENESIS_VALIDATOR_COUNT \
|
||||
--interop-genesis-state \
|
||||
--force
|
||||
|
||||
echo Specification generated at $TESTNET_DIR.
|
||||
echo Specification and genesis.ssz generated at $TESTNET_DIR.
|
||||
echo "Generating $VALIDATOR_COUNT validators concurrently... (this may take a while)"
|
||||
|
||||
lcli \
|
||||
@@ -49,13 +49,3 @@ lcli \
|
||||
--node-count $BN_COUNT
|
||||
|
||||
echo Validators generated with keystore passwords at $DATADIR.
|
||||
echo "Building genesis state... (this might take a while)"
|
||||
|
||||
lcli \
|
||||
interop-genesis \
|
||||
--spec $SPEC_PRESET \
|
||||
--genesis-time $GENESIS_TIME \
|
||||
--testnet-dir $TESTNET_DIR \
|
||||
$GENESIS_VALIDATOR_COUNT
|
||||
|
||||
echo Created genesis state in $TESTNET_DIR
|
||||
|
||||
@@ -40,6 +40,8 @@ if (( $VC_COUNT > $BN_COUNT )); then
|
||||
exit
|
||||
fi
|
||||
|
||||
genesis_file=${@:$OPTIND+0:1}
|
||||
|
||||
# Init some constants
|
||||
PID_FILE=$TESTNET_DIR/PIDS.pid
|
||||
LOG_DIR=$TESTNET_DIR
|
||||
@@ -55,6 +57,9 @@ mkdir -p $LOG_DIR
|
||||
for (( bn=1; bn<=$BN_COUNT; bn++ )); do
|
||||
touch $LOG_DIR/beacon_node_$bn.log
|
||||
done
|
||||
for (( el=1; el<=$BN_COUNT; el++ )); do
|
||||
touch $LOG_DIR/geth_$el.log
|
||||
done
|
||||
for (( vc=1; vc<=$VC_COUNT; vc++ )); do
|
||||
touch $LOG_DIR/validator_node_$vc.log
|
||||
done
|
||||
@@ -92,29 +97,49 @@ execute_command_add_PID() {
|
||||
echo "$!" >> $PID_FILE
|
||||
}
|
||||
|
||||
# Start anvil, setup things up and start the bootnode.
|
||||
# The delays are necessary, hopefully there is a better way :(
|
||||
|
||||
# Delay to let anvil to get started
|
||||
execute_command_add_PID anvil_test_node.log ./anvil_test_node.sh
|
||||
sleeping 10
|
||||
|
||||
# Setup data
|
||||
echo "executing: ./setup.sh >> $LOG_DIR/setup.log"
|
||||
./setup.sh >> $LOG_DIR/setup.log 2>&1
|
||||
|
||||
# Update future hardforks time in the EL genesis file based on the CL genesis time
|
||||
GENESIS_TIME=$(lcli pretty-ssz state_merge $TESTNET_DIR/genesis.ssz | jq | grep -Po 'genesis_time": "\K.*\d')
|
||||
echo $GENESIS_TIME
|
||||
CAPELLA_TIME=$((GENESIS_TIME + (CAPELLA_FORK_EPOCH * 32 * SECONDS_PER_SLOT)))
|
||||
echo $CAPELLA_TIME
|
||||
sed -i 's/"shanghaiTime".*$/"shanghaiTime": '"$CAPELLA_TIME"',/g' $genesis_file
|
||||
cat $genesis_file
|
||||
|
||||
# Delay to let boot_enr.yaml to be created
|
||||
execute_command_add_PID bootnode.log ./bootnode.sh
|
||||
sleeping 1
|
||||
|
||||
execute_command_add_PID el_bootnode.log ./el_bootnode.sh
|
||||
sleeping 1
|
||||
|
||||
# Start beacon nodes
|
||||
BN_udp_tcp_base=9000
|
||||
BN_http_port_base=8000
|
||||
|
||||
EL_base_network=7000
|
||||
EL_base_http=6000
|
||||
EL_base_auth_http=5000
|
||||
|
||||
(( $VC_COUNT < $BN_COUNT )) && SAS=-s || SAS=
|
||||
|
||||
for (( el=1; el<=$BN_COUNT; el++ )); do
|
||||
execute_command_add_PID geth_$el.log ./geth.sh $DATADIR/geth_datadir$el $((EL_base_network + $el)) $((EL_base_http + $el)) $((EL_base_auth_http + $el)) $genesis_file
|
||||
done
|
||||
|
||||
sleeping 20
|
||||
|
||||
# Reset the `genesis.json` config file fork times.
|
||||
sed -i 's/"shanghaiTime".*$/"shanghaiTime": 0,/g' $genesis_file
|
||||
|
||||
for (( bn=1; bn<=$BN_COUNT; bn++ )); do
|
||||
execute_command_add_PID beacon_node_$bn.log ./beacon_node.sh $SAS -d $DEBUG_LEVEL $DATADIR/node_$bn $((BN_udp_tcp_base + $bn)) $((BN_http_port_base + $bn))
|
||||
secret=$DATADIR/geth_datadir$bn/geth/jwtsecret
|
||||
echo $secret
|
||||
execute_command_add_PID beacon_node_$bn.log ./beacon_node.sh $SAS -d $DEBUG_LEVEL $DATADIR/node_$bn $((BN_udp_tcp_base + $bn)) $((BN_http_port_base + $bn)) http://localhost:$((EL_base_auth_http + $bn)) $secret
|
||||
done
|
||||
|
||||
# Start requested number of validator clients
|
||||
|
||||
@@ -30,4 +30,5 @@ exec lighthouse \
|
||||
--testnet-dir $TESTNET_DIR \
|
||||
--init-slashing-protection \
|
||||
--beacon-nodes ${@:$OPTIND+1:1} \
|
||||
--suggested-fee-recipient 0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990 \
|
||||
$VC_ARGS
|
||||
|
||||
@@ -1,17 +1,26 @@
|
||||
# Path to the geth binary
|
||||
GETH_BINARY=geth
|
||||
EL_BOOTNODE_BINARY=bootnode
|
||||
|
||||
# Base directories for the validator keys and secrets
|
||||
DATADIR=~/.lighthouse/local-testnet
|
||||
|
||||
# Directory for the eth2 config
|
||||
TESTNET_DIR=$DATADIR/testnet
|
||||
|
||||
# Mnemonic for the anvil test network
|
||||
ETH1_NETWORK_MNEMONIC="vast thought differ pull jewel broom cook wrist tribe word before omit"
|
||||
# Mnemonic for generating validator keys
|
||||
MNEMONIC_PHRASE="vast thought differ pull jewel broom cook wrist tribe word before omit"
|
||||
|
||||
# Hardcoded deposit contract based on ETH1_NETWORK_MNEMONIC
|
||||
DEPOSIT_CONTRACT_ADDRESS=8c594691c0e592ffa21f153a16ae41db5befcaaa
|
||||
EL_BOOTNODE_ENODE="enode://51ea9bb34d31efc3491a842ed13b8cab70e753af108526b57916d716978b380ed713f4336a80cdb85ec2a115d5a8c0ae9f3247bed3c84d3cb025c6bab311062c@127.0.0.1:0?discport=30301"
|
||||
|
||||
# Hardcoded deposit contract
|
||||
DEPOSIT_CONTRACT_ADDRESS=4242424242424242424242424242424242424242
|
||||
|
||||
GENESIS_FORK_VERSION=0x42424242
|
||||
|
||||
# Block hash generated from genesis.json in directory
|
||||
ETH1_BLOCK_HASH=4b0e17cf5c04616d64526d292b80a1f2720cf2195d990006e4ea6950c5bbcb9f
|
||||
|
||||
VALIDATOR_COUNT=80
|
||||
GENESIS_VALIDATOR_COUNT=80
|
||||
|
||||
@@ -33,7 +42,11 @@ BOOTNODE_PORT=4242
|
||||
CHAIN_ID=4242
|
||||
|
||||
# Hard fork configuration
|
||||
ALTAIR_FORK_EPOCH=18446744073709551615
|
||||
ALTAIR_FORK_EPOCH=0
|
||||
BELLATRIX_FORK_EPOCH=0
|
||||
CAPELLA_FORK_EPOCH=1
|
||||
|
||||
TTD=0
|
||||
|
||||
# Spec version (mainnet or minimal)
|
||||
SPEC_PRESET=mainnet
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Requires `lighthouse`, ``lcli`, `anvil`, `curl`, `jq`
|
||||
# Requires `lighthouse`, `lcli`, `geth`, `bootnode`, `curl`, `jq`
|
||||
|
||||
|
||||
BEHAVIOR=$1
|
||||
@@ -15,21 +15,15 @@ exit_if_fails() {
|
||||
$@
|
||||
EXIT_CODE=$?
|
||||
if [[ $EXIT_CODE -eq 1 ]]; then
|
||||
exit 111
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
genesis_file=$2
|
||||
|
||||
source ./vars.env
|
||||
|
||||
exit_if_fails ../local_testnet/clean.sh
|
||||
|
||||
echo "Starting anvil"
|
||||
|
||||
exit_if_fails ../local_testnet/anvil_test_node.sh &> /dev/null &
|
||||
ANVIL_PID=$!
|
||||
|
||||
# Wait for anvil to start
|
||||
sleep 5
|
||||
|
||||
echo "Setting up local testnet"
|
||||
|
||||
@@ -41,28 +35,31 @@ exit_if_fails cp -R $HOME/.lighthouse/local-testnet/node_1 $HOME/.lighthouse/loc
|
||||
echo "Starting bootnode"
|
||||
|
||||
exit_if_fails ../local_testnet/bootnode.sh &> /dev/null &
|
||||
BOOT_PID=$!
|
||||
|
||||
exit_if_fails ../local_testnet/el_bootnode.sh &> /dev/null &
|
||||
|
||||
# wait for the bootnode to start
|
||||
sleep 10
|
||||
|
||||
echo "Starting local execution nodes"
|
||||
|
||||
exit_if_fails ../local_testnet/geth.sh $HOME/.lighthouse/local-testnet/geth_datadir1 7000 6000 5000 $genesis_file &> geth.log &
|
||||
exit_if_fails ../local_testnet/geth.sh $HOME/.lighthouse/local-testnet/geth_datadir2 7100 6100 5100 $genesis_file &> /dev/null &
|
||||
exit_if_fails ../local_testnet/geth.sh $HOME/.lighthouse/local-testnet/geth_datadir3 7200 6200 5200 $genesis_file &> /dev/null &
|
||||
|
||||
sleep 20
|
||||
|
||||
echo "Starting local beacon nodes"
|
||||
|
||||
exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_1 9000 8000 &> /dev/null &
|
||||
BEACON_PID=$!
|
||||
exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_2 9100 8100 &> /dev/null &
|
||||
BEACON_PID2=$!
|
||||
exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_3 9200 8200 &> /dev/null &
|
||||
BEACON_PID3=$!
|
||||
exit_if_fails ../local_testnet/beacon_node.sh -d debug $HOME/.lighthouse/local-testnet/node_1 9000 8000 http://localhost:5000 $HOME/.lighthouse/local-testnet/geth_datadir1/geth/jwtsecret &> beacon1.log &
|
||||
exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_2 9100 8100 http://localhost:5100 $HOME/.lighthouse/local-testnet/geth_datadir2/geth/jwtsecret &> /dev/null &
|
||||
exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_3 9200 8200 http://localhost:5200 $HOME/.lighthouse/local-testnet/geth_datadir3/geth/jwtsecret &> /dev/null &
|
||||
|
||||
echo "Starting local validator clients"
|
||||
|
||||
exit_if_fails ../local_testnet/validator_client.sh $HOME/.lighthouse/local-testnet/node_1 http://localhost:8000 &> /dev/null &
|
||||
VALIDATOR_1_PID=$!
|
||||
exit_if_fails ../local_testnet/validator_client.sh $HOME/.lighthouse/local-testnet/node_2 http://localhost:8100 &> /dev/null &
|
||||
VALIDATOR_2_PID=$!
|
||||
exit_if_fails ../local_testnet/validator_client.sh $HOME/.lighthouse/local-testnet/node_3 http://localhost:8200 &> /dev/null &
|
||||
VALIDATOR_3_PID=$!
|
||||
|
||||
echo "Waiting an epoch before starting the next validator client"
|
||||
sleep $(( $SECONDS_PER_SLOT * 32 ))
|
||||
@@ -71,7 +68,7 @@ if [[ "$BEHAVIOR" == "failure" ]]; then
|
||||
|
||||
echo "Starting the doppelganger validator client"
|
||||
|
||||
# Use same keys as keys from VC1, but connect to BN2
|
||||
# Use same keys as keys from VC1 and connect to BN2
|
||||
# This process should not last longer than 2 epochs
|
||||
timeout $(( $SECONDS_PER_SLOT * 32 * 2 )) ../local_testnet/validator_client.sh $HOME/.lighthouse/local-testnet/node_1_doppelganger http://localhost:8100
|
||||
DOPPELGANGER_EXIT=$?
|
||||
@@ -79,7 +76,9 @@ if [[ "$BEHAVIOR" == "failure" ]]; then
|
||||
echo "Shutting down"
|
||||
|
||||
# Cleanup
|
||||
kill $BOOT_PID $BEACON_PID $BEACON_PID2 $BEACON_PID3 $ANVIL_PID $VALIDATOR_1_PID $VALIDATOR_2_PID $VALIDATOR_3_PID
|
||||
killall geth
|
||||
killall lighthouse
|
||||
killall bootnode
|
||||
|
||||
echo "Done"
|
||||
|
||||
@@ -98,7 +97,6 @@ if [[ "$BEHAVIOR" == "success" ]]; then
|
||||
echo "Starting the last validator client"
|
||||
|
||||
../local_testnet/validator_client.sh $HOME/.lighthouse/local-testnet/node_4 http://localhost:8100 &
|
||||
VALIDATOR_4_PID=$!
|
||||
DOPPELGANGER_FAILURE=0
|
||||
|
||||
# Sleep three epochs, then make sure all validators were active in epoch 2. Use
|
||||
@@ -144,7 +142,10 @@ if [[ "$BEHAVIOR" == "success" ]]; then
|
||||
|
||||
# Cleanup
|
||||
cd $PREVIOUS_DIR
|
||||
kill $BOOT_PID $BEACON_PID $BEACON_PID2 $BEACON_PID3 $ANVIL_PID $VALIDATOR_1_PID $VALIDATOR_2_PID $VALIDATOR_3_PID $VALIDATOR_4_PID
|
||||
|
||||
killall geth
|
||||
killall lighthouse
|
||||
killall bootnode
|
||||
|
||||
echo "Done"
|
||||
|
||||
@@ -153,4 +154,4 @@ if [[ "$BEHAVIOR" == "success" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
850
scripts/tests/genesis.json
Normal file
850
scripts/tests/genesis.json
Normal file
File diff suppressed because one or more lines are too long
@@ -1,17 +1,23 @@
|
||||
# Path to the geth binary
|
||||
GETH_BINARY=geth
|
||||
EL_BOOTNODE_BINARY=bootnode
|
||||
|
||||
# Base directories for the validator keys and secrets
|
||||
DATADIR=~/.lighthouse/local-testnet
|
||||
|
||||
# Directory for the eth2 config
|
||||
TESTNET_DIR=$DATADIR/testnet
|
||||
|
||||
# Mnemonic for the anvil test network
|
||||
ETH1_NETWORK_MNEMONIC="vast thought differ pull jewel broom cook wrist tribe word before omit"
|
||||
EL_BOOTNODE_ENODE="enode://51ea9bb34d31efc3491a842ed13b8cab70e753af108526b57916d716978b380ed713f4336a80cdb85ec2a115d5a8c0ae9f3247bed3c84d3cb025c6bab311062c@127.0.0.1:0?discport=30301"
|
||||
|
||||
# Hardcoded deposit contract based on ETH1_NETWORK_MNEMONIC
|
||||
DEPOSIT_CONTRACT_ADDRESS=8c594691c0e592ffa21f153a16ae41db5befcaaa
|
||||
# Hardcoded deposit contract
|
||||
DEPOSIT_CONTRACT_ADDRESS=4242424242424242424242424242424242424242
|
||||
|
||||
GENESIS_FORK_VERSION=0x42424242
|
||||
|
||||
# Block hash generated from genesis.json in directory
|
||||
ETH1_BLOCK_HASH=16ef16304456fdacdeb272bd70207021031db355ed6c5e44ebd34c1ab757e221
|
||||
|
||||
VALIDATOR_COUNT=80
|
||||
GENESIS_VALIDATOR_COUNT=80
|
||||
|
||||
@@ -33,7 +39,12 @@ BOOTNODE_PORT=4242
|
||||
CHAIN_ID=4242
|
||||
|
||||
# Hard fork configuration
|
||||
ALTAIR_FORK_EPOCH=18446744073709551615
|
||||
ALTAIR_FORK_EPOCH=0
|
||||
BELLATRIX_FORK_EPOCH=0
|
||||
CAPELLA_FORK_EPOCH=18446744073709551615
|
||||
DENEB_FORK_EPOCH=18446744073709551615
|
||||
|
||||
TTD=0
|
||||
|
||||
# Spec version (mainnet or minimal)
|
||||
SPEC_PRESET=mainnet
|
||||
@@ -45,7 +56,7 @@ SECONDS_PER_SLOT=3
|
||||
SECONDS_PER_ETH1_BLOCK=1
|
||||
|
||||
# Proposer score boost percentage
|
||||
PROPOSER_SCORE_BOOST=40
|
||||
PROPOSER_SCORE_BOOST=70
|
||||
|
||||
# Enable doppelganger detection
|
||||
VC_ARGS=" --enable-doppelganger-protection "
|
||||
VC_ARGS=" --enable-doppelganger-protection "
|
||||
Reference in New Issue
Block a user