Add support for more custom params (existing key) in swarm-test `new_ephemeral` functions
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.6k
- Forks
- 1.3k
- Avg merge
- 8h 47m
- Merged PRs (30d)
- 19
Description
Description
First of all excuse me if I am missing something, this is a suggestion and a question as well.
libp2p-swarm-test are a great way to test libp2p protocols. However there is only a very specific implementations of
``fn new_ephemeral` variants, that create keys inside the function.
There is factory method which helps but still sometimes I want to create a Swarm with specified keys.
Motivation
I am using libp2p-swarm-test in my tests, specifically:
fn new_ephemeral(behaviour_fn: impl FnOnce(libp2p_identity::Keypair) -> Self::NB) -> Self functions (I use tokio variant).
In lot of tests I actually need to create Swarm with existing key, and maybe specify some additional parameters to use in in creating a Swarm. I understand that the doc clearly says that the user of this functions should not rely upon the underlying parameters, but still the existing key use-case remains for me.
I solved this problem by creating my own Swarm factories with MemoryTransport but I was wondering if it would make sense to expand the existing ones in libp2p-swarm-test as well, as I really like the approach around libp2p-swarm-test.
Current Implementation
Current implementation supports most use-cases but does not support specifying already created key to a new_ephemeral function.
Are you planning to do it yourself in a pull request?
Yes
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 locating the libp2p-swarm-test new_ephemeral variants, especially the tokio form that accepts a behaviour function. Compare those constructors with the existing factory and MemoryTransport approach, then define support for an existing libp2p_identity::Keypair and any additional swarm parameters; done means the requested configuration can be used without a custom factory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking, testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100