Skip to content

fix(dashmate)!: differentiate service ports between networks to avoid conflicts#3085

Open
lklimek wants to merge 2 commits intov3.1-devfrom
fix/dashmate-port-conflicts-3002
Open

fix(dashmate)!: differentiate service ports between networks to avoid conflicts#3085
lklimek wants to merge 2 commits intov3.1-devfrom
fix/dashmate-port-conflicts-3002

Conversation

@lklimek
Copy link
Contributor

@lklimek lklimek commented Feb 13, 2026

Issue being fixed or feature implemented

Fixes #3002 — running both mainnet and testnet dashmate nodes on the same machine caused port binding failures because several services shared identical default port numbers across all network presets.

What was done?

Differentiated default ports for 9 services between mainnet, testnet, and local presets so multiple networks can coexist on the same host without port conflicts.

Changed default ports

Service Config Path Mainnet Testnet Local
Insight API/UI core.insight.port 3001 13001 23001
Dashmate Helper dashmate.helper.api.port 9100 19100 29100
Gateway Metrics platform.gateway.metrics.port 9090 19090 29090
Gateway Admin platform.gateway.admin.port 9901 19901 29901
Rate Limiter Metrics platform.gateway.rateLimiter.metrics.port 9102 19102 29102
Quorum List API platform.quorumList.api.port 2444 12444 22444
Drive ABCI Tokio Console platform.drive.abci.tokioConsole.port 6669 16669 26669
Drive ABCI Metrics platform.drive.abci.metrics.port 29090 39090 49090
GroveDB Visualizer platform.drive.abci.grovedbVisualizer.port 8083 18083 28083

Mainnet ports remain unchanged (inherited from base config). Testnet and local presets get unique port offsets.

Changes:

  • Config defaults: Updated getTestnetConfigFactory.js and getLocalConfigFactory.js with unique ports per service
  • Migration: Added automatic port migration in getConfigFileMigrationsFactory.js (v3.1.0 migration) — only updates ports that still match the old base defaults, preserving any custom overrides
  • Documentation: Updated all port references across service and config docs to show per-network defaults

How Has This Been Tested?

  • Unit tests pass (83 tests including full migration from v0.25.0 fixture to current version)
  • The migration test verifies that a v0.25.0 config file migrates to match a freshly created default config for all network presets
  • Manual verification that testnet and local configs now produce distinct port values

Breaking Changes

Default ports for 9 services now differ between mainnet, testnet, and local presets. This may affect:

  • Users with external monitoring/scripts that reference hardcoded port numbers (e.g., Prometheus scrape configs pointing at port 9090 for gateway metrics on testnet — now 19090)
  • Firewall rules that allowlist specific ports for testnet or local services
  • Docker Compose overrides that reference the old default port values

Existing dashmate configs are migrated automatically — ports that still match the old base defaults are updated to the new network-specific values. Custom port overrides are preserved.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

Summary by CodeRabbit

  • New Features

    • Added support for environment-specific port configurations, enabling distinct port assignments across local, testnet, and mainnet networks for improved multi-environment deployment management.
  • Documentation

    • Comprehensive updates to configuration and service documentation clarifying network-specific port mappings and defaults for all services across different environments.

@github-actions github-actions bot added this to the v3.1.0 milestone Feb 13, 2026
@lklimek lklimek requested a review from shumkov February 13, 2026 10:44
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

Adds per-network (local/testnet) port entries across configs and docs and implements migration-time port remapping for local/testnet to avoid shared-port conflicts when multiple networks run on the same host.

Changes

