libp2p / libp2p/jvm-libp2p

NetworkImpl can't handle relayed addresses

Open
#339 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
366
Forks
85
Avg merge
2d 39m
Merged PRs (30d)
6

Description

If you try and dial an address that is relayed, e.g. /ip6/2a03:b0c0:3:d0::f5b:2001/tcp/4001/p2p/12D3KooWAYhKPvH8JrBT7oTiY69LY2QksfvPH2sY8ECvR1KD9ZTo/p2p-circuit/p2p/12D3KooWHci62Skj6sC6c2ASXARBnBMmUuM7kuHqtgi5mVQdJ6Gf

Then you get an error trying to set the peerid, because there are two p2p elements in relayed addresses. We want to append in the p2p-circuit case.

java.lang.IllegalArgumentException: Value (12D3KooWHci62Skj6sC6c2ASXARBnBMmUuM7kuHqtgi5mVQdJ6Gf) for P2P doesn't match existing value in /ip6/2a03:b0c0:3:d0::f5b:2001/tcp/4001/p2p/12D3KooWAYhKPvH8JrBT7oTiY69LY2QksfvPH2sY8ECvR1KD9ZTo/p2p-circuit
at io.libp2p.core.multiformats.Multiaddr.withComponentImpl(Multiaddr.kt:68)
at io.libp2p.core.multiformats.Multiaddr.withComponent(Multiaddr.kt:78)
at io.libp2p.core.multiformats.Multiaddr.withP2P(Multiaddr.kt:57)
at io.libp2p.network.NetworkImpl.connect(NetworkImpl.kt:72)
at io.libp2p.core.Network.connect(Network.kt:75)
at io.libp2p.host.HostImpl.newStream(HostImpl.kt:94)
at io.libp2p.core.multistream.ProtocolBinding.dial(ProtocolBinding.kt:37)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in NetworkImpl.connect at NetworkImpl.kt:72 and follow Multiaddr.withP2P through Multiaddr.kt:57-78. Reproduce the relayed-address dial using the address in the report, then verify that the existing relay peer ID is preserved and the destination peer ID is appended after p2p-circuit without the IllegalArgumentException.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.