Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Kava Protonet Data Reset Chain CI #2025

Closed
wants to merge 57 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
902faae
feat: add base genesis file for kava-protonet validator
sesheffield Sep 18, 2024
fea13c0
feat: update KAVA.VERSION to current branch til merged into master
sesheffield Sep 18, 2024
b480988
add god committee to branch
luke-kava Sep 19, 2024
ae8df5d
add issuance params, bank info and dev-wallet (correct) to account
luke-kava Sep 20, 2024
01b38f0
add README.d
luke-kava Sep 20, 2024
c3faac1
feat: handle protonet flow with new ansible playbook for reset and di…
sesheffield Sep 20, 2024
44dc38c
update README
luke-kava Sep 20, 2024
e7da1ab
fix: remove node-types
sesheffield Sep 20, 2024
895f0a0
fix: add seed-chain-state
sesheffield Sep 20, 2024
e25fae7
fix: increase to 10 seconds
sesheffield Sep 20, 2024
91e7f28
fix: change evm_denom to ukava and london and below blocks to null
sesheffield Sep 20, 2024
6998fd0
fix: use shef-protonet-validator-network-ephemeral branch for infra
sesheffield Sep 23, 2024
92282e7
fix: use akava
sesheffield Sep 23, 2024
cf12137
fix: use kava_version_filepath
sesheffield Sep 23, 2024
d619f41
fix: add another loop to keep waiting til fully in standby, helps wit…
sesheffield Sep 23, 2024
d0ed836
fix: just run reset since reset will start chain too
sesheffield Sep 23, 2024
982a556
fix: add bring the chain online to reset
sesheffield Sep 23, 2024
129aa25
fix: start chain
sesheffield Sep 23, 2024
2b4f24d
fix: update genesis
sesheffield Sep 23, 2024
bebb594
fix: update exit
sesheffield Sep 23, 2024
ee51bfa
fix: update version
sesheffield Sep 23, 2024
ac56d13
fix: update members
sesheffield Sep 23, 2024
badce97
fix: put genesis back
sesheffield Sep 23, 2024
72a8aa4
fix: evm_denom set to akava
sesheffield Sep 23, 2024
b9ff55d
fix: force
sesheffield Sep 23, 2024
7b97d74
fix: add max_gas
sesheffield Sep 23, 2024
9124b4a
fix: force
sesheffield Sep 23, 2024
3ba904a
fix: force
sesheffield Sep 23, 2024
7853d63
fix: update genesis.json to match more internal testnet
sesheffield Sep 23, 2024
c85e39d
fix: do only validator for reset for now
sesheffield Sep 23, 2024
3689b2e
fix: add pricefeed for bnb:usd and swap claims
sesheffield Sep 23, 2024
df499b0
fix: no_base_fee true and other updates
sesheffield Sep 23, 2024
4a80b1f
fix: put back kava1jaw3g097lq9jdrnscchspr2233yhpsxdjky582 auth
sesheffield Sep 23, 2024
bf3ed1f
fix: add rest of genesis.json
sesheffield Sep 23, 2024
aa7263d
fix: update comments
sesheffield Sep 23, 2024
60765b7
fix: update comments
sesheffield Sep 23, 2024
2d42ed1
fix: add env for exit-standby-all-chain-nodes
sesheffield Sep 23, 2024
d204d47
fix: remove unneeded file
sesheffield Sep 23, 2024
70c7170
fix: put back to 6.5 secs between blocks
sesheffield Sep 23, 2024
fa15519
fix: put back to master and only run on merging into master
sesheffield Sep 23, 2024
230c398
update README for kava-protonet
luke-kava Sep 24, 2024
31dfe07
Merge branch 'master' into shef-protonet-validator-network-ci
luke-kava Sep 24, 2024
6c7459d
Merge branch 'shef-protonet-validator-network' into shef-protonet-val…
lbayas Sep 24, 2024
d6fab27
Merge branch 'master' into shef-protonet-validator-network
luke-kava Sep 24, 2024
95f4ed6
Merge branch 'shef-protonet-validator-network' into shef-protonet-val…
luke-kava Sep 24, 2024
01e6549
mimic what validate-internal-testnet-genesis in validate-protonet-gen…
luke-kava Sep 24, 2024
1e01e10
fix: remove dup
sesheffield Sep 24, 2024
24a4aab
fix: restart
sesheffield Sep 24, 2024
d3fe3a8
fix: kvtool?:
sesheffield Sep 25, 2024
8613af8
force
sesheffield Sep 25, 2024
18d1f27
fix: put back to running once merged into master
sesheffield Sep 25, 2024
064a252
feat: handle when kava-protonet files have changed for reset
sesheffield Sep 25, 2024
f1de797
fix: add needs changed_files for reset-chain-to-zero-state
sesheffield Sep 25, 2024
09bcd10
fix: use protonet
sesheffield Sep 25, 2024
5483433
fix: rename AWS_CHAIN_ID_TAG_NAME
sesheffield Sep 25, 2024
7c24a03
Merge branch 'master' into shef-protonet-validator-network-ci
sesheffield Sep 30, 2024
4012a57
fix: newline
sesheffield Sep 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/exit-standby-all-chain-nodes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -x

