Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions e2e/chains/bsc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ bootstrap:

.PHONY:network
network:
docker compose -f docker-compose.simple.yml up -d autoheal
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
docker compose -f docker-compose.simple.yml up -d bsc-rpc2 bsc-validator2-1 bsc-validator2-2 bsc-validator2-3

Expand Down
18 changes: 17 additions & 1 deletion e2e/chains/bsc/docker-compose.simple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ services:
- ./scripts:/scripts
- ./config:/config
command: ash /scripts/bsc-rpc.sh
healthcheck:
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
interval: "5s"
start_period: "10s"

bsc-rpc2: # This is the bootstrap node
image: bsc-geth:docker-local
Expand All @@ -86,6 +90,10 @@ services:
- ./scripts:/scripts
- ./config:/config
command: ash /scripts/bsc-rpc.sh
healthcheck:
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
interval: "5s"
start_period: "10s"

bsc-validator1-1:
image: bsc-geth:docker-local
Expand Down Expand Up @@ -217,6 +225,14 @@ services:
- ./scripts:/scripts
command: ash /scripts/bsc-validator.sh

autoheal:
restart: always
image: willfarrell/autoheal
environment:
- AUTOHEAL_CONTAINER_LABEL=all
volumes:
- /var/run/docker.sock:/var/run/docker.sock

networks:
bsc:
ipam:
Expand All @@ -227,4 +243,4 @@ networks:
ipam:
driver: default
config:
- subnet: 99.98.0.0/16
- subnet: 99.98.0.0/16
4 changes: 2 additions & 2 deletions e2e/chains/bsc/scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ function init_validator() {
# set validator address
mkdir -p ${workspace}/storage/${node_id}/keystore
cp ${workspace}/validators/keystore/${node_id} ${workspace}/storage/${node_id}/keystore/${node_id}
validatorAddr=0x$(cat ${workspace}/storage/${node_id}/keystore/${node_id} | jq .address | sed 's/"//g')
validatorAddr=0x$(jq -r .address ${workspace}/storage/${node_id}/keystore/${node_id})
echo ${validatorAddr} >${workspace}/storage/${node_id}/address

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

echo "${validatorAddr},${validatorAddr},${validatorAddr},0x0000000010000000,${voteAddr}" >>scripts/validators.conf
Expand Down
3 changes: 2 additions & 1 deletion e2e/chains/bsc/scripts/bsc-rpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ while [ "$i" -lt ${account_cnt} ]; do
done

ETHSTATS=""
geth --config ${DATA_DIR}/config.toml --datadir ${DATA_DIR} --netrestrict ${CLUSTER_CIDR} \
# Use exec to handle signals
exec geth --config ${DATA_DIR}/config.toml --datadir ${DATA_DIR} --netrestrict ${CLUSTER_CIDR} \
--state.scheme=hash --db.engine=leveldb --verbosity ${VERBOSE} --nousb ${ETHSTATS} \
--unlock ${unlock_sequences} --password /dev/null --ipcpath /gethipc --override.fixedturnlength 2
3 changes: 2 additions & 1 deletion e2e/chains/bsc/scripts/bsc-validator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ HOST_IP=$(hostname -i)
echo "validator id: ${HOST_IP}"

ETHSTATS=""
geth --config ${DATA_DIR}/config.toml --datadir ${DATA_DIR} --netrestrict ${CLUSTER_CIDR} \
# Use exec to handle signals
exec geth --config ${DATA_DIR}/config.toml --datadir ${DATA_DIR} --netrestrict ${CLUSTER_CIDR} \
--verbosity ${VERBOSE} --nousb ${ETHSTATS} --state.scheme=hash --db.engine=leveldb \
--bootnodes enode://${BOOTSTRAP_PUB_KEY}@${BOOTSTRAP_IP}:${BOOTSTRAP_TCP_PORT} \
--mine --miner.etherbase=${VALIDATOR_ADDR} -unlock ${VALIDATOR_ADDR} --password /dev/null --blspassword /scripts/wallet_password.txt \
Expand Down
6 changes: 6 additions & 0 deletions e2e/chains/bsc/scripts/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -e

timestamp=$(geth attach --exec 'parseInt(eth.getBlockByNumber("latest").timestamp)' /gethipc)
[ $(($(date '+%s') - $timestamp)) -lt 5 ]