waku-org / pm

Project management, admin, misc
3 stars 1 forks source link

[Milestone] Composing Waku Protocols to Improve Reliability #114

Closed chair28980 closed 4 months ago

chair28980 commented 8 months ago

Milestone: https://github.com/waku-org/pm/milestone/7

NOTE: the work originally defined in this issue has been split between the following deliverables:

  1. https://github.com/waku-org/pm/issues/184
  2. https://github.com/waku-org/pm/issues/186

Epics

NOTE: Epics updated to fit within the above 2 Deliverables.

Summary

Deliverables:

Provide recommendation in a form of a library to compose the Waku protocols to minimize message loss at a protocol level. This is both for relay and non-relay node. The aim is to provide opinionated libraries that use Waku in a generalized manner. The library may not fit all use-case and can always be bypassed or forked.

Finally, the expectation is not 100% reliability but simply increased reliability for common scenarios. Application level solution for more certitude are covered as part of Minimum Viable Data Synchronization.

This is part of the general SDK strategy and expected to be implemented in each language:

Note that these SDKs needs to be reliable enough so that any developer can build a PoC application and reach a fair level of reliability. However, it is assumed that when a developer want to push an application to MVP level or further, deeper understanding of Waku is needed to fine tune Waku usage to the application.

Functionalities/User Stories

First attempt to define a functional scope for this milestone:

A. relay node

  1. As a developer, I want a simple API to process incoming messages on one or some content topics.
  2. As a developer, I do not care about shards or pubsub topics, I am only using autosharding
  3. As a developer, I do not want to process the same messages twice (e.g relay amplification should be abstracted)
  4. As a developer, I want a simple API to send messages with a set content topic
  5. As a developer, when sending messages I want fair reliability on whether the messages were propagated (e.g. using store sync)
  6. As a developer, I want some fair protocol level safeguard to ensure that missed messages are detected (e.g. using store sync)

B. non-relay node

  1. As a developer, I want a simple API to register hooks to process messages on one or several content topics
  2. As a developer, I do not care about shards or pubsub topics, I am only using autosharding
  3. As developer, I want fair reliability when receiving messages (e..g redundant filter nodes + filter ping + store sync)
  4. As a developer, I do not want the same incoming message to be processed several times (e.g. filter redundancy should be abstracted)
  5. As a developer, I want fair reliability when sending messages.

Implementation Notes

Relay client

Non-relay client

Receiving messages:

Sending messages:

js-waku vs NodeJS bindings.

API for this output for js-waku and NodeJS bindings should aim to be aligned as much as possible, even if js-waku is non-relay and NodeJS is relay node.

Dependencies

To deliver the reliability part, this would depends on store v3 protocol to get access of message hashes. On research side, couple of weeks left on this (as of 19 Feb) and iteration on nwaku needed.

vpavlin commented 8 months ago

I think the user stories sound good and pretty comprehensive.

My main issues stemmed from a few things so far

  1. Unreliable Filter - seemed like the filter nodes just stopped propagating messages to my app (even with ping on), so I had to resubscribe - but js-waku kept trying to resubscribe to the same node, which for some reason would not work. So having multiple filter nodes and js-waku (or the library) keeping track of this would save a lot of trouble

  2. Unrelaiable Lightpush - after a while I started getting "Remove peer fault" errors and the only thing I could do was to retry. It would be great if the library could just pick different LIghtpush node in case sending fails multiple times

  3. As my filter subscription was failing, I always missed a few messages, so I kept track of the last received message and tried to query store for anything from that timestamp till now.

I implemented all of these in https://github.com/vpavlin/waku-dispatcher/blob/main/src/dispatcher.ts, so it would be great if we can have them in an official library

weboko commented 8 months ago

At this point non-relay node is more relevant to js-waku.

Given formulation I think our team can do following things:

In case of need we can keep an eye on what @vpavlin provided (and we chatted about month ago) - https://github.com/vpavlin/waku-dispatcher/blob/main/src/dispatcher.ts

fryorcraken commented 8 months ago

Current proposal is to limit the bindings to relay node: https://github.com/waku-org/pm/issues/121 So indeed, non-relay would apply to js-waku and relay to nwaku.

fryorcraken commented 8 months ago

@vpavlin I believe the problems you highlighted would be covered by the proposed user stories.

fryorcraken commented 8 months ago

We may also want to add something about connection feedback. I saw some reccent improvement in js-waku here: https://github.com/waku-org/js-waku/issues/1666

vpavlin commented 8 months ago

Yes, I think the user stories are good

fryorcraken commented 8 months ago

should mention RLN

weboko commented 8 months ago

Considering previous comments and this comment I would roughly define js-waku work streams as follows:

We can de-scope some of these streams in the interest of time.

@waku-org/js-waku-developers , @danisharora099 please, add anything I missed

chaitanyaprem commented 8 months ago

Current proposal is to limit the bindings to relay node: waku-org/pm#121 So indeed, non-relay would apply to js-waku and relay to nwaku.

non-relay would be required for nwaku as well, because status desktop (light mode) and status mobile use lightpush and Filter.

chaitanyaprem commented 8 months ago
  1. Unreliable Filter - seemed like the filter nodes just stopped propagating messages to my app (even with ping on), so I had to resubscribe - but js-waku kept trying to resubscribe to the same node, which for some reason would not work. So having multiple filter nodes and js-waku (or the library) keeping track of this would save a lot of trouble

Interesting, we have not seen this so far with status testing. If a node is subscribed to filter, then messages would always be pushed to it. Rather the issues have been more due to something else causing message loss. Wondering if this could be due to browser env where connections are unstable?

fryorcraken commented 8 months ago

non-relay would be required for nwaku as well, because status desktop (light mode) and status mobile use lightpush and Filter.

I don't expect Status to use the output of this milestone. Status already composes the protocols to enable reliability.

Wondering if this could be due to browser env where connections are unstable? Yes, seems to be related to websocket.

fryorcraken commented 8 months ago

A potential follow up would be to add health indicator similar to https://github.com/waku-org/go-waku/issues/1021

However, keeping this out of scope to expedite milestone delivery.

fryorcraken commented 8 months ago

LGTM. Sign-off to happen at Waku PM call

fryorcraken commented 7 months ago

Questions:

fryorcraken commented 7 months ago

Signed-off EU-AS 19 Feb

fryorcraken commented 7 months ago

I suggest to only support autosharding as part of this milestone.

chair28980 commented 7 months ago

Add to scope: https://github.com/waku-org/js-waku/issues/1834 - feat: create helper for running docker locally

fryorcraken commented 7 months ago

Add to scope: waku-org/js-waku#1834 - feat: create helper for running docker locally

Did you mean to update https://github.com/waku-org/pm/issues/137 ?

fryorcraken commented 7 months ago

We decided not to go with a health status to minimize milestone scope: https://github.com/waku-org/go-waku/issues/1021

However this is is something we can do down the road on a follow-up milestone.

weboko commented 7 months ago

We decided not to go with a health status to minimize milestone scope: waku-org/go-waku#1021

However this is is something we can do down the road on a follow-up milestone.

Booking this under following issue for js-waku: https://github.com/waku-org/js-waku/issues/1865

chair28980 commented 4 months ago

Work split between two new deliverables based on updated 2024 Roadmap. Closing in favor of https://github.com/waku-org/pm/issues/184 and https://github.com/waku-org/pm/issues/186.