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: don't add unresponsive DHT servers to the Routing Table #820

Merged
merged 18 commits into from
Jun 12, 2023

Conversation

guillaumemichel
Copy link
Contributor

@guillaumemichel guillaumemichel commented Feb 21, 2023

PR addressing #811

Change summary:

Todo

@Jorropo Jorropo self-requested a review February 21, 2023 16:17
@guillaumemichel guillaumemichel marked this pull request as draft February 21, 2023 17:08
@guillaumemichel guillaumemichel self-assigned this Feb 21, 2023
@guillaumemichel guillaumemichel marked this pull request as ready for review February 22, 2023 14:41
@guillaumemichel
Copy link
Contributor Author

@Jorropo I fixed a flaw but some tests are still failing:

  • TestBootstrappersReplacable doesn't make sense to me. The concept of replaceable peers seems wrongly implemented in go-libp2p-kbucket. I suggest that we get rid of this test.
  • All tests from ext_test.go are failing. They are testing whether DHT requests fail as expected in scenarios the DHT peer is connected to unresponsive peers. However, with this new feature, invalid nodes aren't added to the routing table at all, hence the tests are failing.
  • All other tests are passing as expected.

For ext_test.go, I suggest to get rid of all tests, and add a new test where we try to connect to unresponsive peers and verify that they don't get added to the routing table. WDYT?

@guillaumemichel
Copy link
Contributor Author

Just opened a PR in go-libp2p-kbucket. We need a function to test whether a peer.ID would be useful to the Routing Table, so that we don't bother sending requests to useless peers.

libp2p/go-libp2p-kbucket#113

@guillaumemichel guillaumemichel marked this pull request as ready for review February 23, 2023 16:33
Copy link
Contributor

@Jorropo Jorropo left a comment

Choose a reason for hiding this comment

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

I did a high level surface review, I'll rereview in depth once high level code quality is fixed.

dht.go Outdated Show resolved Hide resolved
dht.go Outdated Show resolved Hide resolved
dht.go Outdated Show resolved Hide resolved
dht.go Outdated Show resolved Hide resolved
dht.go Outdated Show resolved Hide resolved
dht_test.go Show resolved Hide resolved
dht_test.go Outdated Show resolved Hide resolved
dht_test.go Outdated Show resolved Hide resolved
dht_test.go Outdated Show resolved Hide resolved
dht_test.go Outdated Show resolved Hide resolved
@yiannisbot
Copy link

@guillaumemichel is this ready for a second round of reviews from @Jorropo so that we schedule it for one of the upcoming releases?
cc: @BigLep to be in the loop regarding scheduling this, or deferring for later depending on team's priorities.

@BigLep
Copy link

BigLep commented Apr 6, 2023

@guillaumemichel : what are the next steps here?

@guillaumemichel
Copy link
Contributor Author

I am still waiting on a review from @Jorropo for this PR and for libp2p/go-libp2p-kbucket#113 on which it depends.

@guillaumemichel guillaumemichel force-pushed the fix/unresponsive-peers branch 2 times, most recently from 10fbf09 to f083cb3 Compare April 6, 2023 08:27
@BigLep BigLep mentioned this pull request Apr 19, 2023
dht.go Outdated Show resolved Hide resolved
dht.go Outdated Show resolved Hide resolved
dht.go Outdated Show resolved Hide resolved
dht_bootstrap_test.go Outdated Show resolved Hide resolved
dht_net.go Outdated Show resolved Hide resolved
internal/config/config.go Outdated Show resolved Hide resolved
@Jorropo
Copy link
Contributor

Jorropo commented Jun 8, 2023

Also please resolve your conflicts.

@BigLep
Copy link

BigLep commented Jun 8, 2023

Per 2023-06-08 maintainer conversation: @Jorropo is going to take having this code all ready to go so that @guillaumemichel can review it first-thing 2023-06-12 when he returns so that the Kubo 0.21 release can happen afterwards.

optimizations.md Outdated Show resolved Hide resolved
dht.go Outdated Show resolved Hide resolved
Copy link
Contributor

@Jorropo Jorropo left a comment

Choose a reason for hiding this comment

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

LGTM Ty <3

@Jorropo Jorropo changed the title Fix: don't add unresponsive DHT servers to the Routing Table fix: don't add unresponsive DHT servers to the Routing Table Jun 12, 2023
@Jorropo Jorropo mentioned this pull request Jun 12, 2023
@Jorropo Jorropo merged commit 8c9fdff into libp2p:master Jun 12, 2023
11 checks passed
Jorropo added a commit that referenced this pull request Jun 12, 2023
* added check to avoid adding unresponsive dht peers to the dht routing table

* removed lock in adding peers to the rt

* made variable names more meaningful

* fixed network loop and corrected tests

* added UsefulPeer() references from current PR

* go mod tidy

* added delay in TestRefreshBelowMinRTThreshold

* addressed review

* go mod tidy

* addressed Jorropo review

* added comments

* removed state of peers probed recently

* fix conflicts merge

* updated deps

* added optimizations documentation

* Update dht.go

* updated md files

---------

Co-authored-by: Jorropo <jorropo.pgm@gmail.com>
Jorropo pushed a commit that referenced this pull request Jun 12, 2023
* added check to avoid adding unresponsive dht peers to the dht routing table

* removed lock in adding peers to the rt

* made variable names more meaningful

* fixed network loop and corrected tests

* added UsefulPeer() references from current PR

* go mod tidy

* added delay in TestRefreshBelowMinRTThreshold

* addressed review

* go mod tidy

* addressed Jorropo review

* added comments

* removed state of peers probed recently

* fix conflicts merge

* updated deps

* added optimizations documentation

* Update dht.go

* updated md files

---------

Co-authored-by: Jorropo <jorropo.pgm@gmail.com>
(cherry picked from commit 8c9fdff)
achingbrain added a commit to libp2p/js-libp2p that referenced this pull request Apr 29, 2024
Partial revert of #2499

If a node is queried for it's own peer id, return it's own peer
info.

This is necessary because since libp2p/go-libp2p-kad-dht#820
go-libp2p-kad-dht won't add a peer to it's routing tables that
doesn't have any DHT peers that are KAD-futher from it's own ID
already.
achingbrain added a commit to libp2p/js-libp2p that referenced this pull request Apr 29, 2024
Partial revert of #2499

If a node is queried for it's own peer id, return it's own peer
info.

This is necessary because since libp2p/go-libp2p-kad-dht#820
go-libp2p-kad-dht won't add a peer to it's routing tables that
doesn't have any DHT peers that are KAD-futher from it's own ID
already.
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.

None yet

4 participants