-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into stateful-upgrade
- Loading branch information
Showing
52 changed files
with
1,592 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import json | ||
import os | ||
|
||
print("OPEN NEW GENESIS") | ||
genesis = open(os.environ["NEW_GENESIS"], "r").read() | ||
genesis_json_object = json.loads(genesis) | ||
|
||
print("OPEN OLD GENESIS") | ||
exported_genesis = open(os.environ["OLD_GENESIS"], "r").read() | ||
exported_genesis_json_object = json.loads(exported_genesis) | ||
|
||
print("PULL STATE OUT OF OLD GENESIS") | ||
crosschain = exported_genesis_json_object["app_state"]["crosschain"] | ||
observer = exported_genesis_json_object["app_state"]["observer"] | ||
emissions = exported_genesis_json_object["app_state"]["emissions"] | ||
fungible = exported_genesis_json_object["app_state"]["fungible"] | ||
evm = exported_genesis_json_object["app_state"]["evm"] | ||
auth_accounts = exported_genesis_json_object["app_state"]["auth"]["accounts"] | ||
|
||
print("MANIPULATE NEW GENESIS") | ||
genesis_json_object["app_state"]["auth"]["accounts"] = genesis_json_object["app_state"]["auth"]["accounts"] + auth_accounts | ||
genesis_json_object["app_state"]["crosschain"] = crosschain | ||
genesis_json_object["app_state"]["observer"] = observer | ||
genesis_json_object["app_state"]["emissions"] = emissions | ||
genesis_json_object["app_state"]["fungible"] = fungible | ||
|
||
evm_accounts = [] | ||
for index, account in enumerate(evm["accounts"]): | ||
if account["address"] == "0x0000000000000000000000000000000000000001": | ||
print("pop account", account["address"]) | ||
elif account["address"] == "0x0000000000000000000000000000000000000006": | ||
print("pop account", account["address"]) | ||
elif account["address"] == "0x0000000000000000000000000000000000000002": | ||
print("pop account", account["address"]) | ||
elif account["address"] == "0x0000000000000000000000000000000000000002": | ||
print("pop account", account["address"]) | ||
elif account["address"] == "0x0000000000000000000000000000000000000008": | ||
print("pop account", account["address"]) | ||
else: | ||
evm_accounts.append(account) | ||
evm["accounts"] = evm_accounts | ||
genesis_json_object["app_state"]["evm"] = evm | ||
|
||
print("WRITE GENESIS-EDITED") | ||
genesis = open("genesis-edited.json", "w") | ||
genesis_string = json.dumps(genesis_json_object, indent=2) | ||
dumped_genesis_object = genesis_string.replace("0x0000000000000000000000000000000000000001","0x387A12B28fe02DcAa467c6a1070D19B82F718Bb5") | ||
genesis.write(genesis_string) | ||
genesis.close() |
23 changes: 23 additions & 0 deletions
23
.github/actions/upgrade-testing/scripts/get_proposal_id.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import json | ||
import subprocess | ||
import os | ||
|
||
os.environ['NODE'] = "http://127.0.0.1:26657" | ||
def run_command(self, cmd): | ||
COMMAND_PREFIX = "export PATH=" + self.go_path + ":${PATH} && " | ||
cmd = COMMAND_PREFIX + cmd | ||
result = subprocess.run(cmd, stdout=subprocess.PIPE, shell=True) | ||
result_output = result.stdout.decode('utf-8') | ||
return result_output | ||
|
||
try: | ||
QUERY_GOV_PROPOSAL = f"""zetacored query gov proposals --output json --node {os.environ['NODE']}""" | ||
GOV_PROPOSALS = json.loads(run_command(QUERY_GOV_PROPOSAL)) | ||
for proposal in GOV_PROPOSALS["proposals"]: | ||
try: | ||
PROPOSAL_ID = proposal["id"] | ||
except Exception as e: | ||
print(1) | ||
print(PROPOSAL_ID) | ||
except Exception as e: | ||
print(1) |
63 changes: 63 additions & 0 deletions
63
.github/actions/upgrade-testing/scripts/raise_gov_proposal.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import os | ||
import requests | ||
import json | ||
|
||
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"] | ||
UPGRADE_HEIGHT = int(CURRENT_HEIGHT) + ( | ||
int(os.environ['PROPOSAL_TIME_SECONDS']) / int(os.environ['BLOCK_TIME_SECONDS'])) + 20 | ||
github_file = open(os.environ["GITHUB_ENV"], "a+") | ||
github_file.write(f"UPGRADE_HEIGHT={UPGRADE_HEIGHT}") | ||
github_file.close() | ||
|
||
proposal_json = { | ||
"messages": [ | ||
{ | ||
"@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", | ||
"authority": os.environ["GOV_ADDRESS"], | ||
"plan": { | ||
"name": os.environ['VERSION'], | ||
"time": "0001-01-01T00:00:00Z", | ||
"height": str(UPGRADE_HEIGHT).split('.')[0], | ||
"info": os.environ["UPGRADE_INFO"], | ||
"upgraded_client_state": None | ||
} | ||
} | ||
], | ||
"metadata": os.environ["METADATA"], | ||
"deposit": os.environ["DEPOSIT"] | ||
} | ||
|
||
proposal_json = json.dumps(proposal_json) | ||
write_gov_json = open("gov.json", "w") | ||
write_gov_json.write(proposal_json) | ||
write_gov_json.close() | ||
|
||
GOV_PROPOSAL = f"""zetacored tx gov submit-proposal gov.json \ | ||
--from {os.environ['MONIKER']} \ | ||
--chain-id "{os.environ['CHAINID']}" \ | ||
--keyring-backend test \ | ||
--node "{os.environ['NODE']}" \ | ||
--gas=auto \ | ||
--gas-adjustment=2 \ | ||
--gas-prices={os.environ['GAS_PRICES']} \ | ||
-y | ||
""" | ||
|
||
# GOV_PROPOSAL = f"""zetacored tx gov submit-legacy-proposal software-upgrade "{os.environ['VERSION']}" \ | ||
# --from "{os.environ['MONIKER']}" \ | ||
# --deposit {os.environ["DEPOSIT"]} \ | ||
# --upgrade-height "{str(UPGRADE_HEIGHT).split('.')[0]}" \ | ||
# --upgrade-info '{os.environ["UPGRADE_INFO"]}' \ | ||
# --title "{os.environ['VERSION']}" \ | ||
# --description "Zeta Release {os.environ['VERSION']}" \ | ||
# --chain-id "{os.environ['CHAINID']}" \ | ||
# --node "{os.environ['NODE']}" \ | ||
# --keyring-backend test \ | ||
# --gas=auto \ | ||
# --gas-adjustment=2 \ | ||
# --gas-prices={os.environ['GAS_PRICES']} \ | ||
# -y \ | ||
# --no-validate""" | ||
|
||
print(GOV_PROPOSAL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.