Skip to content

Validator/nysa

Validator/nysa #10

Workflow file for this run

name: Gentx checker
on:
pull_request:
types: [ready_for_review, labeled]
push:
paths:
- govgen-1/gentx/*.json
branches:
- "ci/gentx"
env:
GOVGEND_URL: "https://atomone.fra1.digitaloceanspaces.com/govgen/bin/govgend_linux_amd64_v1/govgend"
GENESIS_URL: "https://atomone.fra1.digitaloceanspaces.com/govgen/govgen-1/genesis.json"
MUST_STAKED_AMOUNT: "1000000"
MUST_COMMMISSION_RATE: "0.000000000000000000"
MUST_COMMMISSION_MAX_RATE: "0.000000000000000000"
MUST_COMMMISSION_MAX_CHANGE_RATE: "0.000000000000000000"
jobs:
check-gentx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get changed files
id: files
uses: jitterbit/get-changed-files@v1
- name: Check gentx values
run: |
for f in ${{ steps.files.outputs.all }}; do
if [[ "$f" == "govgen-1/gentx/"* ]]; then
echo "checking file: $f"
COMMISSION_RATE=$(cat $f | jq -r '.body.messages[0].commission.rate')
COMMISSION_MAX_RATE=$(cat $f | jq -r '.body.messages[0].commission.max_rate')
COMMISSION_MAX_CHANGE_RATE=$(cat $f | jq -r '.body.messages[0].commission.max_change_rate')
STAKED_AMOUNT=$(cat $f | jq -r '.body.messages[0].value.amount')
[ $COMMISSION_RATE == "$MUST_COMMISSION_RATE" ] || exit 1
[ $COMMISSION_MAX_RATE == "$MUST_COMMISSION_MAX_RATE" ] || exit 1
[ $COMMISSION_MAX_CHANGE_RATE == "$MUST_COMMISSION_MAX_CHANGE_RATE" ] || exit 1
[ $STAKED_AMOUNT == $MUST_STAKED_AMOUNT ] || exit 1
fi
done
validate-gentx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download govgend
run: |
echo $PATH
wget -O /usr/local/bin/govgend "${GOVGEND_URL}"
chmod +x /usr/bin/govgend
- name: Collect gentxs
run: |
govgend init github-ci --chain-id govgen-1
wget -O /root/.govgen/config/genesis.json $GENESIS_URL
for f in "govgen-1/gentx/*.json"; do
ADDR=$(cat $f | jq -r '.body.messages[0].delegator_address')
govgend add-genesis-account $ADDR 10000000ugovgen
done
govgend collect-gentx --gentx-dir ./govgen-1/gentx
- name: Validate genesis
run: |
govgend validate-genesis