diff --git a/cmd/basecoin/main.go b/cmd/basecoin/main.go index 37a6e2da72..76ba6d5e93 100644 --- a/cmd/basecoin/main.go +++ b/cmd/basecoin/main.go @@ -29,5 +29,7 @@ func main() { ) cmd := cli.PrepareMainCmd(RootCmd, "BC", os.ExpandEnv("$HOME/.basecoin")) - cmd.Execute() + if err := cmd.Execute(); err != nil { + os.Exit(1) + } } diff --git a/demo/data/chain1/config.toml b/demo/data/chain1/config.toml index 9b97202d12..e2bcb49fff 100644 --- a/demo/data/chain1/config.toml +++ b/demo/data/chain1/config.toml @@ -7,5 +7,5 @@ node_laddr = "tcp://0.0.0.0:46656" seeds = "" fast_sync = true db_backend = "leveldb" -log_level = "notice" +log_level = "info" rpc_laddr = "tcp://0.0.0.0:46657" diff --git a/demo/data/chain2/config.toml b/demo/data/chain2/config.toml index 9b97202d12..e2bcb49fff 100644 --- a/demo/data/chain2/config.toml +++ b/demo/data/chain2/config.toml @@ -7,5 +7,5 @@ node_laddr = "tcp://0.0.0.0:46656" seeds = "" fast_sync = true db_backend = "leveldb" -log_level = "notice" +log_level = "info" rpc_laddr = "tcp://0.0.0.0:46657" diff --git a/demo/start.sh b/demo/start.sh index 4ce2305ec4..20335f7392 100644 --- a/demo/start.sh +++ b/demo/start.sh @@ -23,6 +23,13 @@ fi set -u +function ifExit() { + if [[ "$?" != 0 ]]; then + echo "FAIL" + exit 1 + fi +} + function removeQuotes() { temp="${1%\"}" temp="${temp#\"}" @@ -84,11 +91,15 @@ echo "... starting chains" echo "" # start the first node TMROOT=$BCHOME1 tendermint node --p2p.skip_upnp --log_level=info &> $LOG_DIR/chain1_tendermint.log & +ifExit BCHOME=$BCHOME1 basecoin start --without-tendermint &> $LOG_DIR/chain1_basecoin.log & +ifExit # start the second node TMROOT=$BCHOME2 tendermint node --p2p.skip_upnp --log_level=info --p2p.laddr tcp://localhost:36656 --rpc_laddr tcp://localhost:36657 --proxy_app tcp://localhost:36658 &> $LOG_DIR/chain2_tendermint.log & +ifExit BCHOME=$BCHOME2 basecoin start --address tcp://localhost:36658 --without-tendermint &> $LOG_DIR/chain2_basecoin.log & +ifExit echo "" echo "... waiting for chains to start" @@ -105,6 +116,7 @@ echo "... registering chain1 on chain2" echo "" # register chain1 on chain2 basecoin tx ibc --amount 10mycoin $CHAIN_FLAGS2 register --ibc_chain_id $CHAIN_ID1 --genesis $BCHOME1/genesis.json +ifExit echo "" echo "... creating egress packet on chain1" @@ -112,12 +124,14 @@ echo "" # create a packet on chain1 destined for chain2 PAYLOAD="DEADBEEF" #TODO basecoin tx ibc --amount 10mycoin $CHAIN_FLAGS1 packet create --ibc_from $CHAIN_ID1 --to $CHAIN_ID2 --type coin --payload $PAYLOAD --ibc_sequence 1 +ifExit echo "" echo "... querying for packet data" echo "" # query for the packet data and proof QUERY_RESULT=$(basecoin query ibc,egress,$CHAIN_ID1,$CHAIN_ID2,1) +ifExit HEIGHT=$(echo $QUERY_RESULT | jq .height) PACKET=$(echo $QUERY_RESULT | jq .value) PROOF=$(echo $QUERY_RESULT | jq .proof) @@ -144,6 +158,7 @@ echo "... querying for block data" echo "" # get the header and commit for the height HEADER_AND_COMMIT=$(basecoin block $HEIGHT) +ifExit HEADER=$(echo $HEADER_AND_COMMIT | jq .hex.header) HEADER=$(removeQuotes $HEADER) COMMIT=$(echo $HEADER_AND_COMMIT | jq .hex.commit) @@ -158,18 +173,21 @@ echo "... updating state of chain1 on chain2" echo "" # update the state of chain1 on chain2 basecoin tx ibc --amount 10mycoin $CHAIN_FLAGS2 update --header 0x$HEADER --commit 0x$COMMIT +ifExit echo "" echo "... posting packet from chain1 on chain2" echo "" # post the packet from chain1 to chain2 basecoin tx ibc --amount 10mycoin $CHAIN_FLAGS2 packet post --ibc_from $CHAIN_ID1 --height $HEIGHT --packet 0x$PACKET --proof 0x$PROOF +ifExit echo "" echo "... checking if the packet is present on chain2" echo "" # query for the packet on chain2 basecoin query --node tcp://localhost:36657 ibc,ingress,test_chain_2,test_chain_1,1 +ifExit echo "" echo "DONE!"