swarm: remove duplication between `SwarmEvent` and `FromSwarm`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.6k
- Forks
- 1.3k
- Avg merge
- 8h 47m
- Merged PRs (30d)
- 19
Description
Description
Today, SwarmEvent is essentially a super-set of FromSwarm. This super-set is however not expressed in the type-system which leads to inconsistencies as described in https://github.com/libp2p/rust-libp2p/issues/4251.
We can fix this by expressing SwarmEvent as a composition of FromSwarm and ToSwarm (a type parameter that will be filled in by NetworkBehaviour::ToSwarm.
As far as I know, the only thing that is blocking this is https://github.com/libp2p/rust-libp2p/issues/3046 which is "just" waiting for the next round of breaking changes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the SwarmEvent, FromSwarm, and NetworkBehaviour::ToSwarm references in this issue, then review blocking issue #3046 and inconsistency issue #4251. The work is done when SwarmEvent is expressed as a composition of FromSwarm and ToSwarm and the described type-system inconsistencies are resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100