Commit Graph

443 Commits

Author SHA1 Message Date
Zahary Karadjov 454f658ba8
Fixes and tweaks related to the beacon node integration
* Bugfix: Dialing an already connected peer may lead to crash

* Introduced a standard_setup module allowing to instantiate
  the `Switch` object in an easier manner.

* Added `Switch.disconnect(peer)`

* Trailing space removed (sorry about polluting the diff)
2019-12-08 23:58:43 +02:00
Dmitriy Ryajov 31aaa2c8ec update with latest changes 2019-12-07 10:50:58 -06:00
Dmitriy Ryajov 5f6fcc3d90
extract public and private keys fields from peerid (#44)
* extract public and private keys fields from peerid

* allow assigning a public key

* cleaned up TODOs

* make pubsub prefix a const

* public key should be an `Option`
2019-12-07 10:36:39 -06:00
Dmitriy Ryajov e623e70e7b
PubSub (Gossip & Flood) Implementation (#36)
This adds gossipsub and floodsub, as well as basic interop testing with the go libp2p daemon. 

* add close event

* wip: gossipsub

* splitting rpc message

* making message handling more consistent

* initial gossipsub implementation

* feat: nim 1.0 cleanup

* wip: gossipsub protobuf

* adding encoding/decoding of gossipsub messages

* add disconnect handler

* add proper gossipsub msg handling

* misc: cleanup for nim 1.0

* splitting floodsub and gossipsub tests

* feat: add mesh rebalansing

* test pubsub

* add mesh rebalansing tests

* testing mesh maintenance

* finishing mcache implementatin

* wip: commenting out broken tests

* wip: don't run heartbeat for now

* switchout debug for trace logging

* testing gossip peer selection algorithm

* test stream piping

* more work around message amplification

* get the peerid from message

* use timed cache as backing store

* allow setting timeout in constructor

* several changes to improve performance

* more through testing of msg amplification

* prevent gc issues

* allow piping to self and prevent deadlocks

* improove floodsub

* allow running hook on cache eviction

* prevent race conditions

* prevent race conditions and improove tests

* use hashes as cache keys

* removing useless file

* don't create a new seq

* re-enable pubsub tests

* fix imports

* reduce number of runs to speed up tests

* break out control message processing

* normalize sleeps between steps

* implement proper transport filtering

* initial interop testing

* clean up floodsub publish logic

* allow dialing without a protocol

* adding multiple reads/writes

* use protobuf varint in mplex

* don't loose conn's peerInfo

* initial interop pubsub tests

* don't duplicate connections/peers

* bring back interop tests

* wip: interop

* re-enable interop and daemon tests

* add multiple read write tests from handlers

* don't cleanup channel prematurely

* use correct channel to send/receive msgs

* adjust tests with latest changes

* include interop tests

* remove temp logging output

* fix ci

* use correct public key serialization

* additional tests for pubsub interop
2019-12-05 20:16:18 -06:00
Dmitriy Ryajov 903e79ede1
Feat/conn cleanup (#41)
Backporting proper connection cleanup from #36 to align with latest chronos changes.

* add close event

* use proper varint encoding

* add proper channel cleanup in mplex

* add connection cleanup in secio

* tidy up

* add dollar operator

* fix tests

* don't close connections prematurely

* handle closing streams properly

* misc

* implement address filtering logic

* adding pipe tests

* don't use gcsafe if not needed

* misc

* proper connection cleanup and stream muxing

* re-enable pubsub tests
2019-12-03 22:44:54 -06:00
Dmitriy Ryajov 1df16bdbce set log level to trace - not enabled by default 2019-12-02 18:43:21 -06:00
Zahary Karadjov f9eed172d4 Don't handle Exception 2019-12-03 01:26:59 +02:00
Dmitriy Ryajov 5e49072f24 upping chronos version 2019-12-03 01:26:59 +02:00
Dmitriy Ryajov 26366f8b56 use `Exception` to emulate `getCurrentException()` 2019-12-03 01:26:59 +02:00
Dmitriy Ryajov a5b051a14f fix: use exception `msg` field in logs 2019-12-03 01:26:59 +02:00
Dmitriy Ryajov 9e437a681b fix: revert to proper exception handling 2019-12-03 01:26:59 +02:00
cheatfate dde8c01448
Workaround for https://github.com/nim-lang/Nim/issues/12764 .
Remove usage of getCurrentException().
2019-11-28 20:58:56 +02:00
Dmitriy Ryajov 253aa7cf75 fix typo in readme 2019-11-06 12:19:55 -06:00
Dmitriy Ryajov fe3c1d45bb misc: removing unneded accessors 2019-11-06 12:13:21 -06:00
cheatfate 73a309027f
Add proper dependency for nimble file. 2019-11-06 13:59:03 +02:00
cheatfate 80e128b0d9
Tests are now testing with --threads:on.
Bump version to 0.0.2.
2019-11-06 13:01:16 +02:00
Ștefan Talpalaru f3fc763895
daemonapi: direct p2pd's output to parent's streams 2019-11-05 21:16:56 +01:00
Dmitriy Ryajov 1c16eb5d69 docs: reword readme 2019-11-04 22:30:00 -06:00
cheatfate 76fee97724
Fix MultiAddress.init(PeerID) compilation problem. 2019-11-04 20:57:17 +02:00
cheatfate 833e8c9406
Fix overflow problem.
Fix compilation warnings.
2019-10-29 20:51:48 +02:00
Dmitriy Ryajov 400218ba01 fixing remaining overflows in BE/LE 2019-10-29 11:02:28 -06:00
Dmitriy Ryajov 541f0f2a41 avoid buffer overflow on BE/LE conversions 2019-10-29 10:10:19 -06:00
cheatfate cc0d45c482
Add protoAddress() utility procedure. 2019-10-29 15:38:37 +02:00
cheatfate 6d8f21b611
Attempt to fix nimble issues. 2019-10-23 13:27:51 +03:00
Dmitriy Ryajov 21af081066 remove init in favor of upstream init 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov a4431a86a1 fixing windows build issue 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 7b66198566 use init instead of toMultiAddr 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 0b77c8c6e3 add init from TransportAddress to multiaddress 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov ae7b354819 unused directory 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 9e16fd020e use PeerID `==` for comparisons 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov a6cc199807 rebasing latest master 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 9c3b73d40b fix: floodsub with multiple nodes 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 018da65708 compare peer string ids, rather than keys 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 3194e3ac5b fixes after building with 0.20.2 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov bb277d4b56 readLp should warn on ignored exceptions 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov a1c760127b fix floodsub tests 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 464d75d159 minor style fixes 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov f9f75254af readding commented out tests 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 2066e81658 set default timeout to 10 secs 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov b281f46ee5 add tests for self trigger 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 1d4b51413e option to allow triggering own handlers on publish 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 37d7a03fba use a timed cache in floodsub 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 468cddeb45 style/cleanup 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov e98ec9fd49 use doAssert for release asserts 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov f190c155d3 don't throw on missing peer 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 3b9d34116d decrease floodsub traffic 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov f9a04dbb9d todo: poll should allow for timeouts 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov cfd31c5251 properly handle empty messages 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 60b5b2dc2e add pubsub tests 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 6cfbf2c124 don't send messages to self 2019-10-11 08:15:24 +09:00