This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Update libp2p to the latest version 🚀 #2342
Closed
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.
The dependency libp2p was updated from
0.25.5to0.26.0.This version is not covered by your current version range.
If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.
Publisher: jacobheun
License: MIT
Release Notes for v0.26.0
🔦 Highlights
🗣 Gossipsub
Thanks to the awesome work of the ChainSafe team, Gossipsub is here! Gossipsub is a much more efficient pubsub router than Floodsub. Intead of broadcasting to all of its peers, it broadcasts to a controlled subset of peers. To learn more about how Gossipsub works and where it differs from Floodsub, check out the Spec.
If you are using Pubsub you can now switch to using Gossipsub instead of Floodsub. Have old peers you need to flood stuff to? Don't worry, Gossipsub will automatically fallback to Floodsub for peers that don't support it. See the API Changes section below for how to migrate your config over to using Gossipsub.
🚉 Promisify
As we migrate to async/await we are promisifying the Libp2p public methods. Several lower level libraries are currently leveraging libp2p for testing. Their transition to full async/await will be greatly helped by promisifying the libp2p API. Once the async/await changes are propagated up, we will remove Promisify in a future update, along with callback support, as libp2p will have full async/await support at that time. See the API Changes below to check out the Breaking Changes.
🏗 API Changes
BREAKING CHANGES
Configuration
Switch Options
Configuration for
libp2p-switchhas changed.blacklistTTLandblackListAttemptshave been changed todenyTTLanddenyAttemptsrespectively. You can set these as follows:Pubsub
Subscribe: To comply with the pubsub interface, the order of params for
libp2p.pubsub.subscribehave been reordered. They were previouslytopic, options, handler, callback, and are nowtopic, handler, options, callback. If your implementation does not useoptionsyou should be able to ignore this change.Config: Pubsub was previously enabled via the
EXPERIMENTALconfig. You must now specify your pubsub implementation (Gossipsub or Floodsub), and enable/disable it via it's own configuration. Setting pubsub will automatically enable it. You can disable it by explicitly setting enabled to false in the configuration .Promisify
All libp2p public methods have been promisified, so callbacks can be omitted in favor of promise based usage, including async/await. For example,
startcan be used as:Gossipsub
Gossipsub is integrated into the existing
libp2p.pubsubAPI. Once Gossipsub has been supplied as your pubsub implementation, you will be able to use it just as Floodsub was previously used. See the section above for pubsub configuration changes.Commits
The new version differs by 21 commits.
d788433chore: release version v0.26.0d5a977bchore: update contributors0489972chore: release version v0.26.0-rc.33f31b1fchore: update contributorsa2b3446docs: async migration (#397)ff7a6c8fix: promisified methods (#398)9a8d609chore: release version v0.26.0-rc.29fef58cchore: update contributors684f283chore: update switch (#395)3e95e6ffix: dont override methods of created instance (#394)f4f3f0ffix: pubsub default config (#393)7c2c852chore: release version v0.26.0-rc.1e8d8aabchore: update contributorsdd48d26chore: promisify pubsub start and stop (#392)99a5359chore: release version v0.26.0-rc.0There are 21 commits in total.
See the full diff
FAQ and help
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper bot 🌴