UPGRADE_PATH_TESTING #16
Workflow file for this run
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
name: "UPGRADE_PATH_TESTING" | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The new version to upgrade to from latest state.' | |
required: true | |
default: 'v9.0.6' | |
jobs: | |
upgrade_path_test_state_export: | |
name: "UPGRADE_PATH_TEST_STATE_EXPORT" | |
runs-on: ["buildjet-8vcpu-ubuntu-2204"] | |
env: | |
latest_state_export: "https://zetachain-external-files.s3.amazonaws.com/state-export/athens3/latest.json" | |
github_binary_version_link: "https://github.com/zeta-chain/node/releases/download/${{ github.event.inputs.version }}/zetacored-ubuntu-22-amd64" | |
downloaded_binary_name: "zetacored-ubuntu-22-amd64" | |
aws_region: "us-east-1" | |
steps: | |
- uses: actions/checkout@v1 | |
- id: install-aws-cli | |
uses: unfor19/install-aws-cli-action@v1 | |
with: | |
version: 2 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '^1.19' | |
- name: "CLONE:ZETAVISOR:REPOSITORY" | |
uses: actions/checkout@v2 | |
with: | |
repository: zeta-chain/cosmos-sdk | |
path: zetavisor/ | |
ref: zetavisor-v0.1.5 | |
- name: "INSTALL_APT_PACKAGES" | |
working-directory: "zetavisor/cosmovisor" | |
run: | | |
echo "*********INSTALL SOME APT PACKAGES*********" | |
sudo apt update | |
sudo apt install unzip psmisc -y | |
- name: "INSTALL_ZETAVISOR" | |
working-directory: "zetavisor/cosmovisor" | |
run: | | |
echo "*********INSTALL ZETAVISOR*********" | |
go get github.com/zeta-chain/cosmos-sdk/cosmovisor/cmd/zetavisor | |
go install github.com/zeta-chain/cosmos-sdk/cosmovisor/cmd/zetavisor | |
zetavisor version || echo "zetavisor failed to install." | |
echo "*********SETUP ZETAVISOR DIRECTORIES*********" | |
mkdir -p /home/runner/.zetacored/zetavisor | |
mkdir -p /home/runner/.zetacored/zetavisor/current/bin | |
mkdir -p /home/runner/.zetacored/zetavisor/genesis/bin | |
mkdir -p /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin | |
- name: "DOWNLOAD_STATE_EXPORT_AND_BINARIES" | |
run: | | |
echo "*********DOWNLOAD STATE EXPORT*********" | |
wget -q ${latest_state_export} | |
echo "*********DOWNLOAD UPGRADE BINARY AND PUT IN ZETAVISOR UPGRADES FOLDER*********" | |
wget -q ${github_binary_version_link} -O /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored | |
sudo chmod a+x /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored | |
echo "*********DOWNLOAD CURRENT BINARY AND PUT IN ZETAVISOR GENESIS & CURRENT FOLDER*********" | |
current_version=$(curl https://rpc-archive.athens.zetachain.com:26657/abci_info -s | jq .result.response.version -r | tr -d '\n') | |
wget -q https://github.com/zeta-chain/node/releases/download/${current_version}/zetacored-ubuntu-22-amd64 -O /home/runner/.zetacored/zetavisor/current/bin/zetacored | |
cp /home/runner/.zetacored/zetavisor/current/bin/zetacored /home/runner/.zetacored/zetavisor/genesis/bin/zetacored | |
sudo chmod a+x /home/runner/.zetacored/zetavisor/current/bin/zetacored | |
sudo chmod a+x /home/runner/.zetacored/zetavisor/genesis/bin/zetacored | |
echo "PATH=/home/runner/.zetacored/zetavisor/genesis/bin:/home/runner/.zetacored/zetavisor/current/bin:$PATH" >> ${GITHUB_ENV} | |
- name: "START_TESTING_NETWORK" | |
env: | |
LOG_LEVEL: "INFO" | |
CHAIN_ID: "localnet_101-1" | |
GAS_PRICES: "0.1azeta" | |
DAEMON_HOME: "/home/runner/.zetacored" | |
DAEMON_NAME: "zetacored" | |
DENOM: "azeta" | |
DAEMON_ALLOW_DOWNLOAD_BINARIES: "false" | |
DAEMON_RESTART_AFTER_UPGRADE: "true" | |
MONIKER: "zeta" | |
BLOCK_TIME_SECONDS: "6" | |
PROPOSAL_TIME_SECONDS: "60" | |
UNSAFE_SKIP_BACKUP: "true" | |
CLIENT_DAEMON_NAME: "zetaclientd" | |
CLIENT_DAEMON_ARGS: "-enable-chains,GOERLI,-val,zeta" | |
CLIENT_SKIP_UPGRADE: "true" | |
CLIENT_START_PROCESS: "false" | |
BINARY_NAME_SUFFIX: "ubuntu-22-amd64" | |
UPGRADES_SLEEP_TIME: 300 | |
KEYRING: "test" | |
run: | | |
rm -rf ${DAEMON_HOME} | |
zetacored config keyring-backend $KEYRING --home ${DAEMON_HOME} | |
zetacored config chain-id $CHAINID --home ${DAEMON_HOME} | |
zetacored keys delete zetaa --keyring-backend $KEYRING -y > /dev/null 2>&1 || echo "doesn't exist" | |
zetacored keys delete executer_zeta --keyring-backend $KEYRING -y > /dev/null 2>&1 || echo "doesn't exist" | |
zetacored keys delete mario --keyring-backend $KEYRING -y > /dev/null 2>&1 || echo "doesn't exist" | |
zetacored keys delete executer_mario --keyring-backend $KEYRING -y > /dev/null 2>&1 || echo "doesn't exist" | |
echo "race draft rival universe maid cheese steel logic crowd fork comic easy truth drift tomorrow eye buddy head time cash swing swift midnight borrow" | zetacored keys add zeta --algo=secp256k1 --recover --keyring-backend=$KEYRING | |
echo "hand inmate canvas head lunar naive increase recycle dog ecology inhale december wide bubble hockey dice worth gravity ketchup feed balance parent secret orchard" | zetacored keys add mario --algo secp256k1 --recover --keyring-backend=$KEYRING | |
echo "lounge supply patch festival retire duck foster decline theme horror decline poverty behind clever harsh layer primary syrup depart fantasy session fossil dismiss east" | zetacored keys add executer_zeta --recover --keyring-backend=$KEYRING --algo secp256k1 | |
echo "debris dumb among crew celery derive judge spoon road oyster dad panic adult song attack net pole merge mystery pig actual penalty neither peasant"| zetacored keys add executer_mario --algo=secp256k1 --recover --keyring-backend=$KEYRING | |
echo ' | |
[ | |
{ | |
"IsObserver": "y", | |
"ObserverAddress": "zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax", | |
"ZetaClientGranteeAddress": "zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n", | |
"ZetaClientGranteePubKey": "zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp" | |
}, | |
{ | |
"IsObserver": "y", | |
"ObserverAddress": "zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2", | |
"ZetaClientGranteeAddress": "zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx", | |
"ZetaClientGranteePubKey": "zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045" | |
} | |
] | |
' > observers.json | |
zetacored init Zetanode-Localnet --chain-id=$CHAINID | |
#Set config to use azeta | |
cat $DAEMON_HOME/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="azeta"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json | |
cat $DAEMON_HOME/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="azeta"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json | |
cat $DAEMON_HOME/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="azeta"' > ~/.zetacored/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json | |
cat $DAEMON_HOME/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="azeta"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json | |
cat $DAEMON_HOME/config/genesis.json | jq '.app_state["evm"]["params"]["evm_denom"]="azeta"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json | |
cat $DAEMON_HOME/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="10000000"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json | |
cat $DAEMON_HOME/config/genesis.json | jq '.app_state["gov"]["voting_params"]["voting_period"]="60s"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json | |
sed -i '/\[api\]/,+3 s/enable = false/enable = true/' $DAEMON_HOME/config/app.toml | |
zetacored add-observer-list observers.json --keygen-block=5 | |
zetacored gentx zeta 1000000000000000000000azeta --chain-id=$CHAINID --keyring-backend=$KEYRING | |
echo "Collecting genesis txs..." | |
zetacored collect-gentxs | |
echo "Validating genesis file..." | |
zetacored validate-genesis | |
cp $DAEMON_HOME/config/genesis.json ./genesis.json | |
ls -lah | |
echo "Do Genesis Manipulation" | |
export OLD_GENESIS=./latest.json | |
export NEW_GENESIS=./genesis.json | |
python .github/actions/upgrade-testing/create_genesis.py | |
echo "Move Manipulated Genesis" | |
cp ./genesis-edited.json $DAEMON_HOME/config/genesis.json | |
echo "Start Network" | |
nohup zetavisor start --rpc.laddr tcp://0.0.0.0:26657 --minimum-gas-prices ${GAS_PRICES} "--grpc.enable=true" > cosmovisor.log 2>&1 & | |
tail -f cosmovisor.log | |
- name: "DETERMINE_UPGRADE_TYPE" | |
shell: python | |
run: | | |
import os | |
version="${{ github.event.inputs.version }}" | |
major_version = version.split(".")[0] | |
minor_version = version.split(".")[1] | |
sub_version = version.split(".")[2] | |
git_env_file = open(os.environ["GITHUB_ENV"], "a+") | |
if major_version == first_major_version and minor_version != first_minor_version: | |
git_env_file.write("UPGRADE_TYPE=NONCON") | |
elif major_version == first_major_version and minor_version == first_minor_version and sub_version != first_sub_version: | |
git_env_file.write("UPGRADE_TYPE=NONCON") | |
else: | |
git_env_file.write("UPGRADE_TYPE=GOV") | |
git_env_file.close() | |
- name: "CHECK_UPGRADE_TYPE" | |
run: | | |
echo ${UPGRADE_TYPE} |