-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
87 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: "gentx validation atomone-1" | ||
|
||
on: | ||
pull_request: {} | ||
push: | ||
paths: | ||
- atomone-1/gentx/*.json | ||
|
||
env: | ||
VERSION: "v1.0.0" | ||
GENTX_FILES: "./atomone-1/gentx/*.json" | ||
GENESIS_URL: "https://atomone.fra1.digitaloceanspaces.com/atomone/atomone-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 | ||
with: | ||
format: json | ||
|
||
- name: Check gentx values | ||
run: | | ||
for f in ${{ steps.files.outputs.all }}; do | ||
if [[ "$f" == "${GENTX_FILES}" ]]; 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 | ||
if [ "${COMMISSION_RATE}" != "0" ]; then | ||
echo error="Invalid commission rate." >> ${GITHUB_OUTPUT} | ||
exit 1 | ||
fi | ||
if [ "${COMMISSION_MAX_RATE}" != "0" ]; then | ||
echo error="Invalid commission max rate." >> ${GITHUB_OUTPUT} | ||
exit 1 | ||
fi | ||
if [ "${COMMISSION_MAX_CHANGE_RATE}" != "0" ]; then | ||
echo error="Invalid commission max change rate." >> ${GITHUB_OUTPUT} | ||
exit 1 | ||
fi | ||
if [ "${STAKED_AMOUNT}" != "${MUST_STAKED_AMOUNT}" ]; then | ||
echo error="Invalid staked amount." >> ${GITHUB_OUTPUT} | ||
exit 1 | ||
fi | ||
fi | ||
done | ||
validate-gentx: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download atomoned | ||
run: | | ||
wget -O /usr/local/bin/atomoned https://github.com/atomone-hub/atomone/releases/download/${VERSION}/atomoned-${VERSION}-linux-amd64 | ||
chmod +x /usr/local/bin/atomoned | ||
- name: Collect gentxs | ||
run: | | ||
atomoned init github-ci --chain-id atomone-1 | ||
# wget -O $HOME/.atomone/config/genesis.json $GENESIS_URL | ||
for f in ${GENTX_FILES}; do | ||
ADDR=$(cat $f | jq -r '.body.messages[0].delegator_address') | ||
atomoned add-genesis-account $ADDR 10000000uatomone | ||
done | ||
atomoned collect-gentxs --gentx-dir ./atomone-1/gentx | ||
- name: Validate genesis | ||
run: | | ||
atomoned validate-genesis |