diff --git a/contrib/localnet/docker-compose-upgrade-light.yml b/contrib/localnet/docker-compose-upgrade-light.yml index 55dd312a59..8e3cb098c1 100644 --- a/contrib/localnet/docker-compose-upgrade-light.yml +++ b/contrib/localnet/docker-compose-upgrade-light.yml @@ -7,5 +7,5 @@ services: orchestrator: entrypoint: ["/work/start-zetae2e.sh", "local", "upgrade", "90"] - upgradeorchestrator: - entrypoint: ["/root/start-upgradeorchestrator.sh", "90"] \ No newline at end of file + upgrade-orchestrator: + entrypoint: ["/root/start-upgrade-orchestrator.sh", "90"] \ No newline at end of file diff --git a/contrib/localnet/orchestrator/start-zetae2e.sh b/contrib/localnet/orchestrator/start-zetae2e.sh index f1f7899f43..a8e518fe0d 100644 --- a/contrib/localnet/orchestrator/start-zetae2e.sh +++ b/contrib/localnet/orchestrator/start-zetae2e.sh @@ -8,6 +8,21 @@ ZETAE2E_CMD=$1 OPTION=$2 +get_zetacored_version() { + retries=10 + node_info="" + for ((attempt=1; attempt<=$retries; attempt++)); do + node_info=$(curl -s zetacore0:1317/cosmos/base/tendermint/v1beta1/node_info) + if [[ $? == 0 ]]; then + echo "$node_info" | jq -r '.application_version.version' + return + fi + sleep 1 + done + echo "Unable to get zetacored version after ${retries} retries" + exit 1 +} + # Wait for authorized_keys file to exist (generated by zetacore0) while [ ! -f ~/.ssh/authorized_keys ]; do echo "Waiting for authorized_keys file to exist..." @@ -79,17 +94,31 @@ if [ "$OPTION" == "upgrade" ]; then echo "E2E setup passed, waiting for upgrade height..." + OLD_VERSION=$(get_zetacored_version) + CURRENT_HEIGHT=0 + WAIT_HEIGHT=$(( UPGRADE_HEIGHT - 1 )) # wait for upgrade height - while [[ $CURRENT_HEIGHT -lt $UPGRADE_HEIGHT ]] + while [[ $CURRENT_HEIGHT -lt $WAIT_HEIGHT ]] do - CURRENT_HEIGHT=$(curl -s zetacore0:26657/status | jq '.result.sync_info.latest_block_height' | tr -d '"') - echo current height is "$CURRENT_HEIGHT", waiting for "$UPGRADE_HEIGHT" - sleep 5 + CURRENT_HEIGHT=$(curl -s zetacore0:26657/status | jq -r '.result.sync_info.latest_block_height') + echo current height is "$CURRENT_HEIGHT", waiting for "$WAIT_HEIGHT" + sleep 2 done echo "waiting 10 seconds for node to restart..." + sleep 10 + + NEW_VERSION=$(get_zetacored_version) + + if [[ "$OLD_VERSION" == "$NEW_VERSION" ]]; then + echo "version did not change after upgrade height, maybe the upgrade did not run?" + exit 2 + fi + + echo "upgrade complete: ${OLD_VERSION} -> ${NEW_VERSION}" + # wait for zevm endpoint to come up sleep 10 echo "running E2E command to test the network after upgrade..." diff --git a/contrib/localnet/scripts/start-upgrade-orchestrator.sh b/contrib/localnet/scripts/start-upgrade-orchestrator.sh index c64982fa85..17335c1f3d 100755 --- a/contrib/localnet/scripts/start-upgrade-orchestrator.sh +++ b/contrib/localnet/scripts/start-upgrade-orchestrator.sh @@ -20,7 +20,7 @@ done CURRENT_HEIGHT=0 while [[ $CURRENT_HEIGHT -lt 1 ]] do - CURRENT_HEIGHT=$(curl -s zetacore0:26657/status | jq '.result.sync_info.latest_block_height' | tr -d '"') + CURRENT_HEIGHT=$(curl -s zetacore0:26657/status | jq -r '.result.sync_info.latest_block_height') echo "current height is ${CURRENT_HEIGHT}, waiting for 1" sleep 1 done @@ -30,7 +30,7 @@ scp -r zetacore0:"~/.zetacored/config ~/.zetacored/os_info ~/.zetacored/config ~ sed -i 's|tcp://localhost:26657|tcp://zetacore0:26657|g' ~/.zetacored/config/client.toml # get new zetacored version -curl -o /tmp/zetacored.new http://upgradehost:8000/zetacored +curl -o /tmp/zetacored.new http://upgrade-host:8000/zetacored chmod +x /tmp/zetacored.new UPGRADE_NAME=$(/tmp/zetacored.new version) @@ -48,7 +48,7 @@ cat > upgrade.json < upgrade_plan_info.json <