From 06cca8c00c3dbd750437104c46136bcc2dd0cace Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Sat, 20 Apr 2024 12:57:51 -0400 Subject: [PATCH 1/3] style(scripts): Align gen-upgrade-proposal.sh with community forum release posts Fixes #9270 cf. https://community.agoric.com/t/proposal-71-agoric-upgrade-14-interchain-stack-smart-wallet-upgrades/633#creating-an-emerynet-upgrade-proposal-for-rc1-3 --- scripts/gen-upgrade-proposal.sh | 34 +++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/scripts/gen-upgrade-proposal.sh b/scripts/gen-upgrade-proposal.sh index 422b40bd9c6..f2f81f9406c 100755 --- a/scripts/gen-upgrade-proposal.sh +++ b/scripts/gen-upgrade-proposal.sh @@ -1,43 +1,45 @@ #! /bin/bash set -ueo pipefail -cat << EOF 1>&2 ------------------------------------------------------------- +cat << 'EOF' 1>&2 +------------------------------------------------------------------------ This script shows a command for a software upgrade proposal which is compatible with the Cosmovisor found at: https://github.com/agoric-labs/cosmos-sdk/tree/Agoric/cosmovisor#readme ------------------------------------------------------------- +------------------------------------------------------------------------ EOF COMMIT_ID=$(git rev-parse HEAD) -ZIPURL=https://github.com/Agoric/agoric-sdk/archive/$COMMIT_ID.zip +ZIP_URL="https://github.com/Agoric/agoric-sdk/archive/${COMMIT_ID}.zip" -echo "Verifying archive is at $ZIPURL..." 1>&2 +echo "Verifying archive is at $ZIP_URL..." 1>&2 zipfile=$(mktemp) trap 'rm -f "$zipfile"' EXIT -curl -L "$ZIPURL" -o "$zipfile" +curl -L "$ZIP_URL" -o "$zipfile" echo "Generating SHA-256 checksum..." 1>&2 -checksum=sha256:$(shasum -a 256 "$zipfile" | cut -d' ' -f1) +CHECKSUM=sha256:$(shasum -a 256 "$zipfile" | cut -d' ' -f1) -info="{\"binaries\":{\"any\":\"$ZIPURL//agoric-sdk-$COMMIT_ID?checksum=$checksum\"},\"source\":\"$ZIPURL?checksum=$checksum\"}" +UPGRADE_INFO="{\"binaries\":{\"any\":\"$ZIP_URL//agoric-sdk-${COMMIT_ID}?checksum=$CHECKSUM\"},\"source\":\"$ZIP_URL?checksum=$CHECKSUM\"}" -cat << EOF 1>&2 ------------------------------------------------------------- +cat << 'EOF' 1>&2 +------------------------------------------------------------------------ Here is the skeleton of the recomended upgrade proposal command. -You'll need to fill in the details. +You'll need to fill in the details and add arguments such as +`--chain-id=` and `--from=`. -Try \`agd tx submit-proposal software-upgrade --help\` for more info. +Try `agd tx submit-proposal software-upgrade --help` for more info. Also, take a look at existing on-chain software upgrade proposals for -examples. ------------------------------------------------------------- +examples: https://ping.pub/agoric/gov +------------------------------------------------------------------------ EOF cat << EOF agd tx submit-proposal software-upgrade \\ - --upgrade-info='$info' \\ + --upgrade-info='$UPGRADE_INFO' \\ --upgrade-height \\ - --title '' --description '<DESCRIPTION>' \\ + --title '<TITLE>' \\ + --description '<DESCRIPTION>' \\ <TXOPTS>... EOF From 8770dfd7c8c7d3ac3e6aa7ebcad05178c9bdcf8b Mon Sep 17 00:00:00 2001 From: Richard Gibson <richard.gibson@gmail.com> Date: Fri, 26 Apr 2024 19:25:44 -0400 Subject: [PATCH 2/3] style(scripts): Reduce line length --- scripts/gen-upgrade-proposal.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/gen-upgrade-proposal.sh b/scripts/gen-upgrade-proposal.sh index f2f81f9406c..be7612da3cf 100755 --- a/scripts/gen-upgrade-proposal.sh +++ b/scripts/gen-upgrade-proposal.sh @@ -20,7 +20,9 @@ curl -L "$ZIP_URL" -o "$zipfile" echo "Generating SHA-256 checksum..." 1>&2 CHECKSUM=sha256:$(shasum -a 256 "$zipfile" | cut -d' ' -f1) -UPGRADE_INFO="{\"binaries\":{\"any\":\"$ZIP_URL//agoric-sdk-${COMMIT_ID}?checksum=$CHECKSUM\"},\"source\":\"$ZIP_URL?checksum=$CHECKSUM\"}" +BINARY_URL="$ZIP_URL//agoric-sdk-${COMMIT_ID}?checksum=$CHECKSUM" +SOURCE_URL="$ZIP_URL?checksum=$CHECKSUM" +UPGRADE_INFO="{\"binaries\":{\"any\":\"$BINARY_URL\"},\"source\":\"$SOURCE_URL\"}" cat << 'EOF' 1>&2 ------------------------------------------------------------------------ From 0bea6013c338fa4ea017d51afe62ddd684c60943 Mon Sep 17 00:00:00 2001 From: Richard Gibson <richard.gibson@gmail.com> Date: Fri, 26 Apr 2024 19:12:23 -0400 Subject: [PATCH 3/3] refactor(scripts): Replace the gen-upgrade-proposal.sh temp file with an HTTP HEAD request This makes its contents copyable for forum posts, which don't presume to be running inside a script and don't require bash pipefail. --- scripts/gen-upgrade-proposal.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/gen-upgrade-proposal.sh b/scripts/gen-upgrade-proposal.sh index be7612da3cf..8f6443f6b55 100755 --- a/scripts/gen-upgrade-proposal.sh +++ b/scripts/gen-upgrade-proposal.sh @@ -13,12 +13,10 @@ COMMIT_ID=$(git rev-parse HEAD) ZIP_URL="https://github.com/Agoric/agoric-sdk/archive/${COMMIT_ID}.zip" echo "Verifying archive is at $ZIP_URL..." 1>&2 -zipfile=$(mktemp) -trap 'rm -f "$zipfile"' EXIT -curl -L "$ZIP_URL" -o "$zipfile" +curl -fLI --no-progress-meter "$ZIP_URL" -o- > /dev/null echo "Generating SHA-256 checksum..." 1>&2 -CHECKSUM=sha256:$(shasum -a 256 "$zipfile" | cut -d' ' -f1) +CHECKSUM=sha256:$(curl -fL "$ZIP_URL" -o- | shasum -a 256 | cut -d' ' -f1) BINARY_URL="$ZIP_URL//agoric-sdk-${COMMIT_ID}?checksum=$CHECKSUM" SOURCE_URL="$ZIP_URL?checksum=$CHECKSUM"