Skip to content

feat(rebalancer): support RPC overrides#7746

Merged
paulbalaji merged 5 commits intomainfrom
pbio/179e-infra-support-pr
Jan 22, 2026
Merged

feat(rebalancer): support RPC overrides#7746
paulbalaji merged 5 commits intomainfrom
pbio/179e-infra-support-pr

Conversation

@paulbalaji
Copy link
Collaborator

@paulbalaji paulbalaji commented Jan 12, 2026

Summary

Changes

Rebalancer Service (typescript/rebalancer/src/service.ts)

  • Added applyRpcOverrides() function that reads RPC_URL_<CHAIN> env vars (e.g., RPC_URL_ETHEREUM, RPC_URL_ARBITRUM)
  • Overrides chain metadata RPC URLs before creating MultiProvider
  • Added documentation for the new environment variable

Helm Chart (typescript/infra/helm/rebalancer/)

  • Updated external secret template to create RPC_URL_<CHAIN> env vars from GCP secrets
  • Secrets are fetched from <env>-rpc-endpoints-<chain> (e.g., mainnet3-rpc-endpoints-ethereum)
  • Uses first URL from the JSON array stored in secret
  • Added chains array to values.yaml for RPC secret fetching
  • TypeScript helm manager extracts chains from rebalancer config

RPC Rotation Integration (typescript/infra/src/utils/rpcUrls.ts)

  • Added selectRebalancers() function to discover and prompt for rebalancer refresh
  • Added RebalancerHelmManager.getManagersForChain() to find deployed rebalancers by chain
  • Updated refreshDependentK8sResourcesInteractive() to include rebalancers alongside warp monitors

Test plan

  • Deploy a rebalancer with private RPC secrets configured in GCP Secret Manager
  • Verify the ExternalSecret creates the correct RPC_URL_* env vars
  • Confirm the rebalancer applies RPC overrides and connects using private RPCs
  • Run RPC rotation for a chain with a deployed rebalancer and verify it's offered for refresh

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Per-network RPC URL and secret mappings for rebalancers (configurable per chain)
    • Config option to list chains for private RPC secret fetching
    • Interactive rebalancer discovery, selection, and refresh in management tools
    • Environment-based RPC URL overrides per chain
    • Improved discovery of deployed rebalancer instances for management and rotation workflows

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Jan 12, 2026

⚠️ No Changeset found

Latest commit: 3d17d9c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@paulbalaji paulbalaji force-pushed the pbio/179e-infra-support-pr branch from 8189679 to b4c9ff1 Compare January 12, 2026 15:40
@paulbalaji paulbalaji changed the title feat(infra): support private RPCs with rebalancer feat(rebalancer): support RPC overrides Jan 12, 2026
@paulbalaji paulbalaji force-pushed the pbio/179e-infra-support-pr branch from b4c9ff1 to 74a8aec Compare January 12, 2026 15:50
@paulbalaji paulbalaji requested a review from tkporter January 13, 2026 18:39
@hyperlane-xyz hyperlane-xyz deleted a comment from claude bot Jan 15, 2026
@paulbalaji paulbalaji force-pushed the pbio/179e-infra-support-pr branch 2 times, most recently from f5bd361 to 0c48d94 Compare January 16, 2026 18:58
@paulbalaji paulbalaji changed the base branch from main to pb/improved-rpc-rotation January 16, 2026 18:58
@paulbalaji paulbalaji force-pushed the pbio/179e-infra-support-pr branch 2 times, most recently from bd68e89 to 64f8793 Compare January 16, 2026 19:12
@paulbalaji paulbalaji marked this pull request as ready for review January 16, 2026 19:25
@paulbalaji paulbalaji requested a review from Mo-Hussain as a January 16, 2026 19:25
@paulbalaji paulbalaji force-pushed the pb/improved-rpc-rotation branch from 33fafc9 to a89d584 Compare January 16, 2026 21:28
@paulbalaji paulbalaji force-pushed the pbio/179e-infra-support-pr branch from 64f8793 to 83c269c Compare January 16, 2026 21:30
Base automatically changed from pb/improved-rpc-rotation to main January 22, 2026 21:55
@paulbalaji paulbalaji force-pushed the pbio/179e-infra-support-pr branch from 320d54a to 0150453 Compare January 22, 2026 22:31
@paulbalaji paulbalaji enabled auto-merge January 22, 2026 22:31
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

📝 Walkthrough

Walkthrough

This PR adds per-chain RPC env vars and secret mappings in the rebalancer Helm chart, surfaces rebalancer chains through the Helm manager, discovers deployed rebalancer pods to extract warpRouteIds and build chain-specific managers, and applies environment-based RPC URL overrides at service startup.

Changes

