Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style(scripts): Align gen-upgrade-proposal.sh with community forum release posts #9271

Merged
merged 3 commits into from
May 1, 2024
Merged
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
38 changes: 20 additions & 18 deletions scripts/gen-upgrade-proposal.sh
Original file line number Diff line number Diff line change
@@ -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
zipfile=$(mktemp)
trap 'rm -f "$zipfile"' EXIT
curl -L "$ZIPURL" -o "$zipfile"
echo "Verifying archive is at $ZIP_URL..." 1>&2
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)

info="{\"binaries\":{\"any\":\"$ZIPURL//agoric-sdk-$COMMIT_ID?checksum=$checksum\"},\"source\":\"$ZIPURL?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
------------------------------------------------------------
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=<chain id>` and `--from=<wallet>`.

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-NAME> \\
--upgrade-info='$info' \\
--upgrade-info='$UPGRADE_INFO' \\
--upgrade-height <HEIGHT> \\
--title '<TITLE>' --description '<DESCRIPTION>' \\
--title '<TITLE>' \\
--description '<DESCRIPTION>' \\
<TXOPTS>...
EOF
Loading