Anton Kaliaev
3a0edc561d
log error from AddrBook#AddAddress in DialPeersAsync
Refs #1434
7 years ago
Thomas Corbière
ab00bf7c8b
standardize PRNG access ( #1411 )
* replace math/rand with tmlibs equivalent.
* update tmlibs dependency
7 years ago
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
7 years ago
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 ?"
7 years ago
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
7 years ago
Anton Kaliaev
7f6ee7a46b
add a comment for NewSwitch
7 years ago
Anton Kaliaev
3b3f45d49b
use addrbook#AddOurAddress to store our address
7 years ago
Anton Kaliaev
4b8e342309
fix panic: lookup testing on 10.0.2.3:53: no such host
7 years ago
Anton Kaliaev
5a2fa71b03
use combination of IP and port, not just IP
7 years ago
Anton Kaliaev
9a57ef9cbf
do not dial ourselves (ok, maybe just once)
Refs #1275
7 years ago
Jae Kwon
901b456151
P2P now works with Amino
7 years ago
Anton Kaliaev
214817ed17
do not add peer to switch if it fails to start
7 years ago
Anton Kaliaev
714f885dac
mark peer as good if it contributed enough votes or block parts
Refs #1147
7 years ago
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
```
7 years ago
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
```
7 years ago
Anton Kaliaev
d14d4a2527
remove TryBroadcast
7 years ago
zbo14
1d16df6a92
add test, TrySend in broadcast
7 years ago
Ethan Buchman
8f3bd3f209
p2p: addrBook.Save() on DialPeersAsync
7 years ago
Ethan Buchman
21ce5856b3
p2p: notes about ListenAddr
7 years ago
Ethan Buchman
3090b05eb4
p2p: use conn.Close when peer is nil
7 years ago
Ethan Buchman
44e967184a
p2p: tmconn->conn and types->p2p
7 years ago
Ethan Buchman
0d7d16005a
fixes
7 years ago
Ethan Buchman
5b5cbaa66a
p2p: use sub dirs
7 years ago
Ethan Buchman
03550c7076
wip addrbook
7 years ago
Ethan Buchman
68237911ba
NetAddress.Same checks ID or DialString
7 years ago
Ethan Buchman
f9e4f6eb6b
reorder peer.go methods
7 years ago
Ethan Buchman
8b74a8d6ac
NodeInfo not a pointer
7 years ago
Ethan Buchman
08f84cd712
a little more moving around
7 years ago
Ethan Buchman
452d10f368
cleanup switch
7 years ago
Ethan Buchman
7667e11973
remove RemoteAddr from NodeInfo
7 years ago
Ethan Buchman
53a5498fc5
more fixes from review
7 years ago
Ethan Buchman
e4d52401cf
some fixes from review
7 years ago
Ethan Buchman
e2b3b5b58c
dial_persistent_peers -> dial_peers with persistent option
7 years ago
Anton Kaliaev
e4897b7bdd
rename manual peers to persistent peers
7 years ago
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
7 years ago
Ethan Buchman
488ae529ad
p2p: authenticate peer ID
7 years ago
Ethan Buchman
6e823c6e87
p2p: support addr format ID@IP:PORT
7 years ago
Ethan Buchman
7d35500e6b
p2p: add ID to NetAddress and use for AddrBook
7 years ago
Ethan Buchman
a17105fd46
p2p: peer.Key -> peer.ID
7 years ago
Ethan Buchman
b289d2baf4
persistent node key and ID
7 years ago
Ethan Buchman
f2e0abf1dc
p2p: reorder some checks in addPeer; add comments to NodeInfo
7 years ago
Ethan Buchman
528154f1a2
p2p: PrivKey need not be Ed25519
7 years ago
Ethan Buchman
cb3ac6987e
remove some debugs
7 years ago
Ethan Buchman
5d04ccbe51
excessive logging. update tmlibs for timer fix
7 years ago
Ethan Buchman
5511bd8e85
p2p: exponential backoff on reconnect. closes #939
7 years ago
Anton Kaliaev
c609b18698
tolerate unresolvable seeds (Refs #880 )
7 years ago
Anton Kaliaev
691e266bef
ignore ErrAlreadyStarted when starting addrbook in PEXReactor
7 years ago
Anton Kaliaev
69b5da766c
service#Start, service#Stop signatures were changed
See https://github.com/tendermint/tmlibs/issues/45
7 years ago
Ethan Buchman
55b81cc1a1
address linting FIXMEs
7 years ago
Zach Ramsay
15651a931e
linting errors: tackle p2p package
7 years ago