-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Suggestion for adding bitswap to substrate #7133
Conversation
@@ -91,7 +92,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> { | |||
GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone()); | |||
|
|||
let (network, network_status_sinks, system_rpc_tx, network_starter) = | |||
sc_service::build_network(sc_service::BuildNetworkParams { | |||
sc_service::build_network::<_, _, _, _, Multihash>(sc_service::BuildNetworkParams { |
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.
Ideally, I think we want Multihash
to be a default field here, so we don't have to do this whole _, _, _,
thing. As functions can't have generic fields, but structs can, we could move build_network
to be a method of BuildNetworkParams
instead. This would look uglier and be less consistent, but it would atleast solve this problem.
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.
Not sure if BuildNetworkParams
should have a pub field of type PhantomData
. I made build_network
a method that only takes one generic type parameter, the Multihash
.
This can be rebased on top of #6795 as a follow-up. |
@tomaka what are your thoughts on supporting light client to light client network protocols? |
I'm not exactly sure what you would like to get feedback on.
What do you mean by that? Light clients can connect and can theoretically talk to each other. In practice there isn't anything that a light client could ask to another light client at the moment. If you're asking in the context of the DHT, our general assumption at the moment is that light clients are short-lived and that they're more or less parasites for all networking-related purposes. There is a plan to do #3303, but since it hasn't been implemented yet there isn't anything preventing light clients from behaving like a full client on the DHT. |
4396ee2
to
a613f8f
Compare
Whether or not this belongs in substrate and if a network behaviour is the way to go. Question answered, thanks.
The intention of this PR is to change that.
I think it's ready for review, just waiting for ci to turn green. |
629b2b3
to
b1714fc
Compare
I gave a review in #6795 I'd prefer if possible to document in |
b1714fc
to
de30ac0
Compare
Reposting relevant review comment: #6795 (comment) |
Closed b/c of staleness. |
I can fix the build failures, but wanted to get some early feedback first. This is intended to superceed the PR by @expenses #6795 in a way that it is useful for sunshine-protocol to use this feature effectively.
ipfs-embed now supports plugging in an external networking stack. [0] is the corresponding PR to use the
NetworkService
of a substrate light client as the backend for ipfs-embed in the sunshine client.all the changes outside of sc-networking come from adding a generic parameter to the
NetworkService
that implements theMultihashDigest
trait fromtiny-multihash
. This is used by bitswap to verify the hashes of ipfs blocks. (We require this as we have a custom hasher based onsp-trie
that checks that the content identifier matches the trie root).NetworkService
for registering content in the dht.BootstrapComplete
event toNetworkService
, and starts bootstrapping the dht. (not sure why this wasn't required before)NetworkService
for making and handling bitswap requests.NetworkBehaviour
.