Cohort / File(s) Summary
Helm templates & values
typescript/infra/helm/rebalancer/templates/env-var-external-secret.yaml, typescript/infra/helm/rebalancer/values.yaml
Removed GCP_SECRET_OVERRIDES_ENABLED; added per-network RPC_URL_<CHAIN> entries under data generated from per-chain secrets and per-network remoteRef secret mappings; added hyperlane.chains values field.
Rebalancer Helm manager & discovery
typescript/infra/src/rebalancer/helm.ts
Added rebalancerChains field populated from warp core config; include chains in returned Helm values; added RebalancerPodInfo type; implemented getDeployedRebalancerWarpRouteIds to inspect pods and extract warpRouteId; added static getManagersForChain(environment, chain) helper.
Interactive RPC refresh flow
typescript/infra/src/utils/rpcUrls.ts
Integrated rebalancer selection into interactive refresh flow (selectRebalancers); generalized refresh choice logic to include rebalancers with core and warp monitors; updated prompts and manager collection logic.
Service RPC override logic
typescript/rebalancer/src/service.ts
Added internal applyRpcOverrides(chainMetadata) to read RPC_URL_<CHAIN> env vars and replace chain metadata rpcUrls with a single provided endpoint; invoked early in startup; imported ChainMetadata for typing.

Sequence Diagram(s)

sequenceDiagram
    participant Service as Rebalancer Service
    participant Env as Environment
    participant Metadata as Chain Metadata
    participant Provider as MultiProvider

    Service->>Metadata: Load chain metadata
    Service->>Env: Scan for RPC_URL_<CHAIN> vars
    Env-->>Service: Override values (if any)
    Service->>Metadata: Apply overrides (replace rpcUrls)
    Metadata-->>Service: Updated metadata
    Service->>Provider: Initialize providers with updated chains
    Provider-->>Service: Ready
Loading
sequenceDiagram
    participant CLI as CLI/Operator
    participant Manager as RebalancerHelmManager
    participant K8s as Kubernetes API
    participant Helm as Helm

    CLI->>Manager: getManagersForChain(env, chain)
    Manager->>K8s: List pods in namespace
    K8s-->>Manager: Pod list (env vars / args)
    Manager->>Manager: Extract helmReleaseName + warpRouteId
    Manager-->>CLI: RebalancerPodInfo[]
    CLI->>Helm: Deploy/apply with chain-aware helm values
    Helm-->>CLI: Applied
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly Related PRs

Suggested Reviewers

  • Mo-Hussain
  • antigremlin
  • xeno097
  • ltyu

Poem

A swamp of chains now sings a little tune,
Secrets tucked in places, RPCs under the moon.
Pods whisper their routes, Helm stitches the thread,
We fetch, we map, we start—no fuss, just ahead. 🐸

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(rebalancer): support RPC overrides' clearly and concisely summarizes the main change—adding RPC override support to the rebalancer service.
Description check ✅ Passed The description covers all required template sections with comprehensive details about changes, testing approach, and backward compatibility implications throughout the PR.

✏️ 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 pbio/179e-infra-support-pr

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.

paulbalaji and others added 4 commits January 22, 2026 22:38
Add support for private RPC endpoints in the rebalancer, following the same
pattern used by the standalone keyfunder package.

Changes:
- Add RPC_URL_<CHAIN> environment variable support to rebalancer service
- Update helm external secret template to inject RPC URLs from GCP Secret Manager
- Extract chain names from rebalancer config and pass to helm values

The rebalancer now:
1. Fetches RPC URLs from GCP secrets named <env>-rpc-endpoints-<chain>
2. Injects them as RPC_URL_<CHAIN> environment variables (e.g., RPC_URL_ETHEREUM)
3. Applies these overrides to chain metadata before creating MultiProvider

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@paulbalaji paulbalaji force-pushed the pbio/179e-infra-support-pr branch from 0150453 to bbaff24 Compare January 22, 2026 22:38
@hyper-gonk
Copy link
Contributor

hyper-gonk bot commented Jan 22, 2026

🐳 Monorepo Docker Image Built Successfully

Image Tags:

gcr.io/abacus-labs-dev/hyperlane-monorepo:pr-7746
gcr.io/abacus-labs-dev/hyperlane-monorepo:3d17d9c-20260122-224250

@hyper-gonk
Copy link
Contributor

hyper-gonk bot commented Jan 22, 2026

♻️ Rebalancer Docker Image Built Successfully

Image Tags:

gcr.io/abacus-labs-dev/hyperlane-rebalancer:pr-7746
gcr.io/abacus-labs-dev/hyperlane-rebalancer:3d17d9c-20260122-224332

@paulbalaji paulbalaji added this pull request to the merge queue Jan 22, 2026
Merged via the queue into main with commit 2869534 Jan 22, 2026
103 checks passed
@paulbalaji paulbalaji deleted the pbio/179e-infra-support-pr branch January 22, 2026 23:01
@github-project-automation github-project-automation bot moved this from In Review to Done in Hyperlane Tasks Jan 22, 2026
@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.02%. Comparing base (5fad3ed) to head (3d17d9c).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7746   +/-   ##
=======================================
  Coverage   77.02%   77.02%           
=======================================
  Files         117      117           
  Lines        2651     2651           
  Branches      244      244           
=======================================
  Hits         2042     2042           
  Misses        593      593           
  Partials       16       16           
Components Coverage Δ
core 87.80% <ø> (ø)
hooks 71.86% <ø> (ø)
isms 81.10% <ø> (ø)
token 86.67% <ø> (ø)
middlewares 84.98% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants