Discovered external addresses no longer usable for Polkadot #4688
-
We (Parity) are upgrading to libp2p 0.52.0 and have run into an issue with external addresses. What we did prior to 0.52.0 was that when an external address was discovered (
This is obviously incorrect code on our side and the release notes mention that the observed address has to be verified through other means such as using AutoNAT or manually but I believe neither of these are available to us at this time. I'm not sure if the manual verification is completely out of the question but to me it sounds like our downstream users would have to now manually add the external address and it cannot happen automatically like prior to 0.52.0, is this true? The question I have is that is it possible in our code to somehow bring back the old behavior of "trusting" the observed address or is there some other workaround that doesn't require introducing a new protocol to Polkadot? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Thank you for the elaborate report.
If you simply want to bring back the old behavior, you can copy the Is this an option for you @altonen? https://github.com/libp2p/rust-libp2p/blob/v0.51/swarm/src/registry.rs We could even provide this basic registry based mechanism via a In case a provided pluggeable |
Beta Was this translation helpful? Give feedback.
-
Just to clarify what is happening here: I assume you are calling Adding an external address that way will make identify report it to other nodes as an external address and those nodes might then add them to the DHT then. Or are you calling
If you just say |
Beta Was this translation helpful? Give feedback.
The line you need to change is: https://github.com/paritytech/polkadot-sdk/blob/59b15684ed2773cd52bf25e7ebb9abe6b6455ed4/substrate/client/network/src/service.rs#L1464C5-L1464C5
One heuristic could be to check that at least two peers report you the same address as an observed address. In that case, you can go ahead and add it as an external one. That should filter out all of the ephemeral TCP ports.
Another, somewhat related thing is: I saw that you are not enabling port-reuse (https://github.com/paritytech/polkadot-sdk/blob/f4c4c0fe29300f765e3edd32c79ac0c856fa4bb8/substrate/client/network/src/transport.rs#L58). If you enable port-reuse, those ephemeral ports will should go away too.