forked from atomone-hub/govgen-validators
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (60 loc) · 2.42 KB
/
gentx.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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"
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')
# bc return 1 when success
echo "$COMMISSION_RATE == 0" | bc && echo "commission_rate must be 0" && exit 1
echo "$COMMISSION_MAX_RATE == 0" | bc && echo "commission_max_rate must be 0" && exit 1
echo "$COMMISSION_MAX_CHANGE_RATE == 0" | bc && echo "commission_max_change_rate must be 0" && exit 1
echo "$STAKED_AMOUNT == $MUST_STAKED_AMOUNT | bc" && echo "staked amount must be $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