Skip to content

feat: separate typescript relayer package#7671

Merged
paulbalaji merged 2 commits intomainfrom
pbio/relayer-package-extraction
Jan 29, 2026
Merged

feat: separate typescript relayer package#7671
paulbalaji merged 2 commits intomainfrom
pbio/relayer-package-extraction

Conversation

@paulbalaji
Copy link
Copy Markdown
Collaborator

@paulbalaji paulbalaji commented Dec 24, 2025

Summary

Extracts HyperlaneRelayer and ISM metadata builders from SDK into a standalone @hyperlane-xyz/relayer package with browser/Node.js separation.

Changes

  • New @hyperlane-xyz/relayer package with dual exports:
    • Main export (@hyperlane-xyz/relayer): Browser-safe core relayer and metadata builders
    • /fs subpath (@hyperlane-xyz/relayer/fs): Node.js daemon with file-based config, cache persistence, and metrics
  • Moved from SDK: HyperlaneRelayer, all ISM metadata builders (BaseMetadataBuilder, MultisigMetadataBuilder, etc.)
  • Prometheus metrics wired to relayer events via unified observer pattern - tracks message success/failure, retries, backlog size, relay duration
  • Uses shared @hyperlane-xyz/metrics package for metrics server (includes error handling)
  • ESLint rule enforces no Node.js imports in browser-safe code
  • Docker build with ncc bundling: 229MB vs 6.39GB monorepo image (28x smaller)
  • Updated CLI/infra imports to use new package

Package Exports

Export Description Browser-safe
@hyperlane-xyz/relayer Core relayer, metadata builders, config schema Yes
@hyperlane-xyz/relayer/fs RelayerService, loadConfig, metrics No

Breaking Changes

Imports moved from @hyperlane-xyz/sdk to @hyperlane-xyz/relayer:

  • HyperlaneRelayer, RelayerCacheSchema, messageMatchesWhitelist
  • All metadata builders: BaseMetadataBuilder, MultisigMetadataBuilder, AggregationMetadataBuilder, etc.
  • Types: MetadataBuilder, MetadataContext, StructuredMetadata

Note: offchainLookupRequestMessageHash remains in SDK for ccip-server compatibility (also re-exported from relayer).

Metrics

Metric Type Description
hyperlane_relayer_messages_total Counter Messages processed (origin, dest, status labels)
hyperlane_relayer_retries_total Counter Retry attempts
hyperlane_relayer_backlog_size Gauge Current message backlog
hyperlane_relayer_relay_duration_seconds Histogram Time to relay messages (relayer processing, not e2e)
hyperlane_relayer_messages_skipped_total Counter Messages filtered by whitelist
hyperlane_relayer_messages_already_delivered_total Counter Messages already delivered

Recent Changes (CR: yorke)

Addressed review feedback:

  • Unified event system: Replaced RelayerEventCallbacks with discriminated union RelayerEvent type and single RelayerObserver.onEvent() callback - events now include full DispatchedMessage object
  • Simplified RelayerConfig: Replaced class with loadConfig() function, uses zod schema directly
  • Static factory pattern: Added RelayerService.create() async factory (preferred over constructor + init)
  • Unified config: Single relayerConfig?: RelayerConfigInput instead of dual config objects
  • Zod env validation: Added EnvSchema for environment variable parsing in daemon
  • Removed unused mode: Eliminated mode: 'daemon' | 'manual' option
  • Fixed README: Added missing addresses definition in example
  • Restored comments: Re-added explanatory comments for parallelization strategy and whitelist logic
  • Code organization: Extracted cache.ts, events.ts, whitelist.ts modules for cleaner separation

Note: Relay duration metrics intentionally use process time (not onchain timestamps) - the scraper tracks e2e latency while these metrics measure relayer processing performance specifically.

Testing

  • pnpm build passes
  • pnpm test passes
  • Docker image builds successfully

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Dec 24, 2025

🦋 Changeset detected

Latest commit: 65784b4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 23 packages
Name Type
@hyperlane-xyz/relayer Minor
@hyperlane-xyz/cli Minor
@hyperlane-xyz/sdk Minor
@hyperlane-xyz/infra Minor
@hyperlane-xyz/ccip-server Minor
@hyperlane-xyz/helloworld Minor
@hyperlane-xyz/http-registry-server Minor
@hyperlane-xyz/keyfunder Patch
@hyperlane-xyz/metrics Patch
@hyperlane-xyz/rebalancer Patch
@hyperlane-xyz/warp-monitor Patch
@hyperlane-xyz/widgets Minor
@hyperlane-xyz/aleo-sdk Minor
@hyperlane-xyz/starknet-core Minor
@hyperlane-xyz/cosmos-sdk Minor
@hyperlane-xyz/cosmos-types Minor
@hyperlane-xyz/eslint-config Minor
@hyperlane-xyz/github-proxy Minor
@hyperlane-xyz/radix-sdk Minor
@hyperlane-xyz/tsconfig Minor
@hyperlane-xyz/utils Minor
@hyperlane-xyz/deploy-sdk Patch
@hyperlane-xyz/provider-sdk Patch

Not sure what this means? Click here to learn what changesets are.

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

@paulbalaji paulbalaji changed the title feat(relayer): extract HyperlaneRelayer into standalone @hyperlane-xyz/relayer package feat: separate typescript relayer package Dec 24, 2025
@paulbalaji
Copy link
Copy Markdown
Collaborator Author

@greptileai

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

50 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment thread .github/workflows/ts-relayer-docker.yml Outdated
@paulbalaji paulbalaji force-pushed the pbio/relayer-package-extraction branch from c241647 to ca18687 Compare January 23, 2026 16:27
@paulbalaji