Cohort / File(s) Summary
Local Configuration
packages/dashmate/configs/defaults/getLocalConfigFactory.js
Adds local-specific config entries and ports for Insight, Dashmate Helper API, Quorum List API, Gateway (metrics/admin/rateLimiter.metrics), and Drive ABCI tooling (tokioConsole, metrics, grovedbVisualizer).
Testnet Configuration
packages/dashmate/configs/defaults/getTestnetConfigFactory.js
Adds testnet-specific config entries and ports for the same services as local (core.insight, dashmate.helper.api, platform.quorumList.api, gateway metrics/admin/rateLimiter.metrics, drive.abci tokioConsole/metrics/grovedbVisualizer).
Config Migration Logic
packages/dashmate/configs/getConfigFileMigrationsFactory.js
Introduces isLocal/isTestnet checks, clones affected option objects, and applies per-network port remapping for Dashmate, Core Insight, Gateway (metrics/admin/rateLimiter.metrics), Quorum List API, and Drive ABCI endpoints during migrations to prevent shared-reference mutations and port collisions.
Documentation Updates
packages/dashmate/docs/config/..., packages/dashmate/docs/services/...
Updates multiple config and service docs to list per-network default/example ports (mainnet/testnet/local) for Insight, Dashmate Helper, Gateway, Drive ABCI metrics/console/visualizer, Quorum List API, and localhost-only exposure tables.
Misc / Guide
CLAUDE.md
Adds a Pull Requests guidance section specifying PR title/description conventions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 I hopped through ports both old and new,
Split lanes for local, testnet, too,
No more collisions in the night,
Each service now has its own light,
I twitch my nose — the networks are true!

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(dashmate)!: differentiate service ports between networks to avoid conflicts' clearly and specifically summarizes the main change—addressing port conflicts across different network presets.
Linked Issues check ✅ Passed The PR directly addresses #3002 by implementing network-specific port differentiation for 9 services across mainnet, testnet, and local presets, with automatic migration and comprehensive documentation updates.
Out of Scope Changes check ✅ Passed All changes are within scope: port configuration updates in factories, migration logic, and documentation reflecting the new per-network ports. No unrelated changes detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into v3.1-dev

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/dashmate-port-conflicts-3002

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lklimek lklimek force-pushed the fix/dashmate-port-conflicts-3002 branch from 3a5d2b0 to 7ee6419 Compare February 13, 2026 10:48
Multiple services shared identical default ports across mainnet, testnet,
and local networks, causing port binding failures when running multiple
networks on the same machine. Assign unique ports per network for all
9 affected services (Dashmate Helper, Core Insight, Gateway Metrics/Admin,
Rate Limiter Metrics, Quorum List API, Drive Tokio Console/Metrics/GroveDB
Visualizer) and add config migration with cloneDeep to avoid shared
reference mutation from earlier migrations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lklimek lklimek force-pushed the fix/dashmate-port-conflicts-3002 branch from 7ee6419 to acefa21 Compare February 13, 2026 10:52
@lklimek lklimek changed the title fix(dashmate): differentiate service ports between networks fix(dashmate)!: differentiate service ports between networks to avoid conflicts Feb 13, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/dashmate/configs/getConfigFileMigrationsFactory.js`:
- Around line 1413-1414: The detection for local/testnet uses both
options.network and name (isLocal/isTestnet) but
getDefaultConfigByNetwork(options.network) ignores name; update the logic so the
network passed to getDefaultConfigByNetwork reflects the inferred network from
name when options.network is not set or mismatches (e.g., derive const
resolvedNetwork = isLocal ? NETWORK_LOCAL : isTestnet ? NETWORK_TESTNET :
options.network and call getDefaultConfigByNetwork(resolvedNetwork)), ensuring
functions/variables referenced include isLocal, isTestnet, name,
options.network, and getDefaultConfigByNetwork so the default config chosen
matches the earlier detection.
🧹 Nitpick comments (1)
packages/dashmate/docs/services/index.md (1)

78-78: Port documentation is comprehensive and conflict-free.

The localhost-only services table correctly documents all per-network port assignments. Verification confirms:

  • No port conflicts within any single network preset (mainnet/testnet/local)
  • All ports consistent with PR summary and other documentation files
  • Core ZMQ port references align with configuration documentation
💡 Optional: Consider improving table readability

Line 78 is over 600 characters long, which may affect maintainability. Consider reformatting the localhost-only row into a multi-line table entry or breaking it into sub-rows by service category for easier maintenance:

| **Localhost-only** | Core RPC (9998)<br>Insight UI (3001 mainnet / 13001 testnet / 23001 local) | 127.0.0.1 (local) |
|                    | Dashmate Helper (9100 mainnet / 19100 testnet / 29100 local) | " |
|                    | Platform metrics & admin endpoints... | " |

However, the current format works correctly and is a minor style preference.

Also applies to: 83-84

Comment on lines +1413 to +1414
const isLocal = options.network === NETWORK_LOCAL || name === 'local';
const isTestnet = options.network === NETWORK_TESTNET || name === 'testnet';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Potential mismatch between isLocal/isTestnet detection and getDefaultConfigByNetwork.

Lines 1413–1414 detect local/testnet by name or network, but line 1437 resolves the default config using only options.network. If a config has name === 'local' but options.network is not NETWORK_LOCAL (e.g., a misconfigured or legacy config), getDefaultConfigByNetwork falls back to 'base', and the migration would overwrite the port with the base default instead of the local one — effectively a no-op or worse, a silent mismatch.

Consider also checking name when resolving the network config, consistent with lines 1413–1414:

Suggested fix
-            const networkConfig = getDefaultConfigByNetwork(options.network);
+            let effectiveNetwork = options.network;
+            if (name === 'local') effectiveNetwork = NETWORK_LOCAL;
+            else if (name === 'testnet') effectiveNetwork = NETWORK_TESTNET;
+            const networkConfig = getDefaultConfigByNetwork(effectiveNetwork);

Also applies to: 1437-1437

🤖 Prompt for AI Agents
In `@packages/dashmate/configs/getConfigFileMigrationsFactory.js` around lines
1413 - 1414, The detection for local/testnet uses both options.network and name
(isLocal/isTestnet) but getDefaultConfigByNetwork(options.network) ignores name;
update the logic so the network passed to getDefaultConfigByNetwork reflects the
inferred network from name when options.network is not set or mismatches (e.g.,
derive const resolvedNetwork = isLocal ? NETWORK_LOCAL : isTestnet ?
NETWORK_TESTNET : options.network and call
getDefaultConfigByNetwork(resolvedNetwork)), ensuring functions/variables
referenced include isLocal, isTestnet, name, options.network, and
getDefaultConfigByNetwork so the default config chosen matches the earlier
detection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashmate fails to upgrade from v2.0.1

1 participant