Skip to content

Commit

Permalink
Merge PR #974: Clarify demo
Browse files Browse the repository at this point in the history
* update demo

* remove extra dev-env
  • Loading branch information
boojamya authored Sep 7, 2022
1 parent 830b5b9 commit ffc46dc
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 51 deletions.
40 changes: 0 additions & 40 deletions dev-env

This file was deleted.

2 changes: 1 addition & 1 deletion examples/demo/configs/chains/ibc-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"account-prefix": "cosmos",
"keyring-backend": "test",
"gas-adjustment": 1.5,
"gas-prices": "0.025stake",
"gas-prices": "0.025rice",
"debug": true,
"timeout": "10s",
"output-format": "json",
Expand Down
27 changes: 22 additions & 5 deletions examples/demo/dev-env
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,35 @@ sleep 3
# creates clients, connections and channels (all this happens in rly tx command)
rly tx link demo -d -t 3s
sleep 2
echo "Initial balances"
echo "-- Initial balances --"
echo "balance 0 $(rly q bal ibc-0)"
echo "balance 1 $(rly q bal ibc-1)"

echo "-- Sending IBC transaction... --"
rly tx transfer ibc-0 ibc-1 100000samoleans "$(rly keys show ibc-1)" channel-0 -d
rly tx transfer ibc-1 ibc-0 100000samoleans "$(rly keys show ibc-0)" channel-0 -d
sleep 5
# relay remaining packets and then finishes as opposed to starting a continuous listening loop with `rly start`

# relay remaining packets -- (could also be accomplished by running: `rly start`)
rly tx relay-packets demo channel-0 -d
sleep 5

# relay remaining acknowledgments -- (could also be accomplished by running: `rly start`)
rly tx relay-acknowledgements demo channel-0 -d
sleep 5
echo "-- Balances after packets are sent --"
echo "balance 0 $(rly q bal ibc-0)"
echo "balance 1 $(rly q bal ibc-1)"

echo "-- Sending tokens back to original wallet... --"
rly tx transfer ibc-1 ibc-0 100000transfer/channel-0/samoleans "$(rly keys show ibc-0)" channel-0 -d
sleep 5

rly tx relay-packets demo channel-0 -d
sleep 5
# relay remaining acknowledgments and then finishes as opposed to starting a continuous listening loop with `rly start`

rly tx relay-acknowledgements demo channel-0 -d
sleep 5
echo "Balances after packets are sent"

echo "-- Balances after sending packets back --"
echo "balance 0 $(rly q bal ibc-0)"
echo "balance 1 $(rly q bal ibc-1)"
10 changes: 7 additions & 3 deletions examples/demo/scripts/one-chain
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ RPCPORT=$4
P2PPORT=$5
PROFPORT=$6
GRPCPORT=$7
DENOM=$8
BASEDENOM=$9

if [ -z "$1" ]; then
display_usage "[BINARY] ($BINARY|akash)"
Expand Down Expand Up @@ -63,8 +65,8 @@ if ! mkdir -p $CHAINDIR/$CHAINID 2>/dev/null; then
fi

# Build genesis file incl account for passed address
coins="100000000000stake,100000000000samoleans"
delegate="100000000000stake"
coins="100000000000$DENOM,100000000000$BASEDENOM"
delegate="100000000000$DENOM"

redirect $BINARY --home $CHAINDIR/$CHAINID --chain-id $CHAINID init $CHAINID
sleep 1
Expand All @@ -89,14 +91,15 @@ if [ "$unamestr" = 'Linux' ]; then
fi

# Set proper defaults and change ports (use a different sed for Mac or Linux)
echo "Change settings in config.toml file..."
echo "Change settings in config.toml and genesis.json files..."
if [ $platform = 'linux' ]; then
sed -i 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:'"$RPCPORT"'"#g' $CHAINDIR/$CHAINID/config/config.toml
sed -i 's#"tcp://0.0.0.0:26656"#"tcp://0.0.0.0:'"$P2PPORT"'"#g' $CHAINDIR/$CHAINID/config/config.toml
sed -i 's#"localhost:6060"#"localhost:'"$P2PPORT"'"#g' $CHAINDIR/$CHAINID/config/config.toml
sed -i 's/timeout_commit = "5s"/timeout_commit = "1s"/g' $CHAINDIR/$CHAINID/config/config.toml
sed -i 's/timeout_propose = "3s"/timeout_propose = "1s"/g' $CHAINDIR/$CHAINID/config/config.toml
sed -i 's/index_all_keys = false/index_all_keys = true/g' $CHAINDIR/$CHAINID/config/config.toml
sed -i 's/"bond_denom": "stake"/"bond_denom": "'"$DENOM"'"/g' $CHAINDIR/$CHAINID/config/genesis.json
# sed -i '' 's#index-events = \[\]#index-events = \["message.action","send_packet.packet_src_channel","send_packet.packet_sequence"\]#g' $CHAINDIR/$CHAINID/config/app.toml
else
sed -i '' 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:'"$RPCPORT"'"#g' $CHAINDIR/$CHAINID/config/config.toml
Expand All @@ -105,6 +108,7 @@ else
sed -i '' 's/timeout_commit = "5s"/timeout_commit = "1s"/g' $CHAINDIR/$CHAINID/config/config.toml
sed -i '' 's/timeout_propose = "3s"/timeout_propose = "1s"/g' $CHAINDIR/$CHAINID/config/config.toml
sed -i '' 's/index_all_keys = false/index_all_keys = true/g' $CHAINDIR/$CHAINID/config/config.toml
sed -i '' 's/"bond_denom": "stake"/"bond_denom": "'"$DENOM"'"/g' $CHAINDIR/$CHAINID/config/genesis.json
# sed -i '' 's#index-events = \[\]#index-events = \["message.action","send_packet.packet_src_channel","send_packet.packet_sequence"\]#g' $CHAINDIR/$CHAINID/config/app.toml
fi

Expand Down
4 changes: 2 additions & 2 deletions examples/demo/scripts/two-chainz
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ chainid1=ibc-1

echo "Generating gaia configurations..."
mkdir -p $GAIA_DATA && cd $GAIA_DATA && cd ../
./scripts/one-chain gaiad $chainid0 ./data 26657 26656 6060 9090
./scripts/one-chain gaiad $chainid1 ./data 26557 26556 6061 9091
./scripts/one-chain gaiad $chainid0 ./data 26657 26656 6060 9090 stake samoleans
./scripts/one-chain gaiad $chainid1 ./data 26557 26556 6061 9091 rice beans

[ -f $GAIA_DATA/$chainid0.log ] && echo "$chainid0 initialized. Watch file $GAIA_DATA/$chainid0.log to see its execution."
[ -f $GAIA_DATA/$chainid1.log ] && echo "$chainid1 initialized. Watch file $GAIA_DATA/$chainid1.log to see its execution."
Expand Down

0 comments on commit ffc46dc

Please sign in to comment.