libp2p / libp2p/go-libp2p

Envelope codec format

Open
#1,077 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
6.9k
Forks
1.3k
Avg merge
13d 21h
Merged PRs (30d)
1

Description

Libp2p's record "envelop" allows one to specify a "codec". This is a length-prefixed byte array to allow for either "codec" or "paths" (`/foo/bar`). This isn't ambiguous because `/`, UTF-8 encoded, is the uvarint-encoded multicodec for "path".

Unfortunately, this only works if the leading multicodec is encoded as a uvarint. go-libp2p records use 0x0301, big-endian encoded. When parsed as a uvarint-encoded number, this will be interpreted as CIDv3 (not yet defined) followed by a single 0x1 byte.

The libp2p record codec should have been encoded as `[0x01|(0x1<<7), 0x01] = [0x81, 0x03]` (Little Endian)

Options:

1. Require that the "codec" be a big-endian encoded multicodec (removes the possibility for paths, protocol names, etc).
2. Define it as arbitrary bytes (would make "ipld records" difficult).
3. Fix the encoding with an upgrade period.

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 by reviewing the libp2p record envelope and codec encoding path, then compare the stated big-endian and uvarint interpretations. The issue presents three incompatible options but does not select a resolution; done would require an agreed encoding decision and an upgrade or compatibility plan.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.