From c863c400d724880a3d90cacf8582e0a6415fa724 Mon Sep 17 00:00:00 2001 From: Grant Zukel Date: Wed, 20 Sep 2023 09:47:54 -0600 Subject: [PATCH] updates --- .../upgrade-testing/scripts/raise_gov_proposal.py | 11 ++++++++++- .github/workflows/upgrade_path_testing.yaml | 3 +-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/actions/upgrade-testing/scripts/raise_gov_proposal.py b/.github/actions/upgrade-testing/scripts/raise_gov_proposal.py index 8ebfcad8f5..cc8f22d6cf 100644 --- a/.github/actions/upgrade-testing/scripts/raise_gov_proposal.py +++ b/.github/actions/upgrade-testing/scripts/raise_gov_proposal.py @@ -1,6 +1,8 @@ import os import requests import json +import hashlib +import bech32 os.environ['NODE'] = "http://127.0.0.1:26657" CURRENT_HEIGHT = requests.get(f"{os.environ['NODE']}/status").json()["result"]["sync_info"]["latest_block_height"] @@ -10,11 +12,18 @@ github_file.write(f"UPGRADE_HEIGHT={UPGRADE_HEIGHT}") github_file.close() +def derive_module_address(module_name: str, prefix="cosmos") -> str: + hash_bytes = hashlib.sha256(module_name.encode()).digest() + address_bytes = hash_bytes[:20] + address = bech32.bech32_encode(prefix, bech32.convertbits(address_bytes, 8, 5)) + return address + +gov_address = derive_module_address("gov") proposal_json = { "messages": [ { "@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", - "authority": os.environ["GOV_ADDRESS"], + "authority": gov_address, "plan": { "name": os.environ['VERSION'], "time": "0001-01-01T00:00:00Z", diff --git a/.github/workflows/upgrade_path_testing.yaml b/.github/workflows/upgrade_path_testing.yaml index 946dad0218..ed748084af 100644 --- a/.github/workflows/upgrade_path_testing.yaml +++ b/.github/workflows/upgrade_path_testing.yaml @@ -253,8 +253,7 @@ jobs: run: | echo "*****UPGRADE TYPE*****" echo ${UPGRADE_TYPE} - export GOV_ADDRESS=$(zetacored query gov params deposit --chain-id=${CHAINID} | jq -r '.pool_address') - echo "GOV_ADDRESS: ${GOV_ADDRESS}" + echo "*****BUILD GOV PROPOSAL*****" GOV_PROPOSAL=$(python .github/actions/upgrade-testing/scripts/raise_gov_proposal.py) echo "${GOV_PROPOSAL}"