libp2p / specs

Technical specifications for the libp2p networking stack
https://libp2p.io
1.58k stars 275 forks source link

RFC 0001: Text Peer Ids as CIDs #209

Closed lidel closed 5 years ago

lidel commented 5 years ago

Important Note: this is the first RFC ever, following "option 2" from https://github.com/libp2p/specs/issues/198 and creating a template for future RFCs as a side-effect. The goal is to kick-off the RFC process. I am not a native speaker, feel free to tweak sentences that sound weird.

The RFC 0001 aims to modify Peer ID spec to alter the default string representation from Multihash to CIDv1 in Base32 and to support encoding/decoding text peerids as CIDs.

Changes

Feedback needed

cc https://github.com/ipfs/go-ipfs/issues/5287, https://github.com/multiformats/multicodec/issues/130, https://github.com/libp2p/go-libp2p-core/pull/41, https://github.com/ipfs/ipfs/issues/337

lidel commented 5 years ago

I rebased this PR to remove template and make RFC-0001 easier to audit. Will add it in a separate PR after this one is finalized and merged.

lidel commented 5 years ago

@raulk thoughts? :)

lidel commented 5 years ago

@raulk CIDv0 is the same as current text representation (Peer ID being multihash in base58btc), making this a relatively safe change.

Existing CID libraries provide conversion methods and support old representation out of the box, but I've added explicit requirement to the spec in https://github.com/libp2p/specs/pull/209/commits/b621ac506aaa36df5980f843dd429f56715dc862.

Let me know if there is anything else blocking this.

Stebalien commented 5 years ago

@raulk can we :ship: this?

raulk commented 5 years ago

@Stebalien so we've locked in consensus for making the change. I'm not sure how to deal with change management across implementations, though. We haven't worked out the procedural details of how to coordinate the implementation of an RFC across libraries, and how to signal varying support in a matrix-like format :-(

In a nutshell, I want to avoid getting in a situation where go-libp2p spits out string representations of multiaddrs with CIDv1 peer IDs by default to stdout, and when users copy-paste those multiaddrs to an application powered by py-libp2p, it blows up.

I could be paranoid, though.

Stebalien commented 5 years ago

@raulk the first step is https://github.com/libp2p/go-libp2p-core/pull/41/files. That will add support for parsing cid-peer-ids but it won't spit them out by default.

I've created a tracking issue: https://github.com/libp2p/specs/issues/216.