-
Notifications
You must be signed in to change notification settings - Fork 9
Gossipsub partial messages #577
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
base: sigp-gossipsub
Are you sure you want to change the base?
Conversation
…sipsub-partial-messages
protocols/gossipsub/src/behaviour.rs
Outdated
{ | ||
// Return err if trying to publish the same partial message state we currently have. | ||
if existing.available_parts() == partial_message.available_parts() { | ||
return Err(PublishError::Duplicate); |
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 don't think this is correct.
- Imagine you have parts 1,2,3.
- You tell your peers about those parts.
- A peer comes back and says I want part 2.
- You republish with the same parts in order to respond.
- You get this error and fail to respond.
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.
thanks for explaining Marco, updated as we spoke
protocols/gossipsub/src/behaviour.rs
Outdated
data_transform: D, | ||
|
||
/// Partial messages received. | ||
partial_messages: HashMap<TopicHash, HashMap<Vec<u8>, P>>, |
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.
Do you need to store P here? I think it's better if P is owned solely by the application.
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.
yup, you are right, thanks Marco!
protocols/gossipsub/src/types.rs
Outdated
pub(crate) struct PartialData { | ||
pub(crate) ihave: Vec<u8>, | ||
pub(crate) iwant: Vec<u8>, | ||
pub(crate) message: Vec<u8>, |
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.
Is it useful to store the message here? It seems like wasted space, you only use it to check if the peer is sending you a duplicate.
Might be simpler to let the application handle dupes.
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.
thanks Marco, I only left wanted
and has
wanted to avoid sending the same message and has to avoid notifying the application layer of duplicates.
Thanks!
cb0e925
to
e6f1ae4
Compare
e6f1ae4
to
69c2d95
Compare
and create a paralel list for the partial_only topics.
Description
This is a draft implementation of partial messages for gossipsub following the spec PR and based on the Go implementation. Still WIP but should give a good idea of the direction we're heading.