-
Notifications
You must be signed in to change notification settings - Fork 57
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): advertise custom multiaddresses #1512
Conversation
@rymnc I do not agree with moving discv5 to the waku_node module. I think that all the discovery mechanisms should be managed and orchestrated by the peer manager. As a consequence, these mechanisms should be:
|
I am not sure if the PeerManager was intended to have this functionality, i.e discovery. It is currently used to manage dialing, adding and removing peers. But yes, I agree with your point. Maybe @alrevuelta can weigh in here, was this something you intended for the PeerManager to do? |
Note the following from my comment:
This would be something like: discoveryMechanism.onPeerDiscovered do (peer: PeerId):
peerManager.addPeer(peer) |
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! some comments
Jenkins BuildsClick to see older builds (5)
|
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, this is more or less the direction I had in mind too. I've added some comments re keeping the config vs initialisation a bit cleaner and consolidating the two different ENRs into one.
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.
As I said in my initial comment, I see a bad idea in moving the discovery mechanisms inside the waku_node module.
Some comments second this idea: moving the code inside the node module means you have to thread down the configuration. But it also implies that the WakuNode
type has more than one responsibility (besides of orchestrating the different protocols and configuring the switch it also generates the local ENR, configures the discv5 service and holds the discv5 state). So... you cannot test the WakuNode
without the discovery instantiated.
In summary, this couples the node code with the discovery code.
If everybody agrees, I won't block the PR. But I think we should go in the opposite direction: splitting the content of the big modules instead of merging them into big modules.
Moving this PR to draft to decouple disc and |
Agree with @LNSD here. The issue is currently our configuration and initialisation is very convoluted.
Perhaps an increment to make it a bit better is extracting those parts of initialisation to do with constructing addresses and making sure that that's available to both WakuDiscv5 and WakuNode during initialisation? That way WakuDiscv5 initialisation can be decoupled and performed before WakuNode initialisation. For this, the constructor arguments for WakuDiscv5 may also have to change so that it can be initialised from config. I know from previously looking at this that there are some intricacies and gotchas, so I'm okay with incrementing here in reasonable steps to something cleaner and decoupled. |
thanks for addressing the comments, resolved them all.
missed this comment. I think we can keep the peer manager and discovery separated. Peer manager should be agnostic on how the peers are discovered/added to the peer manager. |
1facb06
to
4dca394
Compare
3fc1910
to
f69810d
Compare
@LNSD, I've decoupled the discv5 and waku_node setup. Added a deprecated flag to the original |
feat(discv5): allow custom multiaddr advertisement in discv5 feat(discv5): move discv5 setup from wakunode2 to waku_node fix(waku_node): def param test(discv5): test for ext multiaddr fix(discv5): address comments fix(discv5): address comments fix(wakunode2): discoveryconfig in var before init fix(discv5): pass multiaddr to discv5 directly fix(discv5): make multiaddrs optional fix(test): discv5 init fix(discv5): split discv5 mounting from waku_node chore(discv5): s/WakuAddressMetadata/WakuNodeAddrMeta/g
f69810d
to
c1874a4
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.
Please, check my comments :)
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.
LGTM ✅
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! I think this is a great step forward to also clean up the confusing address configuration and initialisation. It may be worth adding a unit test suite for other aspects of NetConfig
(e.g. populating sensible announcedAddresses
) in future PRs.
Should fix #1475, as a follow up to #1509. Makes discv5 broadcast custom-set multiaddrs