libp2p / libp2p/specs

Document optimistic multistream-select

Open
#643 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
1.8k
Forks
320
Avg merge
11d 15h
Merged PRs (30d)
1

Description

Also sometimes called lazy negotiation or lazy multistream-select.

In {Go,Rust} (unsure about others) we do an optimistic multistream-select when we know the peer supports a certain protocol. The dialer writes the multistream header, the application protocol id, and then application data at once without waiting for the peer to echo back the application protocol id. This lets us remove one round trip when creating a stream and it helps for the one stream per RPC use case.

However, afaict, we have not documented this or what pitfalls to be aware of. Three pitfalls come to mind:

  1. https://github.com/multiformats/go-multistream/pull/115 - implementations should wait for the handshake to finish before closing the stream.
  2. https://github.com/multiformats/go-multistream/pull/87 - related to the above, implementations may want to ignore handshake write errors so that applications can still read data from the stream.
  3. Edge cases around application data being interpreted as multistream-select data: https://github.com/multiformats/go-multistream/issues/20

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 reading the linked go-multistream PRs 115 and 87 and issue 20 to understand optimistic multistream-select and its interoperability pitfalls. Document when the optimization is appropriate, how handshake completion and write errors affect stream closing and reads, and how application data can be misinterpreted as negotiation data.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, rust
Domain
documentation, networking
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.