Export Testnet Upgrade States #158
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: Export Testnet Upgrade States | |
on: | |
workflow_dispatch: | |
schedule: | |
# At 05:30 on Saturdays. | |
- cron: '30 5 * * 6' | |
# push: | |
# concurrency: | |
# group: self-hosted-runners | |
jobs: | |
export-release-testnet: | |
runs-on: cosmos-runner-set | |
environment: export-release-testnet | |
env: | |
SSH_PUB_KEYS: ${{ vars.SSH_PUB_KEYS }} | |
NODE_HOME: /home/runner/.gaia | |
CHAIN_ID: theta-testnet-001 | |
CHAIN_BINARY: 'gaiad' | |
steps: | |
# Get system info | |
- name: Install required packages | |
run: | | |
sudo apt update | |
sudo apt dist-upgrade -y | |
sudo apt -y install python-is-python3 python3-distutils screen curl jq wget python3-venv python3-pip build-essential git psmisc net-tools | |
- run: ifconfig | |
- run: lscpu | |
- run: df -h | |
- run: free -m | |
- run: uname -a | |
- run: lsb_release -a | |
- run: echo "GitHub branch is ${{ github.ref }}" | |
- run: whoami | |
- run: pwd | |
- name: mkdir ~/artifact | |
run: mkdir ~/artifact | |
- name: Update Apt | |
run: | | |
sudo apt update | |
sudo apt dist-upgrade -y | |
- name: Install openssh-server | |
run: | | |
sudo apt install -y openssh-server | |
sudo mkdir /run/sshd | |
sudo /usr/sbin/sshd | |
- name: Setup SSH auth | |
run: | | |
if [ ! -d ~/.ssh ] | |
then | |
mkdir -m 700 ~/.ssh | |
fi | |
echo "$SSH_PUB_KEYS" > ~/.ssh/authorized_keys | |
ssh-keyscan files.polypore.xyz >> ~/.ssh/known_hosts | |
- name: Set SSH key | |
run: | | |
if [ ! -d ~/.ssh ] | |
then | |
mkdir -m 700 ~/.ssh | |
fi | |
echo "${{ secrets.SSH_PRIV_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Init Python venv | |
run: python -m venv ~/env | |
- name: Install dependencies | |
run: | | |
source ~/env/bin/activate | |
python -m pip install --upgrade pip | |
python -m pip install toml-cli requests | |
- name: Get current running gaiad version | |
run: | | |
RUNNING_VERSION=$(curl -s https://rpc.sentry-01.theta-testnet.polypore.xyz/abci_info | jq -r '.result.response.version') | |
echo "Running gaiad version: $RUNNING_VERSION" | |
echo "RUNNING_VERSION=$RUNNING_VERSION" >> $GITHUB_ENV | |
- name: Download binary from cosmos/gaia repo | |
run: | | |
sudo wget -nv https://github.com/cosmos/gaia/releases/download/${{ env.RUNNING_VERSION }}/gaiad-${{ env.RUNNING_VERSION }}-linux-amd64 -O /usr/local/bin/gaiad | |
sudo chmod +x /usr/local/bin/gaiad | |
- name: Initializing chain to sync with RS Testnet | |
env: | |
NODE_MONIKER: theta-node | |
SERVICE_NAME: theta | |
GENESIS_URL: https://github.com/cosmos/testnets/raw/master/release/genesis.json.gz | |
SEEDS: "639d50339d7045436c756a042906b9a69970913f@seed-01.theta-testnet.polypore.xyz:26656,3e506472683ceb7ed75c1578d092c79785c27857@seed-02.theta-testnet.polypore.xyz:26656" | |
SYNC_RPC_1: https://rpc.state-sync-01.theta-testnet.polypore.xyz:443 | |
SYNC_RPC_2: https://rpc.state-sync-02.theta-testnet.polypore.xyz:443 | |
GAS_PRICES: "0.0025uatom" | |
run: | | |
echo "Initializing $NODE_HOME..." | |
$CHAIN_BINARY config set client chain-id $CHAIN_ID --home $NODE_HOME | |
$CHAIN_BINARY config set client keyring-backend test --home $NODE_HOME | |
$CHAIN_BINARY config set client broadcast-mode sync --home $NODE_HOME | |
$CHAIN_BINARY init $NODE_MONIKER --chain-id $CHAIN_ID --home $NODE_HOME | |
sed -i -e "/seeds =/ s^= .*^= \"$SEEDS\"^" $NODE_HOME/config/config.toml | |
echo "Configuring state sync..." | |
CURRENT_BLOCK=$(curl -s $SYNC_RPC_1/block | jq -r '.result.block.header.height') | |
TRUST_HEIGHT=$[$CURRENT_BLOCK-1000] | |
TRUST_BLOCK=$(curl -s $SYNC_RPC_1/block\?height\=$TRUST_HEIGHT) | |
TRUST_HASH=$(echo $TRUST_BLOCK | jq -r '.result.block_id.hash') | |
sed -i -e '/enable =/ s/= .*/= true/' $NODE_HOME/config/config.toml | |
sed -i -e '/trust_period =/ s/= .*/= "8h0m0s"/' $NODE_HOME/config/config.toml | |
sed -i -e "/trust_height =/ s/= .*/= $TRUST_HEIGHT/" $NODE_HOME/config/config.toml | |
sed -i -e "/trust_hash =/ s/= .*/= \"$TRUST_HASH\"/" $NODE_HOME/config/config.toml | |
sed -i -e "/rpc_servers =/ s^= .*^= \"$SYNC_RPC_1,$SYNC_RPC_2\"^" $NODE_HOME/config/config.toml | |
sed -i -e "/minimum-gas-prices =/ s^= .*^= \"$GAS_PRICES\"^" $NODE_HOME/config/app.toml | |
echo "Replaceing genesis..." | |
wget -nv $GENESIS_URL -O genesis.json.gz | |
gunzip genesis.json.gz | |
mv genesis.json $NODE_HOME/config/genesis.json | |
- name: Archive config files | |
run: mkdir -p /home/runner/artifact/config/gaiad && cp -rvp $NODE_HOME/config /home/runner/artifact/config/gaiad/ | |
- name: Start Chain | |
run: screen -L -Logfile /home/runner/artifact/gaiad_sync.log -S gaiad -d -m $CHAIN_BINARY start --x-crisis-skip-assert-invariants --home $NODE_HOME | |
- name: Wait for gaiad to start and stabilize | |
run: tests/test_block_production.sh 127.0.0.1 26657 50 1000 | |
- name: Syncing Chain | |
run: | | |
catching_up="true" | |
while [ $catching_up == "true" ] | |
do | |
catching_up=$(curl -s 127.0.0.1:26657/status | jq -r .result.sync_info.catching_up) | |
echo "Still Syncing: $catching_up" | |
sleep 5 | |
done | |
echo "Done Syncing" | |
- name: Stop gaiad | |
run: | | |
synced_block=$(gaiad status | jq -r '.sync_info.latest_block_height') | |
echo "synced_block=$synced_block" >> $GITHUB_ENV | |
killall gaiad screen | |
sleep 10s | |
- name: Create snapshot | |
run: | | |
cd $NODE_HOME | |
mkdir ~/snapshot | |
tar cfvz ~/snapshot/$CHAIN_ID-snapshot-${{ env.synced_block }}.tar.gz data wasm | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ vars.GO_VER }} | |
- name: Build fork tool | |
run: | | |
cd /home/runner | |
git clone https://github.com/cosmos/gaia.git | |
cd gaia | |
# git checkout ${{ env.RUNNING_VERSION }} | |
git checkout ${{ vars.FORK_TOOL_TAG }} | |
make build BUILD_TAGS="-tag unsafe_start_local_validator" | |
cp build/gaiad /home/runner/go/bin/gaiad-fork | |
- name: Fork the chain | |
run: | | |
curl -L https://raw.githubusercontent.com/hyphacoop/cosmos-ansible/main/examples/validator-keys/validator-40/priv_validator_key.json > /home/runner/.gaia/config/priv_validator_key.json | |
curl -L https://raw.githubusercontent.com/hyphacoop/cosmos-ansible/main/examples/validator-keys/validator-40/node_key.json > /home/runner/.gaia/config/node_key.json | |
pubkey=$(jq -r .pub_key.value /home/runner/.gaia/config/priv_validator_key.json) | |
privkey=$(jq -r .priv_key.value /home/runner/.gaia/config/priv_validator_key.json) | |
sed -i -e "/^persistent_peers =/ s^= .*^= \"\"^" $NODE_HOME/config/config.toml | |
sed -i -e '/enable =/ s/= .*/= false/' $NODE_HOME/config/config.toml | |
sed -i -e "/trust_height =/ s/= .*/= 0/" $NODE_HOME/config/config.toml | |
sed -i -e "/trust_hash =/ s/= .*/= \"\"/" $NODE_HOME/config/config.toml | |
sed -i -e "/rpc_servers =/ s^= .*^= \"\"^" $NODE_HOME/config/config.toml | |
sed -i -e "/halt-height =/ s^= .*^= \"0\"^" $NODE_HOME/config/app.toml | |
screen -L -Logfile /home/runner/artifact/gaiad_fork.log -S gaiad -d -m /home/runner/go/bin/gaiad-fork testnet unsafe-start-local-validator --validator-operator cosmosvaloper1r5v5srda7xfth3hn2s26txvrcrntldju7lnwmv --validator-pubkey "$pubkey" --accounts-to-fund cosmos1r5v5srda7xfth3hn2s26txvrcrntldjumt8mhl --validator-privkey "$privkey" --home /home/runner/.gaia | |
screen -r gaiad -p0 -X logfile flush 0 | |
- name: Wait for gaiad to start and stabilize | |
run: tests/test_block_production.sh 127.0.0.1 26657 50 1000 | |
- name: Stop fork tool | |
run: | | |
echo "exiting gaia and screen" | |
killall gaiad-fork screen | |
sleep 10s | |
- name: Start gaiad | |
run: | | |
screen -L -Logfile /home/runner/artifact/gaiad_upgrade.log -S gaiad -d -m gaiad --home /home/runner/.gaia start | |
- name: Wait for gaiad to start and stabilize | |
run: tests/test_block_production.sh 127.0.0.1 26657 50 1000 | |
- name: Submit and vote on the upgrade proposal | |
run: | | |
echo "Restoring validator key" | |
echo "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art" | gaiad --output json keys add val --keyring-backend test --recover > ~/.gaia/validator.json | |
echo "[INFO] List Keys:" | |
gaiad keys list --keyring-backend test | |
echo "Delegate 10ATOM to validator." | |
gaiad tx staking delegate cosmosvaloper1r5v5srda7xfth3hn2s26txvrcrntldju7lnwmv 10000000uatom --from val --keyring-backend test --fees 1000000uatom -y | |
echo "Wait for the delegation to go on chain..." | |
tests/test_block_production.sh 127.0.0.1 26657 1 10 | |
current_block=$(curl -s 127.0.0.1:26657/block | jq -r .result.block.header.height) | |
upgrade_height=$(($current_block+20)) | |
echo "upgrade_height=$upgrade_height" >> $GITHUB_ENV | |
echo "Submitting the upgrade proposal..." | |
echo "Upgrade Name set to: ${{ vars.UPGRADE_NAME }}" | |
echo "Creating json proposal" | |
jq ".messages[].plan .height=$upgrade_height | .messages[].plan .name=\"${{ vars.UPGRADE_NAME }}\" | . .deposit=\"1000000000uatom\"" templates/proposal-software-upgrade.json > upgrade_prop.json | |
proposal="gaiad --output json tx gov submit-proposal upgrade_prop.json --fees 1000uatom --from val --yes" | |
$proposal | |
txhash=$($proposal | jq -r .txhash) | |
echo "Wait for the proposal to go on chain..." | |
tests/test_block_production.sh 127.0.0.1 26657 1 1 | |
echo "Get proposal ID from txhash..." | |
proposal_id=$(gaiad --output json q tx $txhash | jq -r '.events[] | select(.type=="submit_proposal") | .attributes[] | select(.key=="proposal_id") | .value') | |
echo "Submitting the \"yes\" vote to proposal $proposal_id..." | |
vote="gaiad tx gov vote $proposal_id yes --from val --keyring-backend test --fees 1000uatom --yes" | |
$vote | |
tests/test_block_production.sh 127.0.0.1 26657 1 1 | |
echo "Proposal status" | |
gaiad q gov proposal $proposal_id | |
- name: Stop gaiad when reached upgrade height | |
run: | | |
current_block=0 | |
echo "Upgrade height is: ${{ env.upgrade_height }}" | |
( tail -f -n0 /home/runner/artifact/gaiad_upgrade.log & ) | grep -q "CONSENSUS FAILURE" | |
echo "exiting gaia and screen" | |
killall gaiad screen | |
tail -30 /home/runner/artifact/gaiad_upgrade.log | |
- name: Compress and upload files | |
run: | | |
echo "Compressing ~/.gaia ..." | |
cd /home/runner/ | |
tar czf ${{ env.RUNNING_VERSION }}_${{ env.upgrade_height }}-stateful-upgrade.tar.gz .gaia | |
echo "Uploading archived state to files.polypore.xyz" | |
scp ${{ env.RUNNING_VERSION }}_${{ env.upgrade_height }}-stateful-upgrade.tar.gz [email protected]:/var/www/html/archived-state/theta-testnet/ | |
# Update latest file symlinks | |
ssh [email protected] ln -sf /var/www/html/archived-state/theta-testnet/${{ env.RUNNING_VERSION }}_${{ env.upgrade_height }}-stateful-upgrade.tar.gz /var/www/html/archived-state/theta-testnet/latest_v$(echo ${{ env.RUNNING_VERSION }} | awk -F "." '{ print substr($1,2) }').tar.gz | |
- name: Upload Snapshot | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.CHAIN_ID }}-snapshot-${{ env.synced_block }} | |
path: ~/snapshot/ | |
- name: Upload artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: export-release-testnet | |
path: ~/artifact/ | |
export-ics-testnet-provider: | |
runs-on: cosmos-runner-set | |
environment: export-rs-testnet | |
env: | |
SSH_PUB_KEYS: ${{ vars.SSH_PUB_KEYS }} | |
NODE_HOME: /home/runner/.gaia | |
CHAIN_ID: provider | |
CHAIN_BINARY: 'gaiad' | |
steps: | |
# Get system info | |
- name: Install required packages | |
run: | | |
sudo apt update | |
sudo apt dist-upgrade -y | |
sudo apt -y install python-is-python3 python3-distutils screen curl jq wget python3-venv python3-pip build-essential git psmisc net-tools | |
- run: ifconfig | |
- run: lscpu | |
- run: df -h | |
- run: free -m | |
- run: uname -a | |
- run: lsb_release -a | |
- run: echo "GitHub branch is ${{ github.ref }}" | |
- run: whoami | |
- run: pwd | |
- name: mkdir ~/artifact | |
run: mkdir ~/artifact | |
- name: Update Apt | |
run: | | |
sudo apt update | |
sudo apt dist-upgrade -y | |
- name: Install openssh-server | |
run: | | |
sudo apt install -y openssh-server | |
sudo mkdir /run/sshd | |
sudo /usr/sbin/sshd | |
- name: Setup SSH auth | |
run: | | |
if [ ! -d ~/.ssh ] | |
then | |
mkdir -m 700 ~/.ssh | |
fi | |
echo "$SSH_PUB_KEYS" > ~/.ssh/authorized_keys | |
ssh-keyscan files.polypore.xyz >> ~/.ssh/known_hosts | |
- name: Set SSH key | |
run: | | |
if [ ! -d ~/.ssh ] | |
then | |
mkdir -m 700 ~/.ssh | |
fi | |
echo "${{ secrets.SSH_PRIV_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Init Python venv | |
run: python -m venv ~/env | |
- name: Install dependencies | |
run: | | |
source ~/env/bin/activate | |
python -m pip install --upgrade pip | |
python -m pip install toml-cli requests | |
- name: Get current running gaiad version | |
run: | | |
RUNNING_VERSION=$(curl -s https://rpc.provider-sentry-01.ics-testnet.polypore.xyz/abci_info | jq -r '.result.response.version') | |
echo "Running gaiad version: $RUNNING_VERSION" | |
echo "RUNNING_VERSION=$RUNNING_VERSION" >> $GITHUB_ENV | |
- name: Download binary from cosmos/gaia repo | |
run: | | |
sudo wget -nv https://github.com/cosmos/gaia/releases/download/${{ env.RUNNING_VERSION }}/gaiad-${{ env.RUNNING_VERSION }}-linux-amd64 -O /usr/local/bin/gaiad | |
sudo chmod +x /usr/local/bin/gaiad | |
- name: Initializing chain to sync with RS Testnet | |
env: | |
NODE_MONIKER: provider | |
SERVICE_NAME: provider | |
GENESIS_URL: https://github.com/cosmos/testnets/raw/master/interchain-security/provider/provider-genesis.json | |
SEEDS: "08ec17e86dac67b9da70deb20177655495a55407@provider-seed-01.ics-testnet.polypore.xyz:26656,4ea6e56300a2f37b90e58de5ee27d1c9065cf871@provider-seed-02.ics-testnet.polypore.xyz:26656" | |
SYNC_RPC_1: https://rpc.provider-state-sync-01.ics-testnet.polypore.xyz:443 | |
SYNC_RPC_2: https://rpc.provider-state-sync-02.ics-testnet.polypore.xyz:443 | |
GAS_PRICES: "0.0025uatom" | |
run: | | |
echo "Initializing $NODE_HOME..." | |
$CHAIN_BINARY config set client chain-id $CHAIN_ID --home $NODE_HOME | |
$CHAIN_BINARY config set client keyring-backend test --home $NODE_HOME | |
$CHAIN_BINARY config set client broadcast-mode sync --home $NODE_HOME | |
$CHAIN_BINARY init $NODE_MONIKER --chain-id $CHAIN_ID --home $NODE_HOME | |
sed -i -e "/seeds =/ s^= .*^= \"$SEEDS\"^" $NODE_HOME/config/config.toml | |
echo "Configuring state sync..." | |
CURRENT_BLOCK=$(curl -s $SYNC_RPC_1/block | jq -r '.result.block.header.height') | |
TRUST_HEIGHT=$[$CURRENT_BLOCK-1000] | |
TRUST_BLOCK=$(curl -s $SYNC_RPC_1/block\?height\=$TRUST_HEIGHT) | |
TRUST_HASH=$(echo $TRUST_BLOCK | jq -r '.result.block_id.hash') | |
sed -i -e '/enable =/ s/= .*/= true/' $NODE_HOME/config/config.toml | |
sed -i -e '/trust_period =/ s/= .*/= "8h0m0s"/' $NODE_HOME/config/config.toml | |
sed -i -e "/trust_height =/ s/= .*/= $TRUST_HEIGHT/" $NODE_HOME/config/config.toml | |
sed -i -e "/trust_hash =/ s/= .*/= \"$TRUST_HASH\"/" $NODE_HOME/config/config.toml | |
sed -i -e "/rpc_servers =/ s^= .*^= \"$SYNC_RPC_1,$SYNC_RPC_2\"^" $NODE_HOME/config/config.toml | |
sed -i -e "/minimum-gas-prices =/ s^= .*^= \"$GAS_PRICES\"^" $NODE_HOME/config/app.toml | |
echo "Replaceing genesis..." | |
wget -nv $GENESIS_URL -O genesis.json | |
mv genesis.json $NODE_HOME/config/genesis.json | |
- name: Archive config files | |
run: mkdir -p /home/runner/artifact/config/provider && cp -rvp $NODE_HOME/config /home/runner/artifact/config/provider/ | |
- name: Start Chain | |
run: screen -L -Logfile /home/runner/artifact/gaiad_sync.log -S gaiad -d -m $CHAIN_BINARY start --x-crisis-skip-assert-invariants --home $NODE_HOME | |
- name: Wait for gaiad to start and stabilize | |
run: tests/test_block_production.sh 127.0.0.1 26657 50 1000 | |
- name: Syncing Chain | |
run: | | |
catching_up="true" | |
while [ $catching_up == "true" ] | |
do | |
catching_up=$(curl -s 127.0.0.1:26657/status | jq -r .result.sync_info.catching_up) | |
echo "Still Syncing: $catching_up" | |
sleep 5 | |
done | |
echo "Done Syncing" | |
- name: Stop gaiad | |
run: | | |
synced_block=$(gaiad status | jq -r '.sync_info.latest_block_height') | |
echo "synced_block=$synced_block" >> $GITHUB_ENV | |
killall gaiad screen | |
sleep 10s | |
- name: Create snapshot | |
run: | | |
cd $NODE_HOME | |
mkdir ~/snapshot | |
tar cfvz ~/snapshot/$CHAIN_ID-snapshot-${{ env.synced_block }}.tar.gz data wasm | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ vars.GO_VER }} | |
- name: Build fork tool | |
run: | | |
cd /home/runner | |
git clone https://github.com/cosmos/gaia.git | |
cd gaia | |
git checkout ${{ vars.FORK_TOOL_TAG }} | |
make build BUILD_TAGS="-tag unsafe_start_local_validator" | |
cp build/gaiad /home/runner/go/bin/gaiad-fork | |
- name: Fork the chain | |
run: | | |
curl -L https://raw.githubusercontent.com/hyphacoop/cosmos-ansible/main/examples/validator-keys/validator-40/priv_validator_key.json > /home/runner/.gaia/config/priv_validator_key.json | |
curl -L https://raw.githubusercontent.com/hyphacoop/cosmos-ansible/main/examples/validator-keys/validator-40/node_key.json > /home/runner/.gaia/config/node_key.json | |
pubkey=$(jq -r .pub_key.value /home/runner/.gaia/config/priv_validator_key.json) | |
privkey=$(jq -r .priv_key.value /home/runner/.gaia/config/priv_validator_key.json) | |
sed -i -e "/^persistent_peers =/ s^= .*^= \"\"^" $NODE_HOME/config/config.toml | |
sed -i -e '/enable =/ s/= .*/= false/' $NODE_HOME/config/config.toml | |
sed -i -e "/trust_height =/ s/= .*/= 0/" $NODE_HOME/config/config.toml | |
sed -i -e "/trust_hash =/ s/= .*/= \"\"/" $NODE_HOME/config/config.toml | |
sed -i -e "/rpc_servers =/ s^= .*^= \"\"^" $NODE_HOME/config/config.toml | |
sed -i -e "/halt-height =/ s^= .*^= \"0\"^" $NODE_HOME/config/app.toml | |
screen -L -Logfile /home/runner/artifact/gaiad_fork.log -S gaiad -d -m /home/runner/go/bin/gaiad-fork testnet unsafe-start-local-validator --validator-operator cosmosvaloper1r5v5srda7xfth3hn2s26txvrcrntldju7lnwmv --validator-pubkey "$pubkey" --accounts-to-fund cosmos1r5v5srda7xfth3hn2s26txvrcrntldjumt8mhl --validator-privkey "$privkey" --home /home/runner/.gaia | |
screen -r gaiad -p0 -X logfile flush 0 | |
- name: Wait for gaiad to start and stabilize | |
run: tests/test_block_production.sh 127.0.0.1 26657 50 1000 | |
- name: Stop fork tool | |
run: | | |
echo "exiting gaia and screen" | |
killall gaiad-fork screen | |
sleep 10s | |
- name: Start gaiad | |
run: | | |
screen -L -Logfile /home/runner/artifact/gaiad_upgrade.log -S gaiad -d -m gaiad --home /home/runner/.gaia start | |
- name: Wait for gaiad to start and stabilize | |
run: tests/test_block_production.sh 127.0.0.1 26657 50 1000 | |
- name: Submit and vote on the upgrade proposal | |
run: | | |
echo "Restoring validator key" | |
echo "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art" | gaiad --output json keys add val --keyring-backend test --recover > ~/.gaia/validator.json | |
echo "[INFO] List Keys:" | |
gaiad keys list | |
echo "Delegate 10ATOM to validator." | |
gaiad tx staking delegate cosmosvaloper1r5v5srda7xfth3hn2s26txvrcrntldju7lnwmv 10000000uatom --from val --keyring-backend test --fees 1000000uatom -y | |
echo "Wait for the delegation to go on chain..." | |
tests/test_block_production.sh 127.0.0.1 26657 1 10 | |
current_block=$(curl -s 127.0.0.1:26657/block | jq -r .result.block.header.height) | |
upgrade_height=$(($current_block+20)) | |
echo "upgrade_height=$upgrade_height" >> $GITHUB_ENV | |
echo "Submitting the upgrade proposal..." | |
echo "Upgrade Name set to: ${{ vars.UPGRADE_NAME }}" | |
echo "Creating json proposal" | |
jq ".messages[].plan .height=$upgrade_height | .messages[].plan .name=\"${{ vars.UPGRADE_NAME }}\" | . .deposit=\"1000000000uatom\"" templates/proposal-software-upgrade.json > upgrade_prop.json | |
proposal="gaiad --output json tx gov submit-proposal upgrade_prop.json --fees 1000uatom --from val --yes" | |
$proposal | |
txhash=$($proposal | jq -r .txhash) | |
echo "Wait for the proposal to go on chain..." | |
tests/test_block_production.sh 127.0.0.1 26657 1 1 | |
echo "Get proposal ID from txhash..." | |
proposal_id=$(gaiad --output json q tx $txhash | jq -r '.events[] | select(.type=="submit_proposal") | .attributes[] | select(.key=="proposal_id") | .value') | |
echo "Submitting the \"yes\" vote to proposal $proposal_id..." | |
vote="gaiad tx gov vote $proposal_id yes --from val --keyring-backend test --fees 1000uatom --yes" | |
$vote | |
tests/test_block_production.sh 127.0.0.1 26657 1 1 | |
echo "Proposal status" | |
gaiad q gov proposal $proposal_id | |
- name: Stop gaiad when reached upgrade height | |
run: | | |
current_block=0 | |
echo "Upgrade height is: ${{ env.upgrade_height }}" | |
( tail -f -n0 /home/runner/artifact/gaiad_upgrade.log & ) | grep -q "CONSENSUS FAILURE" | |
echo "exiting gaia and screen" | |
killall gaiad screen | |
tail -30 /home/runner/artifact/gaiad_upgrade.log | |
- name: Compress and upload files | |
run: | | |
echo "Compressing ~/.gaia ..." | |
cd /home/runner/ | |
tar czf ${{ env.RUNNING_VERSION }}_${{ env.upgrade_height }}-provider-stateful-upgrade.tar.gz .gaia | |
echo "Uploading archived state to files.polypore.xyz" | |
scp ${{ env.RUNNING_VERSION }}_${{ env.upgrade_height }}-provider-stateful-upgrade.tar.gz [email protected]:/var/www/html/archived-state/rs-testnet-provider/ | |
# Update latest file symlinks | |
ssh [email protected] ln -sf /var/www/html/genesis/rs-testnet-provider-export/rs-provider-genesis_${{ env.RUNNING_VERSION }}_${{ env.upgrade_height }}.json.gz /var/www/html/genesis/rs-testnet-provider-export/latest_v$(echo ${{ env.RUNNING_VERSION }} | awk -F "." '{ print substr($1,2) }').json.gz | |
ssh [email protected] ln -sf /var/www/html/archived-state/rs-testnet-provider/${{ env.RUNNING_VERSION }}_${{ env.upgrade_height }}-provider-stateful-upgrade.tar.gz /var/www/html/archived-state/rs-testnet-provider/latest_v$(echo ${{ env.RUNNING_VERSION }} | awk -F "." '{ print substr($1,2) }').tar.gz | |
- name: Upload Snapshot | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.CHAIN_ID }}-snapshot-${{ env.synced_block }} | |
path: ~/snapshot/ | |
- name: Upload artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: export-ics-testnet-provider | |
path: ~/artifact/ |