-
Notifications
You must be signed in to change notification settings - Fork 497
Description
Gossipsub support and Promisify API
🗺 What's left for release
- Promisify the public libp2p methods as part of the async/await migration. feat: promisify all api methods that accept callbacks #381
- Fix the subscribe api. fix: make subscribe comply with ipfs interface #389
- Add support for gossipsub feat: integrate gossipsub by default #365
🔦 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-switch
has changed. blacklistTTL
and blackListAttempts
have been changed to denyTTL
and denyAttempts
respectively. You can set these as follows:
const libp2p = new Libp2p({
switch: {
denyTTL: 120e3,
denyAttempts: 5,
}
...
})
Pubsub
Subscribe: To comply with the pubsub interface, the order of params for libp2p.pubsub.subscribe
have been reordered. They were previously topic, options, handler, callback
, and are now topic, handler, options, callback
. If your implementation does not use options
you should be able to ignore this change.
Config: Pubsub was previously enabled via the EXPERIMENTAL
config. 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 .
const libp2p = new Libp2p({
modules: {
pubsub: require('libp2p-gossipsub'),
...
},
config: {
pubsub: {
enabled: true
},
...
}
...
})
Promisify
All libp2p public methods have been promisified, so callbacks can be omitted in favor of promise based usage, including async/await. For example, start
can be used as:
libp2p.start(onStart)
// or
await libp2p.start()
Gossipsub
Gossipsub is integrated into the existing libp2p.pubsub
API. 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.
✅ Release Checklist
- Robustness and quality
- Ensure that all tests are passing, this includes:
- unit
- Publish a release candidate to npm
# Minor prerelease (e.g. 0.24.1 -> 0.25.0-rc.0) $ npx aegir release --type preminor -t node -t browser --preid rc --dist-tag next # Increment prerelease (e.g. 0.25.0-rc.0 -> 0.25.0-rc.1) $ npx aegir release --type prerelease -t node -t browser --preid rc --dist-tag next
- Run tests of the following projects with the new release:
- Ensure that all tests are passing, this includes:
- Documentation
- Ensure that README.md is up to date
- Ensure that all the examples run
- Communication
- Create the release issue
- Take a snapshot between of everyone that has contributed to this release (including its subdeps in IPFS, libp2p, IPLD and multiformats) using
name-your-contributors
. Generate a nice markdown list with this script - Announcements (both pre-release and post-release)
- IRC
- discuss.libp2p.io
- Blog post
- Copy release notes to the GitHub Release description
❤️ Huge thank you to everyone that made this release possible
In alphabetical order, here are the 38 humans that made 429 contributions to this release:
- Abraham Elmahrek (1 PR, 1 issue, 2 comments)
- Alan Shaw (1 PR, 6 reviews, 5 comments)
- Alex Potsides (1 PR, 1 review)
- Cayman (4 PRs, 2 issues, 26 reviews, 10 comments)
- Cody Eilar (2 issues, 4 comments)
- David Dias (6 issues, 8 comments)
- dirkmc (4 reviews, 1 comment)
- Filip Š (1 PR, 1 comment)
- Gregory Markou (4 PRs, 18 reviews, 17 comments)
- hapsody (1 comment)
- Henrique Dias (1 issue, 1 comment)
- Hugo Dias (1 review)
- Isaac Jacobs (1 issue, 7 comments)
- Jacob Heun (14 PRs, 3 issues, 31 reviews, 37 comments)
- Jakub (1 PR)
- John_Suu (2 comments)
- Jorropo (2 PRs)
- Justin Maier (1 comment)
- kumavis (1 review)
- laubsauger (1 issue)
- Maciej Krüger (2 PRs, 1 issue, 2 reviews, 20 comments)
- Marcin Rataj (1 review)
- Marin Petrunić (1 issue, 5 reviews, 1 comment)
- Michael FIG (1 PR)
- Michiel De Backker (1 comment)
- Mikeal Rogers (1 comment)
- Mikerah (2 PRs, 7 reviews, 18 comments)
- Nate Foss (1 PR, 1 issue, 2 comments)
- ohager (2 comments)
- Pat White (1 comment)
- Qmstream (2 PRs, 2 comments)
- Raúl Kripalani (1 comment)
- Richard Schneider (1 comment)
- Saquib ul hassan (1 issue, 1 comment)
- Steven Allen (1 PR)
- Tapasweni Pathak (1 PR, 1 comment)
- Vasco Santos (17 PRs, 4 issues, 59 reviews, 36 comments)
- zthomas (1 issue)
🙌🏽 Want to contribute?
Would you like to contribute to the libp2p project and don't know how? Well, there are a few places you can get started:
- Check the issues with the
help wanted
label in the libp2p repo - Join an IPFS All Hands, introduce yourself and let us know where you would like to contribute - https://github.com/ipfs/team-mgmt#all-hands-call
- Hack with IPFS and show us what you made! The All Hands call is also the perfect venue for demos, join in and show us what you built
- Join the discussion at http://discuss.libp2p.io/ and help users finding their answers.
- Join the ⚡️Libp2p Team Sync 🙌🏽 and be part of the Sprint action!
⁉️ Do you have questions?
The best place to ask your questions about libp2p, how it works and what you can do with it is at discuss.libp2p.io. We are also available at the #libp2p channel on Freenode.