ethresearch / sharding-p2p-poc

Proof of Concept of Ethereum Serenity Peer-to-Peer Layer on libp2p PubSub System
40 stars 19 forks source link

Look into circuit relay #116

Closed NIC619 closed 5 years ago

NIC619 commented 5 years ago

What is wrong?

As mentioned in #109 , we ran into peer dialing failure due to libp2p's new default circuit relay.

How can it be fixed?

Look into how circuit relay works and what changes need to made to enable circuit relay.

NIC619 commented 5 years ago

cc @mhchia It turns out that it's the problem with how we generate the multi-address for the peer in GetFullAddr.

After Circuit Relay is enabled, an additional Circuit Relay listener is set up. As a consequence the multi-address returned here is of Circuit Relay type which means the node will have to connect to the peer via circuit relay.

Possible fix: When adding the peer info to the address book, (1) use /ip4/…/tcp/… type multi-address instead or (2) add both type(/ip4/…/tcp/… and Circuit Relay type) of multi-address

prestonvanloon commented 5 years ago

We have an address factory that will advertise a relay address only: https://github.com/prysmaticlabs/prysm/blob/master/shared/p2p/addr_factory.go

Does that help?

NIC619 commented 5 years ago

Thanks @prestonvanloon , that definitely helps! Just out of curiosity, what would be the scenarios you have in mind that requires advertising only relay type multi-addresses?

prestonvanloon commented 5 years ago

Our specific scenario is a kubernetes deployment. A peer node can only be reached from the outside world via relay node so this peer only broadcasts the relay multiaddr.

Another scenario might be that you only want to open one port on your firewall, but run 2+ nodes.