Ethan Buchman
94e823cc91
p2p: NodeInfo.Channels is HexBytes
2018-04-26 23:43:51 -04:00
Anton Kaliaev
3a0edc561d
log error from AddrBook#AddAddress in DialPeersAsync
...
Refs #1434
2018-04-12 15:51:17 +02:00
Thomas Corbière
ab00bf7c8b
standardize PRNG access ( #1411 )
...
* replace math/rand with tmlibs equivalent.
* update tmlibs dependency
2018-04-11 11:38:30 +02:00
Vladislav Dmitriyev
7c22e47629
Replaced NodeInfo's pubkey to ID ( #1443 )
...
* Replaced NodeInfo PubKey to NodeID
* Fixed tests and replaced NodeID with ID
* Removed unnecessary method ID()
* Fixed codec_test.go
* Fixed codec_test.go
* Removed unnecessary bracket
* Fixed all tests
* Fixed peer_set_test.go
* Fixed peer_test.go
* Fixed common_test.go
* Fixed common_test.go
* Renamed node_id to id
* Removed peer.ID() from RPC net.go
* Replaced NodeInfo pubKey to ID
* Fixed codec_test.go
* Fixed peer_set_test.go
* Fix pex_reactor_test.go
* Refactored code for privateKey initiali
* Fixed peer_set_test.go
* Fixed test.proto and removed orphan string in codec_test.go
* Fixed pointer to a string
* generate node_key when running tendermint init
* [docs] prefix IPs with node IDs
Refs #1429
* gen_node_key cmd
* [docs/specification/secure-p2p] add a note about config
* fix data race
Closes #1442
```
WARNING: DATA RACE
Write at 0x00c4209de7c8 by goroutine 23:
github.com/tendermint/tendermint/types.(*Block).fillHeader()
/home/vagrant/go/src/github.com/tendermint/tendermint/types/block.go:88 +0x157
github.com/tendermint/tendermint/types.(*Block).Hash()
/home/vagrant/go/src/github.com/tendermint/tendermint/types/block.go:104 +0x121
github.com/tendermint/tendermint/types.(*Block).HashesTo()
/home/vagrant/go/src/github.com/tendermint/tendermint/types/block.go:135 +0x4f
github.com/tendermint/tendermint/consensus.(*ConsensusState).enterPrecommit()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1037 +0x182d
github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1425 +0x1a6c
github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1318 +0x77
github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:581 +0x7a9
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:539 +0x6c3
Previous read at 0x00c4209de7c8 by goroutine 47:
github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*HexBytes).MarshalJSON()
<autogenerated>:1 +0x52
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.invokeMarshalJSON()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:433 +0x88
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:82 +0x8d2
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSONStruct()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:348 +0x539
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:119 +0x83f
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSONStruct()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:348 +0x539
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:119 +0x83f
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSONStruct()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:348 +0x539
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:119 +0x83f
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSONStruct()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:348 +0x539
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:119 +0x83f
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).MarshalJSON()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/amino.go:296 +0x182
github.com/tendermint/tendermint/rpc/lib/types.NewRPCSuccessResponse()
/home/vagrant/go/src/github.com/tendermint/tendermint/rpc/lib/types/types.go:100 +0x12c
github.com/tendermint/tendermint/rpc/lib/server.makeJSONRPCHandler.func1()
/home/vagrant/go/src/github.com/tendermint/tendermint/rpc/lib/server/handlers.go:152 +0xab7
net/http.HandlerFunc.ServeHTTP()
/usr/lib/go-1.9/src/net/http/server.go:1918 +0x51
net/http.(*ServeMux).ServeHTTP()
/usr/lib/go-1.9/src/net/http/server.go:2254 +0xa2
github.com/tendermint/tendermint/rpc/lib/server.RecoverAndLogHandler.func1()
/home/vagrant/go/src/github.com/tendermint/tendermint/rpc/lib/server/http_server.go:138 +0x4fa
net/http.HandlerFunc.ServeHTTP()
/usr/lib/go-1.9/src/net/http/server.go:1918 +0x51
net/http.serverHandler.ServeHTTP()
/usr/lib/go-1.9/src/net/http/server.go:2619 +0xbc
net/http.(*conn).serve()
/usr/lib/go-1.9/src/net/http/server.go:1801 +0x83b
Goroutine 23 (running) created at:
github.com/tendermint/tendermint/consensus.(*ConsensusState).OnStart()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:250 +0x35b
github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*BaseService).Start()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/service.go:130 +0x5fc
github.com/tendermint/tendermint/consensus.(*ConsensusReactor).OnStart()
/home/vagrant/go/src/github.com/tendermint/tendermint/consensus/reactor.go:69 +0x1b4
github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*BaseService).Start()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/service.go:130 +0x5fc
github.com/tendermint/tendermint/consensus.(*ConsensusReactor).Start()
<autogenerated>:1 +0x43
github.com/tendermint/tendermint/p2p.(*Switch).OnStart()
/home/vagrant/go/src/github.com/tendermint/tendermint/p2p/switch.go:177 +0x124
github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*BaseService).Start()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/service.go:130 +0x5fc
github.com/tendermint/tendermint/node.(*Node).OnStart()
/home/vagrant/go/src/github.com/tendermint/tendermint/node/node.go:416 +0xa1b
github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*BaseService).Start()
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/service.go:130 +0x5fc
github.com/tendermint/tendermint/rpc/test.StartTendermint()
/home/vagrant/go/src/github.com/tendermint/tendermint/rpc/test/helpers.go:100 +0x5b
github.com/tendermint/tendermint/rpc/client_test.TestMain()
/home/vagrant/go/src/github.com/tendermint/tendermint/rpc/client/main_test.go:17 +0x4c
main.main()
github.com/tendermint/tendermint/rpc/client/_test/_testmain.go:76 +0x1cd
Goroutine 47 (running) created at:
net/http.(*Server).Serve()
/usr/lib/go-1.9/src/net/http/server.go:2720 +0x37c
net/http.Serve()
/usr/lib/go-1.9/src/net/http/server.go:2323 +0xe2
github.com/tendermint/tendermint/rpc/lib/server.StartHTTPServer.func1()
/home/vagrant/go/src/github.com/tendermint/tendermint/rpc/lib/server/http_server.go:35 +0xb3
```
* removed excessive comment
Refs https://github.com/tendermint/tendermint/pull/1446#discussion_r180353446
* use the tag interface for pubsub. (#1438 )
* use the tag interface for pubsub.
* update tmlibs.
* Fix unresolved conflict.
* improve `show_node_id` (#1433 )
* fix show_node_id
* make LoadNodeKey public
* make LoadNodeKey public
* remove if
* remove if
2018-04-11 10:11:11 +02:00
suyuhuang
384b3ea065
improve `show_node_id` ( #1433 )
...
* fix show_node_id
* make LoadNodeKey public
* make LoadNodeKey public
* remove if
* remove if
2018-04-10 16:03:51 +02:00
Ethan Buchman
1a1e4e767b
check max msg size in DecodeMessage
2018-04-09 15:18:47 +03:00
Ethan Buchman
c68d406195
fix tests
2018-04-07 19:47:19 +03:00
Ethan Buchman
02c0835e9b
fixes post merge
2018-04-07 16:25:10 +03:00
Ethan Buchman
c170800fbd
Merge branch 'develop' into jae/aminoify
2018-04-07 16:16:53 +03:00
Javed Khan
5d8767e656
p2p: don't use dial funcn in peerconfig
2018-04-07 12:51:51 +05:30
Javed Khan
54adb790f2
p2p: switch - reconnect only if persistent
2018-04-07 11:46:48 +05:30
Jae Kwon
fb64314d1c
Review from Anton
2018-04-06 13:46:40 -07:00
Anton Kaliaev
3d32474da8
make linter happy
2018-04-06 13:26:05 +02:00
Anton Kaliaev
3233c318ea
only log errors, dial correct addresses
...
"this means if there are lookup errors or typos in the persistent_peers,
tendermint will fail to start ? didn't some one ask for us not to do
this previously ?"
2018-04-06 12:35:48 +02:00
Anton Kaliaev
6e39ec6e26
do not even try to dial ourselves
...
also, remove address from the book (plus mark it as our address)
and return an error if we fail to parse peers list
2018-04-05 15:45:52 +02:00
Anton Kaliaev
7f6ee7a46b
add a comment for NewSwitch
2018-04-05 15:27:47 +02:00
Anton Kaliaev
34b77fcad4
log error when we fail to add new address
2018-04-05 15:27:47 +02:00
Anton Kaliaev
3b3f45d49b
use addrbook#AddOurAddress to store our address
2018-04-05 15:27:47 +02:00
Anton Kaliaev
3284a13fee
add test
...
Refs #1275
2018-04-05 15:27:47 +02:00
Anton Kaliaev
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
Anton Kaliaev
4b8e342309
fix panic: lookup testing on 10.0.2.3:53: no such host
2018-04-05 15:27:46 +02:00
Anton Kaliaev
5a2fa71b03
use combination of IP and port, not just IP
2018-04-05 15:27:46 +02:00
Anton Kaliaev
9a57ef9cbf
do not dial ourselves (ok, maybe just once)
...
Refs #1275
2018-04-05 15:27:46 +02:00
Ethan Buchman
7cce07bc99
Merge pull request #1352 from tendermint/1228-require-id
...
p2p: require all addresses come with an ID no matter what
2018-04-05 15:55:41 +03:00
Jae Kwon
5d1c758730
Fix evidence
2018-04-05 05:43:23 -07:00
Anton Kaliaev
cee7b5cb54
GetSelectionWithBias
...
Refs #1130
2018-04-05 12:00:16 +02:00
Anton Kaliaev
1585152341
https://github.com/tendermint/tendermint/pull/1128#discussion_r162799294
...
Refs #1130
2018-04-05 12:00:16 +02:00
Anton Kaliaev
8e699c2bfd
defaultSeedDisconnectWaitPeriod should be at least as long as we expect
...
it to take for a peer to become MarkGood
Refs #1130
2018-04-05 12:00:16 +02:00
Anton Kaliaev
904a3115a6
require addresses to have an ID by default
...
Refs #1228
2018-04-05 11:55:29 +02:00
Javed Khan
5ef639fcbe
p2p: persistent - redial if first dial fails
...
Fixes #1401
2018-04-03 09:27:06 +05:30
Thomas Corbière
2644a529f0
Fix lint errors ( #1390 )
...
* use increment and decrement operators.
* remove unnecessary else branches.
* fix package comment with leading space.
* fix receiver names.
* fix error strings.
* remove omittable code.
* remove redundant return statement.
* Revert changes (code is generated.)
* use cfg as receiver name for all config-related types.
* use lsi as the receiver name for the LastSignedInfo type.
2018-04-02 10:21:17 +02:00
Anton Kaliaev
22949e6dfd
new tmlibs Parallel implementation
2018-03-28 19:13:08 +02:00
Jae Kwon
901b456151
P2P now works with Amino
2018-03-26 06:40:02 +02:00
Anton Kaliaev
214817ed17
do not add peer to switch if it fails to start
2018-03-23 13:31:48 +01:00
Anton Kaliaev
a7250af303
Exponential backoff follow up ( #1349 )
...
* document new functionality [ci skip]
Refs #1304
* add fixme [ci skip]
Refs #1304
* ensure that we dial peer after backoff duration
Refs #1304
2018-03-23 09:48:27 +01:00
Jae Kwon
ced74251e9
maxPacketMsg -> packetMsgMax...
2018-03-21 02:47:38 +01:00
Jae Kwon
6c345f9fa2
First stab: p2p/conn
2018-03-21 02:27:10 +01:00
Alexander Simmerl
50ae892d5e
p2p: Keep reference to connections in test peer
...
We observed non-deterministic test failures in one of our switch tests,
which would happen if the GC would run between iterations of the accept
loop. As we don't hold any reference to the connection the setup
finalizer might get triggered and therefore the file handle closed. For
the curious check the references on finalizers and the variable scoping
in the spec:
https://groups.google.com/forum/#!topic/golang-nuts/xWkhGJ5PY6c
https://groups.google.com/forum/#!topic/golang-nuts/d8aF4rAob7U/discussion
https://golang.org/ref/spec#Declarations_and_scope
Fixes #1266
2018-03-19 20:35:12 +01:00
Anton Kaliaev
d8b08cd943
return back panic in peer#onReceive
...
Refs #1317
2018-03-19 13:19:05 +03:00
Anton Kaliaev
ab59f64f57
test we record votes and block parts
...
Refs #1317
2018-03-19 13:17:11 +03:00
Ethan Buchman
eaabdb5cac
Merge pull request #1282 from tendermint/1126-private-peers
...
private peers
2018-03-18 22:53:57 +01:00
Anton Kaliaev
714f885dac
mark peer as good if it contributed enough votes or block parts
...
Refs #1147
2018-03-15 11:58:20 +04:00
Anton Kaliaev
d86855ad7a
stop peer if it sends us msg with unknown channel
2018-03-15 11:58:20 +04:00
Anton Kaliaev
4242352852
stop peer on decoding error
2018-03-15 11:58:19 +04:00
Anton Kaliaev
31deaa4a79
fix broken merge
2018-03-15 11:55:30 +04:00
Anton Kaliaev
736ea055a8
add a test for pex reactor
2018-03-15 11:55:30 +04:00
Anton Kaliaev
a39aec0bae
rename private_peers to private_peer_ids to distinguish from peers
2018-03-15 11:55:30 +04:00
Anton Kaliaev
fc5b0471d9
use time.Since
2018-03-11 14:13:34 +04:00
Anton Kaliaev
264bce4ddd
skip dialing based on last time dialed
2018-03-11 14:00:49 +04:00
Anton Kaliaev
0f41570c80
fixes from bucky's review
2018-03-11 13:22:37 +04:00
Anton Kaliaev
f85c8896d9
test pex_reactor's dialPeer
2018-03-09 16:23:52 +04:00
Anton Kaliaev
f0d4f56327
refactor pex_reactor tests
2018-03-09 16:02:24 +04:00
Anton Kaliaev
1941b5c769
fixes from @xla's review
2018-03-08 16:31:44 +04:00
Anton Kaliaev
21e2c41c6b
exponential backoff for addrs in the address book
...
Refs #1125
2018-03-08 14:04:26 +04:00
Alexander Simmerl
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
Alexander Simmerl
8f2703e8b2
Dial seeds directly without potential peers
...
In order to improve the operator experience we want the node to dial
seeds immediately if there are no peers to connect to. Until now the
routine responsible for ensuring peers are connected to would wait
a random amount of time up to 30s (if not configured otherwise).
2018-03-02 12:55:01 +01:00
Zach
2cc63069c6
rename dummy to kvstore ( #1223 )
...
* remove accidental binary
* docs: s/Dummy&dummy/KVStore&kvstore/g
* glide update to abci
* update abci import paths
* dummy begone, hello kvstore
* RequestInitChain needs genesisBytes
* glide update
2018-02-27 18:01:10 +04:00
Ethan Buchman
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
Anton Kaliaev
fc585bcdec
do not block when writing to pongTimeoutCh
...
Refs #1205
2018-02-12 17:04:07 +04:00
Anton Kaliaev
2a24ae90c1
fixes from Jae's review
...
1. remove pointer
2. add Quit() method to Service interface
2018-02-12 14:32:09 +04:00
Anton Kaliaev
22b038810a
do not block in recvRoutine
2018-02-09 23:03:26 +04:00
Anton Kaliaev
45750e1b29
fix race by sending signal instead of stopping pongTimer
2018-02-09 21:32:29 +04:00
Anton Kaliaev
26419fba28
refactor code plus add one more test
...
* extract stopPongTimer method
* TestMConnectionMultiplePings
2018-02-09 21:32:29 +04:00
Anton Kaliaev
ac0123d249
drain pongTimeoutCh and pongTimer's channel to prevent leaks
2018-02-09 21:32:29 +04:00
Anton Kaliaev
f4ff66de30
rewrite pong timer to use time.AfterFunc
2018-02-09 21:32:29 +04:00
Anton Kaliaev
747b73cb95
fix merge conflicts
2018-02-09 21:32:29 +04:00
Anton Kaliaev
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
Anton Kaliaev
3ae738f453
increase timeouts
2018-02-09 21:32:29 +04:00
Anton Kaliaev
d14d4a2527
remove TryBroadcast
2018-02-09 21:32:29 +04:00
Anton Kaliaev
860da464df
remove weird concurrency testing
2018-02-09 21:32:28 +04:00
Anton Kaliaev
4e2000abfe
control order by sending msgs from one goroutine
2018-02-09 21:32:28 +04:00
Anton Kaliaev
5834a59816
read ping
2018-02-09 21:32:28 +04:00
Anton Kaliaev
b28b76ddf7
rename pingTimeout to pingInterval, pongTimer is now time.Timer
2018-02-09 21:32:28 +04:00
zbo14
91e4f4b786
ping/pong timeout in config
2018-02-09 21:32:28 +04:00
zbo14
9b554fb2c4
switch test modification
2018-02-09 21:32:28 +04:00
zbo14
f97ead4f5f
prep for merge
2018-02-09 21:32:28 +04:00
zbo14
5af22d6ee6
remove SwitchEventNewPeer, SwitchEventDonePeer
2018-02-09 21:32:28 +04:00
zbo14
1d16df6a92
add test, TrySend in broadcast
2018-02-09 21:32:27 +04:00
Ethan Buchman
199ea40980
Merge pull request #1196 from tendermint/1149-TestReactorValidatorSetChanges-fails-non-deterministically
...
WIP: TestReactorValidatorSetChanges fails non deterministically
2018-02-09 01:51:17 -05:00
Anton Kaliaev
3f9aa8d8fa
document that msgBytes in p2p/connection change
2018-02-08 13:25:26 +04:00
Anton Kaliaev
d6d1f8512d
do not reset pingTimer
...
don't bother with this "only ping when we havent heard from them". lets
just always ping every peer from the sendRoutine every 10s no matter
what. if they dont pong within pongTimeout, disconnect :)
2018-02-08 13:08:11 +04:00
Anton Kaliaev
2b2c233977
write docs for Reactor interface
2018-02-08 13:07:40 +04:00
Ethan Buchman
7640e6a29f
add some p2p TODOs
2018-02-08 12:46:04 +04:00
Anton Kaliaev
11b68f1934
rewrite broadcastTxRoutine to use channels
...
https://play.golang.org/p/gN21yO9IRs3
```
func waitWithCancel(f func() *clist.CElement, ctx context.Context) *clist.CElement {
el := make(chan *clist.CElement, 1)
select {
case el <- f():
```
will just run f() blockingly, so this doesn't change much in terms of behavior.
2018-02-05 16:36:26 +04:00
Ethan Buchman
426379dc47
remove use of wire/nowriter
2018-02-03 03:39:14 -05:00
Ethan Buchman
baff4bd8cc
p2p/conn: better handling for some stop conditions
2018-01-25 02:11:16 -05:00
Ethan Buchman
27ef3489a0
Merge pull request #1049 from tendermint/p2p-channels
...
p2p: add Channels to NodeInfo and don't send for unknown channels
2018-01-24 15:29:38 -05:00
Ethan Buchman
b6eb275b22
p2p: fix break in double loop
2018-01-24 14:27:37 -05:00
Ethan Buchman
99034904f8
p2p: fix tests for required channels
2018-01-23 23:45:51 -05:00
Ethan Buchman
d7b1b8d3d5
Merge pull request #1129 from tendermint/addrbook
...
p2p: bust up into sub dirs
2018-01-23 23:10:50 -05:00
Ethan Buchman
50129ad8ac
p2p: add Channels to NodeInfo and don't send for unknown channels
2018-01-23 22:43:56 -05:00
Ethan Buchman
8f3bd3f209
p2p: addrBook.Save() on DialPeersAsync
2018-01-23 22:25:39 -05:00
Ethan Buchman
85816877c6
config: fix addrbook path to go in config
2018-01-23 22:21:17 -05:00
Ethan Buchman
775bb85efb
p2p/pex: wait to connect to all peers in reactor test
2018-01-23 21:30:53 -05:00
Ethan Buchman
21ce5856b3
p2p: notes about ListenAddr
2018-01-23 21:26:19 -05:00
Ethan Buchman
3090b05eb4
p2p: use conn.Close when peer is nil
2018-01-21 16:26:59 -05:00
Ethan Buchman
44e967184a
p2p: tmconn->conn and types->p2p
2018-01-21 00:34:41 -05:00
Ethan Buchman
0d7d16005a
fixes
2018-01-20 21:44:30 -05:00
Ethan Buchman
5b5cbaa66a
p2p: use sub dirs
2018-01-20 21:35:37 -05:00
Ethan Buchman
03550c7076
wip addrbook
2018-01-20 21:33:43 -05:00
Ethan Buchman
930fde056a
p2p: add back lost func
2018-01-20 21:28:00 -05:00
Ethan Buchman
8d758560d8
p2p/trustmetric: non-deterministic test
2018-01-20 21:24:22 -05:00
Ethan Buchman
7b87cdaed8
p2p: seed disconnects after sending addrs
2018-01-20 21:24:22 -05:00
Ethan Buchman
c2f97e6454
p2p: seed mode fixes from rebase and review
2018-01-20 21:24:22 -05:00
Ethan Buchman
88eb3e7af0
some minor renames
2018-01-20 21:24:20 -05:00
caffix
949211a137
added a test for PEX reactor seed mode
2018-01-20 21:23:48 -05:00
Ethan Buchman
8171628ee5
make tests run faster
2018-01-19 00:59:09 -05:00
Ethan Buchman
bc19e7843c
Merge branch 'develop' into p2p-consolidate
2018-01-18 18:30:37 -05:00
Ethan Buchman
fc7915ab4c
fixes from review
2018-01-14 13:03:57 -05:00
Zach Ramsay
26aaa283a9
p2p: remove deprecated Dockerfile
2018-01-14 13:51:28 +00:00
Zach
a29c67563c
Update p2p README, closes #1102
2018-01-14 13:50:34 +00:00
Ethan Buchman
17f7a9b510
improve seed dialing logic
2018-01-14 03:56:15 -05:00
Ethan Buchman
3df5fd21cd
better abuse handling in pex
2018-01-14 03:22:01 -05:00
Ethan Buchman
68237911ba
NetAddress.Same checks ID or DialString
2018-01-14 01:15:37 -05:00
Ethan Buchman
f9e4f6eb6b
reorder peer.go methods
2018-01-14 01:15:37 -05:00
Ethan Buchman
8b74a8d6ac
NodeInfo not a pointer
2018-01-14 01:15:33 -05:00
Ethan Buchman
08f84cd712
a little more moving around
2018-01-13 23:56:57 -05:00
Ethan Buchman
452d10f368
cleanup switch
2018-01-13 17:37:52 -05:00
Ethan Buchman
7667e11973
remove RemoteAddr from NodeInfo
2018-01-13 17:36:03 -05:00
Ethan Buchman
53a5498fc5
more fixes from review
2018-01-13 17:34:12 -05:00
Ethan Buchman
e4d52401cf
some fixes from review
2018-01-13 16:06:51 -05:00
Ethan Buchman
9670519a21
remove PoW from ID
2018-01-13 15:50:59 -05:00
Ethan Buchman
b1485b181a
Merge branch 'p2p-consolidate' into p2p-id
2018-01-13 15:20:23 -05:00
Ethan Buchman
c1e167e330
note in trust metric test
2018-01-13 15:11:13 -05:00
Ethan Buchman
e2b3b5b58c
dial_persistent_peers -> dial_peers with persistent option
2018-01-13 14:50:58 -05:00
Anton Kaliaev
075ae1e301
minimal test for dialing seeds in pex reactor
2018-01-09 18:29:29 -06:00
Anton Kaliaev
705d51aa42
move dialSeedsIfAddrBookIsEmptyOrPEXFailedToConnect into PEX reactor
2018-01-09 17:54:29 -06:00
Anton Kaliaev
e4897b7bdd
rename manual peers to persistent peers
2018-01-09 16:18:05 -06:00
Anton Kaliaev
28fc15028a
distinguish between seeds and manual peers in the config/flags
...
- we only use seeds if we can’t connect to peers in the addrbook.
- we always connect to nodes given in config/flags
Refs #864
2018-01-09 16:03:24 -06:00
Adrian Brink
f602de437e
Move P2P docs into docs folder
2018-01-03 10:49:47 +01:00
Ethan Buchman
488ae529ad
p2p: authenticate peer ID
2018-01-01 23:23:11 -05:00
Ethan Buchman
6e823c6e87
p2p: support addr format ID@IP:PORT
2018-01-01 23:08:20 -05:00
Ethan Buchman
7d35500e6b
p2p: add ID to NetAddress and use for AddrBook
2018-01-01 22:39:08 -05:00
Ethan Buchman
a17105fd46
p2p: peer.Key -> peer.ID
2018-01-01 22:39:05 -05:00
Ethan Buchman
b289d2baf4
persistent node key and ID
2018-01-01 21:21:42 -05:00
Ethan Buchman
f2e0abf1dc
p2p: reorder some checks in addPeer; add comments to NodeInfo
2018-01-01 21:21:39 -05:00
Ethan Buchman
528154f1a2
p2p: PrivKey need not be Ed25519
2018-01-01 19:44:01 -05:00
Ethan Buchman
bc71840f06
more p2p docs
2018-01-01 16:30:36 -05:00
Ethan Buchman
1acb12edf5
p2p docs
2017-12-31 17:11:09 -05:00
Ethan Buchman
14c812a39c
tmlibs timer fix
2017-12-25 11:11:55 -05:00
Ethan Buchman
652d1e3de8
Merge pull request #979 from tendermint/934-node-fails-to-parse-seeds
...
strip protocol if defined
2017-12-19 12:26:32 -05:00
Ethan Buchman
cb3ac6987e
remove some debugs
2017-12-19 10:11:37 -05:00
Ethan Buchman
5d04ccbe51
excessive logging. update tmlibs for timer fix
2017-12-16 19:16:08 -05:00
Ethan Buchman
d7cb2f850d
more logs in p2p
2017-12-16 13:36:52 -05:00
Ethan Buchman
bfe0a4a8ac
more logging
2017-12-16 13:36:52 -05:00
Ethan Buchman
0ec7909ec3
more logging in p2p and consensus
2017-12-16 13:36:52 -05:00
Anton Kaliaev
c513649df4
strip protocol if defined
...
Fixes #934
2017-12-15 13:36:08 -06:00
Anton Kaliaev
a6911825b0
PanicCrisis is deprecated
2017-12-15 13:35:49 -06:00
Ethan Buchman
068d83bce8
Merge pull request #677 from tendermint/blockchain-test-store
...
blockchain: add tests for BlockStore
2017-12-15 13:33:55 -05:00
Ethan Buchman
78a682e4b6
blockchain: test fixes
2017-12-15 12:07:48 -05:00