fix!: add topicValidators to pubsub interface#298
Conversation
|
What's the reasoning behind this being a field on the public API and not an implementation-specific field? Given that it's part of the public API and |
|
I guess it is in the spec so maybe we are fine with it? |
Spec says it's mandatory for every implementation so it makes sense to have it in public API and shared between implementations. From what I see, none of the implementations are caching it and support changing it at runtime (which spec doesn't say it must be supported): |
|
If we aren't gonna adopt this in interfaces, we should remove/change example which says this is possible: https://github.com/libp2p/js-libp2p/blob/master/examples/pubsub/message-filtering/README.md |
|
No, I guess this just got missed during some of the refactorings. If this works out of the box with floodsub and gossipsub it's probably safe to release it as a minor, right? |
Both floodsub/pubsub and gossipsup has a different implementation. I took a bit of both. |
achingbrain
left a comment
There was a problem hiding this comment.
LGTM, just a small nit about the comments
|
We should probably allow @wemeetagain @dapplion and @tuyennhv to review as this impacts gossipsub |
|
@mpetrunic could you PR floodsub and gossipsub with the updates necessary to support this interface change? |
already have changes locally for pubsub/floodsub, will do gossipsub |
dapplion
left a comment
There was a problem hiding this comment.
Requiring functions to throw is a bad pattern I've been regreting in Lodestar for a while. Exceptions should be exceptional, and a message getting a REJECT, IGNORE is expected behaviour.
topicValidators have to be mutable at runtime too.
So these changes LGTM
## [@libp2p/interface-pubsub-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v2.1.0...@libp2p/interface-pubsub-v3.0.0) (2022-10-11) ### ⚠ BREAKING CHANGES * add topicValidators to pubsub interface (#298) ### Bug Fixes * add topicValidators to pubsub interface ([#298](#298)) ([e5ff819](e5ff819))
|
🎉 This PR is included in version @libp2p/interface-pubsub-v3.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [@libp2p/interface-pubsub-compliance-tests-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v2.0.5...@libp2p/interface-pubsub-compliance-tests-v3.0.0) (2022-10-11) ### ⚠ BREAKING CHANGES * add topicValidators to pubsub interface (#298) ### Bug Fixes * add topicValidators to pubsub interface ([#298](#298)) ([e5ff819](e5ff819)) ### Dependencies * update sibling dependencies ([8f3680e](8f3680e))
|
🎉 This PR is included in version @libp2p/interface-pubsub-compliance-tests-v3.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
resolves #297
Still need to: