Commit Graph

1111 Commits

Author SHA1 Message Date
Tanguy 868ecab54f
Pin go version in CI (#706) 2022-04-05 13:12:55 +02:00
Tanguy 84cbcd8f22
Bump dependencies (#703) 2022-03-29 09:23:24 +02:00
Tanguy eaa72dcdbe
WS Accept timeout (#699)
* Add timeout to WS accept
* Handle more WS errors
2022-03-17 10:16:48 +01:00
Tanguy c7504d2446
Gossipsub peer exchange (#647)
* Signed envelopes and routing records
* Send signed peer record as part of identify (#649)
* Add SPR from identify to new peer book (#657)
* Send & receive gossipsub PX
* Add Signed Payload

Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com>
2022-03-14 09:39:30 +01:00
Tanguy cba3ca3c3e
Unstable (#695) 2022-02-25 09:41:32 +01:00
Eric Mastro 44a7260f07
fixes from #688 (#697)
* tests: invert message logic on expect from #688
* fix: export pubsub_errors for backward compatibility
2022-02-24 17:32:20 +01:00
Tanguy c09d032133
Allow force dial (#696) 2022-02-24 17:31:47 +01:00
Tanguy f98bf612bd
Fix tests of #638 2022-02-21 18:14:43 +01:00
Tanguy fd59cbc7a9
Fix shuffle of #638 2022-02-21 17:00:18 +01:00
Tanguy bc318084f4
GS: Publish to fanout when mesh unhealthy (#638)
* Send to fanout when mesh unhealthy

* don't use fanout when floodPublish
2022-02-21 16:22:08 +01:00
Eric Mastro 3b718baa97
feat: allow msgIdProvider to fail (#688)
* feat: allow msgIdProvider to fail

Closes: #642.

Changes the return type of the msgIdProvider to `Result[MessageID, string]` so that message id generation can fail.

String error type was chosen as this `msgIdProvider` mainly because the failed message id generation drops the message and logs the error provided. Because `msgIdProvider` can be externally provided by library consumers, an enum didn’t make sense and a object seemed to be overkill. Exceptions could have been used as well, however, in this case, Result ergonomics were warranted and prevented wrapping quite a large block of code in try/except.

The `defaultMsgIdProvider` function previously allowed message id generation to fail silently for use in the tests: when seqno or source peerid were not valid, the message id generated was based on a hash of the message data and topic ids. The silent failing was moved to the `defaultMsgIdProvider` used only in the tests so that it could not fail silently in applications.

Unit tests were added for the `defaultMsgIdProvider`.

* Change MsgIdProvider error type to ValidationResult
2022-02-21 16:04:17 +01:00
Tanguy 9a7e3bda3c
Bump dependencies (#694) 2022-02-10 14:21:12 +01:00
Tanguy 00e1f9342f
Fix identify log for json_sink (#690) 2022-02-01 18:35:48 +01:00
Tanguy 07da14a7a7
Fix websocket EOF reading exception (#689) 2022-01-28 18:05:07 +00:00
Tanguy c18830ad33
Score correctly on mesh peer unsub (#644)
* Score correctly on mesh peer unsub
* remove from mesh before removing from gossipsub
2022-01-15 12:47:41 +01:00
Tanguy 1a97d0a2f5
Validate pubsub subscriptions (#627)
* Check topic before subscribing
* Block subscribe to invalid topics
2022-01-14 12:40:30 -06:00
Ștefan Talpalaru e72d03bc78
CI: test with multiple Nim versions by default (#684)
* CI: test with 1.2 & devel by default
* Skip buggy windows websocket test
2022-01-10 12:29:52 +01:00
Tanguy 388b92d58f
Bump dependencies (#683) 2022-01-07 08:19:22 +01:00
Tanguy f3dee6865c
Chronos strict exception tracking (#652)
* Enable chronos strict exception tracking ( -d:chronosStrictException )
2022-01-05 16:27:33 +01:00
Dmitriy Ryajov dffe4bed45
mitigate high traffic - drop faulty peers (#460)
Only allow 1 connection per peer

Co-authored-by: Tanguy <tanguy@status.im>
2022-01-04 11:21:24 +00:00
Tanguy fb0d10b6fd
Gossipsub: process messages concurrently (#680)
* Gossip sub: process messages concurrently

* Retries for flaky test
2021-12-27 11:17:00 +01:00
Tanguy 58f383e661
Bump unittest2
Now that we have pinned nimble deps, we get
surprises from the nim version updates
2021-12-17 09:13:17 +01:00
Tanguy 123bf290c3
Merge branch 'unstable' (#674) 2021-12-17 08:31:47 +01:00
Tanguy 1e7e95f5fd
Pin dependencies for CI (#677)
Adds a pin-file for CI. When a dependency break something in the libp2p, we don't want for the CI to be
broken on every branch, just on a "bump" branch that will update the pin-file & fix the eventual interop issue.
2021-12-16 18:00:10 +00:00
Tanguy df566e69db
Fixes for style check (#676) 2021-12-16 11:05:20 +01:00
Tanguy 1152012bb0
Update README
Core developers, badges, module list were not up to date
2021-12-15 15:01:28 +01:00
Jacek Sieka c49932b55a
fast path for writes (#659)
avoids several copies of the various message buffers being kept alive
for the lifetime of the future
2021-12-14 10:55:17 +01:00
Tanguy 47a35e26d7
Typo: s/unsubcribeBackoff/unsubscribeBackoff (#675) 2021-12-14 10:50:57 +01:00
Etan Kissling 2373ee0061
harden `ecnist` byte export against uninitialized key (#671)
Currently, `ecnist`'s `toBytes` and `getBytes` methods operate only on
properly initialized keys. If an un-initialized key is given, an
`IndexError` may be raised if the key's `xlen` / `qlen` property is
larger than the maximum buffer size. This patch hardens those functions
to report a proper error in that case.
Note that the library functions called by `init` and `initRaw` already
reject data that does not have the expected length, so these new checks
should not be reachable in practice.
2021-12-13 18:46:25 +00:00
Etan Kissling 0be9180977
harden `ProtoBuffer.finish()` assert (#672)
This hardens the length check in `ProtoBuffer.finish` to account for
passed `options`.
2021-12-13 18:31:05 +00:00
Tanguy 8fe44e35c2
Fix flaky tests (#669)
* Fix push identify flaky test
* Fix mplex flaky tests
* Fix switch flaky test
2021-12-13 11:25:33 +01:00
Jacek Sieka 18dc233c9b
link to style guide 2021-12-10 10:11:52 +01:00
Eric Mastro fffa7e8cc2
fix: remove returned Futures from switch.start (#662)
* fix: remove returned Futures from switch.start

The proc `start` returned a seq of futures that was mean to be awaited by the caller. However, the start proc itself awaited each Future before returning it, so the ceremony requiring the caller to await the Future, and returning the Futures themselves was just used to handle errors. But we'll give a better way to handle errors in a future revision

Remove `switch.start` return type (implicit `Future[void]`)

Update tutorials and examples to reflect the change.

* Raise error during failed transport

Replaces logging of error, and adds comment that it should be replaced with a callback in a future PR.
2021-12-03 19:23:12 +01:00
Tanguy 6893bd9dbb
Customizable gossipsub backoff on unsubscribe (#665)
* Customizable gossipsub backoff on unsubscribe
* change default to 5s
2021-12-02 14:47:40 +00:00
Eric Mastro c19b966d23
fix (directchat): auto disconnect self once conn closed (#663)
When closing a connection of clientA(using the command “/disconnect”), the connection is then closed on clientA’s side. However, the connection remained open on clientB and clientB could continue sending message to clientA and clientA would receive those messages.

This PR listens for a closing connection on clientB, then also closes clientB’s connection.
2021-12-02 13:45:55 +01:00
Tanguy b8c54068a3
Handle websock exceptions in handle (#658) 2021-11-26 13:55:35 +01:00
Tanguy 0dfac6fce7
Signed envelopes and routing records (#656) 2021-11-24 14:03:40 -06:00
Dmitriy Ryajov 73168b6eae
Add support for multiple addresses to transports (#598)
* add test for multiple local addresses

* allow transports to listen on multiple addrs

* fix tcp transport accept

* check switch addrs are correct

* switch test to port 0

* close accepted peers on close

* ignore CancelledError in transport accept

* test ci

* only accept in accept loop

* avoid accept greedyness

* close acceptedPeers

* accept doesn't crash on cancelled fut

* add common transport test

* close conn on handling failure

* close accepted peers in two steps

* test for macos

* revert accept greedyness

* fix dialing cancel

* test chronos fix

* add ws

* ws cancellation

* small fix

* remove chronos blocked test

* fix testping

* Fix transport's switch start (like #609)

* bump chronos

* Websocket: handle both ws & wss

Co-authored-by: Tanguy Cizain <tanguycizain@gmail.com>
Co-authored-by: Tanguy <tanguy@status.im>
2021-11-24 14:01:12 -06:00
Tanguy 98184d9dfd
Merge pull request #654 from status-im/ci_testslim
CI Multi nim: only test slim
2021-11-19 14:54:51 +01:00
Tanguy 5f18968c3f
CI Multi nim: only test slim 2021-11-19 11:52:29 +01:00
Tanguy 32ede6da3c
Merge pull request #651 from status-im/unstable
Unstable
2021-11-16 17:36:00 +01:00
Tanguy 6f779c47c8
Gossipsub: don't send to peers seen during validation (#648)
* Gossipsub: don't send to peers seen during validation

* Less error prone code

* add metric

* Fix metric

* remove dangling code test

* address comments

* don't allocate memory
2021-11-14 09:08:05 +01:00
Tanguy 5d1b10f3e7
Short agent fix (#645)
* Copy client type to muxed channel

* Fix incoming shortAgent
2021-11-08 18:33:37 +01:00
Tanguy 7d677f848f
Short agent fix (#645)
* Copy client type to muxed channel

* Fix incoming shortAgent
2021-11-08 17:42:56 +01:00
Tanguy c92125a1a4
Integrate dns resolving (#615)
* integrate dns

* give hostname to transport dial

* add hostname test

* switched to websock master

* Add dnsaddr dial test w multiple transports
2021-11-08 13:02:03 +01:00
Tanguy e787fc35a6
Add examples to CI (#599)
* add examples to CI

* add markdown runner

* two tutorials
2021-11-08 13:00:44 +01:00
Zahary Karadjov cf8a1a60a4 Work-around a Nim compilation error 2021-11-04 12:19:17 +02:00
Tanguy e1d96a0f4d
Remove isWire (#640) 2021-10-28 19:11:31 +02:00
Ștefan Talpalaru b308affb98
CI: test multiple Nim compiler branches (#624)
* CI: test multiple Nim compiler branches

* make it a separate workflow and limit target branches

* make it a daily job
2021-10-26 14:47:30 -06:00
Tanguy 5885e03680
Add maxMessageSize option to pubsub (#634)
* Add maxMessageSize option to pubsub
* Switched default to 1mb
2021-10-25 12:58:38 +02:00