Skip to content

Commit

Permalink
rebase develop and fix smoketest
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Oct 4, 2023
2 parents 994ec15 + 70ed79b commit f96feeb
Show file tree
Hide file tree
Showing 358 changed files with 25,989 additions and 4,547 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
* @brewmaster012 @kingpinXD @kevinssgh @fadeev @lumtis @ws4charlie

.github/** @zeta-chain/devops
2 changes: 1 addition & 1 deletion .github/actions/build-binaries/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
with:
run-tests: ${{ env.GITHUB_REF_NAME != 'develop' }}
build-indexer: false
go-version: '1.19'
go-version: '1.20'
```
2 changes: 1 addition & 1 deletion .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ runs:
- uses: actions/setup-go@v4
if: ${{ inputs.skip_go == 'false' }}
with:
go-version: '1.19.0'
go-version: '1.20'
cache: false

- uses: actions/setup-python@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/upgrade-testing/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
################
# BUILD ZETAVISOR
################
FROM golang:1.19 AS cosmovisor
FROM golang:1.20 AS cosmovisor
ENV GOBIN=/go/bin
ENV GOPATH=/go
ENV CGO_ENABLED=0
Expand All @@ -16,7 +16,7 @@ RUN apt update && \

FROM ubuntu:latest
RUN apt-get update && apt-get install -y curl ca-certificates
ENV GO_VERSION 1.19
ENV GO_VERSION 1.20
RUN curl -L https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz -o go.tar.gz && \
tar -C /usr/local -xzf go.tar.gz && \
rm go.tar.gz
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/upgrade-testing/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ runs:
BINARY_NAME_SUFFIX: "ubuntu-22-amd64"
UPGRADES_SLEEP_TIME: 300
DEBUG_UPGRADES: "false"
#BINARY_DOWNLOAD_LIST: '{"binary_download_list":[["v8.3.3", "zetacored-ubuntu-22-amd64"],["v9.0.0", "zetacored-ubuntu-22-amd64"]]}'
#BINARY_DOWNLOAD_LIST: '{"binary_download_list":[["v8.3.3", "zetacored-testnet-linux-amd64"],["v9.0.0", "zetacored-ubuntu-22-amd64"]]}'
#TAG_LIST: '{"tag_list":["v8.3.3","v9.0.0"]}'
STARTING_VERSION: "v8.3.3"
#END_VERSION: "v9.0.0"
Expand All @@ -60,7 +60,7 @@ runs:
echo "***********Change Permission of Zetacored*********************"
chmod a+x zetacored*
chmod -R 777 zetacored*
mv zetacored-ubuntu-22-amd64 zetacored
mv zetacored-testnet-linux-amd64 zetacored
export PATH=$(pwd):$PATH
echo "***********Change Directories into the Upgrade Testing Directory.*********************"
Expand Down
54 changes: 54 additions & 0 deletions .github/actions/upgrade-testing/create_genesis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import json
import os

genesis = open(os.environ["NEW_GENESIS"], "r").read()
genesis_json_object = json.loads(genesis)

#cut this out for now because it fails to start when done in python with the exact same keys being replaced with same value. Will fix later.
# genesis_json_object["staking"]["params"]["bond_denom"] = "azeta"
# genesis_json_object["crisis"]["constant_fee"]["denom"] = "azeta"
# genesis_json_object["gov"]["deposit_params"]["min_deposit"][0]["denom"] = "azeta"
# genesis_json_object["mint"]["params"]["mint_denom"] = "azeta"
# genesis_json_object["evm"]["params"]["evm_denom"] = "azeta"
# genesis_json_object["block"]["max_gas"] = "10000000"
# genesis_json_object["gov"]["voting_params"]["voting_period"] = '60s'

exported_genesis = open(os.environ["OLD_GENESIS"], "r").read()
exported_genesis_json_object = json.loads(exported_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"]

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

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()
49 changes: 49 additions & 0 deletions .github/actions/upgrade-testing/scripts/create_genesis.py
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 .github/actions/upgrade-testing/scripts/get_proposal_id.py
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 .github/actions/upgrade-testing/scripts/raise_gov_proposal.py
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['UPGRADE_NAME'],
"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['UPGRADE_NAME']}" \
--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['UPGRADE_NAME']}" \
--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)
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ breaking:proto:
breaking:cli:
- "x/*/client/cli/*.go"
- "cmd/**/*.go"

ci:
- ".github/**"
Loading

0 comments on commit f96feeb

Please sign in to comment.