-
Notifications
You must be signed in to change notification settings - Fork 453
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
feat!: 2.0 breaking changes #2663
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
achingbrain
changed the title
fix!: remove CustomEvent export from
feat!: 2.0 breaking changes
Aug 14, 2024
@libp2p/interface
(#2656)`CustomEvent` is global in Node.js as of `v18.7.0`. We support LTS and Current which means `v20+`, and Electron has upgraded to node 20 so the polyfill isn't necessary any more. BREAKING CHANGE: `@libp2p/interface` no longer exports a `CustomEvent` polyfill
achingbrain
force-pushed
the
release-v2.0
branch
from
September 6, 2024 09:34
cf789cf
to
500500c
Compare
To better align with [[email protected]](https://github.com/libp2p/go-libp2p/releases/tag/v0.34.0) rename "transient" connections to "limited". BREAKING CHANGE: There are three breaking API changes: * Connections have an optional `.limits` property * The `runOnTransientConnection` property of `libp2p.handle` and `libp2p.dialProtocol` has been renamed to `runOnLimitedConnection` * The `notifyOnTransient` property of `libp2p.register` has been renamed `notifyOnLimitedConnection` Refs: #2622
Requiring the local peer id in connection encryption appears to be historical cruft. The more current approach would be to have a `ConnectionEncrypter` be specific to a single peer id, passed in during instantiation in its Components. BREAKING CHANGE: removes `localPeer: PeerId` first parameter from `secureInbound` and `secureOutbound` in `ConnectionEncrypter` --------- Co-authored-by: Alex Potsides <[email protected]>
JavaScript errors have a `.name` property that can be used to disambiguate the type of error. libp2p has used the `.code` property for this until now, but we will soon use that field to indicate remote errors, so switch to using the `.name` property. BREAKING CHANGE: The `.code` property has been removed from most errors, use `.name` instead
The autodialer is a feature from an older time when the DHT was less reliable and we didn't have things like the random walk component. There's not a lot of benefit in opening connections to any old peer, instead protocols now have better ways of targetting the kind of peers they require. Actively dialing peers harms platforms where connections are extremely expensive such as react-native so this feature has been removed. Closes #2621 Fixes #2418 BREAKING CHANGE: the autodialer has been removed as well as the corresponding config keys --------- Co-authored-by: Russell Dempsey <[email protected]>
To allow doing things like having a single `AbortSignal` that can be used as a timeout for incoming connection establishment, allow passing it as an option to the `ConnectionEncrypter` `secureOutbound` and `secureInbound` methods. Previously we'd wrap the stream to be secured in an `AbortableSource`, however this has some [serious performance implications](ChainSafe/js-libp2p-gossipsub#361) and it's generally better to just use a signal to cancel an ongoing operation instead of racing every chunk that comes out of the source. BREAKING CHANGE: the final argument to `secureOutbound` and `secureInbound` in the `ConnectionEncrypter` interface is now an options object --------- Co-authored-by: chad <[email protected]>
The only time you should ever see a private key on a `PeerId` is for the id of the currently running node. An exception to this is the keychain which used `PeerId`s to export private keys, but a nicer API there is to just deal with `PrivateKey` instances directly. At runtime a service can obtain the unmarshaled private key by adding a `privateKey: PrivateKey` field to it's components map so there's no need to have the field on every `PeerId`. The `publicKey` field of a `PeerId` was a `Uint8Array` which (if present) held the public key bytes in a protobuf wrapper along with a field saying what type of key it was. This was because we wanted to avoid pulling `@libp2p/crypto` into front ends, since it had a dependency on `node-forge` which was a large blob of untreeshakable CSJ code. This dependency has been removed so `@libp2p/crypto` is now comparatively lightweight so we can use the `PublicKey` type instead of `Uint8Array`, which also saves CPU time since we don't need to unmarshal the key before we can use it. Fixes #2659 BREAKING CHANGE: - The `.privateKey` field of the `PeerId` interface has been removed - The `.publicKey` field of the `PeerId` interface is now a `PublicKey` instead of a `Uint8Array` - `createLibp2p` now accepts a `privateKey` instead of a `peerId` - The keychain operates on `PrivateKey` instances instead of `PeerId`s with `.privateKey` fields - `@libp2p/peer-id-factory` has been removed, use `generateKeyPair` and `peerIdFromPrivateKey` instead
Adds instructions for how to upgrade from v1.x to v2.x --------- Co-authored-by: Russell Dempsey <[email protected]>
achingbrain
force-pushed
the
release-v2.0
branch
from
September 6, 2024 09:41
500500c
to
b3fa833
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is of the branch containing all changes for the v2 release.
Important - it must not be squashed on merge, otherwise the changelog/release notes will not be generated with all of the breaking changes listed.