-
Notifications
You must be signed in to change notification settings - Fork 690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get rid of libp2p
dependency in sc-authority-discovery
#5842
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Bastian Köcher <[email protected]>
This reverts commit 73860e6.
@dmitry-markin , what about |
bot fmt |
@dmitry-markin https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7724737 was started for your command Comment |
@dmitry-markin Command |
Nothing wrong with this. This line means we are importing libp2p bitswap protocol implementation from litep2p. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some minor nits, otherwise looks good!
@@ -1455,17 +1455,17 @@ where | |||
fn handle_worker_message(&mut self, msg: ServiceToWorkerMsg) { | |||
match msg { | |||
ServiceToWorkerMsg::GetValue(key) => | |||
self.network_service.behaviour_mut().get_value(key), | |||
self.network_service.behaviour_mut().get_value(key.to_vec().into()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just key.into()
here and below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that it's because service.rs
in general, and network_service
in particular, are still dependant on libp2p
.
@@ -864,7 +864,7 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkBackend<B, H> for Litep2pNetworkBac | |||
); | |||
|
|||
self.event_streams.send(Event::Dht( | |||
DhtEvent::ValuePut(libp2p::kad::RecordKey::new(&key)) | |||
DhtEvent::ValuePut(sc_network_types::kad::Key::new(&key.to_vec())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't the following work to avoid copying?
DhtEvent::ValuePut(sc_network_types::kad::Key::new(&key.to_vec())) | |
DhtEvent::ValuePut(sc_network_types::kad::Key::from(key.to_vec())) |
Also below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even better: we can implement From
for sc_network_types::kad::Key
to convert it directly from litep2p key, and then the line will become:
DhtEvent::ValuePut(key.into())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even better: we can implement
From
forsc_network_types::kad::Key
to convert it directly from litep2p key, and then the line will become:DhtEvent::ValuePut(key.into())
From
was already implemented for sc_network_types::kad::Key
😃 so now we have DhtEvent::ValuePut(key.into())
. I'm guessing the task in the next issue, will be to remove libp2p
from behaviour.rs
and service.rs
? 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure we can remove libp2p
from behavior.rs and service.rs since they are specific to libp2p architecture (they implement the behavior and work with swarm events)
Good to merge? 👀 |
Let me have a look why zombienet tests are failing. |
Issue
#4859
Description
This PR removes
libp2p
types in authority-discovery, and replace them with network backend agnostic types fromsc-network-types
.The
sc-network
interface is therefore updated accordingly.