Repository navigation
fix: avoid modifying slice returned by AddrsFactory - #3068
Merged
Merged
Conversation
ivan4th
added a commit
to spacemeshos/go-spacemesh
that referenced
this pull request
Nov 26, 2024
Also, upgrade go-libp2p-kad-dht to v0.28.1 and quic-go to v0.48.2. There's a bug in go-libp2p related to reuse of the slices retured by `AddrsFactory`, fix: libp2p/go-libp2p#3068 For now, the problem is mitigated by cloning the slice returned from `AddrsFactory` (`cfg.AdvertiseAddress`). Deprecated `max-reservations-per-peer` field in the relay server config, as now it is always 1 (and other values didn't make too much sense).
2 tasks
sukunrt
approved these changes
Nov 27, 2024
sukunrt
left a comment
Member
There was a problem hiding this comment.
Nice! Thanks for slices.Clone β€οΈ
Contributor
Author
|
Could we merge this PR? (I have no permissions to do so...) |
Member
|
Yeah. I was waiting for fixing the interop test(unrelated issue). But this is fine. We can do that later. |
Contributor
Author
|
Thanks! |
This file contains hidden or 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
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.
In some cases,
AddrsFactorymay return a reusable slice. This slice should not be modified.In
BasicHost.Addrs(), the slice was already being cloned before being passed toma.Unique()(updated this place to useslices.Clone()function), but in other places, the slice was being modified without being cloned, which in some cases could lead to crashes / unpredictable behavior.