Skip to content

AddressBook with multiaddr confidence #593

@vasco-santos

Description

@vasco-santos

As part of the PeerStore improvements epic, we intend to add multiaddr confidence into the AddressBook.

Background

When js-libp2p dials a peer, it tries to dial several known addresses of a peer in parallel. We use a token based dialer to not use a lot of resources to a single connection. However, we don't have a good way of deciding which subset of addresses we should try first. If we gather metrics from peer addresses stored in the PeerStore, we can create a scoring function for the addresses.

Goals

  • Know when multiaddrs are successful and when they fail so we can keep track of their confidence (take aborted dials into account)
  • Understand the confidence in each multiaddr of a peer so we can manage addresses we store/use/exchange

WIP Notes

  • If we dial multiple addrs, and we abort the slower addrs, take into account the confidence of the fastest address
    • Update on success, update on failure, aborts are no ops
    • When the Abort is a timeout abort, treat as a failure for all addresses that were tried
      • Need to account for low dial timeouts poisoning potentially valid address confidence
        • Potentialy weight low dial timeout confidence adjustments
  • Parameters: latency, availability, last connection timestamp
  • Score function

Relevant Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    exp/wizardExtensive knowledge (implications, ramifications) requiredkind/enhancementA net-new feature or improvement to an existing featurekind/stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions