Restart test without supermajority (#17808)

* Restart test without supermajority

* Change check to look at stake rather than transaction confirmation

* Add stake info while waiting for consensus

* replace jq with grep (buildkite doesn't have jq installed)
This commit is contained in:
Ashwin Sekar
2021-06-10 12:56:31 -07:00
committed by GitHub
parent 6a2aec1047
commit 027ac3c8f2
3 changed files with 36 additions and 9 deletions

View File

@ -8,6 +8,10 @@ source "$(dirname "$0")"/../automation_utils.sh
RESULT_FILE="$1"
if [[ -z $CONSENSUS_TIMEOUT ]]; then
CONSENSUS_TIMEOUT=180
fi
startGpuMode="off"
if [[ -z $ENABLE_GPU ]]; then
ENABLE_GPU=false
@ -21,11 +25,6 @@ if [[ "$ASYNC_NODE_INIT" = "true" ]]; then
maybeAsyncNodeInit="--async-node-init"
fi
declare maybeExtraPrimordialStakes
if [[ -n "$EXTRA_PRIMORDIAL_STAKES" ]]; then
maybeExtraPrimordialStakes="--extra-primordial-stakes $EXTRA_PRIMORDIAL_STAKES"
fi
# Restart the network
"$REPO_ROOT"/net/net.sh stop
@ -33,8 +32,20 @@ sleep 2
# shellcheck disable=SC2086
"$REPO_ROOT"/net/net.sh start --skip-setup --no-snapshot-fetch --no-deploy \
--gpu-mode $startGpuMode $maybeAsyncNodeInit $maybeExtraPrimordialStakes
--gpu-mode $startGpuMode $maybeAsyncNodeInit
# TODO add the test here
# wait until consensus
start=$SECONDS
activeStake=$(get_active_stake)
while [[ $((SECONDS - start)) -lt $CONSENSUS_TIMEOUT ]]; do
currentStake=$(get_current_stake)
echo "$((SECONDS - start))s: Current stake $currentStake, Active stake $activeStake" >> "$RESULT_FILE"
if [[ $activeStake -eq $currentStake ]]; then
echo "Restart Test Succeeded" >>"$RESULT_FILE"
exit 0
fi
sleep 5
done
echo "Restart Test Succeeded" >>"$RESULT_FILE"
echo "Could not establish consensus in $CONSENSUS_TIMEOUT seconds" >> "$RESULT_FILE"
exit 1