2016-07-24 14:08:47 -04:00
|
|
|
#! /bin/bash
|
2016-08-25 18:27:21 -04:00
|
|
|
set -eu
|
2016-07-24 14:08:47 -04:00
|
|
|
|
|
|
|
DOCKER_IMAGE=$1
|
|
|
|
NETWORK_NAME=local_testnet
|
2016-12-12 16:00:21 -05:00
|
|
|
N=4
|
2018-02-27 14:01:10 +00:00
|
|
|
PROXY_APP=persistent_kvstore
|
2016-07-24 14:08:47 -04:00
|
|
|
|
2017-03-06 03:08:04 -05:00
|
|
|
cd "$GOPATH/src/github.com/tendermint/tendermint"
|
2016-08-27 16:01:52 -04:00
|
|
|
|
2016-12-20 21:16:39 +04:00
|
|
|
# stop the existing testnet and remove local network
|
|
|
|
set +e
|
2017-03-06 03:08:04 -05:00
|
|
|
bash test/p2p/local_testnet_stop.sh "$NETWORK_NAME" "$N"
|
2016-12-20 21:16:39 +04:00
|
|
|
set -e
|
|
|
|
|
p2p: introduce peerConn to simplify peer creation (#1226)
* expose AuthEnc in the P2P config
if AuthEnc is true, dialed peers must have a node ID in the address and
it must match the persistent pubkey from the secret handshake.
Refs #1157
* fixes after my own review
* fix docs
* fix build failure
```
p2p/pex/pex_reactor_test.go:288:88: cannot use seed.NodeInfo().NetAddress() (type *p2p.NetAddress) as type string in array or slice literal
```
* p2p: introduce peerConn to simplify peer creation
* Introduce `peerConn` containing the known fields of `peer`
* `peer` only created in `sw.addPeer` once handshake is complete and NodeInfo is checked
* Eliminates some mutable variables and makes the code flow better
* Simplifies the `newXxxPeer` funcs
* Use ID instead of PubKey where possible.
* SetPubKeyFilter -> SetIDFilter
* nodeInfo.Validate takes ID
* remove peer.PubKey()
* persistent node ids
* fixes from review
* test: use ip_plus_id.sh more
* fix invalid memory panic during fast_sync test
```
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: panic: runtime error: invalid memory address or nil pointer dereference
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x98dd3e]
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]:
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: goroutine 3432 [running]:
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: github.com/tendermint/tendermint/p2p.newOutboundPeerConn(0xc423fd1380, 0xc420933e00, 0x1, 0x1239a60, 0
xc420128c40, 0x2, 0x42caf6, 0xc42001f300, 0xc422831d98, 0xc4227951c0, ...)
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: #011/go/src/github.com/tendermint/tendermint/p2p/peer.go:123 +0x31e
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: github.com/tendermint/tendermint/p2p.(*Switch).addOutboundPeerWithConfig(0xc4200ad040, 0xc423fd1380, 0
xc420933e00, 0xc423f48801, 0x28, 0x2)
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: #011/go/src/github.com/tendermint/tendermint/p2p/switch.go:455 +0x12b
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: github.com/tendermint/tendermint/p2p.(*Switch).DialPeerWithAddress(0xc4200ad040, 0xc423fd1380, 0x1, 0x
0, 0x0)
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: #011/go/src/github.com/tendermint/tendermint/p2p/switch.go:371 +0xdc
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: github.com/tendermint/tendermint/p2p.(*Switch).reconnectToPeer(0xc4200ad040, 0x123e000, 0xc42007bb00)
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: #011/go/src/github.com/tendermint/tendermint/p2p/switch.go:290 +0x25f
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: created by github.com/tendermint/tendermint/p2p.(*Switch).StopPeerForError
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: #011/go/src/github.com/tendermint/tendermint/p2p/switch.go:256 +0x1b7
```
2018-02-27 06:54:40 -05:00
|
|
|
PERSISTENT_PEERS=$(bash test/p2p/persistent_peers.sh $N $DOCKER_IMAGE)
|
2017-03-05 23:12:27 -05:00
|
|
|
|
2016-07-24 14:08:47 -04:00
|
|
|
# start the testnet on a local network
|
2016-12-22 01:39:06 +04:00
|
|
|
# NOTE we re-use the same network for all tests
|
2018-01-09 16:18:05 -06:00
|
|
|
bash test/p2p/local_testnet_start.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$N" "$PROXY_APP" "$PERSISTENT_PEERS"
|
2016-07-24 14:08:47 -04:00
|
|
|
|
2016-12-12 16:00:21 -05:00
|
|
|
# test basic connectivity and consensus
|
|
|
|
# start client container and check the num peers and height for all nodes
|
2017-03-06 03:08:04 -05:00
|
|
|
bash test/p2p/client.sh "$DOCKER_IMAGE" "$NETWORK_NAME" basic "test/p2p/basic/test.sh $N"
|
2016-08-25 18:27:21 -04:00
|
|
|
|
2016-12-12 16:00:21 -05:00
|
|
|
# test atomic broadcast:
|
|
|
|
# start client container and test sending a tx to each node
|
2017-03-06 03:08:04 -05:00
|
|
|
bash test/p2p/client.sh "$DOCKER_IMAGE" "$NETWORK_NAME" ab "test/p2p/atomic_broadcast/test.sh $N"
|
2016-12-12 16:00:21 -05:00
|
|
|
|
2017-03-06 03:08:04 -05:00
|
|
|
# test fast sync (from current state of network):
|
|
|
|
# for each node, kill it and readd via fast sync
|
|
|
|
bash test/p2p/fast_sync/test.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$N" "$PROXY_APP"
|
2016-12-21 01:36:06 +04:00
|
|
|
|
2017-01-13 19:27:31 +04:00
|
|
|
# test killing all peers 3 times
|
2017-03-06 03:08:04 -05:00
|
|
|
bash test/p2p/kill_all/test.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$N" 3
|
2017-01-13 19:27:31 +04:00
|
|
|
|
|
|
|
# test pex
|
2017-03-06 03:08:04 -05:00
|
|
|
bash test/p2p/pex/test.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$N" "$PROXY_APP"
|