-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Autosharding API for relay subscriptions #1983
Conversation
You can find the image built from this PR at
Built from 86fc087 |
You can find the experimental image built from this PR at
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I think:
- subscribing, unsubscribing and publishing on the underlying gossipsub object should only happen in one place. We currently have multiple paths towards each of these functions, which will be very error-prone and requires multiple logic duplications. If we add another API call for e.g.
subscribe
, it should simply do the necessary translations/conversions (e.g. determining the pubsub topic via autosharding) to call the "base"subscribe
. - I think we should avoid mixed configuration here: people should either subscribe via content topics or directly on pubsub topic. In other words, once you've unsubscribed from all content topics matching a specific shard, that shard subscription can be safely removed without considering if we have configured a "direct" subscription too.
- this would make the auto-subscription methods a very light layer on top of the existing subscribe/unsubscribe functions and hopefully minimise the state we have to keep
It now only use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I think it looks great! I added comments that I hope you find useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nice and enriching PR! Thanks for it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I think this is now much cleaner than before. Approving as I don't want to be blocker, but have made some minor suggestions below.
# This is the 1st commit message: feat: Autosharding API for relay subscriptions # This is the commit message #2: Fix
…erly (#2082) * libwaku.nim: unsubscribe -> unsubscribeAll to make it build properly We introduced a change in the next PR #1983 that made the `libwaku` to stop building properly (make libwaku) because a signature change in the `unsubscribe` proc of waku/waku_relay/protocol.nim. This commit is a temporary workaround to make it work, and not block any ongoing PR tests, although not exactly as it is expected because we are unsubscribing from all topics. * ci.yml: adds library/** to force tests when changes under that folder
Description
Added new API that take only content topics and use autosharding to subscribe to the correct shard.
You have to manage the relay handlers otherwise it would happen that unsubscribing from a shard would remove all content topic handlers.
You also have to not duplicate or remove the default handlers otherwise Filter and/or Archive would receive no or duplicate messages.
I don't like adding more code to
waku_node
maybe adding a new component/sub-system would be better?Changes
waku_node
track subscriptions to avoid unsubbing from shard used by other content topics.waku_relay
now has the same proc than GossipSubunsubscribeAll
which take no handler andunsubscribe
that remove only the handler provided.Tracking #1936