Skip to content
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

[Gossipsub] Prevent non-published messages being added to caches #1930

Merged
merged 2 commits into from
Jan 20, 2021

Conversation

AgeManning
Copy link
Contributor

This addresses issue #1926.

Currently, Gossipsub messages may not be published on a topic if there are no subscribed peers on that topic, however they are being added to a duplicate cache. If the messages are content-addressed, this prevents the user from attempting to republish the message in the future.

This PR modifies the logic such that messages are only added to the caches (duplicate, memcache and published_messages) if the message could be published to at least one peer.

Previously, a failed publish would be added the memcache. This meant that the router would gossip about a failed publish, such that if a peer joined the topic after the failed publish (but within the gossip history time window) the message could still be propagated to the newly connected peers. With this PR, a failed publish now definitively indicates the message will not be published on the network and the user is required to re-submit at a later time, once sufficient peers exist on the topic.

@xu-cheng
Copy link
Contributor

Thanks for the fix.

Copy link
Contributor

@romanb romanb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good to me. Thanks.

Previously, a failed publish would be added the memcache. This meant that the router would gossip about a failed publish, such that if a peer joined the topic after the failed publish (but within the gossip history time window) the message could still be propagated to the newly connected peers. With this PR, a failed publish now definitively indicates the message will not be published on the network and the user is required to re-submit at a later time, once sufficient peers exist on the topic.

That sounds reasonable to me.

@mxinden mxinden merged commit eac43d1 into libp2p:master Jan 20, 2021
@mxinden
Copy link
Member

mxinden commented Jan 20, 2021

For the record, I pushed bbd3df6 to update changelogs and cargo tomls. Let us know in case you need a release with this patch.

@AgeManning AgeManning deleted the gossipsub-update branch July 8, 2021 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants