Skip to content

Commit 8b40eb5

Browse files
committed
clients/prysm: checkpoint sync
1 parent 76f11e8 commit 8b40eb5

File tree

1 file changed

+34
-19
lines changed

1 file changed

+34
-19
lines changed

clients/prysm-bn/prysm_bn.sh

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Immediately abort the script on any error encountered
44
set -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
@@ -26,22 +26,39 @@ esac
2626

2727
echo "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
37-
fi
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
3843

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
44+
echo config.yaml:
45+
cat /hive/input/config.yaml
46+
config_option="--chain-config-file=/hive/input/config.yaml"
4147
fi
4248

43-
echo config.yaml:
44-
cat /hive/input/config.yaml
49+
if [ -f "/hive/input/config.yaml" ]; then
50+
genesis_option="--genesis-state=/hive/input/genesis.ssz"
51+
fi
52+
if [ -f "/hive/input/checkpoint_state.ssz" ]; then
53+
if [ ! -f "/hive/input/checkpoint_block.ssz" ]; then
54+
echo "checkpoint_block.ssz file is missing"
55+
exit 1
56+
fi
57+
checkpoint_option="--checkpoint-state=/hive/input/checkpoint_state.ssz --checkpoint-block=/hive/input/checkpoint_block.ssz"
58+
fi
59+
if [[ "$HIVE_ETH2_ETH1_RPC_ADDRS" != "" ]]; then
60+
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}"
61+
fi
4562

4663
CONTAINER_IP=`hostname -i | awk '{print $1;}'`
4764
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 +82,20 @@ echo Starting Prysm Beacon Node
6582
--verbosity="$LOG" \
6683
--accept-terms-of-use=true \
6784
--datadir=/data/beacon \
68-
--chain-config-file=/hive/input/config.yaml \
69-
--genesis-state=/hive/input/genesis.ssz \
85+
$config_option \
86+
$genesis_option \
7087
$bootnode_option \
88+
$checkpoint_option \
7189
--p2p-tcp-port="${HIVE_ETH2_P2P_TCP_PORT:-9000}" \
7290
--p2p-udp-port="${HIVE_ETH2_P2P_UDP_PORT:-9000}" \
7391
--p2p-host-ip="${CONTAINER_IP}" \
7492
--p2p-local-ip="${CONTAINER_IP}" \
75-
--execution-endpoint="$HIVE_ETH2_ETH1_RPC_ADDRS" \
76-
--jwt-secret=/jwtsecret \
93+
$execution_option \
7794
--min-sync-peers=1 \
7895
--subscribe-all-subnets=true \
7996
--enable-debug-rpc-endpoints=true \
8097
$metrics_option \
8198
$builder_option \
82-
--deposit-contract="${HIVE_ETH2_CONFIG_DEPOSIT_CONTRACT_ADDRESS:-0x1111111111111111111111111111111111111111}" \
83-
--contract-deployment-block="${HIVE_ETH2_DEPOSIT_DEPLOY_BLOCK_NUMBER:-0}" \
8499
--rpc-host=0.0.0.0 --rpc-port="${HIVE_ETH2_BN_GRPC_PORT:-3500}" \
85100
--grpc-gateway-host=0.0.0.0 --grpc-gateway-port="${HIVE_ETH2_BN_API_PORT:-4000}" --grpc-gateway-corsdomain="*" \
86101
--suggested-fee-recipient="0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B"

0 commit comments

Comments
 (0)