libp2p / libp2p/js-libp2p

connection-monitor: clean up options for v4

Open
#3,515 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.6k
Forks
546
Avg merge
8h 18m
Merged PRs (30d)
16

Description

After the silence-gating change in #3504, ConnectionMonitorInit (packages/libp2p/src/connection-monitor.ts) has overlapping and leaky options. Two breaking cleanups for the next major (v4):

  • Drop abortConnectionOnPingFailure. Now that aborts are gated on connectionStaleTimeout, the boolean overlaps with the timeout — "never abort on ping failure" can be expressed as connectionStaleTimeout: Infinity instead of a separate flag.

  • Tidy pingTimeout (keep the adaptive timeout). Today it's Omit<AdaptiveTimeoutInit, 'metricsName' | 'metrics'>, which couples the public API to a @libp2p/utils-internal type — and the Omit key is typo'd (the field is metricName), so metricName leaks through. Replace it with connection-monitor's own { minTimeout?, maxTimeout? }, keeping AdaptiveTimeout internally so the ping timeout still adapts to RTT.

Plan to deprecate both in 3.x (@deprecated pointing here) for a runway. Behavior is unchanged — purely an options/API cleanup.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/libp2p/src/connection-monitor.ts at ConnectionMonitorInit and inspect how pingTimeout is passed to the internal AdaptiveTimeout. Update the public options and 3.x deprecation annotations while preserving adaptive RTT behavior and connectionStaleTimeout handling; done means the overlapping flag and leaked metricName are removed from the public API without behavior changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
networking
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.