libp2p / specs

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

mplex: size of `id` unspecified #259

Closed arnetheduck closed 3 years ago

arnetheduck commented 4 years ago

https://github.com/libp2p/specs/tree/master/mplex#message-format

the id field of the message is unlimited in size as specified - base128 does not impose a max size per se - practically though, if a uint64 is used, there's 61 bits of id to play with and clients should support this (or 29, if we cap on 32-bits).

Stebalien commented 4 years ago

The go implementation, at least, caps it at 64 bits. That is, up to 9 full bytes and one bit from the 10th byte.

arnetheduck commented 4 years ago

@Stebalien consider though that the id is mixed in with header on the wire - if the go implementation uses a normal 64-bit read of the varint, 3 bits of id will be lost in translation.

Stebalien commented 4 years ago

Ah, yeah, you're right. We only support IDs up to 61 bits.