Commit Graph

904 Commits

Author SHA1 Message Date
Dmitriy Ryajov 4c815d75e7
More gossip cleanup (#257)
* more cleanup

* correct pubsub peer count

* close the stream first

* handle cancelation

* fix tests

* fix fanout ttl

* merging master

* remove `withLock` as it conflicts with stdlib

* fix trace build

Co-authored-by: Giovanni Petrantoni <giovanni@fragcolor.xyz>
2020-07-09 14:21:47 -06:00
Jacek Sieka c720e042fc
clean up mesh handling logic (#260)
* gossipsub is a function of subscription messages only
* graft/prune work with mesh, get filled up from gossipsub
* fix race conditions with await
* fix exception unsafety when grafting/pruning
* fix allowing up to DHi peers in mesh on incoming graft
* fix metrics in several places
2020-07-09 11:16:46 -06:00
Jacek Sieka 9a3684c221
init from concrete key type (#252) 2020-07-09 02:59:09 -06:00
Jacek Sieka 45c089ff0d
noise updates (#255)
* clear secrets explicitly
* simplify keygen
* avoid some trivial memory allocations
* fix little endian encoding of nonce
2020-07-09 02:53:19 -06:00
Giovanni Petrantoni 4e12d0d97a nil check peer before disconnect 2020-07-09 17:20:45 +09:00
Giovanni Petrantoni f9e0a1f069 CI fix handleDisconnect (pubsub) 2020-07-09 13:56:59 +09:00
Giovanni Petrantoni 9b8b159abb Remove other spurious getStacktrace in pubsub traces 2020-07-09 13:19:34 +09:00
Giovanni Petrantoni 4bcb567d47 fix gossip tests 2020-07-09 12:34:36 +09:00
Giovanni Petrantoni 4698f41a91 Remove stacktrace logging from pubsub connect 2020-07-09 12:23:03 +09:00
Giovanni Petrantoni fec507e755
Add peers back to gossipsub table, slow down heartbeat (#256)
* Add peers back to gossipsub table, slow down heartbeat

* exclude on unsub from mesh and fanout
2020-07-08 11:06:26 -06:00
Giovanni Petrantoni f2e7035a17 fix gossip 11 upstream 2020-07-08 19:22:02 +09:00
Giovanni Petrantoni 853250918c wip 2020-07-08 15:45:11 +09:00
Giovanni Petrantoni be98a478b4 Fix merge oops 2020-07-08 12:58:39 +09:00
Giovanni Petrantoni a7d90214ea Merge branch 'gossip-one-one' of github.com:status-im/nim-libp2p into gossip-one-one 2020-07-08 11:52:54 +09:00
Giovanni Petrantoni 0fbc0ec4b2 fix multistream 1.1 multi proto 2020-07-08 11:52:44 +09:00
Giovanni Petrantoni 38422ff4cb Merge branch 'master' into gossip-one-one 2020-07-08 11:39:33 +09:00
Dmitriy Ryajov a52763cc6d
fix publishing (#250)
* use var semantics to optimize table access

* wip... lvalues don't work properly sadly...

* big publish refactor, replenish and balance

* fix internal tests

* use g.peers for fanout (todo: don't include flood peers)

* exclude non gossip from fanout

* internal test fixes

* fix flood tests

* fix test's trypublish

* test interop fixes

* make sure to not remove peers from gossip table

* restore old replenishFanout

* cleanups

* Cleanup resources (#246)

* consolidate reading in lpstream

* remove debug echo

* tune log level

* add channel cleanup and cancelation handling

* cancelation handling

* cancelation handling

* cancelation handling

* cancelation handling

* cleanup and cancelation handling

* cancelation handling

* cancelation

* tests

* rename isConnected to connected

* remove testing trace

* comment out debug stacktraces

* explicit raises

* restore trace vs debug in gossip

* improve fanout replenish behavior further

* cleanup stale peers more eaguerly

* synchronize connection cleanup and small refactor

* close client first and call parent second

* disconnect failed peers on publish

* check for publish result

* fix tests

* fix tests

* always call close

Co-authored-by: Giovanni Petrantoni <giovanni@fragcolor.xyz>
2020-07-07 18:33:05 -06:00
Eugene Kabanov 775cab414a
Remove SHA1 from crypto and crypto tests. (#251)
* Remove SHA1 from crypto and crypto tests.

* Simplify RSA comparison procedure.
Refactor some procedures in crypto.nim.
2020-07-07 15:48:15 +02:00
Giovanni Petrantoni 57e6a95b9c Merge branch 'publish-backporting' into gossip-one-one 2020-07-07 21:54:07 +09:00
Giovanni Petrantoni 2d0e285810 Merge branch 'master' into publish-backporting 2020-07-07 20:58:58 +09:00
Jacek Sieka d522537b19
reuse single RNG instance for all crypto key generation (#249)
* reuse single RNG instance for all crypto key generation

* use foolproof rng

* initRng -> newRng (because it's ref)

* fix test

* imports/exports, chat fix

* fix rsa

* imports and exports

* work around threadvar issue

* fixup

* mac workaround test
2020-07-07 13:14:11 +02:00
Giovanni Petrantoni 73cefce798 remove assertion in publish 2020-07-07 19:42:36 +09:00
Giovanni Petrantoni 69a92aebe6 merge 1.0 2020-07-04 20:53:40 +09:00
Giovanni Petrantoni 2f39cf6f42 Merge branch 'publish-backporting' into gossip-one-one 2020-07-04 19:37:31 +09:00
Giovanni Petrantoni 479c83c1df with sugar 2020-07-04 19:36:15 +09:00
Giovanni Petrantoni 5e0870d4a4 minor fixes 2020-07-04 14:22:58 +09:00
Giovanni Petrantoni aed8dcadaf actually lock the heartbeat 2020-07-04 14:09:42 +09:00
Giovanni Petrantoni ad7db1ca26 add more heartbeat locking to prevent races 2020-07-04 14:04:44 +09:00
Giovanni Petrantoni 466f3c9171 add back topics in peers, re-enable flood publish 2020-07-04 12:15:35 +09:00
Giovanni Petrantoni 028b390c7f conditional enable gossip11 module 2020-07-04 11:58:35 +09:00
Giovanni Petrantoni be0375f840 fix up merge 2020-07-04 11:51:09 +09:00
Giovanni Petrantoni afb5cb88f9 Merge remote-tracking branch 'origin/publish-backporting' into gossip-one-one 2020-07-04 11:42:16 +09:00
Giovanni Petrantoni 8d0709ce5d merge new pubsubpeer, copy 1.1 to new module 2020-07-04 11:29:37 +09:00
Giovanni Petrantoni 0d0309a601 better diagnostics 2020-07-03 09:28:20 +09:00
Giovanni Petrantoni 27d22d534d simplify rebalanceMesh (following spec) and make it finally reach D_high 2020-07-02 23:07:17 +09:00
Giovanni Petrantoni 5e4934bcce Merge branch 'master' into publish-backporting 2020-07-02 17:44:23 +09:00
Giovanni Petrantoni 4f5c97e27c remove topics from pubsubpeer (was unused) 2020-07-01 17:44:26 +09:00
Giovanni Petrantoni d9e0ca6091 getGossipPeers fixes 2020-07-01 17:26:42 +09:00
Giovanni Petrantoni a976c22dae triage publish nil peers (issue is on master too but just hidden behind a if/in) 2020-07-01 16:54:28 +09:00
Jacek Sieka b49c619ca8
export public field types (#248)
* export public field types

* one more
2020-07-01 09:22:29 +02:00
Giovanni Petrantoni ec00c7fc50
Peer resultification and defect only (#245)
* Peer resultification and defect only

* Fixing some tests

* test fixes

* Rename peer into peerid

* better result error message in identify

* further merge fixes
2020-07-01 08:25:09 +02:00
Giovanni Petrantoni f49e59cb4e improve fanout replenish behavior further 2020-06-30 11:36:47 +09:00
Giovanni Petrantoni 509d84f03d restore trace vs debug in gossip 2020-06-30 11:28:45 +09:00
Giovanni Petrantoni 9d33390239 restore utility module import 2020-06-30 00:17:58 +09:00
Dmitriy Ryajov c788a6a3c0
Cleanup resources (#246)
* consolidate reading in lpstream

* remove debug echo

* tune log level

* add channel cleanup and cancelation handling

* cancelation handling

* cancelation handling

* cancelation handling

* cancelation handling

* cleanup and cancelation handling

* cancelation handling

* cancelation

* tests

* rename isConnected to connected

* remove testing trace

* comment out debug stacktraces

* explicit raises
2020-06-29 09:15:31 -06:00
Giovanni Petrantoni 680dcfd9cb cleanups 2020-06-30 00:10:11 +09:00
Giovanni Petrantoni 3a657135dc Merge branch 'master' into publish-backporting 2020-06-29 22:02:58 +09:00
Giovanni Petrantoni 3dd28adc9f restore old replenishFanout 2020-06-29 10:46:59 +09:00
Giovanni Petrantoni 2356f6ab68 make sure to not remove peers from gossip table 2020-06-29 10:45:06 +09:00
Jacek Sieka aa6756dfe0
allow message id provider to be specified (#243)
* don't send public key in message when not signing (information leak)
* don't run rebalance if there are peers in gossip (see #242)
* don't crash randomly on bad peer id from remote
2020-06-28 09:56:38 -06:00