-
Notifications
You must be signed in to change notification settings - Fork 995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core: encapsulate multistream-select
#3759
Comments
multistream-select
within libp2p-core
multistream-select
Here are some updated thoughts on this: I think upgrading the transport layer should be completely encapsulated in a crate like For protocols, I'd also advocate that we should actually expose a newtype to them. Once we have #2863, I think they should just receive an opaque |
The currently provided `ConnectionHandlerUpgrErr` is very hard to use. Not only does it have a long name, it also features 3 levels of nesting which results in a lot of boilerplate. Last but not least, it exposes `multistream-select` as a dependency to all protocols. We fix all of the above by renaming the type to `StreamUpgradeError` and flattening out its interface. Unrecoverable errors during protocol selection are hidden within the `Io` variant. Related: #3759. Pull-Request: #3882.
This patch tackles two things at once that are fairly intertwined: 1. There is no such thing as a "substream" in libp2p, the spec and other implementations only talk about "streams". We fix this by deprecating `NegotiatedSubstream`. 2. Previously, `NegotiatedSubstream` was a type alias that pointed to a type from `multistream-select`, effectively leaking the version of `multistream-select` to all dependencies of `libp2p-swarm`. We fix this by introducing a `Stream` newtype. Resolves: #3759. Related: #3748. Pull-Request: #3912.
Description
At the moment, the multiple types from
multistream-select
leak into thelibp2p-core
APIs, resulting in cascading breaking changes.libp2p-core
. This would also flatten theUpgradeError
type.Motivation
Stop the cascade of breaking changes. For example, #2831 could have been done in a backwards-compatible way if we would already have this in place.
Are you planning to do it yourself in a pull request?
Yes.
The text was updated successfully, but these errors were encountered: