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

Faucet don't give a second chance #2210

Merged
merged 13 commits into from
Mar 12, 2019
25 changes: 18 additions & 7 deletions .aws/faucet.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

AMOUNTS=10000000stake
AMOUNTP=5photino
AMOUNTC=1cococoin
AMOUNTP=5000000photino
# AMOUNTC=123123cococoin

ACCOUNT=$1
PASSWORD=$2
Expand All @@ -19,14 +19,25 @@ do
DESTINATION=$(echo $row | awk '{print $4}')
if [[ ${#DESTINATION} -eq 45 ]];
then
# work only on stuff that have the right length
ADDRESS=$(./gaiacli keys show ${ACCOUNT} --home . --address)
echo ${PASSWORD} | ./gaiacli tx send ${DESTINATION} ${AMOUNTS} --home . --from ${ADDRESS} --chain-id=${NETWORK}
echo ${PASSWORD} | ./gaiacli tx send ${DESTINATION} ${AMOUNTP} --home . --from ${ADDRESS} --chain-id=${NETWORK}
echo ${PASSWORD} | ./gaiacli tx send ${DESTINATION} ${AMOUNTC} --home . --from ${ADDRESS} --chain-id=${NETWORK}
ACCOUNT_INFO=$(./gaiacli query account ${DESTINATION} --chain-id ${NETWORK} --trust-node --home .)
dt=$(date '+%d/%m/%Y %H:%M:%S');
if [[ ${ACCOUNT_INFO} == *"stake"* ]]; then
echo "$dt - $DESTINATION already funded, accounts are only funded once"
else
# work only on stuff that have the right length
ADDRESS=$(./gaiacli keys show ${ACCOUNT} --home . --address)
echo "stakes $AMOUNTS at $DESTINATION"
echo ${PASSWORD} | ./gaiacli tx send ${DESTINATION} ${AMOUNTS} --home . --from ${ADDRESS} --chain-id=${NETWORK}
sleep 5s # TODO: should be smarter, check if block was created or not
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smaller timeout doesn't work? @alessio this was the problem I explained

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah in this moment apparently that's the safest solution available

echo "photino $AMOUNTP at $DESTINATION"
echo ${PASSWORD} | ./gaiacli tx send ${DESTINATION} ${AMOUNTP} --home . --from ${ADDRESS} --chain-id=${NETWORK}
# echo ${PASSWORD} | ./gaiacli tx send ${DESTINATION} ${AMOUNTC} --home . --from ${ADDRESS} --chain-id=${NETWORK}
echo "$dt - $DESTINATION funded, enjoy!"
fi
fi
# Remove this address from the ones that needs money
aws s3 rm s3://cosmos-gaia/addresses/${DESTINATION}
done
fi
sleep 10s
done
4 changes: 2 additions & 2 deletions .aws/first.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ NODEID=$(./gaiad tendermint show-node-id --home .)

# Create our main account and add it to the genesis with a lot of money
echo ${PASSWORD} | ./gaiacli keys add ${ACCOUNT} --home . > account_address.log
./gaiad add-genesis-account $(./gaiacli keys show ${ACCOUNT} --home . --address) 100000000000000000stake,999000000000photino,123123123123cococoin --home .
./gaiad add-genesis-account $(./gaiacli keys show ${ACCOUNT} --home . --address) 1000000000000000000000stake,100000000000000000000photino,123123123123123123cococoin --home .
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not 9999999999999999999999999999999 so we don't run out

Copy link
Contributor Author

@sabau sabau Mar 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

18446744073709551615 should be the biggest available

go Tour

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol ok why not that number then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are already overflowing XD:

1000000000000000000000
18446744073709551615

So probably we already have everything we can

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, on SDK I found out big integers are used so we have way more than 64 bits, as soon as I'm sure about the number of bits I'll update this number


echo ${PASSWORD} | ./gaiad gentx --name ${ACCOUNT} --home . --home-client .
./gaiad collect-gentxs --home .
Expand All @@ -26,6 +26,6 @@ aws s3 cp config/genesis.json s3://cosmos-gaia/genesis.json
# boot proper nodes in reachable detached sessions
screen -dmS gaia ./gaiad start --home .
screen -dmS rest ./gaiacli rest-server --laddr tcp://0.0.0.0:${API_PORT} --home . --node http://localhost:${PORT} --chain-id ${NETWORK} --trust-node true
screen -dmS faucet ./faucet.sh ${ACCOUNT} ${PASSWORD} ${NETWORK}
screen -dmSL faucet ./faucet.sh ${ACCOUNT} ${PASSWORD} ${NETWORK}

echo ${NODEID}
2 changes: 1 addition & 1 deletion .aws/others.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ aws s3 cp s3://cosmos-gaia/genesis.json config/genesis.json
NODEID=$(./gaiad tendermint show-node-id --home .)

# boot referring to the remote node
screen -dmS gaia ./gaiad start --home . --p2p.persistent_peers="$MAINNODEID@$MAINNODEIP:$((PORT))"
screen -dmSL gaia ./gaiad start --home . --p2p.persistent_peers="$MAINNODEID@$MAINNODEIP:$((PORT))"

# get the key to make my node validator
PUBKEY=$(./gaiad tendermint show-validator --home .)
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]


### Changed

- [#\2154](https://github.com/cosmos/voyager/pull/2154) Added ledger button and style updates @jbibla
Expand Down
4 changes: 2 additions & 2 deletions PENDING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
## [Unreleased]

### Added

- [\#2104](https://github.com/cosmos/voyager/issues/2104) fix transaction times @fedekunze
Expand All @@ -9,6 +7,8 @@
### Changed

- [#\2202](https://github.com/cosmos/voyager/pull/2202) Fix circle configuration for publishing @sabau
- [\#1805](https://github.com/cosmos/voyager/issues/1805) support all transaction types @fedekunze
- [\#2210](https://github.com/cosmos/voyager/pull/2210) Enrich faucet @sabau
- [#\2211](https://github.com/cosmos/voyager/pull/2211) simplified sidebar and mobile menu, cleaned up css, fixed tests @jbibla

### Fixed
Expand Down