Skip to content

Possible use of libp2p_identity::PeerId as PeerId type #73

@dmitry-markin

Description

@dmitry-markin

While working on paritytech/polkadot-sdk#1631 I tried upgrading litep2p to use multiaddr-0.18.1 also used by libp2p-0.52.3. The thing with multiaddr-0.18.1 is that it uses libp2p_identity::PeerId as a payload of Protocol::P2p instead of Multihash in the older versions.

So, we have three options:

  1. Make litep2p indirectly depend on libp2p-identity via multiaddr, but keep distinct PeerId types. We would need to add conversion between libp2p & litep2p PeerId types to litep2p.
  2. Completely replace all PeerId types used in litep2p & polkadot-sdk by libp2p_identity::PeerId.
  3. Introduce own Multiaddr implementation into litep2p with a layer of abstraction in polkadot-sdk like it's currently done with PeerId types.

I don't think route 3 is a good idea due to code duplication and layers of abstraction more heavy than the ones for PeerId, and a lot of code touched overall.

To proceed with paritytech/polkadot-sdk#1631 I'm going to go route 1 for now, but we should at least consider route 2 as something that would simplify things.

CC @altonen @lexnv

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions