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

fix(gossipsub): make sure we have fanout peers when publish #5793

Merged
merged 3 commits into from
Jan 6, 2025

Conversation

ackintosh
Copy link
Contributor

@ackintosh ackintosh commented Jan 5, 2025

Description

This PR is to submit a fix in Lighthouse. sigp/lighthouse#6738

An InsufficientPeers error can occur under a particular condition, even if we have peers subscribed to a topic.

Notes & open questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

Copy link
Contributor

@elenaf9 elenaf9 left a comment

Choose a reason for hiding this comment

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

Is it deliberate that we don't remove an entry from self.fanout when the last peer in the its list is removed?

protocols/gossipsub/src/behaviour.rs Outdated Show resolved Hide resolved
@ackintosh
Copy link
Contributor Author

@elenaf9 Thanks for your review!

Is it deliberate that we don't remove an entry from self.fanout when the last peer in the its list is removed?

Yes, because if we choose the way of removing an entry, we need to ensure that it's removed without any omissions. From a quick look at the code, it seems that removal would need to be handled in at least two places. In contrast, doing is_empty check during publishing ensures that we can reliably avoid iterating on an empty list.

@ackintosh ackintosh marked this pull request as ready for review January 6, 2025 13:42
Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

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

Thanks Akihito! LGTM

@jxs jxs added the send-it label Jan 6, 2025
@mergify mergify bot merged commit 34ac476 into libp2p:master Jan 6, 2025
71 checks passed
@ackintosh ackintosh deleted the fix-insufficient-peers branch January 6, 2025 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants