3
3
# Immediately abort the script on any error encountered
4
4
set -e
5
5
6
- if [ ! -f " /hive/input/genesis.ssz" ]; then
6
+ if [ ! -f " /hive/input/genesis.ssz" ] && [ ! -f " /hive/input/checkpoint_state.ssz " ] ; then
7
7
if [ -z " $HIVE_ETH2_ETH1_RPC_ADDRS " ]; then
8
8
echo " genesis.ssz file is missing, and no Eth1 RPC addr was provided for building genesis from scratch."
9
9
# TODO: alternative to start from weak-subjectivity-state
26
26
27
27
echo " bootnodes: ${HIVE_ETH2_BOOTNODE_ENRS} "
28
28
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
33
34
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"
37
47
fi
38
48
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 "
41
51
fi
42
52
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
45
63
46
64
CONTAINER_IP=` hostname -i | awk ' {print $1;}' `
47
65
metrics_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
65
83
--verbosity=" $LOG " \
66
84
--accept-terms-of-use=true \
67
85
--datadir=/data/beacon \
68
- --chain-config-file=/hive/input/config.yaml \
69
- --genesis-state=/hive/input/genesis.ssz \
86
+ $config_option \
87
+ $genesis_option \
70
88
$bootnode_option \
89
+ $checkpoint_option \
71
90
--p2p-tcp-port=" ${HIVE_ETH2_P2P_TCP_PORT:- 9000} " \
72
91
--p2p-udp-port=" ${HIVE_ETH2_P2P_UDP_PORT:- 9000} " \
73
92
--p2p-host-ip=" ${CONTAINER_IP} " \
74
93
--p2p-local-ip=" ${CONTAINER_IP} " \
75
- --execution-endpoint=" $HIVE_ETH2_ETH1_RPC_ADDRS " \
76
- --jwt-secret=/jwtsecret \
94
+ $execution_option \
77
95
--min-sync-peers=1 \
78
96
--subscribe-all-subnets=true \
79
97
--enable-debug-rpc-endpoints=true \
80
98
$metrics_option \
81
99
$builder_option \
82
- --deposit-contract=" ${HIVE_ETH2_CONFIG_DEPOSIT_CONTRACT_ADDRESS:- 0x1111111111111111111111111111111111111111} " \
83
- --contract-deployment-block=" ${HIVE_ETH2_DEPOSIT_DEPLOY_BLOCK_NUMBER:- 0} " \
84
100
--rpc-host=0.0.0.0 --rpc-port=" ${HIVE_ETH2_BN_GRPC_PORT:- 3500} " \
85
101
--grpc-gateway-host=0.0.0.0 --grpc-gateway-port=" ${HIVE_ETH2_BN_API_PORT:- 4000} " --grpc-gateway-corsdomain=" *" \
86
102
--suggested-fee-recipient=" 0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B"
0 commit comments