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

chore(dot/network): use mdns instead of mdns_legacy #2794

Merged
merged 15 commits into from
Jan 2, 2023

Conversation

qdm12
Copy link
Contributor

@qdm12 qdm12 commented Sep 1, 2022

Changes

Tests

MODE=rpc go test -run ^TestStableNetworkRPC$ github.com/ChainSafe/gossamer/tests/rpc -v

Issues

Related to #2768 and #2788

Primary Reviewer

@qdm12
Copy link
Contributor Author

qdm12 commented Sep 1, 2022

@Stebalien This PR only focuses on moving to the newer mdns package. I also tried with the latest github.com/libp2p/go-libp2p without success (on #2788).

One of the test failing is an integration test TestStableNetworkRPC running 3 nodes, and no node is found (should be 2).

To help you reproduce:

git clone --single-branch --branch qdm12/dot/network/mdns-upgrade --depth 1 https:/ChainSafe/gossamer.git
cd gossamer
MODE=rpc go test -run ^TestStableNetworkRPC$ github.com/ChainSafe/gossamer/tests/rpc -v

Thank you in advance for any tips! 👍

@codecov
Copy link

codecov bot commented Sep 1, 2022

Codecov Report

Merging #2794 (6da74a2) into development (4442eee) will increase coverage by 0.10%.
The diff coverage is 48.76%.

Additional details and impacted files
@@               Coverage Diff               @@
##           development    #2794      +/-   ##
===============================================
+ Coverage        51.77%   51.87%   +0.10%     
===============================================
  Files              220      219       -1     
  Lines            27764    27718      -46     
===============================================
+ Hits             14374    14379       +5     
+ Misses           12162    12113      -49     
+ Partials          1228     1226       -2     

@Stebalien
Copy link

Hm. It looks like it could be related to libp2p/go-libp2p#1333.

@Stebalien
Copy link

cc @marten-seemann

@marten-seemann
Copy link

Hm. It looks like it could be related to libp2p/go-libp2p#1333.

Not sure. Could be, but we have a similar test case in go-libp2p (some nodes discovering each other) that works fine.

@qdm12
Copy link
Contributor Author

qdm12 commented Sep 1, 2022

Thanks @marten-seemann and @Stebalien for helping out! 👍
I tried to separate each of the 3 Gossamer node launches by 1 minute, and then wait an extra 10 minutes and it still doesn't find other peers 😢 So maybe another problem?

For extra debugging information, the notifee HandlePeerFound(p peer.AddrInfo) is never called. The mdns is created though (NewMDNSService doesn't hang).

Do we have to perhaps change the libp2p host creation or change the service name string? (we use the same string(m.host.protocolID) as before for now)? Thanks!

@qdm12
Copy link
Contributor Author

qdm12 commented Sep 12, 2022

Could be, but we have a similar test case in go-libp2p (some nodes discovering each other) that works fine.

Can you point me to it please? Maybe I can spot what's missing/wrong in those code changes or our existing code.

@qdm12 qdm12 force-pushed the qdm12/dot/network/mdns-upgrade branch from 117fa6d to 42f7e92 Compare October 12, 2022 07:35
@qdm12
Copy link
Contributor Author

qdm12 commented Oct 12, 2022

I changed this to use our own internal/mdns implementation based off libp2p's mdns_legacy. It's still using github.com/whyrusleeping/mdns under the hood, maybe upgrading to github.com/hashicorp/mdns would be nice once their race condition is fixed in hashicorp/mdns#75 but really not a necessity.

With this merged, #2788 should finally be unblocked.

Copy link
Contributor

@jimjbrettj jimjbrettj left a comment

Choose a reason for hiding this comment

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

lgtm

@qdm12 qdm12 force-pushed the qdm12/dot/network/mdns-upgrade branch from 0be2816 to 0f045cf Compare October 26, 2022 15:43
@qdm12 qdm12 force-pushed the qdm12/dot/network/mdns-upgrade branch 4 times, most recently from 6ac78b7 to 9a0ae60 Compare December 1, 2022 13:19
internal/mdns/dialable.go Outdated Show resolved Hide resolved
internal/mdns/dialable.go Outdated Show resolved Hide resolved
internal/mdns/mdns.go Show resolved Hide resolved
internal/mdns/mdns.go Show resolved Hide resolved
internal/mdns/mdns.go Outdated Show resolved Hide resolved
internal/mdns/mdns.go Outdated Show resolved Hide resolved
internal/mdns/mdns.go Outdated Show resolved Hide resolved
@qdm12 qdm12 requested a review from timwu20 December 2, 2022 10:38
@qdm12 qdm12 force-pushed the qdm12/dot/network/mdns-upgrade branch 2 times, most recently from a706332 to 152c60b Compare December 14, 2022 09:53
@qdm12 qdm12 force-pushed the qdm12/dot/network/mdns-upgrade branch from 152c60b to b093f4e Compare January 2, 2023 11:15
@qdm12 qdm12 force-pushed the qdm12/dot/network/mdns-upgrade branch from b093f4e to 618e985 Compare January 2, 2023 11:19
@qdm12 qdm12 merged commit 9154ced into development Jan 2, 2023
@qdm12 qdm12 deleted the qdm12/dot/network/mdns-upgrade branch January 2, 2023 15:08
Copy link

🎉 This PR is included in version 0.8.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

5 participants