Skip to content

multistream-select implementation used by WebRTC doesn't conform to the spec #75

Open
@dmitry-markin

Description

@dmitry-markin

Currently, we encode and send all protocols at once during multistream-select phase when opening WebRTC stream:

let message = encode_multistream_message(
std::iter::once(protocol.clone())
.chain(fallback_names.clone())
.filter_map(|protocol| Protocol::try_from(protocol.as_ref()).ok())
.map(|protocol| Message::Protocol(protocol)),
)?

This is against libp2p multistream-select spec, which states that protocols should be negotiated one-by-one.

Also, the received protocols are also expected to be sent as a list:

let Message::Protocols(protocols) =
Message::decode(payload.into()).map_err(|_| Error::InvalidData)?

This also doesn't conform to the spec.

Nevertheless, the above works with smoldot. This issue is about fixing the implementation, and, may be, filing a bug to smoldot if it doesn't conform to the spec either.

Originally discussed in #51 (comment).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions