Closed fryorcraken closed 8 months ago
some learnings: js-waku being a client and not actually participating in discv5 discovery process, the implementation would be mostly limited to filtering out the right nodes from discovery protocols; in terms of peer exchange, the goal is to connect only with peers from the PX response that share the same pubsub topic or shard that the relay protocol is subscribed to, while discarding other peers received in the response
cc @fryorcraken keen to know your perspective on the above
note: is currently blocked on nwaku and go-waku as while they have the functionality implemented, they are not exposed to the user yet through a flag
Child issue: https://github.com/waku-org/js-waku/issues/1430
some learnings: js-waku being a client and not actually participating in discv5 discovery process, the implementation would be mostly limited to filtering out the right nodes from discovery protocols; in terms of peer exchange, the goal is to connect only with peers from the PX response that share the same pubsub topic or shard that the relay protocol is subscribed to, while discarding other peers received in the response
cc @fryorcraken keen to know your perspective on the above
that and we also need to implement the API to enable static and naming sharding on filter, light push, store and relay. Which is the discussion I saw on Discord.
Note this is needed for the "community preview" web portal of Status. Cc @danisharora099 @chair28980 @john-44 @prichodko @felicio
Note this is needed for the "community preview" web portal of Status. Cc @danisharora099 @chair28980 @John-44 @prichodko @felicio
and Community Channel Preview web pages
some notes for design:
pubsubTopic
when they wanna start a node beforehand@weboko and I discussed how the user flow might look like for subscription & unsubscription from the user's end where we assume Alice will pass the shard during the initialisation of the node:
sequenceDiagram
participant Alice
participant js-waku
participant connection manager
Alice->>js-waku: start (pass [`shard1`, `shard2`])
js-waku->>connection manager: discovers & attempts connections to relevant peers
connection manager->>connection manager: cache peers for irrelevant static shards
Alice->>js-waku: subscribe to a new pubsubtopic (`shard3`) based on IDecoder (that includes pubsubTopic)
js-waku->>js-waku: if the new IDecoder is for static sharding (following topic name convention)
js-waku->>connection manager: attempt dial
connection manager->>connection manager: check if we already have a connected peer for this shard & use this peer
connection manager->>connection manager: else, loop over discovered peers and attempt a dial to new peer
js-waku->>Alice: if no peers are found for that shard -- throw error
js-waku->>Alice: else, return the subscription object
Alice->>js-waku: unsubscribe (shard1)
js-waku->>connection manager: drop connection with peers that exclusively support that shard
My view here is that there are the following sub-tasks:
createWakuNode({ shards })
;PeerStore
shards relevant to it;IEncoder
& IDecoder
to facilitate the passing of shard in ISubscriber
;unsubscribe
so that if no listeners to a shard are found - drop connection to a peer which was used for that shard exclusively;Taking into account https://github.com/waku-org/js-waku/issues/1430#issuecomment-1655066881, where we assume that shards will not change mid-run; we can update the sequence diagram as:
sequenceDiagram
participant Alice
participant js-waku
participant connection manager
Alice->>js-waku: start (pass [`shard1`, `shard2`])
js-waku->>connection manager: discovers & attempts connections to relevant peers
Alice->>js-waku: send a subscription request that includes a pubsubtopic based on IDecoder
js-waku->>js-waku: if the new pubsubtopic is different from initialisation, throw error
js-waku->>js-waku: if the new pubsubtopic is one of the ones from initialisation, proceed
js-waku->>connection manager: open a stream with one of the connected peers from the relevant shard
js-waku->>Alice: return the subscription object
this definitely narrows our scope of work (v1) but we can design our system as above discussed where we think of it being potentially scaled up to being used for run-time changes as well (v2?)
pubsubTopics
during the creation of node: https://github.com/waku-org/js-waku/pull/1586
const node = createRelayNode({ cluster: M, shards: [N, O] });
rs
/rsv
and add that information in PeerStore
for easier accessrs
/rsv
value & then dial them accordinglypubsubTopic
for that request is for a shard that the js-waku node was setup with during initialisation: https://github.com/waku-org/js-waku/pull/1586
let me know what you think @weboko @fryorcraken
Looks good. Would be good to have a review from @waku-org/go-waku-developers and @waku-org/nwaku-developers if they see any issue from their experience/implementaiton.
Agreed that for static sharding, we can assume that the static shard does not change after a start to support the Community Preview portal and Community Channel web pages for Status. Cc @felicio @prichodko
Do note that with auto-sharding, shards can change mid run (but out of scope for this issue).
Weekly Update
Weekly Update
Weekly Update
master
and the Static Sharding milestone is now completereopening this in reference to https://github.com/waku-org/js-waku/issues/1684 to be done
Closing considering #1684 is done
Planned start date: Due date: 15 Oct 2023
Summary
Implement Static Sharding as specified in https://rfc.vac.dev/spec/51/#static-sharding
Acceptance Criteria
As an app dev, I can...
Tasks
Taking into account https://github.com/waku-org/js-waku/issues/1430#issuecomment-1655066881, where we assume that shards will not change mid-run; we can update the sequence diagram as:
this definitely narrows our scope of work (v1) but we can design our system as above discussed where we think of it being potentially scaled up to being used for run-time changes as well (v2?)
Tasks (v1)
Create
pubsubTopics
during the creation of node: https://github.com/waku-org/js-waku/pull/1586const node = createRelayNode({ cluster: M, shards: [N, O] });
Discovery
rs
/rsv
and add that information inPeerStore
for easier access https://github.com/waku-org/js-waku/pull/1626ConnectionManager
rs
/rsv
value & then dial them accordingly https://github.com/waku-org/js-waku/pull/1626Protocols
pubsubTopic
for that request is for a shard that the js-waku node was setup with during initialisation: https://github.com/waku-org/js-waku/pull/1586RAID (Risks, Assumptions, Issues and Dependencies)