-
Notifications
You must be signed in to change notification settings - Fork 960
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(kad): New provider record update strategy #5536
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mivik
changed the title
feat(kad): Keep
fix(kad): Keep Aug 7, 2024
provided
in sync with providers
in MemoryStore
provided
in sync with providers
in MemoryStore
Former implementations keep provider records sorted by their distance to the key, however this strategy is vulnerable to Sybil attack, in which an attacker can flood the network with false identities in order to eclipse a key. This commit change the strategy to simply keep old providers and ignore new ones. This new strategy however, can cause load imbalance, but can be mitigated by increasing `max_providers_per_key`.
Mivik
changed the title
fix(kad): Keep
refactor(kad): New provider record update strategy
Aug 9, 2024
provided
in sync with providers
in MemoryStore
guillaumemichel
force-pushed
the
master
branch
from
August 13, 2024 12:52
9525592
to
fc4a725
Compare
guillaumemichel
approved these changes
Aug 13, 2024
There was a problem hiding this 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 @Mivik for your contribution!
Can you also add an entry in the changelog and bump the version of kad
?
Sure, should I bump to 0.47.0 or 0.46.1? |
This is a non-breaking change, so you can bump to |
guillaumemichel
changed the title
refactor(kad): New provider record update strategy
feat(kad): New provider record update strategy
Aug 13, 2024
guillaumemichel
force-pushed
the
master
branch
from
August 13, 2024 15:30
c7e11e6
to
d92950e
Compare
guillaumemichel
force-pushed
the
master
branch
from
August 13, 2024 15:53
d92950e
to
a9de64a
Compare
TimTinkers
pushed a commit
to unattended-backpack/rust-libp2p
that referenced
this pull request
Sep 14, 2024
In `MemoryStore`, the number of provider records per key is limited by `max_providers_per_key`. Former implementations keep provider records sorted by their distance to the key, and only keep those with the smallest distance. This strategy is vulnerable to Sybil attack, in which an attacker can flood the network with false identities in order to eclipse a key. This commit change the strategy to simply keep old providers and ignore new ones. This new strategy however, can cause load imbalance, but can be mitigated by increasing `max_providers_per_key`. In addition, old implementations failed to keep `provided` and `providers` in sync, and this commit fixes this issue. Pull-Request: libp2p#5536.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In
MemoryStore
, the number of provider records per key is limited bymax_providers_per_key
. Former implementations keep provider records sorted by their distance to the key, and only keep those with the smallest distance. This strategy is vulnerable to Sybil attack, in which an attacker can flood the network with false identities in order to eclipse a key.This commit change the strategy to simply keep old providers and ignore new ones. This new strategy however, can cause load imbalance, but can be mitigated by increasing
max_providers_per_key
.In addition, old implementations failed to keep
provided
andproviders
in sync, and this commit fixes this issue.Change checklist