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
Add pieces announcement through DSN. #847
Add pieces announcement through DSN. #847
Conversation
- add libp2p crate dependency
- introduce ‘announce_piece’ for Node - introduce ‘get_piece_providers for Node - add provider’s support for the custom_data_store
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.
Announcement is great, but we also need to have a way to cancel announcement. What I imagine is that announce
returns some guard object you need to keep around for as long as you're providing the data and once you're not anymore you just drop it and cancellation will be sent over the network.
@@ -19,6 +19,7 @@ dusk-bls12_381 = { version = "0.11", default-features = false, features = ["allo | |||
dusk-bytes = "0.1" | |||
dusk-plonk = { version = "0.12.0", default-features = false, features = ["alloc"], git = "https://github.com/subspace/plonk", rev = "193e68ba3d20f737d730e4b6edc757e4f639e7c3" } | |||
hex = { version = "0.4.3", default-features = false } | |||
libp2p = {version = "0.46.1", optional=true, default-features = false } |
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.
Hm... I think it is really quite undesirable to make subspace-core-primitives
depend on libp2p 😞
Also attention to detail:
libp2p = {version = "0.46.1", optional=true, default-features = false } | |
libp2p = { version = "0.46.1", optional = true, default-features = false } |
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.
Last time we had this conversation, you suggested adding dependencies. We need such a conversion (PieceIndexHash -> Multihash), we'll probably need some more conversions for primitive types. An alternative would be creating explicit conversion methods in the networking crate.
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.
Well, PieceIndexHash
already has AsRef<[u8]>
implemented for it. Which means all you need to write is MultihashDigest::digest(&Code::Identity, piece_index_hash.as_ref())
, which depending on how frequently that is used likely not worth building libp2p, which takes non-negligible amount of time, just to have From
conversion.
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.
Also one whitespace is still missing with latest changes.
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 agree that we need a provider removing mechanism. I wanted to add it using Kademlia's builtin features (provider ttl and republication interval). However, I wanted this changes in the next PR closer to the new plotting, when we will have pulling pieces.
It's not a problem though, please, let me know if you want it in this PR - I'll initialize these constants and add providers' removal code to the PR.
@@ -19,6 +19,7 @@ dusk-bls12_381 = { version = "0.11", default-features = false, features = ["allo | |||
dusk-bytes = "0.1" | |||
dusk-plonk = { version = "0.12.0", default-features = false, features = ["alloc"], git = "https://github.com/subspace/plonk", rev = "193e68ba3d20f737d730e4b6edc757e4f639e7c3" } | |||
hex = { version = "0.4.3", default-features = false } | |||
libp2p = {version = "0.46.1", optional=true, default-features = false } |
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.
Last time we had this conversation, you suggested adding dependencies. We need such a conversion (PieceIndexHash -> Multihash), we'll probably need some more conversions for primitive types. An alternative would be creating explicit conversion methods in the networking crate.
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.
TTL and republish are useful, but I believe there is also a way to explicitly remove it, which we can use for convenience. I wish there was a TODO for that, but nothing in this PR is necessarily blocking.
@@ -19,6 +19,7 @@ dusk-bls12_381 = { version = "0.11", default-features = false, features = ["allo | |||
dusk-bytes = "0.1" | |||
dusk-plonk = { version = "0.12.0", default-features = false, features = ["alloc"], git = "https://github.com/subspace/plonk", rev = "193e68ba3d20f737d730e4b6edc757e4f639e7c3" } | |||
hex = { version = "0.4.3", default-features = false } | |||
libp2p = {version = "0.46.1", optional=true, default-features = false } |
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.
Well, PieceIndexHash
already has AsRef<[u8]>
implemented for it. Which means all you need to write is MultihashDigest::digest(&Code::Identity, piece_index_hash.as_ref())
, which depending on how frequently that is used likely not worth building libp2p, which takes non-negligible amount of time, just to have From
conversion.
@@ -19,6 +19,7 @@ dusk-bls12_381 = { version = "0.11", default-features = false, features = ["allo | |||
dusk-bytes = "0.1" | |||
dusk-plonk = { version = "0.12.0", default-features = false, features = ["alloc"], git = "https://github.com/subspace/plonk", rev = "193e68ba3d20f737d730e4b6edc757e4f639e7c3" } | |||
hex = { version = "0.4.3", default-features = false } | |||
libp2p = {version = "0.46.1", optional=true, default-features = false } |
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.
Also one whitespace is still missing with latest changes.
Turns out that TTL works only for the receiving peers and doesn't work for announcing peers. So, the I will format |
Dusk crates are foundational, you'll have to write a lot of tricky code to get the same results as API provided by |
Let's wait for some issues with this code, I'm not sure we will find any but feel free to move the conversion code to the networking crate any moment you found one. |
I mean the immediate issue is that everything (quite literally) depends on |
This PR starts adding the archival storage layer support for the DSN v2. Fixes #846
Changes
PieceIndexHash
primitiveannounce_piece
andget_piece_providers
methods to Node in the networking crateComments
Code contributor checklist: