Ethan Buchman
936d1a0e68
some notes about the p2p layer
7 years ago
Ethan Buchman
c45ba2967a
fixes from review
7 years ago
Ethan Buchman
593a785ae2
set NodeInfo on switch before starting RPC server
should fix #1199
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
Ethan Buchman
c68d406195
fix tests
7 years ago
Jae Kwon
fb64314d1c
Review from Anton
7 years ago
Jae Kwon
3ca5292dc9
Fix rpc tests
7 years ago
Jae Kwon
c541d58d2f
WIP: fix rpc/core
7 years ago
Jae Kwon
e4492afbad
Merge
7 years ago
Anton Kaliaev
d38a6cc7ea
trim whitespace from elements of lists (like `persistent_peers`)
Refs #1380
7 years ago
Anton Kaliaev
3b3f45d49b
use addrbook#AddOurAddress to store our address
7 years ago
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.
7 years ago
Anton Kaliaev
1c82281b77
make app_options -> app_state backwards compatible
7 years ago
Alexander Simmerl
9b9022f8df
privVal: Improve SocketClient network code ( #1315 )
Follow-up to feedback from #1286 , this change simplifies the connection
handling in the SocketClient and makes the communication via TCP more
robust. It introduces the tcpTimeoutListener to encapsulate accept and
i/o timeout handling as well as connection keep-alive, this type could
likely be upgraded to handle more fine-grained tuning of the tcp stack
(linger, nodelay, etc.) according to the properties we desire. The same
methods should be applied to the RemoteSigner which will be overhauled
when the priv_val_server is fleshed out.
* require private key
* simplify connect logic
* break out conn upgrades to tcpTimeoutListener
* extend test coverage and simplify component setup
7 years ago
Anton Kaliaev
714f885dac
mark peer as good if it contributed enough votes or block parts
Refs #1147
7 years ago
Anton Kaliaev
2a258a2c3f
revert removing private peers from persistent
7 years ago
Anton Kaliaev
a39aec0bae
rename private_peers to private_peer_ids to distinguish from peers
7 years ago
Anton Kaliaev
8bef3eb1f4
private peers
Refs #1126
7 years ago
Alexander Simmerl
ca619c80b6
Stop privVal socket client on node shutdown
7 years ago
Ethan Buchman
d4e4055d57
PrivValidatorAddr -> PrivValidatorListenAddr. Update ADR008
7 years ago
Ethan Frey
fff0c6cd8e
Add app_state from genesis file in InitChain message
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
Alexander Simmerl
74d3f7e1fd
Integrate private validator socket client
Following ADDR 008 the node will connect to an external
process to handle signing requests. Operation of the external process is
left to the user.
* introduce alias for PrivValidator interface on socket client
* integrate socket client in node
* structure tests
* remove unnecessary flag
7 years ago
Alexander Simmerl
a14aab67de
Integrate PrivValidator socket server
7 years ago
Alexander Simmerl
7d71e702d8
Integrate privVal client with node secret
7 years ago
Ethan Buchman
23eb84db35
wip: priv val via sockets
7 years ago
Anton Kaliaev
cf1f483526
add seed_mode flag (`--p2p.seed_mode`)
7 years ago
Ethan Buchman
e7747f7d66
it compiles
7 years ago
Ethan Buchman
cd0fd06b0d
update for sdk2 libs. need to fix kv test
NOTE we only updating for tmlibs and abci
7 years ago
Ethan Buchman
50129ad8ac
p2p: add Channels to NodeInfo and don't send for unknown channels
7 years ago
Ethan Buchman
44e967184a
p2p: tmconn->conn and types->p2p
7 years ago
Ethan Buchman
0d7d16005a
fixes
7 years ago
Ethan Buchman
f06cc6630b
mempool: cfg.CacheSize and expose InitWAL
7 years ago
Ethan Buchman
620c957a44
fix test
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
53a5498fc5
more fixes from review
7 years ago
Ethan Buchman
9670519a21
remove PoW from ID
7 years ago
Anton Kaliaev
705d51aa42
move dialSeedsIfAddrBookIsEmptyOrPEXFailedToConnect into PEX reactor
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
Anton Kaliaev
179d6062e4
try to connect through addrbook before requesting peers from seeds
we only use seeds if we can’t connect to peers in the addrbook.
Refs #864
7 years ago
Ethan Buchman
b9cbaf8f10
priv-val: fix timestamp for signing things that only differ by timestamp
7 years ago
Ethan Buchman
b289d2baf4
persistent node key and ID
7 years ago
Ethan Buchman
528154f1a2
p2p: PrivKey need not be Ed25519
7 years ago
Ethan Buchman
cb845ebff5
fix EvidencePool and VerifyEvidence
7 years ago
Ethan Buchman
6112578d07
ValidateBlock is a method on blockExec
7 years ago
Ethan Buchman
ae68fcb78a
move fireEvents to ApplyBlock
7 years ago
Ethan Buchman
1d6f00859d
fixes from review
7 years ago
Ethan Buchman
397251b0f4
fix evidence
7 years ago