# get all the node's ec2 instance ids for the specified chain id
chain_node_instance_ids=$(aws ec2 describe-instances --filters "Name=tag:KavaChainId,Values=$CHAIN_ID" | jq -r '[.Reservations | .[] | .Instances | .[] | .InstanceId] | join(" ")')
chain_node_instance_ids=$(aws ec2 describe-instances --filters "Name=tag:$CHAIN_TAG_NAME,Values=$CHAIN_ID" | jq -r '[.Reservations | .[] | .Instances | .[] | .InstanceId] | join(" ")')

for chain_node_instance_id in ${chain_node_instance_ids}
do
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/put-all-chain-nodes-on-standby.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
set -x

# get all the node's ec2 instance ids for the specified chain id
chain_node_instance_ids=$(aws ec2 describe-instances --filters "Name=tag:KavaChainId,Values=$CHAIN_ID" | jq -r '[.Reservations | .[] | .Instances | .[] | .InstanceId] | join(" ")')
# get all the node's ec2 instance ids for the specified chain id KavaChainId
chain_node_instance_ids=$(aws ec2 describe-instances --filters "Name=tag:$CHAIN_TAG_NAME,Values=$CHAIN_ID" | jq -r '[.Reservations | .[] | .Instances | .[] | .InstanceId] | join(" ")')

for chain_node_instance_id in ${chain_node_instance_ids}
do
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/seed-protonet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -ex
# broadcast mode of `block` in order to
# minimize the chance tx's fail due to an
# account sequence number mismatch
AVG_SECONDS_BETWEEN_BLOCKS=6.5
AVG_SECONDS_BETWEEN_BLOCKS=10

# configure kava binary to talk to the desired chain endpoint
kava config node "${CHAIN_API_URL}"
Expand Down
22 changes: 14 additions & 8 deletions .github/workflows/cd-protonet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ name: Continuous Deployment (Protonet)
# workflows: [Continuous Integration (Kava Master)]
# types:
# - completed
on:
push:

jobs:
# in order:
Expand All @@ -15,22 +17,26 @@ jobs:
# reset application database state (only done on internal testnet)
reset-chain-to-zero-state:
# only start cd pipeline if last ci run was successful
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: ./.github/workflows/cd-reset-internal-testnet.yml
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: ./.github/workflows/cd-reset-protonet.yml
with:
aws-region: us-east-1
chain-tag-name: ChainId
chain-id: proto_2221-17000
ssm-document-name: kava-testnet-internal-node-update
playbook-name: reset-protonet-playbook.yml
playbook-infrastructure-branch: master
auto_scaling_group_names: kava-protonet-iavl-v1-validator-api-node,kava-protonet-iavl-v1-rpc-api-node
ssm-document-name: kava-protonet-iavl-v1-instance-update
playbook-name: reset-chain.yml
playbook-infrastructure-branch: shef-protonet-validator-network-ephemeral
secrets: inherit

