Fix Makefile, remove no longer needed demo!

This commit is contained in:
Ethan Frey 2017-06-16 17:10:45 +02:00
parent 6eac364c43
commit f75ebca3ae
12 changed files with 1 additions and 319 deletions

View File

@ -24,7 +24,7 @@ test_cli: tests/cli/shunit2
# sudo apt-get install jq
@./tests/cli/basictx.sh
@./tests/cli/counter.sh
@./clitest/ibc.sh
@./tests/cli/ibc.sh
get_vendor_deps: tools
glide install

View File

@ -22,6 +22,5 @@ test:
- "cd $REPO && glide install && go install ./cmd/..."
- ls $GOPATH/bin
- "cd $REPO && make test"
- "cd $REPO/demo && bash start.sh"

View File

@ -1,10 +0,0 @@
#! /bin/bash
killall -9 basecoin tendermint
TMHOME=./data/chain1 tendermint unsafe_reset_all
TMHOME=./data/chain2 tendermint unsafe_reset_all
rm ./*.log
rm ./data/chain1/*.bak
rm ./data/chain2/*.bak

View File

@ -1,11 +0,0 @@
# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml
proxy_app = "tcp://127.0.0.1:46658"
moniker = "anonymous"
node_laddr = "tcp://0.0.0.0:46656"
seeds = ""
fast_sync = true
db_backend = "leveldb"
log_level = "info"
rpc_laddr = "tcp://0.0.0.0:46657"

View File

@ -1,31 +0,0 @@
{
"app_hash": "",
"chain_id": "test_chain_1",
"genesis_time": "0001-01-01T00:00:00.000Z",
"validators": [
{
"amount": 10,
"name": "",
"pub_key": {
"type": "ed25519",
"data":"D6EBB92440CF375054AA59BCF0C99D596DEEDFFB2543CAE1BA1908B72CF9676A"
}
}
],
"app_options": {
"accounts": [
{
"pub_key": {
"type": "ed25519",
"data": "B3588BDC92015ED3CDB6F57A86379E8C79A7111063610B7E625487C76496F4DF"
},
"coins": [
{
"denom": "mycoin",
"amount": 9007199254740992
}
]
}
]
}
}

View File

@ -1,12 +0,0 @@
{
"address": "D397BC62B435F3CF50570FBAB4340FE52C60858F",
"priv_key": {
"type": "ed25519",
"data": "39E75AA1CF7BC710585977EFC375CD1730519186BD231478C339F2819C3C26E7B3588BDC92015ED3CDB6F57A86379E8C79A7111063610B7E625487C76496F4DF"
},
"pub_key": {
"type": "ed25519",
"data": "B3588BDC92015ED3CDB6F57A86379E8C79A7111063610B7E625487C76496F4DF"
}
}

View File

@ -1 +0,0 @@
{"address":"EBB0B4A899973C524A6BB18A161056A55F590F41","pub_key":{"type":"ed25519","data":"D6EBB92440CF375054AA59BCF0C99D596DEEDFFB2543CAE1BA1908B72CF9676A"},"last_height":0,"last_round":0,"last_step":0,"last_signature":null,"priv_key":{"type":"ed25519","data":"5FFDC1EA5FA2CA4A0A5503C86D2D348C5B401AD80FAA1899508F1ED00D8982E8D6EBB92440CF375054AA59BCF0C99D596DEEDFFB2543CAE1BA1908B72CF9676A"}}

View File

@ -1,11 +0,0 @@
# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml
proxy_app = "tcp://127.0.0.1:46658"
moniker = "anonymous"
node_laddr = "tcp://0.0.0.0:46656"
seeds = ""
fast_sync = true
db_backend = "leveldb"
log_level = "info"
rpc_laddr = "tcp://0.0.0.0:46657"

View File

@ -1,31 +0,0 @@
{
"app_hash": "",
"chain_id": "test_chain_2",
"genesis_time": "0001-01-01T00:00:00.000Z",
"validators": [
{
"amount": 10,
"name": "",
"pub_key": {
"type": "ed25519",
"data": "9A76DDE4CA4EE660C073D288DBE4F8A128F23857881A95F18167682D47E7058F"
}
}
],
"app_options": {
"accounts": [
{
"pub_key": {
"type": "ed25519",
"data": "0628C8E6C2D50B15764B443394E06C6A64F3082CE966A2A8C1A55A4D63D0FC5D"
},
"coins": [
{
"denom": "mycoin",
"amount": 9007199254740992
}
]
}
]
}
}

View File

@ -1,11 +0,0 @@
{
"address": "053BA0F19616AFF975C8756A2CBFF04F408B4D47",
"priv_key": {
"type": "ed25519",
"data": "22920C428043D869987F253D7C9B2305E7010642C40CE88A52C9F6CE5ACC42080628C8E6C2D50B15764B443394E06C6A64F3082CE966A2A8C1A55A4D63D0FC5D"
},
"pub_key": {
"type": "ed25519",
"data": "0628C8E6C2D50B15764B443394E06C6A64F3082CE966A2A8C1A55A4D63D0FC5D"
}
}

View File

@ -1 +0,0 @@
{"address":"D42CFCB9C42DF9A73143EEA89255D1DF027B6240","pub_key":{"type":"ed25519","data":"9A76DDE4CA4EE660C073D288DBE4F8A128F23857881A95F18167682D47E7058F"},"last_height":0,"last_round":0,"last_step":0,"last_signature":null,"priv_key":{"type":"ed25519","data":"6353FAF4ADEB03EA496A9EAE5BE56C4C6A851CB705401788184FDC9198413C2C9A76DDE4CA4EE660C073D288DBE4F8A128F23857881A95F18167682D47E7058F"}}

View File

@ -1,198 +0,0 @@
#! /bin/bash
set -e
cd $GOPATH/src/github.com/tendermint/basecoin/demo
LOG_DIR="."
TM_VERSION="master"
#TM_VERSION="v0.10.0"
if [[ "$CIRCLECI" == "true" ]]; then
# set log dir
LOG_DIR="${CIRCLE_ARTIFACTS}"
# install tendermint
set +e
go get github.com/tendermint/tendermint
pushd $GOPATH/src/github.com/tendermint/tendermint
git checkout $TM_VERSION
glide install
go install ./cmd/tendermint
popd
set -e
fi
set -u
function ifExit() {
if [[ "$?" != 0 ]]; then
echo "FAIL"
exit 1
fi
}
function removeQuotes() {
temp="${1%\"}"
temp="${temp#\"}"
echo "$temp"
}
function waitForNode() {
addr=$1
set +e
curl -s $addr/status > /dev/null
ERR=$?
i=0
while [ "$ERR" != 0 ]; do
if [[ "$i" == 10 ]]; then
echo "waited too long for chain to start"
exit 1
fi
echo "...... still waiting on $addr"
sleep 1
curl -s $addr/status > /dev/null
ERR=$?
i=$((i+1))
done
set -e
echo "... node $addr is up"
}
function waitForBlock() {
addr=$1
b1=`curl -s $addr/status | jq .result.latest_block_height`
b2=$b1
while [ "$b2" == "$b1" ]; do
echo "Waiting for node $addr to commit a block ..."
sleep 1
b2=`curl -s $addr/status | jq .result.latest_block_height`
done
}
# make basecoin root vars
export BCHOME="."
BCHOME1="./data/chain1"
BCHOME2="./data/chain2"
# grab the chain ids
CHAIN_ID1=$(cat $BCHOME1/genesis.json | jq .chain_id)
CHAIN_ID1=$(removeQuotes $CHAIN_ID1)
CHAIN_ID2=$(cat $BCHOME2/genesis.json | jq .chain_id)
CHAIN_ID2=$(removeQuotes $CHAIN_ID2)
echo "CHAIN_ID1: $CHAIN_ID1"
echo "CHAIN_ID2: $CHAIN_ID2"
# make reusable chain flags
CHAIN_FLAGS1="--chain_id $CHAIN_ID1 --from $BCHOME1/key.json"
CHAIN_FLAGS2="--chain_id $CHAIN_ID2 --from $BCHOME2/key.json --node tcp://localhost:36657"
echo ""
echo "... starting chains"
echo ""
# start the first node
TMHOME=$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
TMHOME=$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"
echo ""
waitForNode localhost:46657
waitForNode localhost:36657
# TODO: remove the sleep
# Without it we sometimes get "Account bytes are empty for address: 053BA0F19616AFF975C8756A2CBFF04F408B4D47"
sleep 3
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"
echo ""
# send coins from chain1 to an address on chain2
# TODO: dont hardcode the address
basecoin tx send --amount 10mycoin $CHAIN_FLAGS1 --to $CHAIN_ID2/053BA0F19616AFF975C8756A2CBFF04F408B4D47
ifExit
# alternative way to create packets (for testing)
# basecoin tx ibc --amount 10mycoin $CHAIN_FLAGS1 packet create --ibc_from $CHAIN_ID1 --to $CHAIN_ID2 --type coin --payload $PAYLOAD --ibc_sequence 0
echo ""
echo "... querying for packet data"
echo ""
# query for the packet data and proof
# since we only sent one packet, the sequence number is 0
QUERY_RESULT=$(basecoin query ibc,egress,$CHAIN_ID1,$CHAIN_ID2,0)
ifExit
HEIGHT=$(echo $QUERY_RESULT | jq .height)
PACKET=$(echo $QUERY_RESULT | jq .value)
PROOF=$(echo $QUERY_RESULT | jq .proof)
PACKET=$(removeQuotes $PACKET)
PROOF=$(removeQuotes $PROOF)
echo ""
echo "QUERY_RESULT: $QUERY_RESULT"
echo "HEIGHT: $HEIGHT"
echo "PACKET: $PACKET"
echo "PROOF: $PROOF"
# the query returns the height of the next block, which contains the app hash
# but which may not be committed yet, so we have to wait for it to query the commit
echo ""
echo "... waiting for a block to be committed"
echo ""
waitForBlock localhost:46657
waitForBlock localhost:36657
echo ""
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)
COMMIT=$(removeQuotes $COMMIT)
echo ""
echo "HEADER_AND_COMMIT: $HEADER_AND_COMMIT"
echo "HEADER: $HEADER"
echo "COMMIT: $COMMIT"
echo ""
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,0
ifExit
echo ""
echo "DONE!"