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

Feat/pubsub topics #3630

Merged
merged 4 commits into from
Nov 6, 2019
Merged

Feat/pubsub topics #3630

merged 4 commits into from
Nov 6, 2019

Conversation

ZenGround0
Copy link
Contributor

Motivation

We want to move to gossipsub and keep race conditions out of tests. This required waiting for recent upgrades to libp2p. This PR takes the first step of 1) updating libp2p 2) refactoring our internal wrappers to make use of the new topic abstraction

Proposed changes

  • update pubsub dep to 0.2.1
  • go-filecoin uses topic abstraction. syncer and messaging submodules own block and message topics. internal go-filecoin wrapper changed to a single Topic type. Construction modified. Publish and subscribe calls modified to not take in topic string.

Helps close #3561

@codecov-io
Copy link

codecov-io commented Nov 5, 2019

Codecov Report

Merging #3630 into master will decrease coverage by <1%.
The diff coverage is 57%.

@@          Coverage Diff           @@
##           master   #3630   +/-   ##
======================================
- Coverage      47%     46%   -1%     
======================================
  Files         269     269           
  Lines       17133   17130    -3     
======================================
- Hits         8112    8047   -65     
- Misses       7926    7995   +69     
+ Partials     1095    1088    -7

@@ -46,7 +45,7 @@ type NetworkSubmodule struct {
// Router is a router from IPFS
Router routing.Routing

fsub *libp2pps.PubSub
Fsub *libp2pps.PubSub
Copy link
Member

Choose a reason for hiding this comment

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

"F" for flood is no longer a good name here.

topic, err := network.Fsub.Join(net.MessageTopic(network.NetworkName))
if err != nil {
return MessagingSubmodule{}, err
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit confused about the difference between this Join and Topic.Subscribe() calls below. I've been code diving to try to reconcile this with the code I see in libp2p (on master) but haven't 100% figured it out.

Subscribing (having any network side-effect) at module construction is undesirable. It looks like in libp2p, this Join() is a no-op (but also with no return value?). If that's an assumption we're making in order to not have side-effects here, we should document as such. But with GossipSub, Join does do a bunch, so we're not getting any abstraction here.

If constructing a Topic object involves interacting with libp2p in a way that has side effects, I think we're better representing a topic as a string until we actually want to subscribe to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to move away from the deprecated endpoints so I'm keeping Topics. However your point on side effects during construction is well taken. I'll construct both the topic and subscription during start.

@ZenGround0 ZenGround0 merged commit 27b2d06 into master Nov 6, 2019
@ZenGround0 ZenGround0 mentioned this pull request Nov 6, 2019
@ZenGround0 ZenGround0 deleted the feat/pubsub-topics branch December 9, 2019 14:54
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.

Gossipsub -- make the node wait for the mesh before publishing anything
4 participants