There is now a global PeerStore structure (instead of having one for libp2p, one for waku, etc)
The user can create custom books for new types easily
Also add a pruning system to remove dead peers
* 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>
* 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
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.