-
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
To investigate: adding circuit relay information to multiaddr #1491
Comments
Reading more about ENR, i see there's a limit of 300 bytes. Wouldn't it be better to have a new key called |
Hm, after trying for a while, looks like storing only the relayaddr, destaddr := ma.SplitFunc(m, func(c multiaddr.Component) bool {
return c.Protocol().Code == ma.P_CIRCUIT
}) If we pass
Based on this, for experimenting I'll create a draft PR in go-waku that will modify the enr-record to have a
Let me know what you think |
Thanks, @richard-ramos. I think this makes sense as a possible extension to the ENR spec for p2p-circuit addresses (as the I'm still confused though how nodes were discovering each other without this? 😅 Afaik, hole punching is active and working, so how are these peers finding each other? |
There's some magic going on there. I haven't figured it out yet but will update this issue once i find out what's going on! |
Right! Because an alternative here would be to do something like implement libp2p rendezvous discovery on multiaddrs as secondary discovery method without needing this encoding. |
Isn't the 300 bytes should be enough, you shouldn't advertise many addresses anyway. (2 or 3 max) Long term it will make sense to switch to a libp2p discovery method either way, because the discv5 DHT is built with the assumption that everyone is reachable, if you have too many users only reachable through HP, that assumption starts to fail |
Currently it is only being used for |
I gotta mention that I find using "/ip4/192.168.0.106/tcp/60000/p2p/16Uiu2HAmUVVrJo1KMw4QwUANYF7Ws4mfcRqf9xHaaGP87GbMuY2f",
"/ip4/127.0.0.1/tcp/60000/p2p/16Uiu2HAmUVVrJo1KMw4QwUANYF7Ws4mfcRqf9xHaaGP87GbMuY2f",
"/ip4/192.168.1.20/tcp/19710/p2p/16Uiu2HAmUVVrJo1KMw4QwUANYF7Ws4mfcRqf9xHaaGP87GbMuY2f",
"/dns4/node-02.gc-us-central1-a.status.prod.statusim.net/tcp/30303/p2p/16Uiu2HAmDQugwDHM3YeUp86iGjrUvbdw3JPRgikC7YoGBsT2ymMg/p2p-circuit/p2p/16Uiu2HAmUVVrJo1KMw4QwUANYF7Ws4mfcRqf9xHaaGP87GbMuY2f",
"/dns4/node-02.gc-us-central1-a.status.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAmDQugwDHM3YeUp86iGjrUvbdw3JPRgikC7YoGBsT2ymMg/p2p-circuit/p2p/16Uiu2HAmUVVrJo1KMw4QwUANYF7Ws4mfcRqf9xHaaGP87GbMuY2f"
"/dns4/node-01.gc-us-central1-a.wakuv2.test.statusim.net/tcp/8000/wss/p2p/16Uiu2HAmJb2e28qLXxT5kZxVUUoJt72EMzNGXB47Rxx5hw3q4YjS/p2p-circuit/p2p/16Uiu2HAmUVVrJo1KMw4QwUANYF7Ws4mfcRqf9xHaaGP87GbMuY2f"
"/dns4/node-01.gc-us-central1-a.wakuv2.test.statusim.net/tcp/30303/p2p/16Uiu2HAmJb2e28qLXxT5kZxVUUoJt72EMzNGXB47Rxx5hw3q4YjS/p2p-circuit/p2p/16Uiu2HAmUVVrJo1KMw4QwUANYF7Ws4mfcRqf9xHaaGP87GbMuY2f" I'm not sure then what to put in the multiaddrs field |
Right.. |
Ah! this could be tied to this issue I created here: #1493 to make discv5 ignore private addresses.
Indeed!, It seems that I'll get a multiaddress per protocol for each node with circuit relay enabled I connect to? |
Your node should only establish circuits with up to
If you avoid sending your own key, and let the dialer set it, it becomes The next optimization would be to resolve the dns and send the ip instead, The last optimization would be to send the relay key once per relay, so we would have to send something like ( Note that realistically, by the EOY, we'll have 4 transports enabled, so we have to be ready for that |
Regarding the usage of the
Hopefully this answers most questions above. Do note in the case of secure websocket, the fqdn and the port needs to be provided together at a given port is secured by a given SSL cert which in turns is valid for a given fqdn.
Finally, in case of
|
In desktop i'm not enabling websockets, yet when I connected to a relay node, i got 2 addresses from it:
I guess a relay node will give you a p2p-circuit address for all protocols it supports? |
Yes |
@fryorcraken , @jm-clius , @Menduist In waku-org/go-waku#431 i tried to create an ENR record with the following information.
As soon as I add a second it immediately complains about the record being longer than 300 bytes. Interestingly enough, those two circuit relay multiaddresses only represent 100 bytes in the ENR record, so I guess the rest of the bytes is spent into the other fields and the record signature. For reference, if I use a single circuit relay multiaddress, then it's okay. Here's an example of ENR record with a single circuit relay address:
It can be decoded in https://enr-viewer.com/ |
One of the downside of using ENR was definitely the size limit. We did consider Libp2p signed envelopes too but ENR was preferred as it is more field tested (I feel this should have been documented in the RFC). Why do your two multiaddrs have the same peer id? |
I copy pasted one of the circuit-relay multiaddresses since I wanted to see if I could store at least 2 in the multiaddr (this because when we use circuit relay with the status.prod fleet nodes, the node receives 4 multiaddresses (2 for each circuit relay node). I guess for the time being I'll have to limit the number of multiaddresses stored in I wonder it makes sense to fork discv5 to increase this size limit to be able to store at least 2 circuit-relay addresses? I do not know what implications could that have |
I think there are few options on the table. Not sure of the implications either:
@jm-clius @kaiserd thoughts? I know that @kaiserd really busy. |
I think we should consider adding a discovery mechanism that is more suitable for discovering signed peer records, specifically libp2p rendezvous discovery. IIRC we determined previously that it won't be too much of an effort on either the go-waku or nwaku side to add. |
@jm-clius What are the next step? Should we oipen an issue in vac research or rfc? |
@fryorcraken captured it here: vacp2p/research#176 Basically, if we're roughly agreed on that issue that libp2p rendezvous is a good discovery method to add and will solve the ENR size issue, I think we can go ahead and assign ownership. I've included a somewhat related suggestion of specifying a pubsubTopic/shard negotiation mechanism as well, which would work independently from discovery mechanisms, but allow us to be more selective in terms of nodes we connect to (with an eye on multiple shard scaling) |
In the meantime I have updated the logic for the
|
Update: I had to limit the number of multiaddresses stored in the ENR to not exceed a hard coded limit, due to crashes being reported in: |
My suggestion for an ad-hoc solution for the Status MVP would be
Including rendezvous, we have to take sharding into consideration 51/WAKU2-RELAY-SHARDING. As an alternative, we could increase the ENR size as an ad-hoc solution for the Status MVP. (I will think about this, have discussions, and open an issue to include the chosen solution in the respective RFC, most likely in: vacp2p/research#167 ) Future work on (hierarchical) capability discovery should solve this issue. |
One more idea (ad-hoc for the MVP): add a rendezvous support indicator field to the ENR. |
Closing since Rendezvous is enabled by default when relay is enabled now |
This might not be a problem in nwaku, but i'm reporting this just in case:
The status fleet has circuit relay enabled to facilitate hole punching,this means that nodes that nodes behind NAT or firewalls will have multiaddresses that follow this format:
/ip4/7.7.7.7/tcp/55555/p2p/QmRelay/p2p-circuit/p2p/QmAlice
, in which everything prior to the/p2p-circuit/
above is the address of the relay peer (a node from the fleet), which includes the transport address and their Peer IDQmRelay
. After/p2p-circuit/
is the actual peer ID.While using status-desktop / go-waku, I noticed that the information about the p2p-circuit is not part of the ENR, so nodes would advertise themselves in DiscV5 using information from the relay node instead of their own and not be discoverable then. Here's an example of the record data, using the above multiaddress as example
In 31/WAKU2-ENR I read that we have a multiaddrs key which is used to store additional multiaddress information, so to fix this problem I'll add this information in that key (the p2p-circuit/p2p/QmAlice part).
cc: @cammellos @Menduist
The text was updated successfully, but these errors were encountered: