diff --git a/.github/actions/upgrade-testing/create_genesis.py b/.github/actions/upgrade-testing/create_genesis.py index 75ef7f9f66..bdd3fd2ecd 100644 --- a/.github/actions/upgrade-testing/create_genesis.py +++ b/.github/actions/upgrade-testing/create_genesis.py @@ -1,54 +1,56 @@ 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() +from memory_profiler import profile + + +@profile +def genesis_modification(): + genesis = open(os.environ["NEW_GENESIS"], "r").read() + genesis_json_object = json.loads(genesis) + + exported_genesis = open(os.environ["OLD_GENESIS"], "r").read() + exported_genesis_json_object = json.loads(exported_genesis) + + exported_genesis = None + genesis = None + + print("APP_STATE:AUTH:ACCOUNTS") + genesis_json_object["app_state"]["auth"]["accounts"] = genesis_json_object["app_state"]["auth"]["accounts"] + \ + exported_genesis_json_object["app_state"]["auth"]["accounts"] + print("APP_STATE:CROSSCHAIN") + genesis_json_object["app_state"]["crosschain"] = exported_genesis_json_object["app_state"]["crosschain"] + print("APP_STATE:OBSERVER") + genesis_json_object["app_state"]["observer"] = exported_genesis_json_object["app_state"]["observer"] + print("APP_STATE:EMISSIONS") + genesis_json_object["app_state"]["emissions"] = exported_genesis_json_object["app_state"]["emissions"] + print("APP_STATE:FUNGIBLE") + genesis_json_object["app_state"]["fungible"] = exported_genesis_json_object["app_state"]["fungible"] + + print("EVM:ACCOUNTS") + evm_accounts = [] + for index, account in enumerate(exported_genesis_json_object["app_state"]["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) + + print("SET:EVM:ACCOUNTS") + exported_genesis_json_object["app_state"]["evm"]["accounts"] = evm_accounts + evm_accounts = None + print("UPDATE:EVM") + genesis_json_object["app_state"]["evm"] = exported_genesis_json_object["app_state"]["evm"] + exported_genesis_json_object = None + print("SAVE:EDITED:GENESIS") + with open("genesis-edited.json", "w") as genesis: + genesis.write(json.dumps(genesis_json_object)) + + +genesis_modification() diff --git a/.github/workflows/upgrade_path_testing.yaml b/.github/workflows/upgrade_path_testing.yaml index 681e6a28dc..94f3c7f6e4 100644 --- a/.github/workflows/upgrade_path_testing.yaml +++ b/.github/workflows/upgrade_path_testing.yaml @@ -6,23 +6,24 @@ on: version: description: 'The new version of tag you are going to download the binary from..' required: true - default: 'v10.1.0' + default: 'v12.1.0' upgrade_name: description: 'The version that is set in setup_handlers.go' required: true - default: 'v10.1.0' + default: 'v12.1.0' current_version: description: 'The version that the network is currently on.' required: true - default: 'v10.0.0' + default: 'v10.1.0' jobs: upgrade_path_test_state_export: name: "UPGRADE_PATH_TEST_STATE_EXPORT" - runs-on: ["buildjet-8vcpu-ubuntu-2204"] + runs-on: ["buildjet-16vcpu-ubuntu-2204"] + timeout-minutes: 3000 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_testnet-linux-amd64" + latest_state_export: "https://storage.googleapis.com/statesync-rpc-snapshots-zetachain-dev/latest.json" + github_binary_version_link: "https://github.com/zeta-chain/ci-testing-node/releases/download/${{ github.event.inputs.version }}/zetacored_testnet-linux-amd64" downloaded_binary_name: "zetacored-testnet-linux-amd64" VERSION: "${{ github.event.inputs.version }}" aws_region: "us-east-1" @@ -37,6 +38,7 @@ jobs: DENOM: "azeta" DAEMON_ALLOW_DOWNLOAD_BINARIES: "true" DAEMON_RESTART_AFTER_UPGRADE: "true" + SLEEP_START_TIME: "800" MONIKER: "zeta" BLOCK_TIME_SECONDS: "6" PROPOSAL_TIME_SECONDS: "60" @@ -61,11 +63,6 @@ jobs: 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: check-latest: false @@ -106,8 +103,13 @@ jobs: wget -q ${latest_state_export} echo "*********DOWNLOAD UPGRADE BINARY AND PUT IN ZETAVISOR UPGRADES FOLDER*********" + echo "*********DOWNLOADING: ${github_binary_version_link}*********" wget -q ${github_binary_version_link} -O /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored + + echo "GET CHECKSUME OF DOWNLOADED BINARY" ZETACORED_CHECKSUM=$(shasum -b -a 256 /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored | cut -d ' ' -f 1) + + echo "CHANGE PERMISSIONS" sudo chmod a+x /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored echo "UPGRADE_INFO=${UPGRADE_INFO}" >> ${GITHUB_ENV} @@ -141,8 +143,9 @@ jobs: sudo chmod a+x /home/runner/.zetacored/zetavisor/genesis/bin/zetacored echo "PATH=/home/runner/.zetacored/zetavisor/genesis/bin:$PATH" >> ${GITHUB_ENV} - - name: "START_TESTING_NETWORK" + - name: "SETUP:GENESIS" run: | + pip install memory_profiler zetacored config keyring-backend $KEYRING --home ${DAEMON_HOME} zetacored config chain-id $CHAINID --home ${DAEMON_HOME} @@ -198,26 +201,59 @@ jobs: zetacored validate-genesis cp $DAEMON_HOME/config/genesis.json ./genesis.json + echo "enable swap" + sudo fallocate -l 30G ./swapfile + sudo chmod 600 ./swapfile + sudo mkswap ./swapfile + sudo swapon ./swapfile + sudo swapon --show echo "Do Genesis Manipulation" export OLD_GENESIS=./latest.json export NEW_GENESIS=./genesis.json - - python .github/actions/upgrade-testing/scripts/create_genesis.py + nohup /usr/bin/time -v python .github/actions/upgrade-testing/scripts/create_genesis.py & + PYTHON_PID=$! + # Loop while the Python process is running + while ps -p $PYTHON_PID > /dev/null 2>&1; do + free + sleep 1 # Pause for 1 second before the next check + done + echo "Move Manipulated Genesis" cp ./genesis-edited.json $DAEMON_HOME/config/genesis.json - - cat $DAEMON_HOME/config/genesis.json | grep -A 10 -B 10 out_tx_tracker - + echo "DAEMON HOME: $DAEMON_HOME" + ls -lah $DAEMON_HOME/config/ + echo "Zetavisor Version" zetavisor version || echo "zetavisor not found" zetacored version || echo "zetcored not found" + echo "BEFORE CHANGE CONFIG DB" + cat $DAEMON_HOME/config/config.toml + echo "***************************" + + echo "fix db" + sed -i 's/db_backend = "goleveldb"/db_backend = "pebbledb"/g' $DAEMON_HOME/config/config.toml + + echo "AFTER CHANGE CONFIG DB" + cat $DAEMON_HOME/config/config.toml + echo "***************************" + + - name: "START_TESTING_NETWORK" + run: | + sudo swapoff ./swapfile + sudo rm ./swapfile + 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 & - - sleep ${UPGRADES_SLEEP_TIME} + duration=10 + start_time=$SECONDS + while [ $(($SECONDS - start_time)) -lt ${SLEEP_START_TIME} ]; do + free + echo "Looping..." + sleep 1 + done cat cosmovisor.log - name: "DETERMINE_UPGRADE_TYPE" @@ -251,6 +287,7 @@ jobs: - name: "NON_CONSENSUS_BREAKING_UPGRADE" if: env.UPGRADE_TYPE == 'NONCON' run: | + cat cosmovisor.log echo ${UPGRADE_TYPE} echo "*********CHECK VERSION BEFORE BINARY SWITCH*********" zetavisor version diff --git a/.github/workflows/validate-changelog.yml b/.github/workflows/validate-changelog.yml index 33f3d75d07..1e5374179f 100644 --- a/.github/workflows/validate-changelog.yml +++ b/.github/workflows/validate-changelog.yml @@ -14,6 +14,7 @@ jobs: fetch-depth: 0 - name: Check for CHANGELOG.md changes + if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog') }} run: | git fetch origin ${{ github.base_ref }} CHANGELOG_DIFF=$(git diff origin/${{ github.base_ref }} origin/${{ github.head_ref }} -- changelog.md) diff --git a/changelog.md b/changelog.md index 2dbd72c572..52869ffec4 100644 --- a/changelog.md +++ b/changelog.md @@ -40,4 +40,3 @@ * fix: begin blocker for mock mainnet by @kingpinXD in https://github.com/zeta-chain/node/pull/1308 -