# start kava with new binary and genesis state on api, peer and seed nodes, place nodes in service once they start and are synched to live
start-chain-api:
uses: ./.github/workflows/cd-start-chain.yml
uses: ./.github/workflows/cd-start-protonet-chain.yml
with:
aws-region: us-east-1
chain-tag-name: ChainId
chain-id: proto_2221-17000
auto_scaling_group_names: kava-protonet-iavl-v1-validator-api-node,kava-protonet-iavl-v1-rpc-api-node
ssm-document-name: kava-testnet-internal-node-update
playbook-name: start-chain-api-playbook.yml
playbook-infrastructure-branch: master
Expand All @@ -45,7 +51,7 @@ jobs:
chain-id: proto_2221-17000
seed-script-filename: seed-protonet.sh
erc20-deployer-network-name: protonet
genesis_validator_addresses: "kavavaloper14w4avgdvqrlpww6l5dhgj4egfn6ln7gmtp7r2m"
genesis_validator_addresses: "kavavaloper1jaw3g097lq9jdrnscchspr2233yhpsxdlq7ula"
kava_version_filepath: ./ci/env/kava-protonet/KAVA.VERSION
secrets: inherit
needs: [start-chain-api]
Expand All @@ -57,4 +63,4 @@ jobs:
metric-name: kava.deploys.testnet.proto
namespace: Kava/ContinuousDeployment
secrets: inherit
needs: [seed-chain-state]
needs: [seed-chain-state]
1 change: 1 addition & 0 deletions .github/workflows/cd-reset-internal-testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
- name: take the chain offline
run: bash ${GITHUB_WORKSPACE}/.github/scripts/put-all-chain-nodes-on-standby.sh
env:
CHAIN_TAG_NAME: ${{ inputs.chain-tag-name }}
sesheffield marked this conversation as resolved.
Show resolved Hide resolved
CHAIN_ID: ${{ inputs.chain-id }}
AWS_REGION: ${{ inputs.aws-region }}
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
Expand Down
92 changes: 92 additions & 0 deletions .github/workflows/cd-reset-protonet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Reset Internal Testnet

on:
workflow_call:
inputs:
auto_scaling_group_names:
required: true
type: string
description: 'Comma-separated list of auto-scaling group names'
chain-tag-name:
required: false
type: string
default: 'KavaChainId'
chain-id:
required: true
type: string
aws-region:
required: true
type: string
ssm-document-name:
required: true
type: string
playbook-name:
required: true
type: string
playbook-infrastructure-branch:
required: true
type: string
secrets:
CI_AWS_KEY_ID:
required: true
CI_AWS_KEY_SECRET:
required: true
KAVA_PRIVATE_GITHUB_ACCESS_TOKEN:
required: true

# in order:
# enter standby (prevents autoscaling group from killing node during deploy)
# stop kava
# download updated binary and genesis
# reset application database state (only done on internal testnet)
jobs:
place-chain-nodes-on-standby:
runs-on: ubuntu-latest
steps:
- name: checkout repo from current commit
uses: actions/checkout@v4
- name: take the chain offline
run: bash ${GITHUB_WORKSPACE}/.github/scripts/put-all-chain-nodes-on-standby.sh
env:
CHAIN_TAG_NAME: ${{ inputs.chain-tag-name }}
CHAIN_ID: ${{ inputs.chain-id }}
AWS_REGION: ${{ inputs.aws-region }}
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
- name: checkout infrastructure repo
uses: actions/checkout@v4
with:
repository: Kava-Labs/infrastructure
token: ${{ secrets.KAVA_PRIVATE_GITHUB_ACCESS_TOKEN }}
path: infrastructure
ref: master
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: build kava node updater
run: cd infrastructure/cli/kava-node-updater && make install && cd ../../../
- name: run reset playbook on all chain nodes
run: |
IFS=',' read -r -a auto_scaling_group_names <<< "$AUTO_SCALING_GROUP_NAMES"
for auto_scaling_group_name in "${auto_scaling_group_names[@]}"; do
kava-node-updater \
--debug \
--max-retries=2 \
--aws-ssm-document-name="$SSM_DOCUMENT_NAME" \
--infrastructure-git-pointer="$PLAYBOOK_INFRASTRUCTURE_BRANCH" \
--update-playbook-filename="$PLAYBOOK_NAME" \
--autoscaling-group-name="$auto_scaling_group_name" \
--max-upgrade-batch-size=0 \
--node-types="" \
--wait-for-node-sync-after-upgrade=true
done
env:
SSM_DOCUMENT_NAME: ${{ inputs.ssm-document-name }}
PLAYBOOK_NAME: ${{ inputs.playbook-name }}
AUTO_SCALING_GROUP_NAMES: ${{ inputs.auto_scaling_group_names }}
AWS_REGION: ${{ inputs.aws-region }}
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
AWS_SDK_LOAD_CONFIG: 1
PLAYBOOK_INFRASTRUCTURE_BRANCH: ${{ inputs.playbook-infrastructure-branch }}
5 changes: 5 additions & 0 deletions .github/workflows/cd-start-chain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Start Chain
on:
workflow_call:
inputs:
chain-tag-name:
required: false
type: string
default: 'KavaChainId'
chain-id:
required: true
type: string
Expand Down Expand Up @@ -36,6 +40,7 @@ jobs:
- name: take the chain offline
run: bash ${GITHUB_WORKSPACE}/.github/scripts/put-all-chain-nodes-on-standby.sh
env:
CHAIN_TAG_NAME: ${{ inputs.chain-tag-name }}
CHAIN_ID: ${{ inputs.chain-id }}
AWS_REGION: ${{ inputs.aws-region }}
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/cd-start-protonet-chain.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Start Chain

