Skip to content

Commit 16fa086

Browse files
author
Naohiro Yoshida
committed
Merge branch 'main' into audit
2 parents dceb592 + 1346504 commit 16fa086

File tree

6 files changed

+30
-5
lines changed

6 files changed

+30
-5
lines changed

e2e/chains/bsc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ bootstrap:
1010

1111
.PHONY:network
1212
network:
13+
docker compose -f docker-compose.simple.yml up -d autoheal
1314
docker compose -f docker-compose.simple.yml up -d bsc-rpc bsc-validator1-1 bsc-validator1-2 bsc-validator1-3 bsc-validator1-4 bsc-validator1-5
1415
docker compose -f docker-compose.simple.yml up -d bsc-rpc2 bsc-validator2-1 bsc-validator2-2 bsc-validator2-3
1516

e2e/chains/bsc/docker-compose.simple.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ services:
7171
- ./scripts:/scripts
7272
- ./config:/config
7373
command: ash /scripts/bsc-rpc.sh
74+
healthcheck:
75+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
76+
interval: "5s"
77+
start_period: "10s"
7478

7579
bsc-rpc2: # This is the bootstrap node
7680
image: bsc-geth:docker-local
@@ -86,6 +90,10 @@ services:
8690
- ./scripts:/scripts
8791
- ./config:/config
8892
command: ash /scripts/bsc-rpc.sh
93+
healthcheck:
94+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
95+
interval: "5s"
96+
start_period: "10s"
8997

9098
bsc-validator1-1:
9199
image: bsc-geth:docker-local
@@ -217,6 +225,14 @@ services:
217225
- ./scripts:/scripts
218226
command: ash /scripts/bsc-validator.sh
219227

228+
autoheal:
229+
restart: always
230+
image: willfarrell/autoheal
231+
environment:
232+
- AUTOHEAL_CONTAINER_LABEL=all
233+
volumes:
234+
- /var/run/docker.sock:/var/run/docker.sock
235+
220236
networks:
221237
bsc:
222238
ipam:
@@ -227,4 +243,4 @@ networks:
227243
ipam:
228244
driver: default
229245
config:
230-
- subnet: 99.98.0.0/16
246+
- subnet: 99.98.0.0/16

e2e/chains/bsc/scripts/bootstrap.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ function init_validator() {
2121
# set validator address
2222
mkdir -p ${workspace}/storage/${node_id}/keystore
2323
cp ${workspace}/validators/keystore/${node_id} ${workspace}/storage/${node_id}/keystore/${node_id}
24-
validatorAddr=0x$(cat ${workspace}/storage/${node_id}/keystore/${node_id} | jq .address | sed 's/"//g')
24+
validatorAddr=0x$(jq -r .address ${workspace}/storage/${node_id}/keystore/${node_id})
2525
echo ${validatorAddr} >${workspace}/storage/${node_id}/address
2626

2727
# create new BLS vote address
2828
expect ${workspace}/scripts/create_bls_key.sh ${workspace}/storage/${node_id}
29-
voteAddr=0x$(cat ${workspace}/storage/${node_id}/bls/keystore/*json| jq .pubkey | sed 's/"//g')
29+
voteAddr=0x$(jq -r .pubkey ${workspace}/storage/${node_id}/bls/keystore/*json)
3030
echo $voteAddr
3131

3232
echo "${validatorAddr},${validatorAddr},${validatorAddr},0x0000000010000000,${voteAddr}" >>scripts/validators.conf

e2e/chains/bsc/scripts/bsc-rpc.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ while [ "$i" -lt ${account_cnt} ]; do
1313
done
1414

1515
ETHSTATS=""
16-
geth --config ${DATA_DIR}/config.toml --datadir ${DATA_DIR} --netrestrict ${CLUSTER_CIDR} \
16+
# Use exec to handle signals
17+
exec geth --config ${DATA_DIR}/config.toml --datadir ${DATA_DIR} --netrestrict ${CLUSTER_CIDR} \
1718
--state.scheme=hash --db.engine=leveldb --verbosity ${VERBOSE} --nousb ${ETHSTATS} \
1819
--unlock ${unlock_sequences} --password /dev/null --ipcpath /gethipc --override.fixedturnlength 2

e2e/chains/bsc/scripts/bsc-validator.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ HOST_IP=$(hostname -i)
1010
echo "validator id: ${HOST_IP}"
1111

1212
ETHSTATS=""
13-
geth --config ${DATA_DIR}/config.toml --datadir ${DATA_DIR} --netrestrict ${CLUSTER_CIDR} \
13+
# Use exec to handle signals
14+
exec geth --config ${DATA_DIR}/config.toml --datadir ${DATA_DIR} --netrestrict ${CLUSTER_CIDR} \
1415
--verbosity ${VERBOSE} --nousb ${ETHSTATS} --state.scheme=hash --db.engine=leveldb \
1516
--bootnodes enode://${BOOTSTRAP_PUB_KEY}@${BOOTSTRAP_IP}:${BOOTSTRAP_TCP_PORT} \
1617
--mine --miner.etherbase=${VALIDATOR_ADDR} -unlock ${VALIDATOR_ADDR} --password /dev/null --blspassword /scripts/wallet_password.txt \
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
timestamp=$(geth attach --exec 'parseInt(eth.getBlockByNumber("latest").timestamp)' /gethipc)
6+
[ $(($(date '+%s') - $timestamp)) -lt 5 ]

0 commit comments

Comments
 (0)