Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.1.md#extended-validators
Add extended topic validators and minimal refactoring to properly support it
Integrate scoring for validation (validation begin/reject/ignore), and successful message delivery
src/pubsub.js
required some refactoring to support this feature. The main reason is that messages should first be checked forseenCache
entries before running topic validation. Since theseenCache
is currently on the gossipsub layer, and validation on the pubsub layer, there was some reworking to allowseenCache
to checked before validation -- namely, moving validation from_processRpc
, as a pre-step to_processRpcMessage
, to instead run validation within_processRpcMessage
. (See libp2p/js-libp2p-pubsub#50 and #92 for wrinkles still lingering)This required some refactoring of the pubsub tests within this repo.
src/pubsub.js
also got some slight refactoring around emitting messages._emitMessage
now takes a single parameter (a InMessage), and is reused in both self publishing and publishing from received messages._processRpcMessage
was extended with an additional method_publishFrom
, which is meant to act as the "success case" for messages received from peers (step 7 in #92). This method is now extended on the gossipsub layer to broadcast messages to floodsub/mesh peers and support "message delivered" peer scoring.