This comment was marked as outdated.

@claude

This comment was marked as outdated.

@paulbalaji paulbalaji force-pushed the pbio/relayer-package-extraction branch 2 times, most recently from ff012fe to fbd13e7 Compare January 24, 2026 23:09
@paulbalaji paulbalaji changed the base branch from main to pbio/keyfunder-infra-migration January 24, 2026 23:09
@paulbalaji paulbalaji force-pushed the pbio/keyfunder-infra-migration branch from 626016d to 38c6939 Compare January 24, 2026 23:14
@paulbalaji paulbalaji force-pushed the pbio/relayer-package-extraction branch 2 times, most recently from 8c6117c to 8bd15d6 Compare January 24, 2026 23:25
@paulbalaji paulbalaji force-pushed the pbio/keyfunder-infra-migration branch 2 times, most recently from 7bc69d3 to 491ee77 Compare January 24, 2026 23:37
@paulbalaji paulbalaji force-pushed the pbio/relayer-package-extraction branch from 267ad95 to 65784b4 Compare January 24, 2026 23:37
@paulbalaji paulbalaji marked this pull request as ready for review January 27, 2026 15:23
@paulbalaji paulbalaji force-pushed the pbio/relayer-package-extraction branch from 65784b4 to befe85e Compare January 27, 2026 15:34
@paulbalaji paulbalaji force-pushed the pbio/keyfunder-infra-migration branch from 491ee77 to 45ed7c4 Compare January 27, 2026 15:34
@paulbalaji paulbalaji force-pushed the pbio/relayer-package-extraction branch 4 times, most recently from 2396979 to 8bd4902 Compare January 27, 2026 16:13
@paulbalaji paulbalaji force-pushed the pbio/keyfunder-infra-migration branch from f65320b to 992f37b Compare January 27, 2026 16:22
@paulbalaji paulbalaji force-pushed the pbio/relayer-package-extraction branch 2 times, most recently from 3033102 to 8cbe839 Compare January 27, 2026 16:29
Comment thread typescript/relayer/src/core/HyperlaneRelayer.ts Outdated
Comment thread typescript/relayer/src/core/HyperlaneRelayer.ts Outdated
Comment thread typescript/relayer/src/core/HyperlaneRelayer.ts
Comment thread typescript/relayer/src/core/HyperlaneRelayer.ts
Comment thread typescript/relayer/src/core/HyperlaneRelayer.ts
Comment thread typescript/relayer/src/fs/service.ts Outdated
Comment thread typescript/relayer/src/fs/service.ts Outdated
Comment thread typescript/relayer/src/metadata/aggregation.test.ts
Comment thread typescript/relayer/hardhat.config.cts
Comment thread typescript/relayer/README.md
@paulbalaji paulbalaji force-pushed the pbio/keyfunder-infra-migration branch from 542cd49 to 6d88f89 Compare January 28, 2026 16:05
@paulbalaji paulbalaji force-pushed the pbio/relayer-package-extraction branch from f4903d2 to 1b474f5 Compare January 28, 2026 16:21
@paulbalaji paulbalaji force-pushed the pbio/keyfunder-infra-migration branch from 6d88f89 to b29a170 Compare January 28, 2026 17:37
@paulbalaji paulbalaji force-pushed the pbio/relayer-package-extraction branch from 1b474f5 to 85523cb Compare January 28, 2026 17:39
Base automatically changed from pbio/keyfunder-infra-migration to main January 28, 2026 18:40
@paulbalaji paulbalaji force-pushed the pbio/relayer-package-extraction branch from 85523cb to 9f52957 Compare January 28, 2026 18:43
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 28, 2026

Warning

Rate limit exceeded

@paulbalaji has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 38 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pbio/relayer-package-extraction

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.

@hyper-gonk
Copy link
Copy Markdown
Contributor

hyper-gonk Bot commented Jan 28, 2026

⚙️ Node Service Docker Images Built Successfully

Service Tag
🔑 key-funder 9f52957-20260128-184349
🔍 offchain-lookup-server 9f52957-20260128-184349
♻️ rebalancer 9f52957-20260128-184349
🚀 ts-relayer 9f52957-20260128-184349
🕵️ warp-monitor 9f52957-20260128-184349
Full image paths
gcr.io/abacus-labs-dev/hyperlane-key-funder:9f52957-20260128-184349
gcr.io/abacus-labs-dev/hyperlane-offchain-lookup-server:9f52957-20260128-184349
gcr.io/abacus-labs-dev/hyperlane-rebalancer:9f52957-20260128-184349
gcr.io/abacus-labs-dev/hyperlane-ts-relayer:9f52957-20260128-184349
gcr.io/abacus-labs-dev/hyperlane-warp-monitor:9f52957-20260128-184349

@hyper-gonk
Copy link
Copy Markdown
Contributor

hyper-gonk Bot commented Jan 28, 2026

🐳 Monorepo Docker Image Built Successfully

Service Tag
📦 monorepo 9f52957-20260128-184345
Full image paths
gcr.io/abacus-labs-dev/hyperlane-monorepo:9f52957-20260128-184345

@paulbalaji paulbalaji enabled auto-merge January 29, 2026 10:13
@paulbalaji paulbalaji added this pull request to the merge queue Jan 29, 2026
Merged via the queue into main with commit 42b72c3 Jan 29, 2026
111 checks passed
@paulbalaji paulbalaji deleted the pbio/relayer-package-extraction branch January 29, 2026 10:23
@github-project-automation github-project-automation Bot moved this from In Review to Done in Hyperlane Tasks Jan 29, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.02%. Comparing base (b2b795b) to head (9f52957).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7671   +/-   ##
=======================================
  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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants