Skip to content

Commit

Permalink
check valid gentx (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhernandezb authored Jul 13, 2021
1 parent 2909e66 commit 133886a
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 2 deletions.
17 changes: 15 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,28 @@ steps:
GITHUB_TOKEN:
from_secret: github_token
- name: collect
image: publicawesome/stargaze:develop
image: publicawesome/stargaze:0.9.1
commands:
- sh ./check.sh
- name: runner
image: publicawesome/stargaze:0.9.1
detach: true
commands:
- apk add jq
- sh ./run.sh
- name: check_runner
image: alpine:3
commands:
- apk add curl
- apk add jq
- sh ./check-running-node.sh

trigger:
event:
- pull_request

---
kind: signature
hmac: 74faa35fc712dd6a99de2f8bfa716b1775485b116b9d549810cfcee1ffbef285
hmac: 682577d282dcaedb9d72319d71325feecb71e29b15bbe021d1ee51188b197818

...
6 changes: 6 additions & 0 deletions check-running-node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#/bin/sh
FILE=./check-gen-tx
if [ -f "$FILE" ]; then
sleep 50
curl http://runner:26657/status
fi
46 changes: 46 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#/bin/sh
FILE=./check-gen-tx
DENOM=ustarx
CHAIN_ID=cygnusx-1
ONE_HOUR=3600
ONE_DAY=$(($ONE_HOUR * 24))
ONE_YEAR=$(($ONE_DAY * 365))
VALIDATOR_COINS=1000000000000$DENOM


if [ -f "$FILE" ]; then
starsd init validator --chain-id cygnusx-1
if [ "$1" == "mainnet" ]
then
LOCKUP=ONE_YEAR
else
LOCKUP=ONE_DAY
fi
echo "Lockup period is $LOCKUP"

echo "Adding vesting accounts..."
GENESIS_TIME=$(jq '.genesis_time' ~/.starsd/config/genesis.json | tr -d '"')
echo "Genesis time is $GENESIS_TIME"
if [[ "$OSTYPE" == "darwin"* ]]; then
GENESIS_UNIX_TIME=$(TZ=UTC gdate "+%s" -d $GENESIS_TIME)
else
GENESIS_UNIX_TIME=$(TZ=UTC date "+%s" -d $GENESIS_TIME)
fi
vesting_start_time=$(($GENESIS_UNIX_TIME + $LOCKUP))
vesting_end_time=$(($vesting_start_time + $LOCKUP))

sed -i 's#tcp://127.0.0.1:26657#tcp://0.0.0.0:26657#g' ~/.starsd/config/config.toml
mkdir -p ~/.starsd/config/gentx
echo "Processing validators..."
for i in $CHAIN_ID/gentx/*.json; do
echo $i
starsd add-genesis-account $(jq -r '.body.messages[0].delegator_address' $i) $VALIDATOR_COINS \
--vesting-amount $VALIDATOR_COINS \
--vesting-start-time $vesting_start_time \
--vesting-end-time $vesting_end_time
cp $i ~/.starsd/config/gentx/
done
starsd collect-gentxs
starsd validate-genesis
starsd start
fi

0 comments on commit 133886a

Please sign in to comment.