-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Modularize go-libp2p
Type: Refactor (Stability & Security)
Prysm, Anytype, Celestia, etc. want to have greater control on the set of dependencies and modules they import while using go-libp2p. Currently go-libp2p introduces a large number of compile time dependencies.
Therefore, through pruning the dependency tree, refactoring, making configuration options more ergonomic, etc. we want to create a very low-cost abstraction for p2p networks to build on go-libp2p (vs custom protocols over QUIC).
This can be achieved by providing a new, smaller go-libp2p library which imports a minimal set of dependencies and through better config options, enables users to build and configure the host with only what they need.
Prototype solution:
https://gist.github.com/sukunrt/8a09ed8e2959dfb033ee9d17fc1d7049
An alternative is a simpler, no defaults, go-libp2p constructor: libp2p/go-libp2p#2962
This keeps the existing Host interface. The main difference is in how the Host is constructed. Instead of the existing constructor a new constructor that uses Fx directly will be exposed. This constructor will let users opt-in to all behaviors explicitly. Nothing will be provided by default to opt-out of.
This should also similarly surface in gossipsub and kad-dht.
ETA
Q4 2025
Expected impact
More satisfied power users, with lower costs of maintenance / audits.
Fewer occurrences of non-adoption to barriers to entry of the “kitchen-sink” approach.
Easier adoption curve based on developers adopting the components they need (e.g. adding in hole punching, UPnP, etc. only if they need it), and building / contributing alternative / missing components.
Key users
Prysmatic Labs (Prysm — Go implementation of Ethereum Consensus client) has requested this project.
This project will help with adoption and maintainability of go-libp2p. We expect that users who want a more modular libp2p with fewer dependencies will adopt this change.
Upstream tracking issue
Metadata
Metadata
Assignees
Labels
Type
Projects
Status