fix(node): restore layer1 validator metrics overrides#1023
Conversation
📝 WalkthroughWalkthroughLayer1 verify mode resolves the validator metrics address from optional CLI/environment overrides, with fallback to Tendermint configuration and a default port when only a hostname is provided. ChangesValidator metrics overrides
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant CLI as CLI or environment
participant Resolver as resolveValidatorMetricsAddr
participant VerifyMode as Layer1 verify mode
participant MetricsServer as Validator metrics server
CLI->>Resolver: Provide metrics hostname and port
Resolver->>VerifyMode: Return override or fallback address
VerifyMode->>MetricsServer: Start server on resolved address
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@node/cmd/node/main.go`:
- Around line 419-434: Update resolveValidatorMetricsAddr to use ctx.IsSet for
metrics hostname and port, preserving the fallback only when neither option is
set and retaining an explicitly provided port value of zero. Apply
defaultMetricsPort only when the port is genuinely unset, then construct the
address with net.JoinHostPort so IPv6 hosts are bracketed correctly; convert the
port to the required string form using strconv.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: fa44c184-e866-45bc-9445-86ec7c0c4088
📒 Files selected for processing (2)
node/cmd/node/main.gonode/flags/flags.go
There was a problem hiding this comment.
Claude Code Review
Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.
Tip: disable this comment in your organization's Code Review settings.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@node/cmd/node/main_test.go`:
- Around line 51-55: Update the subtests in the tests loop to clear inherited
MORPH_NODE_METRICS_HOSTNAME and MORPH_NODE_METRICS_PORT before applying each
case’s configured environment values, ensuring fallback, hostname-only, and
port-only scenarios run independently of ambient variables.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5ce06bcf-bcd6-4478-a99b-bd31fb463cae
📒 Files selected for processing (2)
node/cmd/node/main.gonode/cmd/node/main_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- node/cmd/node/main.go
46d6ddf to
fa66980
Compare
fa66980 to
7883889
Compare
Restore enable and port CLI/environment overrides only for the standalone layer1 validator listener while leaving Tendermint-backed modes unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
7883889 to
b51050b
Compare
Problem
PR #966 removed the standalone layer1 validator metrics CLI/environment overrides. Operators can configure metrics through Tendermint
[instrumentation], but can no longer override the enable switch or listener port from deployment environment variables without editingconfig.toml.Fix
Restore two overrides for layer1 verification mode only:
--metrics-server-enable/MORPH_NODE_METRICS_SERVER_ENABLEoverrides[instrumentation] prometheusfor the standalone layer1 validator listener.--metrics-port/MORPH_NODE_METRICS_PORTreplaces only that listener port while preserving the hostname fromprometheus_listen_addr.When neither option is set, behavior comes entirely from
config.toml. Other modes continue using Tendermint metrics and are unaffected by these compatibility flags.Validation
go test ./derivation ./cmd/node ./flagsmake -C node lint