Skip to content

feat(peer-store): Remove addresses from peer store on dial failure #5926

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

Merged
merged 20 commits into from
Apr 11, 2025

Conversation

dknopik
Copy link
Contributor

@dknopik dknopik commented Mar 10, 2025

Description

When the MemoryStore receives a FromSwarm::DialFailure event, it will now modify the store appropriately:

  • LocalPeerId: Remove the peer from the store.
  • WrongPeerId: Remove the address for the dialed peer ID and readd it for the received peer ID.
  • Transport: Remove the failed addresses from the store.
  • other: no action.

Furthermore, we group some repeated event logic in a new function push_event_and_wake for internal use.

Follow-up to #5724

Notes & open questions

None.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

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

Thanks Daniel! Overall LGTM, left a comment.

@jxs jxs requested a review from elenaf9 March 11, 2025 16:14
Copy link
Member

@elenaf9 elenaf9 left a comment

Choose a reason for hiding this comment

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

Thanks @dknopik!

elenaf9

This comment was marked as outdated.

@dknopik dknopik force-pushed the peer-store-remove-undialable branch from 2c8f8f9 to aa7c0c4 Compare March 26, 2025 09:24
@dknopik
Copy link
Contributor Author

dknopik commented Mar 26, 2025

Pushed a new version that:

  • Does not differentiate between the way addresses were added for the sake of simplicity.
  • Removes addresses as described in the PR description unless disabled by the user.
  • Removes peer records if there is no address or custom data remaining.
  • Makes the *_silent non-pub

The only open question from my perspective is whether to reintroduce the "permanent address" mechanism as seen here: 2c8f8f9

EDIT: discussed in call - we'll differentiate by origin (update_address vs event)

@dknopik dknopik requested review from drHuangMHT, elenaf9 and jxs March 26, 2025 15:00
Co-authored-by: Elena Frank <[email protected]>
@dknopik dknopik force-pushed the peer-store-remove-undialable branch from a731633 to 5184663 Compare March 31, 2025 21:26
Copy link
Member

@elenaf9 elenaf9 left a comment

Choose a reason for hiding this comment

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

LGTM!

@jxs jxs added the send-it label Apr 9, 2025
@elenaf9 elenaf9 removed the send-it label Apr 9, 2025
elenaf9
elenaf9 previously approved these changes Apr 11, 2025
@mergify mergify bot dismissed elenaf9’s stale review April 11, 2025 04:34

Approvals have been dismissed because the PR was updated after the send-it label was applied.

Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

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

Thanks fr the patience Daniel! ❤️

@mergify mergify bot merged commit 7677277 into libp2p:master Apr 11, 2025
70 of 71 checks passed
mergify bot pushed a commit that referenced this pull request Apr 30, 2025
Refactor the events emitted by the `peer_store::Behavior`:
1. Merge the current 3 event types (`behavior::Event`, `store::Event`, `memory_store::Event`) into a single type that is emitted by the `Store` implementation.
2. Use more descriptive event variants `AddressAdded`, `AddressRemoved` that also expose the specific `Multiaddr`.
3. Remove `Event::CustomDataUpdate` variant.

Discussed in #5926 (comment) and #5926 (comment).

Pull-Request: #6011.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants