mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-14 05:41:21 +00:00
tests: broadcast_tx with tmsp; p2p
This commit is contained in:
@ -1236,6 +1236,7 @@ func (cs *ConsensusState) finalizeCommit(height int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// txs committed, bad ones removed from mepool; fire events
|
// txs committed, bad ones removed from mepool; fire events
|
||||||
|
// NOTE: the block.AppHash wont reflect these txs until the next block
|
||||||
eventCache.Flush()
|
eventCache.Flush()
|
||||||
|
|
||||||
// Save to blockStore.
|
// Save to blockStore.
|
||||||
|
7
scripts/glide/parse.sh
Normal file
7
scripts/glide/parse.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
GLIDE=$1
|
||||||
|
LIB=$2
|
||||||
|
|
||||||
|
cat $GLIDE | grep -A1 $LIB | grep -v $LIB | awk '{print $2}'
|
@ -7,12 +7,7 @@ IFS=$'\n\t'
|
|||||||
GLIDE=$1
|
GLIDE=$1
|
||||||
LIB=$2
|
LIB=$2
|
||||||
|
|
||||||
# get vendored commit for given lib
|
OLD_COMMIT=`bash scripts/glide/parse.sh $GLIDE $LIB`
|
||||||
function parseGlide() {
|
|
||||||
cat $1 | grep -A1 $2 | grep -v $2 | awk '{print $2}'
|
|
||||||
}
|
|
||||||
|
|
||||||
OLD_COMMIT=`parseGlide $GLIDE $LIB`
|
|
||||||
|
|
||||||
PWD=`pwd`
|
PWD=`pwd`
|
||||||
cd $GOPATH/src/github.com/tendermint/$LIB
|
cd $GOPATH/src/github.com/tendermint/$LIB
|
11
scripts/install_tmsp_apps.sh
Normal file
11
scripts/install_tmsp_apps.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
go get github.com/tendermint/tmsp/...
|
||||||
|
|
||||||
|
COMMIT=`bash scripts/glide/parse.sh $(pwd)/glide.lock tmsp`
|
||||||
|
|
||||||
|
cd $GOPATH/src/github.com/tendermint/tmsp
|
||||||
|
git checkout $COMMIT
|
||||||
|
go install ./cmd/...
|
||||||
|
|
||||||
|
|
@ -1,7 +1,23 @@
|
|||||||
# Pull base image.
|
# Pull base image.
|
||||||
FROM golang:1.6
|
FROM golang:1.6
|
||||||
|
|
||||||
|
# Grab deps (jq, hexdump)
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
jq bsdmainutils && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENV TENDERMINT_ORG $GOPATH/src/github.com/tendermint/
|
ENV TENDERMINT_ORG $GOPATH/src/github.com/tendermint/
|
||||||
RUN mkdir -p $TENDERMINT_ORG
|
RUN mkdir -p $TENDERMINT_ORG
|
||||||
COPY . $TENDERMINT_ORG/tendermint
|
COPY . $TENDERMINT_ORG/tendermint
|
||||||
WORKDIR $TENDERMINT_ORG/tendermint
|
WORKDIR $TENDERMINT_ORG/tendermint
|
||||||
|
|
||||||
|
RUN make get_vendor_deps
|
||||||
|
|
||||||
|
RUN go install ./cmd/tendermint
|
||||||
|
|
||||||
|
RUN bash scripts/install_tmsp_apps.sh
|
||||||
|
|
||||||
|
|
||||||
|
EXPOSE 46656
|
||||||
|
EXPOSE 46657
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
function toHex() {
|
function toHex() {
|
||||||
echo -n $1 | hexdump -ve '1/1 "%.2X"'
|
echo -n $1 | hexdump -ve '1/1 "%.2X"'
|
||||||
@ -12,23 +13,31 @@ TESTNAME=$1
|
|||||||
# store key value pair
|
# store key value pair
|
||||||
KEY="abcd"
|
KEY="abcd"
|
||||||
VALUE="dcba"
|
VALUE="dcba"
|
||||||
curl localhost:46657/broadcast_tx_commit?tx=\"$(toHex $KEY=$VALUE)\"
|
curl 127.0.0.1:46657/broadcast_tx_commit?tx=\"$(toHex $KEY=$VALUE)\"
|
||||||
|
echo $?
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# we should be able to look up the key
|
# we should be able to look up the key
|
||||||
RESPONSE=`tmsp-cli query $KEY`
|
RESPONSE=`tmsp-cli query $KEY`
|
||||||
|
|
||||||
|
set +e
|
||||||
A=`echo $RESPONSE | grep exists=true`
|
A=`echo $RESPONSE | grep exists=true`
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
echo "Failed to find 'exists=true' for $KEY. Response:"
|
echo "Failed to find 'exists=true' for $KEY. Response:"
|
||||||
echo "$RESPONSE"
|
echo "$RESPONSE"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
set -e
|
||||||
|
|
||||||
# we should not be able to look up the value
|
# we should not be able to look up the value
|
||||||
RESPONSE=`tmsp-cli query $VALUE`
|
RESPONSE=`tmsp-cli query $VALUE`
|
||||||
|
set +e
|
||||||
A=`echo $RESPONSE | grep exists=true`
|
A=`echo $RESPONSE | grep exists=true`
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
echo "Found 'exists=true' for $VALUE when we should not have. Response:"
|
echo "Found 'exists=true' for $VALUE when we should not have. Response:"
|
||||||
echo "$RESPONSE"
|
echo "$RESPONSE"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
set -e
|
||||||
|
|
||||||
echo "Passed Test: $TESTNAME"
|
echo "Passed Test: $TESTNAME"
|
@ -8,37 +8,59 @@ set -e
|
|||||||
|
|
||||||
# TODO: install everything
|
# TODO: install everything
|
||||||
|
|
||||||
function dummy_over_socket(){
|
export TMROOT=$HOME/.tendermint_broadcast_tx
|
||||||
dummy > /dev/null &
|
|
||||||
tendermint node > tendermint.log &
|
|
||||||
sleep 3
|
|
||||||
|
|
||||||
|
function dummy_over_socket(){
|
||||||
|
rm -rf $TMROOT
|
||||||
|
tendermint init
|
||||||
|
echo "Starting dummy and tendermint"
|
||||||
|
dummy > /dev/null &
|
||||||
|
pid_dummy=$!
|
||||||
|
tendermint node > tendermint.log &
|
||||||
|
pid_tendermint=$!
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
echo "running test"
|
||||||
bash dummy_test.sh "Dummy over Socket"
|
bash dummy_test.sh "Dummy over Socket"
|
||||||
|
|
||||||
killall dummy tendermint
|
kill -9 $pid_dummy $pid_tendermint
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function counter_over_socket() {
|
function counter_over_socket() {
|
||||||
|
rm -rf $TMROOT
|
||||||
|
tendermint init
|
||||||
|
echo "Starting counter and tendermint"
|
||||||
counter --serial > /dev/null &
|
counter --serial > /dev/null &
|
||||||
|
pid_counter=$!
|
||||||
tendermint node > tendermint.log &
|
tendermint node > tendermint.log &
|
||||||
sleep 3
|
pid_tendermint=$!
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
echo "running test"
|
||||||
bash counter_test.sh "Counter over Socket"
|
bash counter_test.sh "Counter over Socket"
|
||||||
|
|
||||||
killall counter tendermint
|
kill -9 $pid_counter $pid_tendermint
|
||||||
}
|
}
|
||||||
|
|
||||||
function counter_over_grpc() {
|
function counter_over_grpc() {
|
||||||
|
rm -rf $TMROOT
|
||||||
|
tendermint init
|
||||||
|
echo "Starting counter and tendermint"
|
||||||
counter --serial --tmsp grpc > /dev/null &
|
counter --serial --tmsp grpc > /dev/null &
|
||||||
|
pid_counter=$!
|
||||||
tendermint node --tmsp grpc > tendermint.log &
|
tendermint node --tmsp grpc > tendermint.log &
|
||||||
sleep 3
|
pid_tendermint=$!
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
echo "running test"
|
||||||
bash counter_test.sh "Counter over GRPC"
|
bash counter_test.sh "Counter over GRPC"
|
||||||
|
|
||||||
killall counter tendermint
|
kill -9 $pid_counter $pid_tendermint
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cd $GOPATH/src/github.com/tendermint/tendermint/test/broadcast_tx
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"dummy_over_socket")
|
"dummy_over_socket")
|
||||||
dummy_over_socket
|
dummy_over_socket
|
||||||
@ -50,8 +72,11 @@ case "$1" in
|
|||||||
counter_over_grpc
|
counter_over_grpc
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
echo "Running all"
|
||||||
dummy_over_socket
|
dummy_over_socket
|
||||||
|
echo ""
|
||||||
counter_over_socket
|
counter_over_socket
|
||||||
|
echo ""
|
||||||
counter_over_grpc
|
counter_over_grpc
|
||||||
esac
|
esac
|
||||||
|
|
4
test/p2p/clean.sh
Normal file
4
test/p2p/clean.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
docker rm -vf $(docker ps -aq)
|
||||||
|
docker network rm local_testnet
|
9
test/p2p/data/app/init.sh
Executable file
9
test/p2p/data/app/init.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
# This is a sample bash script for a TMSP application
|
||||||
|
|
||||||
|
cd app/
|
||||||
|
git clone https://github.com/tendermint/nomnomcoin.git
|
||||||
|
cd nomnomcoin
|
||||||
|
npm install .
|
||||||
|
|
||||||
|
node app.js --eyes="unix:///data/tendermint/data/data.sock"
|
53
test/p2p/data/chain_config.json
Normal file
53
test/p2p/data/chain_config.json
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"id": "",
|
||||||
|
"val_set_id": "anon",
|
||||||
|
"validators": [
|
||||||
|
{
|
||||||
|
"validator": {
|
||||||
|
"id": "mach1",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"p2p_addr": "",
|
||||||
|
"rpc_addr": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"validator": {
|
||||||
|
"id": "mach2",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"p2p_addr": "",
|
||||||
|
"rpc_addr": "",
|
||||||
|
"index": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"validator": {
|
||||||
|
"id": "mach3",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"p2p_addr": "",
|
||||||
|
"rpc_addr": "",
|
||||||
|
"index": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"validator": {
|
||||||
|
"id": "mach4",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"p2p_addr": "",
|
||||||
|
"rpc_addr": "",
|
||||||
|
"index": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
20
test/p2p/data/core/init.sh
Executable file
20
test/p2p/data/core/init.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
# This is a sample bash script for tendermint core
|
||||||
|
# Edit this script before "mintnet start" to change
|
||||||
|
# the core blockchain engine.
|
||||||
|
|
||||||
|
TMREPO="github.com/tendermint/tendermint"
|
||||||
|
BRANCH="master"
|
||||||
|
|
||||||
|
go get -d $TMREPO/cmd/tendermint
|
||||||
|
### DEPENDENCIES (example)
|
||||||
|
# cd $GOPATH/src/github.com/tendermint/tmsp
|
||||||
|
# git fetch origin $BRANCH
|
||||||
|
# git checkout $BRANCH
|
||||||
|
### DEPENDENCIES END
|
||||||
|
cd $GOPATH/src/$TMREPO
|
||||||
|
git fetch origin $BRANCH
|
||||||
|
git checkout $BRANCH
|
||||||
|
make install
|
||||||
|
|
||||||
|
tendermint node --seeds="$TMSEEDS" --moniker="$TMNAME" --proxy_app="$PROXYAPP"
|
7
test/p2p/data/data/init.sh
Executable file
7
test/p2p/data/data/init.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
# This is a sample bash script for MerkleEyes.
|
||||||
|
# NOTE: mintnet expects data.sock to be created
|
||||||
|
|
||||||
|
go get github.com/tendermint/merkleeyes/cmd/merkleeyes
|
||||||
|
|
||||||
|
merkleeyes server --address="unix:///data/tendermint/data/data.sock"
|
39
test/p2p/data/mach1/core/genesis.json
Normal file
39
test/p2p/data/mach1/core/genesis.json
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"app_hash": "",
|
||||||
|
"chain_id": "chain-9ujDWI",
|
||||||
|
"genesis_time": "2016-06-24T20:01:19.322Z",
|
||||||
|
"validators": [
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach1",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach2",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach3",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach4",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
14
test/p2p/data/mach1/core/priv_validator.json
Normal file
14
test/p2p/data/mach1/core/priv_validator.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"address": "0E6925C3EE4C599DFF1536A5071AF4A26DF33635",
|
||||||
|
"last_height": 0,
|
||||||
|
"last_round": 0,
|
||||||
|
"last_step": 0,
|
||||||
|
"priv_key": [
|
||||||
|
1,
|
||||||
|
"547AA07C7A8CE16C5CB2A40C6C26D15B0A32960410A9F1EA6E50B636F1AB389ABE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116"
|
||||||
|
],
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116"
|
||||||
|
]
|
||||||
|
}
|
39
test/p2p/data/mach2/core/genesis.json
Normal file
39
test/p2p/data/mach2/core/genesis.json
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"app_hash": "",
|
||||||
|
"chain_id": "chain-9ujDWI",
|
||||||
|
"genesis_time": "2016-06-24T20:01:19.322Z",
|
||||||
|
"validators": [
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach1",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach2",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach3",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach4",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
14
test/p2p/data/mach2/core/priv_validator.json
Normal file
14
test/p2p/data/mach2/core/priv_validator.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"address": "99DBBD2AFC28FB5BAC5574AFAF0D9C806CED3B55",
|
||||||
|
"last_height": 0,
|
||||||
|
"last_round": 0,
|
||||||
|
"last_step": 0,
|
||||||
|
"priv_key": [
|
||||||
|
1,
|
||||||
|
"D047889E60502FC3129D0AB7F334B1838ED9ED1ECD99CBB96B71AD5ABF5A81436DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD"
|
||||||
|
],
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD"
|
||||||
|
]
|
||||||
|
}
|
39
test/p2p/data/mach3/core/genesis.json
Normal file
39
test/p2p/data/mach3/core/genesis.json
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"app_hash": "",
|
||||||
|
"chain_id": "chain-9ujDWI",
|
||||||
|
"genesis_time": "2016-06-24T20:01:19.322Z",
|
||||||
|
"validators": [
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach1",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach2",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach3",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach4",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
14
test/p2p/data/mach3/core/priv_validator.json
Normal file
14
test/p2p/data/mach3/core/priv_validator.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"address": "4C5F061DAC28660853904A66705B12CA2B317572",
|
||||||
|
"last_height": 0,
|
||||||
|
"last_round": 0,
|
||||||
|
"last_step": 0,
|
||||||
|
"priv_key": [
|
||||||
|
1,
|
||||||
|
"C1A4E47F349FC5F556F4A9A27BA776B94424C312BAA6CF6EE44B867348D7C3F2AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1"
|
||||||
|
],
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1"
|
||||||
|
]
|
||||||
|
}
|
39
test/p2p/data/mach4/core/genesis.json
Normal file
39
test/p2p/data/mach4/core/genesis.json
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"app_hash": "",
|
||||||
|
"chain_id": "chain-9ujDWI",
|
||||||
|
"genesis_time": "2016-06-24T20:01:19.322Z",
|
||||||
|
"validators": [
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach1",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach2",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach3",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": 1,
|
||||||
|
"name": "mach4",
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
14
test/p2p/data/mach4/core/priv_validator.json
Normal file
14
test/p2p/data/mach4/core/priv_validator.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"address": "86F6DA4B34F16D743D2D992B5ACB12F5E724CC2D",
|
||||||
|
"last_height": 0,
|
||||||
|
"last_round": 0,
|
||||||
|
"last_step": 0,
|
||||||
|
"priv_key": [
|
||||||
|
1,
|
||||||
|
"C4CC3ED28F020C2DBDA98BCDBF08C3CED370470E74F25E938D5D295E8E3D2B0C9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9"
|
||||||
|
],
|
||||||
|
"pub_key": [
|
||||||
|
1,
|
||||||
|
"9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9"
|
||||||
|
]
|
||||||
|
}
|
28
test/p2p/local_testnet.sh
Normal file
28
test/p2p/local_testnet.sh
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
DOCKER_IMAGE=$1
|
||||||
|
NETWORK_NAME=$2
|
||||||
|
|
||||||
|
cd $GOPATH/src/github.com/tendermint/tendermint
|
||||||
|
|
||||||
|
# create docker network
|
||||||
|
docker network create --driver bridge --subnet 172.57.0.0/16 $NETWORK_NAME
|
||||||
|
|
||||||
|
N=4
|
||||||
|
seeds="172.57.0.101:46656"
|
||||||
|
for i in `seq 2 $N`; do
|
||||||
|
seeds="$seeds,172.57.0.$((100+$i)):46656"
|
||||||
|
done
|
||||||
|
echo "Seeds: $seeds"
|
||||||
|
|
||||||
|
for i in `seq 1 $N`; do
|
||||||
|
# start tendermint container
|
||||||
|
docker run -d \
|
||||||
|
--net=$NETWORK_NAME \
|
||||||
|
--ip=172.57.0.$((100+$i)) \
|
||||||
|
--name local_testnet_$i \
|
||||||
|
--entrypoint tendermint \
|
||||||
|
-e TMROOT=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$i/core \
|
||||||
|
$DOCKER_IMAGE node --seeds $seeds --proxy_app=dummy
|
||||||
|
done
|
79
test/p2p/run_test.sh
Normal file
79
test/p2p/run_test.sh
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# wait for everyone to come online
|
||||||
|
echo "Waiting for nodes to come online"
|
||||||
|
for i in `seq 1 4`; do
|
||||||
|
addr="172.57.0.$((100+$i)):46657"
|
||||||
|
curl -s $addr/status > /dev/null
|
||||||
|
ERR=$?
|
||||||
|
while [ "$ERR" != 0 ]; do
|
||||||
|
sleep 1
|
||||||
|
curl -s $addr/status > /dev/null
|
||||||
|
ERR=$?
|
||||||
|
done
|
||||||
|
echo "... node $i is up"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
# run the test on each of them
|
||||||
|
for i in `seq 1 4`; do
|
||||||
|
addr="172.57.0.$((100+$i)):46657"
|
||||||
|
|
||||||
|
# - assert everyone has 3 other peers
|
||||||
|
N_PEERS=`curl -s $addr/net_info | jq '.result[1].peers | length'`
|
||||||
|
while [ "$N_PEERS" != 3 ]; do
|
||||||
|
echo "Waiting for node $i to connect to all peers ..."
|
||||||
|
sleep 1
|
||||||
|
N_PEERS=`curl -s $addr/net_info | jq '.result[1].peers | length'`
|
||||||
|
done
|
||||||
|
|
||||||
|
# - assert block height is greater than 1
|
||||||
|
BLOCK_HEIGHT=`curl -s $addr/status | jq .result[1].latest_block_height`
|
||||||
|
while [ "$BLOCK_HEIGHT" -le 1 ]; do
|
||||||
|
echo "Waiting for node $i to commit a block ..."
|
||||||
|
sleep 1
|
||||||
|
BLOCK_HEIGHT=`curl -s $addr/status | jq .result[1].latest_block_height`
|
||||||
|
done
|
||||||
|
echo "Node $i is connected to all peers and at block $BLOCK_HEIGHT"
|
||||||
|
|
||||||
|
# current state
|
||||||
|
HASH1=`curl -s $addr/status | jq .result[1].latest_app_hash`
|
||||||
|
|
||||||
|
# - send a tx
|
||||||
|
TX=\"aadeadbeefbeefbeef0$i\"
|
||||||
|
echo "Broadcast Tx $TX"
|
||||||
|
curl -s $addr/broadcast_tx_commit?tx=$TX
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# we need to wait another block to get the new app_hash
|
||||||
|
h1=`curl -s $addr/status | jq .result[1].latest_block_height`
|
||||||
|
h2=$h1
|
||||||
|
while [ "$h2" == "$h1" ]; do
|
||||||
|
sleep 1
|
||||||
|
h2=`curl -s $addr/status | jq .result[1].latest_block_height`
|
||||||
|
done
|
||||||
|
|
||||||
|
# check that hash was updated
|
||||||
|
HASH2=`curl -s $addr/status | jq .result[1].latest_app_hash`
|
||||||
|
if [[ "$HASH1" == "$HASH2" ]]; then
|
||||||
|
echo "Expected state hash to update from $HASH1. Got $HASH2"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check we get the same new hash on all other nodes
|
||||||
|
for j in `seq 1 4`; do
|
||||||
|
if [[ "$i" != "$j" ]]; then
|
||||||
|
HASH3=`curl -s 172.57.0.$((100+$j)):46657/status | jq .result[1].latest_app_hash`
|
||||||
|
|
||||||
|
if [[ "$HASH2" != "$HASH3" ]]; then
|
||||||
|
echo "App hash for node $j doesn't match. Got $HASH3, expected $HASH2"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "All nodes are up to date"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "PASS"
|
10
test/p2p/test.sh
Normal file
10
test/p2p/test.sh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
DOCKER_IMAGE=$1
|
||||||
|
NETWORK_NAME=local_testnet
|
||||||
|
|
||||||
|
# start the testnet on a local network
|
||||||
|
bash test/p2p/local_testnet.sh $DOCKER_IMAGE $NETWORK_NAME
|
||||||
|
|
||||||
|
# run the test
|
||||||
|
bash test/p2p/test_client.sh $DOCKER_IMAGE $NETWORK_NAME test/p2p/run_test.sh
|
16
test/p2p/test_client.sh
Normal file
16
test/p2p/test_client.sh
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
DOCKER_IMAGE=$1
|
||||||
|
NETWORK_NAME=$2
|
||||||
|
CMD=$3
|
||||||
|
|
||||||
|
# run the test container on the local network
|
||||||
|
docker run -t \
|
||||||
|
--rm \
|
||||||
|
-v $GOPATH/src/github.com/tendermint/tendermint/test/p2p/:/go/src/github.com/tendermint/tendermint/test/p2p \
|
||||||
|
--net=$NETWORK_NAME \
|
||||||
|
--ip=172.57.0.99 \
|
||||||
|
--name test_container \
|
||||||
|
--entrypoint bash \
|
||||||
|
$DOCKER_IMAGE $CMD
|
@ -1,14 +1,22 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
echo `pwd`
|
echo `pwd`
|
||||||
|
|
||||||
BRANCH=`git rev-parse --abbrev-ref HEAD`
|
BRANCH=`git rev-parse --abbrev-ref HEAD`
|
||||||
echo "Current branch: $BRANCH"
|
echo "Current branch: $BRANCH"
|
||||||
|
|
||||||
make get_vendor_deps
|
# go test --race github.com/tendermint/tendermint/...
|
||||||
|
|
||||||
make test_race
|
make test_race
|
||||||
|
|
||||||
|
# run the broadcast_tx tests
|
||||||
|
bash test/broadcast_tx/test.sh
|
||||||
|
|
||||||
if [[ "$BRANCH" == "master" || "$BRANCH" == "staging" ]]; then
|
if [[ "$BRANCH" == "master" || "$BRANCH" == "staging" ]]; then
|
||||||
|
echo ""
|
||||||
|
echo "* branch $BRANCH; testing libs"
|
||||||
|
# checkout every github.com/tendermint dir and run its tests
|
||||||
bash test/test_libs.sh
|
bash test/test_libs.sh
|
||||||
|
|
||||||
|
# TODO: mintnet/netmon
|
||||||
fi
|
fi
|
||||||
|
11
test/test.sh
11
test/test.sh
@ -8,5 +8,16 @@
|
|||||||
# If we pushed to STAGING or MASTER,
|
# If we pushed to STAGING or MASTER,
|
||||||
# it will also run the tests for all dependencies
|
# it will also run the tests for all dependencies
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "* building docker file"
|
||||||
docker build -t tester -f ./test/Dockerfile .
|
docker build -t tester -f ./test/Dockerfile .
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "* running go tests and broadcast tests"
|
||||||
docker run -t tester bash test/run_test.sh
|
docker run -t tester bash test/run_test.sh
|
||||||
|
|
||||||
|
# test basic network connectivity
|
||||||
|
# by starting a local testnet and checking peers connect and make blocks
|
||||||
|
echo ""
|
||||||
|
echo "* running basic peer tests"
|
||||||
|
bash test/p2p/test.sh tester
|
||||||
|
Reference in New Issue
Block a user