-
Notifications
You must be signed in to change notification settings - Fork 51
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: add new metadata protocol #2062
Conversation
You can find the image built from this PR at
Built from a6ad8ce |
11475b4
to
6914cde
Compare
This PR may contain changes to configuration options of one of the apps. If you are introducing a breaking change (i.e. the set of options in latest release would no longer be applicable) make sure the original option is preserved with a deprecation note for 2 following releases before it is actually removed. Please also make sure the label |
ff7c927
to
2a3755a
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.
Looks good!
I would be curious to know how much longer does a full connection cycle take if we have to wait for an exchange of metadata.
We could wait 2 Waku releases before disconnecting from peer who don't support the protocol.
I feel like it would smooth the transition.
As for the live updating of supported shards, let's just do the same as with discv5.
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.
Should this implementation include some kind of backoff mechanism to avoid reconnecting to the same peer frequently? (which is something that could happen with discv5 as it frequently returns the same peers)
Guess 1 RTT. For relay not something that matters imho, since its doesnt block anything. But for req/resp protocols like store or filter, it will indeed add a small delay = to 1 RTT i guess.
Now that I think about it, another option would be to only use this protocol and force a disconnection if
Then in future releases we can remove this check to enforce it always. wdyt @SionoiS ?
Sure, leaving it for another PR. Tracker: #2105
imho its not needed, since cluster-ids are also filtered in the discv5 layer. I mean, you won't try to connect to a peer in a different cluster, since we filter out that peer based on the ENR. This protocol is specially usefull in inbound connections, since you dont have any control of that, and most likely you dont have the enr to know theh cluster. |
How many round trips happen currently? Do you know? What's the % increase.
Good idea! Do you want to change the RFC to include cluster id 0 == default? |
2a3755a
to
78eb939
Compare
PR is ready for review. As discussed, disconnections are only triggered if clusterId!=0 AND myClusterId!=remoteClusterId. This prevents from breaking old/new nodes compatibility. clusterId=0 is used as default, so acts as a "feature flag" by now. |
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! One question re housekeeping, but the approach makes sense to me.
conn = await pm.switch.dial(peerId, WakuMetadataCodec) | ||
except CatchableError: | ||
info "disconnecting from peer", peerId=peerId, reason="waku metadata codec not supported" | ||
asyncSpawn(pm.switch.disconnect(peerId)) |
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.
Without having looked into the details it's not immediately clear to me if this disconnect
would also trigger a proper cleanup of the peer in the peer store/manager so that we don't keep stale peers?
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.
indeed, good catch. removing the peer here:
dbd692a
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.
Looks good overall but I feel like we should keep in mind the apps that will not use TWN or use their own discovery process.
This metadata protocol should not be a requirement, just like relay
is not required.
Also various nitpicks.
78eb939
to
dbd692a
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.
👍
Thanks.
I'm still not sure about the use case where Waku is used without TWN. I'll think about it.
Description:
cluster-id
flag towakunode2
.WakuMetadata
protocol. See feat(66/WAKU2-METADATA): add WakuMetadata Protocol vacp2p/rfc#619WakuMetadata
andcluster-id
in the peer manager, triggering disconnecitons with peers that support a differentcluster-id
than us. This is applied only ifcluster-id!=0
so sincecluster-id=0
by default, this prevents from breaking backwards compat.