From 500654cf02cbc5e91de756a1b88dfcc8047ef0dc Mon Sep 17 00:00:00 2001 From: Csongor Kiss Date: Tue, 18 Oct 2022 00:32:52 +0100 Subject: [PATCH] scripts: uppercase digest in governance generator the injection command prints out in this format, so it's easier to read for guardians this way --- scripts/contract-upgrade-governance.sh | 9 +++++++-- scripts/register-chain-governance.sh | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/contract-upgrade-governance.sh b/scripts/contract-upgrade-governance.sh index 0072bbbf7..727e18dd8 100755 --- a/scripts/contract-upgrade-governance.sh +++ b/scripts/contract-upgrade-governance.sh @@ -323,6 +323,11 @@ echo "$rest" >> "$gov_msg_file" verify=$(guardiand admin governance-vaa-verify "$gov_msg_file" 2>&1) digest=$(echo "$verify" | grep "VAA with digest" | cut -d' ' -f6 | sed 's/://g') +# massage the digest into the same format that the inject command prints it +digest=$(echo "$digest" | awk '{print toupper($0)}' | sed 's/^0X//') +# we use the first 7 characters of the digest as an identifier for the prototxt file +gov_id=$(echo "$digest" | cut -c1-7) + ################################################################################ # Print vote command and expected digests @@ -333,12 +338,12 @@ cat <<-EOD Shell command for voting: \`\`\`shell - cat << EOF > governance.prototxt + cat << EOF > governance-$gov_id.prototxt $(cat "$gov_msg_file") EOF - guardiand admin governance-vaa-inject --socket /path/to/admin.sock governance.prototxt + guardiand admin governance-vaa-inject --socket /path/to/admin.sock governance-$gov_id.prototxt \`\`\` Expected digest(s): diff --git a/scripts/register-chain-governance.sh b/scripts/register-chain-governance.sh index 5e96d80e8..bff92d2f6 100755 --- a/scripts/register-chain-governance.sh +++ b/scripts/register-chain-governance.sh @@ -153,6 +153,11 @@ echo "$rest" >> "$gov_msg_file" verify=$(guardiand admin governance-vaa-verify "$gov_msg_file" 2>&1) digest=$(echo "$verify" | grep "VAA with digest" | cut -d' ' -f6 | sed 's/://g') +# massage the digest into the same format that the inject command prints it +digest=$(echo "$digest" | awk '{print toupper($0)}' | sed 's/^0X//') +# we use the first 7 characters of the digest as an identifier for the prototxt file +gov_id=$(echo "$digest" | cut -c1-7) + ################################################################################ # Print vote command and expected digests @@ -163,12 +168,12 @@ cat <<-EOD Shell command for voting: \`\`\`shell - cat << EOF > governance.prototxt + cat << EOF > governance-$gov_id.prototxt $(cat "$gov_msg_file") EOF - guardiand admin governance-vaa-inject --socket /path/to/admin.sock governance.prototxt + guardiand admin governance-vaa-inject --socket /path/to/admin.sock governance-$gov_id.prototxt \`\`\` Expected digest(s):