connection-monitor: clean up options for v4
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 onconnectionStaleTimeout, the boolean overlaps with the timeout — "never abort on ping failure" can be expressed asconnectionStaleTimeout: Infinityinstead of a separate flag. -
Tidy
pingTimeout(keep the adaptive timeout). Today it'sOmit<AdaptiveTimeoutInit, 'metricsName' | 'metrics'>, which couples the public API to a@libp2p/utils-internal type — and theOmitkey is typo'd (the field ismetricName), sometricNameleaks through. Replace it with connection-monitor's own{ minTimeout?, maxTimeout? }, keepingAdaptiveTimeoutinternally 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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