From 36d42c6139ccc196bd55d0b640950c838744c526 Mon Sep 17 00:00:00 2001 From: Cayman Date: Wed, 27 Sep 2023 11:50:29 -0400 Subject: [PATCH 1/4] fix!: remove dialler language --- .../src/connection-manager/dial-queue.ts | 4 +- .../test/connection-manager/auto-dial.spec.ts | 40 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/packages/libp2p/src/connection-manager/dial-queue.ts b/packages/libp2p/src/connection-manager/dial-queue.ts index 54a387e14c..1a141ac330 100644 --- a/packages/libp2p/src/connection-manager/dial-queue.ts +++ b/packages/libp2p/src/connection-manager/dial-queue.ts @@ -101,8 +101,8 @@ export class DialQueue { setMaxListeners?.(Infinity, this.shutDownController.signal) } catch {} - this.pendingDialCount = components.metrics?.registerMetric('libp2p_dialler_pending_dials') - this.inProgressDialCount = components.metrics?.registerMetric('libp2p_dialler_in_progress_dials') + this.pendingDialCount = components.metrics?.registerMetric('libp2p_dial_queue_pending_dials') + this.inProgressDialCount = components.metrics?.registerMetric('libp2p_dial_queue_in_progress_dials') this.pendingDials = [] for (const [key, value] of Object.entries(init.resolvers ?? {})) { diff --git a/packages/libp2p/test/connection-manager/auto-dial.spec.ts b/packages/libp2p/test/connection-manager/auto-dial.spec.ts index 3c5968bdf1..45f594a0d1 100644 --- a/packages/libp2p/test/connection-manager/auto-dial.spec.ts +++ b/packages/libp2p/test/connection-manager/auto-dial.spec.ts @@ -22,7 +22,7 @@ import type { PeerStore, Peer } from '@libp2p/interface/peer-store' import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' describe('auto-dial', () => { - let autoDialler: AutoDial + let autoDial: AutoDial let events: EventEmitter let peerStore: PeerStore let peerId: PeerId @@ -38,8 +38,8 @@ describe('auto-dial', () => { }) afterEach(() => { - if (autoDialler != null) { - autoDialler.stop() + if (autoDial != null) { + autoDial.stop() } }) @@ -73,7 +73,7 @@ describe('auto-dial', () => { getDialQueue: [] }) - autoDialler = new AutoDial({ + autoDial = new AutoDial({ peerStore, connectionManager, events @@ -81,8 +81,8 @@ describe('auto-dial', () => { minConnections: 10, autoDialInterval: 10000 }) - autoDialler.start() - void autoDialler.autoDial() + autoDial.start() + void autoDial.autoDial() await pWaitFor(() => { return connectionManager.openConnection.callCount === 1 @@ -127,15 +127,15 @@ describe('auto-dial', () => { getDialQueue: [] }) - autoDialler = new AutoDial({ + autoDial = new AutoDial({ peerStore, connectionManager, events }, { minConnections: 10 }) - autoDialler.start() - await autoDialler.autoDial() + autoDial.start() + await autoDial.autoDial() await pWaitFor(() => connectionManager.openConnection.callCount === 1) await delay(1000) @@ -181,15 +181,15 @@ describe('auto-dial', () => { }] }) - autoDialler = new AutoDial({ + autoDial = new AutoDial({ peerStore, connectionManager, events }, { minConnections: 10 }) - autoDialler.start() - await autoDialler.autoDial() + autoDial.start() + await autoDial.autoDial() await pWaitFor(() => connectionManager.openConnection.callCount === 1) await delay(1000) @@ -207,7 +207,7 @@ describe('auto-dial', () => { getDialQueue: [] }) - autoDialler = new AutoDial({ + autoDial = new AutoDial({ peerStore, connectionManager, events @@ -215,12 +215,12 @@ describe('auto-dial', () => { minConnections: 10, autoDialInterval: 10000 }) - autoDialler.start() + autoDial.start() // call autodial twice await Promise.all([ - autoDialler.autoDial(), - autoDialler.autoDial() + autoDial.autoDial(), + autoDial.autoDial() ]) // should only have queried peer store once @@ -258,7 +258,7 @@ describe('auto-dial', () => { getDialQueue: [] }) - autoDialler = new AutoDial({ + autoDial = new AutoDial({ peerStore, connectionManager, events @@ -266,9 +266,9 @@ describe('auto-dial', () => { minConnections: 10, autoDialPeerRetryThreshold: 2000 }) - autoDialler.start() + autoDial.start() - void autoDialler.autoDial() + void autoDial.autoDial() await pWaitFor(() => { return connectionManager.openConnection.callCount === 1 @@ -282,7 +282,7 @@ describe('auto-dial', () => { await delay(2000) // autodial again - void autoDialler.autoDial() + void autoDial.autoDial() await pWaitFor(() => { return connectionManager.openConnection.callCount === 3 From 2cc500c19cd49cd918439fbeba8ba47e1715f9b5 Mon Sep 17 00:00:00 2001 From: Cayman Date: Fri, 6 Oct 2023 17:19:32 -0400 Subject: [PATCH 2/4] chore: address pr comments --- .../test/connection-manager/auto-dial.spec.ts | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/libp2p/test/connection-manager/auto-dial.spec.ts b/packages/libp2p/test/connection-manager/auto-dial.spec.ts index 45f594a0d1..1bd578fdbe 100644 --- a/packages/libp2p/test/connection-manager/auto-dial.spec.ts +++ b/packages/libp2p/test/connection-manager/auto-dial.spec.ts @@ -22,7 +22,7 @@ import type { PeerStore, Peer } from '@libp2p/interface/peer-store' import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' describe('auto-dial', () => { - let autoDial: AutoDial + let autoDialer: AutoDial let events: EventEmitter let peerStore: PeerStore let peerId: PeerId @@ -38,8 +38,8 @@ describe('auto-dial', () => { }) afterEach(() => { - if (autoDial != null) { - autoDial.stop() + if (autoDialer != null) { + autoDialer.stop() } }) @@ -73,7 +73,7 @@ describe('auto-dial', () => { getDialQueue: [] }) - autoDial = new AutoDial({ + autoDialer = new AutoDial({ peerStore, connectionManager, events @@ -81,8 +81,8 @@ describe('auto-dial', () => { minConnections: 10, autoDialInterval: 10000 }) - autoDial.start() - void autoDial.autoDial() + autoDialer.start() + void autoDialer.autoDial() await pWaitFor(() => { return connectionManager.openConnection.callCount === 1 @@ -127,15 +127,15 @@ describe('auto-dial', () => { getDialQueue: [] }) - autoDial = new AutoDial({ + autoDialer = new AutoDial({ peerStore, connectionManager, events }, { minConnections: 10 }) - autoDial.start() - await autoDial.autoDial() + autoDialer.start() + await autoDialer.autoDial() await pWaitFor(() => connectionManager.openConnection.callCount === 1) await delay(1000) @@ -181,15 +181,15 @@ describe('auto-dial', () => { }] }) - autoDial = new AutoDial({ + autoDialer = new AutoDial({ peerStore, connectionManager, events }, { minConnections: 10 }) - autoDial.start() - await autoDial.autoDial() + autoDialer.start() + await autoDialer.autoDial() await pWaitFor(() => connectionManager.openConnection.callCount === 1) await delay(1000) @@ -207,7 +207,7 @@ describe('auto-dial', () => { getDialQueue: [] }) - autoDial = new AutoDial({ + autoDialer = new AutoDial({ peerStore, connectionManager, events @@ -215,12 +215,12 @@ describe('auto-dial', () => { minConnections: 10, autoDialInterval: 10000 }) - autoDial.start() + autoDialer.start() // call autodial twice await Promise.all([ - autoDial.autoDial(), - autoDial.autoDial() + autoDialer.autoDial(), + autoDialer.autoDial() ]) // should only have queried peer store once @@ -258,7 +258,7 @@ describe('auto-dial', () => { getDialQueue: [] }) - autoDial = new AutoDial({ + autoDialer = new AutoDial({ peerStore, connectionManager, events @@ -266,9 +266,9 @@ describe('auto-dial', () => { minConnections: 10, autoDialPeerRetryThreshold: 2000 }) - autoDial.start() + autoDialer.start() - void autoDial.autoDial() + void autoDialer.autoDial() await pWaitFor(() => { return connectionManager.openConnection.callCount === 1 @@ -282,7 +282,7 @@ describe('auto-dial', () => { await delay(2000) // autodial again - void autoDial.autoDial() + void autoDialer.autoDial() await pWaitFor(() => { return connectionManager.openConnection.callCount === 3 From 8d3344fc1f6174c25b625f315f9a978e79355d60 Mon Sep 17 00:00:00 2001 From: Cayman Date: Tue, 10 Oct 2023 09:45:02 -0400 Subject: [PATCH 3/4] chore: add migration doc --- doc/migrations/v0.46-v1.0.md | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 doc/migrations/v0.46-v1.0.md diff --git a/doc/migrations/v0.46-v1.0.md b/doc/migrations/v0.46-v1.0.md new file mode 100644 index 0000000000..456f00ce54 --- /dev/null +++ b/doc/migrations/v0.46-v1.0.md @@ -0,0 +1,53 @@ + +# Migrating to libp2p@1.0 + +A migration guide for refactoring your application code from libp2p v0.46 to v1.0. + +## Table of Contents + +- [API](#api) +- [Module Updates](#module-updates) +- [Metrics](#metrics) + +## API + + + +## Module Updates + +With this release you should update the following libp2p modules if you are relying on them: + + + +```json + +``` + +## Metrics + +The following metrics were renamed: + +`libp2p_dialler_pending_dials` => `libp2p_dialler_pending_dials` +`libp2p_dialler_in_progress_dials` => `libp2p_dial_queue_in_progress_dials` From 04ed25f3ddf7ecf37e2828faed67469ec26fb19d Mon Sep 17 00:00:00 2001 From: Cayman Date: Tue, 10 Oct 2023 23:39:59 -0400 Subject: [PATCH 4/4] Update doc/migrations/v0.46-v1.0.md Co-authored-by: Chad Nehemiah --- doc/migrations/v0.46-v1.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/migrations/v0.46-v1.0.md b/doc/migrations/v0.46-v1.0.md index 456f00ce54..184b266cf0 100644 --- a/doc/migrations/v0.46-v1.0.md +++ b/doc/migrations/v0.46-v1.0.md @@ -49,5 +49,5 @@ It's recommended to check package.json changes for this: The following metrics were renamed: -`libp2p_dialler_pending_dials` => `libp2p_dialler_pending_dials` +`libp2p_dialler_pending_dials` => `libp2p_dial_queue_pending_dials` `libp2p_dialler_in_progress_dials` => `libp2p_dial_queue_in_progress_dials`