Skip to content
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: configure and filter discovered records for static shards #1776

Closed
3 tasks done
jm-clius opened this issue Jun 1, 2023 · 1 comment
Closed
3 tasks done

feat: configure and filter discovered records for static shards #1776

jm-clius opened this issue Jun 1, 2023 · 1 comment
Assignees
Labels
good first issue Good for newcomers

Comments

@jm-clius
Copy link
Contributor

jm-clius commented Jun 1, 2023

Problem

This is a subtask for #1643

RFC 51 introduces the idea of static sharding for Waku and specifies how static shards should be encoded in ENRs. A Waku client should be configurable to relay messages on one or more static shards, encode this information in its own advertised ENR and filter discovered peers to only consider those subscribed to the static shards that it's configured for.

#1763 added the following functionality towards achieving this:

  • ability to encoding static shards into an ENR, check if the record contains a specific shard and other utilities see module
  • ability to filter discovered discv5 nodes using a predicate function

However, to finish this feature, the following still needs to be finished:

  • the wakunode2 app should be configurable with static shards
  • a node configured for static shards should encode this in its own advertised ENR
  • a node configured for static shards should filter its discovered nodes to only consider those connected to one or more of its own configured static shards

Suggested solution

To achieve the above, I can see at least three self-contained steps, preferably completed in at least three incremental PRs:

Step 1: allow static shard configuration on wakunode2 application

This entails allowing the node to be configured for static shards via the app's --topic option.
Once configured for one or more static shards, the app should verify that:

  • there are no configured non-static shard topics
  • all configured static shards are from the same cluster (see RFC 51)
    A node with static shard configuration should then encode this information in its ENR.

Step 2: move discv5 discovery loop into wakunode2 application

In order to sensibly create a predicate function by which to filter discovered nodes, the recurring task of discv5 lookups should move from the node to the application. This in turn would allow us to remove wakuDiscv5 as a node component.

Step 3: create predicate to filter discovered nodes on static shard

Once the discv5 discovery loop is part of the application (and not the underlying node), the application should create a predicate function by which to filter discovered node records (ENRs), if it detects a static shard configuration. This should use the already provided functionality to filter ENRs based on the static shard field.

Acceptance criteria

  • nodes configured with static shard topics advertise this in their ENR according to RFC51
  • discv5 no longer belongs to the waku_node, but to the wakunode2 application
  • nodes configured with static shard topics filter discovered nodes according to their own configuration
@SionoiS
Copy link
Contributor

SionoiS commented Jun 20, 2023

Discv5 re-org will be tracked separately. Other stuff is done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Archived in project
Development

No branches or pull requests

2 participants