Add EL scripts

This commit is contained in:
Pawan Dhananjay 2022-11-30 22:45:06 +05:30
parent 2cd971c7d3
commit ff24773a5a
6 changed files with 101 additions and 9 deletions

View File

@ -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,6 +41,8 @@ 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 \
--debug-level $DEBUG_LEVEL \
@ -54,4 +58,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

View File

@ -0,0 +1,4 @@
priv_key="02fd74636e96a8ffac8e7b01b0de8dea94d6bcf4989513b38cf59eb32163ff91"
bootnode --nodekeyhex $priv_key

54
scripts/local_testnet/geth.sh Executable file
View 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}
geth_binary=geth-merge
# Init
$geth_binary init \
--datadir $data_dir \
$genesis_file
echo "Completed init"
exec $geth_binary \
--datadir $data_dir \
--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

View File

@ -13,11 +13,11 @@ 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
# 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,10 +32,16 @@ lcli \
--genesis-delay $GENESIS_DELAY \
--genesis-fork-version $GENESIS_FORK_VERSION \
--altair-fork-epoch $ALTAIR_FORK_EPOCH \
--bellatrix-fork-epoch $ALTAIR_FORK_EPOCH \
--capella-fork-epoch $ALTAIR_FORK_EPOCH \
--eip4844-fork-epoch $ALTAIR_FORK_EPOCH \
--eth1-block-hash 0000000000000000000000000000000000000000000000000000000000000000 \
--eth1-id $CHAIN_ID \
--eth1-follow-distance 1 \
--seconds-per-slot $SECONDS_PER_SLOT \
--seconds-per-eth1-block $SECONDS_PER_ETH1_BLOCK \
--validator-count $GENESIS_VALIDATOR_COUNT \
--interop-genesis-state \
--force
echo Specification generated at $TESTNET_DIR.

View File

@ -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
@ -107,14 +112,25 @@ echo "executing: ./setup.sh >> $LOG_DIR/setup.log"
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=6000
(( $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
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))
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)) $DATADIR/geth_datadir$el/geth/jwt.hex
done
# Start requested number of validator clients

View File

@ -6,9 +6,12 @@ TESTNET_DIR=$DATADIR/testnet
# Mnemonic for the ganache 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
# DEPOSIT_CONTRACT_ADDRESS=8c594691c0e592ffa21f153a16ae41db5befcaaa
DEPOSIT_CONTRACT_ADDRESS=4242424242424242424242424242424242424242
GENESIS_FORK_VERSION=0x42424242
@ -33,7 +36,10 @@ 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
EIP4844_FORK_EPOCH=2
# Spec version (mainnet or minimal)
SPEC_PRESET=mainnet