on:
workflow_call:
inputs:
auto_scaling_group_names:
required: true
type: string
description: 'Comma-separated list of auto-scaling group names'
chain-tag-name:
required: false
type: string
default: 'KavaChainId'
chain-id:
required: true
type: string
aws-region:
required: true
type: string
ssm-document-name:
required: true
type: string
playbook-name:
required: true
type: string
playbook-infrastructure-branch:
required: true
type: string
secrets:
CI_AWS_KEY_ID:
required: true
CI_AWS_KEY_SECRET:
required: true
KAVA_PRIVATE_GITHUB_ACCESS_TOKEN:
required: true

jobs:
# start kava, allow nodes to start processing requests from users once they are synced to live
serve-traffic:
runs-on: ubuntu-latest
steps:
- name: checkout repo from current commit
uses: actions/checkout@v4
- name: take the chain offline
run: bash ${GITHUB_WORKSPACE}/.github/scripts/put-all-chain-nodes-on-standby.sh
env:
CHAIN_TAG_NAME: ${{ inputs.chain-tag-name }}
CHAIN_ID: ${{ inputs.chain-id }}
AWS_REGION: ${{ inputs.aws-region }}
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
- name: checkout infrastructure repo
uses: actions/checkout@v4
with:
repository: Kava-Labs/infrastructure
token: ${{ secrets.KAVA_PRIVATE_GITHUB_ACCESS_TOKEN }}
path: infrastructure
ref: master
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: build kava node updater
run: cd infrastructure/cli/kava-node-updater && make install && cd ../../../
- name: run start-chain playbook on all chain nodes
run: |
IFS=',' read -r -a auto_scaling_group_names <<< "$AUTO_SCALING_GROUP_NAMES"
for auto_scaling_group_name in "${auto_scaling_group_names[@]}"; do
kava-node-updater \
--debug \
--max-retries=2 \
--aws-ssm-document-name="$SSM_DOCUMENT_NAME" \
--infrastructure-git-pointer="$PLAYBOOK_INFRASTRUCTURE_BRANCH" \
--update-playbook-filename="$PLAYBOOK_NAME" \
--autoscaling-group-name="$auto_scaling_group_name" \
--max-upgrade-batch-size=0 \
--node-types="" \
--wait-for-node-sync-after-upgrade=true
done
env:
SSM_DOCUMENT_NAME: ${{ inputs.ssm-document-name }}
PLAYBOOK_NAME: ${{ inputs.playbook-name }}
AUTO_SCALING_GROUP_NAMES: ${{ inputs.auto_scaling_group_names }}
AWS_REGION: ${{ inputs.aws-region }}
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
AWS_SDK_LOAD_CONFIG: 1
PLAYBOOK_INFRASTRUCTURE_BRANCH: ${{ inputs.playbook-infrastructure-branch }}
- name: bring the chain online
run: bash ${GITHUB_WORKSPACE}/.github/scripts/exit-standby-all-chain-nodes.sh
2 changes: 1 addition & 1 deletion ci/env/kava-protonet/KAVA.VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
master
shef-protonet-validator-network
11 changes: 11 additions & 0 deletions ci/env/kava-protonet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Genesis Updates
===============
- Added the God Committee section to the `app_state.committee.committees` section
- Added dev wallet `kava1vlpsrmdyuywvaqrv7rx6xga224sqfwz3fyfhwq` to `app_state.auth.accounts` for genesis account
- Added dev wallet balances to `app_state.bank.balances` to enable this account to fund various other accounts
- Updated `app_state.issuance.params` with different kava assets that will be needed in `seed-protonet.sh` script

Summary
=======
- We decided to move critical data sections into the genesis.json file to ensure the node that starts up has all relevant state it needs BEFORE we execute any scripts to manipulate state.
- The genesis.json contains the initial dev wallet, genesis account and associated balances to said account which is then used to pre-fund various ancillary kava balances (ex: community) to serve whatever testing purpose to protonet
Loading
Loading