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(discv5): added find random nodes with predicate (#1762) #1763

Merged
merged 6 commits into from
Jun 6, 2023

Conversation

jm-clius
Copy link
Contributor

This repeats the changes introduced by @LNSD in #1709, but do so from a base repo branch rather than a fork. This allows contributors on the base repo to take ownership of fixing tests, rebasing and other tasks needed to merge the changes.

Original issue description below.


Description

Waku discovery5 implementation does random walks through the DHT and reports the discovered nodes. To support Waku relay static shards discovery, we want to announce in the ENR the shards the node is subscribed to and keep only the discovered nodes that match specific criteria (a.k.a. predicate).

Changes

  • Simplified and refactored some parts of the WakuDiscv5 implementation (e.g., moved from exceptions to Results)
  • Added a predicate argument to the "find random peers" method to filter out records that do not match the predicate.
  • Reworked the Waku Discv5 test suites.

Co-authored-by: Lorenzo Delgado <lnsdev@proton.me>
@jm-clius jm-clius marked this pull request as ready for review June 1, 2023 11:28
@jm-clius
Copy link
Contributor Author

jm-clius commented Jun 1, 2023

I've now simplified the tests in order to hopefully get less flaky outputs. Marked as ready for review so that I can continue with this feature.

Copy link
Collaborator

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That LGMT! Thanks for it!

examples/v2/subscriber.nim Outdated Show resolved Hide resolved
tests/v2/test_waku_discv5.nim Outdated Show resolved Hide resolved
waku/v2/node/waku_node.nim Outdated Show resolved Hide resolved
jm-clius and others added 3 commits June 6, 2023 15:52
Co-authored-by: Ivan Folgueira Bande <128452529+Ivansete-status@users.noreply.github.com>
Co-authored-by: Ivan Folgueira Bande <128452529+Ivansete-status@users.noreply.github.com>
Co-authored-by: Ivan Folgueira Bande <128452529+Ivansete-status@users.noreply.github.com>
@jm-clius jm-clius merged commit 21737c7 into master Jun 6, 2023
@jm-clius jm-clius deleted the feat/discv5-filter-predicate branch June 6, 2023 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants