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

address_store: Improve address tracking and add eviction algorithm #250

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

lexnv
Copy link
Collaborator

@lexnv lexnv commented Sep 24, 2024

This PR improves the transport manager's address tracking to keep a healthier view of addresses.

General changes:

  • Fixes a bug where listener addresses were tracked instead of dialing addresses (incoming connections may be established with ephemeral ports and there's no guarantee the remote is listening on them)
  • PeerIdMismatch error coming from the noise handshake redirects the address to the appropriate peer for healthier addresses
  • Addresses are tracked first, regardless of the peer state to ensure we update our view of the addresses (reachable or not)

Address Store changes:

  • The store is bounded to a maximum of 64 tracked addresses
  • Removing and reinsertion of addresses into the store is prone to error and instead the address store updates addresses in place
  • Introduces an eviction algorithm for tracking addresses with higher score

Testing Done

  • added extra tests to the address store
  • tested with subp2p-explorer for discovering kusama

This PR is part of a bigger refactor to keep track of healthier addresses.
It is essentially a breakdown of #248 for an easier review process.

@lexnv lexnv added the enhancement New feature or request label Sep 24, 2024
@lexnv lexnv self-assigned this Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant