Commit Graph

73 Commits

Author SHA1 Message Date
3284a13fee add test
Refs #1275
2018-04-05 15:27:47 +02:00
fc9ffee2e3 remove unused tracking because it leads to memory leaks in tests
see https://blog.cosmos.network/debugging-the-memory-leak-in-tendermint-210186711420
2018-04-05 15:27:47 +02:00
b7ce89e568 Speed up CircleCI builds
To achieve faster feedback cycles for our feature PRs this change
reduces the average buildtime from 35 to ~6min by utilising their new
2.0 offering based on docker and nomad. We make use of parallel build
steps wherever possible so that the duration is determined by the
slowest test suite (p2p).

This is an intermediate step until we move our CI/CD completely
on-premise for more control and added security.
2018-03-06 17:36:44 +01:00
9293ae76bf 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 15:54:40 +04:00
747b73cb95 fix merge conflicts 2018-02-09 21:32:29 +04:00
161e100a24 close return channel when we're done
Benchmark results:

```
BenchmarkSwitchBroadcast-2         30000             71275 ns/op
--- BENCH: BenchmarkSwitchBroadcast-2
        switch_test.go:339: success: 1, failure: 0
        switch_test.go:339: success: 100, failure: 0
        switch_test.go:339: success: 10000, failure: 0
        switch_test.go:339: success: 30000, failure: 0
```
2018-02-09 21:32:29 +04:00
d14d4a2527 remove TryBroadcast 2018-02-09 21:32:29 +04:00
9b554fb2c4 switch test modification 2018-02-09 21:32:28 +04:00
f97ead4f5f prep for merge 2018-02-09 21:32:28 +04:00
1d16df6a92 add test, TrySend in broadcast 2018-02-09 21:32:27 +04:00
44e967184a p2p: tmconn->conn and types->p2p 2018-01-21 00:34:41 -05:00
5b5cbaa66a p2p: use sub dirs 2018-01-20 21:35:37 -05:00
f9e4f6eb6b reorder peer.go methods 2018-01-14 01:15:37 -05:00
a17105fd46 p2p: peer.Key -> peer.ID 2018-01-01 22:39:05 -05:00
b289d2baf4 persistent node key and ID 2018-01-01 21:21:42 -05:00
528154f1a2 p2p: PrivKey need not be Ed25519 2018-01-01 19:44:01 -05:00
5511bd8e85 p2p: exponential backoff on reconnect. closes #939 2017-12-11 13:41:09 -05:00
69b5da766c service#Start, service#Stop signatures were changed
See https://github.com/tendermint/tmlibs/issues/45
2017-11-29 10:38:58 -06:00
55b81cc1a1 address linting FIXMEs 2017-11-27 22:39:12 +00:00
15651a931e linting errors: tackle p2p package 2017-11-27 22:39:11 +00:00
46ccbcbff6 linting: apply 'gofmt -s -w' throughout 2017-11-27 22:39:11 +00:00
283544c7f3 p2p: use fake net.Pipe since only >=Go1.10 implements SetDeadline
Fixes https://github.com/tendermint/tendermint/issues/851

Go1.9 and below's net.Pipe did not implement the SetDeadline
method so after commit
e2dd8ca946
this problem was exposed since now we check for errors.

To counter this problem, implement a simple composition for
net.Conn that always returns nil on SetDeadline instead of
tripping out.

Added build tags so that anyone using go1.10 when it is released
will be able to automatically use net.Pipe's net.Conns
2017-11-14 22:03:23 -07:00
e69d36d54f some more robust sleeps 2017-11-14 22:31:23 +00:00
9f6a09277e Merge pull request #812 from tendermint/808-make-connected-switches
MakeConnectedSwitches: connect first switch to others
2017-11-08 00:54:23 +00:00
7869e541f6 change MakeConnectedSwitches to not connect to itself
and a test for it
2017-11-07 18:33:00 -05:00
e0daca5693 fixes from Bucky's review 2017-11-07 18:20:24 -05:00
2d4ad02356 prefer tickers to time.Sleep (Refs #790) 2017-11-07 15:38:25 -05:00
b50339e8e7 p2p: sw.AddPeer -> sw.addPeer 2017-09-21 15:47:41 -04:00
aea8629272 peer interface 2017-09-15 18:40:59 -04:00
e6cecb9595 p2p: fix test 2017-07-07 13:33:15 -04:00
16509ac3db p2p: fix race by peer.Start() before peers.Add() 2017-05-13 10:24:59 +02:00
f803544195 new logging 2017-05-13 10:24:58 +02:00
46151720f8 fix tests 2017-05-04 22:46:41 -04:00
57151d6043 p2p: use cmn instead of . 2017-05-04 22:43:55 -04:00
5d660e073a remove viper from p2p 2017-05-04 22:43:55 -04:00
fcf78a5da7 cleanup go-config/viper and some unnamed imports 2017-04-25 14:54:56 -04:00
23a6a6f8fc move into p2p package 2017-04-21 18:07:52 -04:00
c4ed55d801 Refactor to move common libraries out of project 2015-10-22 17:39:06 -07:00
b54522c60f more versioning 2015-09-16 05:08:06 +00:00
625f23af13 Blockpool better timeouts, download rate observation, quicker switching to consensus; Id -> ID (sorry, this doesn't belong here) 2015-09-11 21:09:00 -07:00
1b9fd811a1 RPCResponse.Result && EventData are registered interfaces; -skip_upnp option 2015-08-11 11:01:18 -07:00
3be3647dc8 tendermint/binary -> tendermint/wire 2015-07-28 12:18:17 -07:00
c0a64d74be Service log prettify 2015-07-20 17:02:18 -07:00
571a134318 BaseService and BaseReactor refactor and unification 2015-07-20 14:52:24 -07:00
e4c351f5fc UUID -> PubKeyEd25519 2015-07-15 14:31:03 -07:00
fd64547ce7 Put a SecretConnection before the MConnection; Node Priv/PubKeys 2015-07-15 14:17:20 -07:00
af5b763112 avoid connection to self 2015-07-12 16:49:12 +00:00
8a2d9525f0 network > chain_id, put in genesis.json 2015-05-29 18:14:19 -04:00
d9bfe82d93 rpc.StartHTTPServer listener bug fix 2015-04-23 18:33:20 -07:00
dc1fddd1d8 Added NodeInfo (still need to add to AddrBook); Proper Handshake 2015-04-20 15:29:01 -07:00