Skip to content

Commit

Permalink
style(scripts): Align gen-upgrade-proposal.sh with community forum re…
Browse files Browse the repository at this point in the history
…lease posts (#9271)

Fixes #9270

## Description

Adopt variable names and interpolation patterns as seen in community
forum posts such as 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
. Also provides slightly more guidance regarding expected transaction
options and where to look for past proposals.

### Security Considerations

n/a

### Scaling Considerations

n/a

### Documentation Considerations

We might want to direct operators to this script, rather than
duplicating its contents.

### Testing Considerations

This script is well-exercised.

### Upgrade Considerations

Script functionality must not change.
  • Loading branch information
mergify[bot] committed May 1, 2024
2 parents e456308 + 0bea601 commit a2c6d29
Showing 1 changed file with 20 additions and 18 deletions.
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

0 comments on commit a2c6d29

Please sign in to comment.