-
Notifications
You must be signed in to change notification settings - Fork 53
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: running periodicaly peer exchange if discv5 is disabled #3150
Conversation
You can find the image built from this PR at
Built from a122086 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! It will give a much more robust PX procedure 🥳
I've added a couple of comments that I hope you find reasonable ;P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely! Thanks for it! 💯
I just added a nitpick comment
3a72eb0
to
32cf0e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great extension, but unsure from where it will get PX service peer to provide peers instead of discv5. Maybe I overlooked sthg.
|
||
# Use px to periodically get peers if discv5 is disabled, as discv5 nodes have their own | ||
# periodic loop to find peers and px returned peers actually come from discv5 | ||
if conf.peerExchange and not conf.discv5Discovery: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If have no discv5 but want to use PX, how can we ensure to get some initial PX service peer?
Isn't it conf.peerExchangeNode
setting ensure it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it even without setting peerExchangeNode
and worked :))
If there isn't a peerExchangeNode
set, then any peer we have in the store with the PX codec is chosen randomly, so we just need to be connected to at least one peer that supports PX
nwaku/waku/node/peer_manager/peer_manager.nim
Lines 243 to 254 in b3656d6
pm.serviceSlots.withValue(proto, serviceSlot): | |
trace "Got peer from service slots", | |
peerId = serviceSlot[].peerId, multi = serviceSlot[].addrs[0], protocol = proto | |
return some(serviceSlot[]) | |
# If not slotted, we select a random peer for the given protocol | |
if peers.len > 0: | |
trace "Got peer from peerstore", | |
peerId = peers[0].peerId, multi = peers[0].addrs[0], protocol = proto | |
return some(peers[0]) | |
trace "No peer found for protocol", protocol = proto | |
return none(RemotePeerInfo) |
It can be any of our normal bootstrap nodes or a static node also.
Then, the peers we receive via PX if they also support it will enter to the pool from which we choose randomly, so it's just a matter of having a point where to start from, and luckily it must not necessarily be a configured peerExchangeNode
:)
Description
As part of
in #3076, we are adding the functionality for nwaku edge nodes to periodically query Peer Exchange for new peers.
Currently the periodic search for peers is done by Discv5, so I activated the periodic Peer Exchange queries whenever Peer Exchange is enabled and Discv5 is disabled.
Let me know what you think, we could also create a flag to turn it on and off, but as we try not to add too many flags and over-complicate the configurations, I initially added it in this use case which should be the most common/logical.
Changes