Make webrtc-specific multistream-select negotiation spec compliant#554
Make webrtc-specific multistream-select negotiation spec compliant#554haikoschol wants to merge 4 commits intoparitytech:masterfrom
Conversation
|
The last commit ended up being a big larger than expected. Originally I tried to get rid of But then I realized that the current multistream-select implementation still does not cover the valid scenario of receiving the header and the first proposed protocol in two separate webrtc protobuf messages. While implementing support for this I also made some changes that reduce the number of allocations when decoding multistream-select messages. I think the result is overall better than before though. I've made sure the tests still make sense and tested it manually with smoldot. Still, these changes are not necessary, more of a nice-to-have. If you prefer to keep the PR as small as possible, I can revert the commit. |
This PR brings the WebRTC-specific multistream-select implementation in line with the spec. Before this change, the header, the desired protocol and all fallback protocols were sent in a single multistream-select message. The spec mandates that only the desired protocol is to be sent instead. If the peer responds with a
na, indicating it does not support this protocol, another multistream-select message should be sent, containing the first fallback protocol. This is to be repeated until the peer accepts a protocol or the dialer runs out of fallbacks.This fix is required for interop with smoldot. Without this fix, the following happens:
/multistream/1.0.0\n/c7fd75141ca230c62e99af66d68f9d1f84b0821bcc1e17d2be92aaf5602d1c0e/block-announces/1\n/dot/block-announces/1\n)./c7fd75141ca230c62e99af66d68f9d1f84b0821bcc1e17d2be92aaf5602d1c0e/block-announces/1\nand sends back a confirmation.DecodeBlockAnnounceError(Verify).closes #75