33# Immediately abort the script on any error encountered
44set -e
55
6- if [ ! -f " /hive/input/genesis.ssz" ]; then
6+ if [ ! -f " /hive/input/genesis.ssz" ] && [ ! -f " /hive/input/checkpoint_state.ssz " ] ; then
77 if [ -z " $HIVE_ETH2_ETH1_RPC_ADDRS " ]; then
88 echo " genesis.ssz file is missing, and no Eth1 RPC addr was provided for building genesis from scratch."
99 # TODO: alternative to start from weak-subjectivity-state
2626
2727echo " bootnodes: ${HIVE_ETH2_BOOTNODE_ENRS} "
2828
29- # znrt encodes the values of these items between double quotes (""), which is against the spec:
30- # https://github.com/ethereum/consensus-specs/blob/v1.1.10/configs/mainnet.yaml
31- sed -i ' s/"\([[:digit:]]\+\)"/\1/' /hive/input/config.yaml
32- sed -i ' s/"\(0x[[:xdigit:]]\+\)"/\1/' /hive/input/config.yaml
29+ if [ -f " /hive/input/config.yaml" ]; then
30+ # znrt encodes the values of these items between double quotes (""), which is against the spec:
31+ # https://github.com/ethereum/consensus-specs/blob/v1.1.10/configs/mainnet.yaml
32+ sed -i ' s/"\([[:digit:]]\+\)"/\1/' /hive/input/config.yaml
33+ sed -i ' s/"\(0x[[:xdigit:]]\+\)"/\1/' /hive/input/config.yaml
3334
34- if [ " $HIVE_TERMINAL_TOTAL_DIFFICULTY " != " " ]; then
35- sed -i ' /TERMINAL_TOTAL_DIFFICULTY/d' /hive/input/config.yaml
36- echo " TERMINAL_TOTAL_DIFFICULTY: $HIVE_TERMINAL_TOTAL_DIFFICULTY " >> /hive/input/config.yaml
35+ if [ " $HIVE_TERMINAL_TOTAL_DIFFICULTY " != " " ]; then
36+ sed -i ' /TERMINAL_TOTAL_DIFFICULTY/d' /hive/input/config.yaml
37+ echo " TERMINAL_TOTAL_DIFFICULTY: $HIVE_TERMINAL_TOTAL_DIFFICULTY " >> /hive/input/config.yaml
38+ fi
39+
40+ if [[ " $HIVE_ETH2_SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY " != " " ]]; then
41+ echo " SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY: $HIVE_ETH2_SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY " >> /hive/input/config.yaml
42+ fi
43+
44+ echo config.yaml:
45+ cat /hive/input/config.yaml
46+ config_option=" --chain-config-file=/hive/input/config.yaml"
3747fi
3848
39- if [[ " $HIVE_ETH2_SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY " != " " ] ]; then
40- echo " SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY: $HIVE_ETH2_SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY " >> /hive/input/config.yaml
49+ if [ -f " /hive/input/genesis.ssz " ]; then
50+ genesis_option= " --genesis-state= /hive/input/genesis.ssz "
4151fi
4252
43- echo config.yaml:
44- cat /hive/input/config.yaml
53+ if [ -f " /hive/input/checkpoint_state.ssz" ]; then
54+ if [ ! -f " /hive/input/checkpoint_block.ssz" ]; then
55+ echo " checkpoint_block.ssz file is missing"
56+ exit 1
57+ fi
58+ checkpoint_option=" --checkpoint-state=/hive/input/checkpoint_state.ssz --checkpoint-block=/hive/input/checkpoint_block.ssz"
59+ fi
60+ if [[ " $HIVE_ETH2_ETH1_RPC_ADDRS " != " " ]]; then
61+ execution_option=" --execution-endpoint=$HIVE_ETH2_ETH1_RPC_ADDRS --jwt-secret=/jwtsecret --deposit-contract=${HIVE_ETH2_CONFIG_DEPOSIT_CONTRACT_ADDRESS:- 0x1111111111111111111111111111111111111111} --contract-deployment-block=${HIVE_ETH2_DEPOSIT_DEPLOY_BLOCK_NUMBER:- 0} "
62+ fi
4563
4664CONTAINER_IP=` hostname -i | awk ' {print $1;}' `
4765metrics_option=$( [[ " $HIVE_ETH2_METRICS_PORT " == " " ]] && echo " --disable-monitoring=true" || echo " --disable-monitoring=false --monitoring-host=0.0.0.0 --monitoring-port=$HIVE_ETH2_METRICS_PORT " )
@@ -65,22 +83,20 @@ echo Starting Prysm Beacon Node
6583 --verbosity=" $LOG " \
6684 --accept-terms-of-use=true \
6785 --datadir=/data/beacon \
68- --chain-config-file=/hive/input/config.yaml \
69- --genesis-state=/hive/input/genesis.ssz \
86+ $config_option \
87+ $genesis_option \
7088 $bootnode_option \
89+ $checkpoint_option \
7190 --p2p-tcp-port=" ${HIVE_ETH2_P2P_TCP_PORT:- 9000} " \
7291 --p2p-udp-port=" ${HIVE_ETH2_P2P_UDP_PORT:- 9000} " \
7392 --p2p-host-ip=" ${CONTAINER_IP} " \
7493 --p2p-local-ip=" ${CONTAINER_IP} " \
75- --execution-endpoint=" $HIVE_ETH2_ETH1_RPC_ADDRS " \
76- --jwt-secret=/jwtsecret \
94+ $execution_option \
7795 --min-sync-peers=1 \
7896 --subscribe-all-subnets=true \
7997 --enable-debug-rpc-endpoints=true \
8098 $metrics_option \
8199 $builder_option \
82- --deposit-contract=" ${HIVE_ETH2_CONFIG_DEPOSIT_CONTRACT_ADDRESS:- 0x1111111111111111111111111111111111111111} " \
83- --contract-deployment-block=" ${HIVE_ETH2_DEPOSIT_DEPLOY_BLOCK_NUMBER:- 0} " \
84100 --rpc-host=0.0.0.0 --rpc-port=" ${HIVE_ETH2_BN_GRPC_PORT:- 3500} " \
85101 --grpc-gateway-host=0.0.0.0 --grpc-gateway-port=" ${HIVE_ETH2_BN_API_PORT:- 4000} " --grpc-gateway-corsdomain=" *" \
86102 --suggested-fee-recipient=" 0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B"
0 commit comments