-
Notifications
You must be signed in to change notification settings - Fork 31
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
fix: make local peer id optional #440
Conversation
`libp2p@2.x.x` will remove the `localPeer` argument from the `secureInbound` and `secureOutbound` methods of the `ConnectionEncrypter` interface. Unfortunately the `js-libp2p` monorepo has a depdendency on this module so the change cannot be released until this module is compatible... with the unreleased change. This PR tests the first argument to `secureInbound` and `secureOutbound` to ensure that it is actually a `PeerId`. If not it shuffles all the arguments along by one place. This PR can be reverted and the first argument removed once `libp2p@2.x.x` is released.
Won't there still be type errors since the interfaces don't match? |
I think there will be breakage after the
|
Maybe we'll need to do a major here shortly after the v2 release that updates the interface version, then a follow up that upgrades libp2p to the new noise major. There will be a short window where things are broken but I'm not sure how else we can resolve the circular dependency, other than adding noise to the libp2p monorepo. I am open to ideas 😅 |
Can we cut a breaking release here that relies on a 2.0-compatible commit of libp2p/interface? then after 2.0 is released, rely on the official upstream again. Eg:
|
Actually I wonder if we could use method overloading to be compatible with both versions of the interface? Deps would get duplicated but tsc should be happy. |
worth a shot, should be able to be tested locally for build errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
libp2p@2.x.x
will remove thelocalPeer
argument from thesecureInbound
andsecureOutbound
methods of theConnectionEncrypter
interface - see libp2p/js-libp2p#2304.Unfortunately the
js-libp2p
monorepo has a depdendency on this module so the change cannot be released until this module is compatible... with the unreleased change.This PR tests the first argument to
secureInbound
andsecureOutbound
to ensure that it is actually aPeerId
. If not it shuffles all the arguments along by one place. This makes@chainsafe/libp2p-noise
compatible with bothlibp2p@1.x.x
andlibp2p@2.x.x
.This PR can be reverted and the first argument removed once
libp2p@2.x.x
is released.