Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Allow passing a NetworkBehaviour trait implementation to customize the networking #4751

Closed
tomaka opened this issue Jan 28, 2020 · 2 comments
Labels
J0-enhancement An additional feature request.

Comments

@tomaka
Copy link
Contributor

tomaka commented Jan 28, 2020

While sc-network now has a easy-to-use gossiping API (#4284), there are situations, such as substrate-lfs, where you want to have more low-level control over the networking.

Libp2p provides a NetworkBehaviour trait that does that and that is designed to be combined with other NetworkBehaviour.

We should add a way for a user to "inject" a NetworkBehaviour into sc-network.
Substrate already implements its own NetworkBehaviours, and they would then be combined with the one provided by the user.

@tomaka tomaka added the J0-enhancement An additional feature request. label Jan 28, 2020
@tomaka
Copy link
Contributor Author

tomaka commented Jan 29, 2020

The road to that is to first get libp2p/rust-libp2p#1405 in libp2p.
While it seems like purely a convenience, it is actually essential if we don't want to add hundreds of lines of unmaintainable trait bound requirements throughout Substrate.

@tomaka
Copy link
Contributor Author

tomaka commented Apr 6, 2020

Since we're aiming towards stabilization, and that the libp2p NetworkBehaviour would be too much of a burden to expose on the API level, the plan now is to let users customize the networking with notifications protocols they register and request-response protocols they register.

The former is already possible. The latter is #5536. As such, closing this issue.

@tomaka tomaka closed this as completed Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request.
Projects
None yet
Development

No branches or pull requests

1 participant