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): update filter predicate #1918

Merged
merged 2 commits into from
Aug 23, 2023
Merged

feat(discv5): update filter predicate #1918

merged 2 commits into from
Aug 23, 2023

Conversation

SionoiS
Copy link
Contributor

@SionoiS SionoiS commented Aug 18, 2023

Description

I changed the way the discovery predicate is computed. Instead of passing a record to searchLoop it uses the record already in discv5 if possible. Also, when the ENR is updated the predicate is too.

Changes

  • discovery filter predicate can be updated.
  • updating the ENR trigger a predicate update too.

Follow up from #1875

@github-actions
Copy link

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:1918

@SionoiS SionoiS marked this pull request as ready for review August 18, 2023 15:38
Copy link
Contributor

@jm-clius jm-clius left a comment

Choose a reason for hiding this comment

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

LGTM. Seems like this also include changes related to the other PR's ENR updating? My comments on that PR still holds, but in general agree with caching the predicate on the discv5 object.

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.

Thanks for the PR! I've added a few comments that I hope you find useful

tests/test_waku_discv5.nim Outdated Show resolved Hide resolved
waku/node/jsonrpc/relay/handlers.nim Outdated Show resolved Hide resolved
waku/node/jsonrpc/relay/handlers.nim Outdated Show resolved Hide resolved
waku/node/rest/relay/handlers.nim Outdated Show resolved Hide resolved
waku/waku_discv5.nim Outdated Show resolved Hide resolved
waku/waku_discv5.nim Outdated Show resolved Hide resolved
waku/waku_discv5.nim Outdated Show resolved Hide resolved
waku/waku_discv5.nim Outdated Show resolved Hide resolved
waku/waku_discv5.nim Show resolved Hide resolved
@SionoiS SionoiS merged commit 4539dfc into master Aug 23, 2023
13 checks passed
@SionoiS SionoiS deleted the newdiscv5 branch August 23, 2023 15:51
@@ -314,8 +320,12 @@ proc subscriptionsListener*(wd: WakuDiscoveryV5, topicSubscriptionQueue: AsyncEv
if unsubRes.isErr():
debug "ENR shard removal failed", reason= $unsubRes.error

if subRes.isOk() and unsubRes.isOk():
debug "ENR updated successfully"
if subRes.isErr() and unsubRes.isErr():
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this better be an or ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if either one succeed then add the log message and update the predicate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Failing is not that bad in this case.

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.

3 participants