Skip to content

feat: self-relay for EVM messages#247

Draft
paulbalaji wants to merge 14 commits intomainfrom
pb/selfrelay
Draft

feat: self-relay for EVM messages#247
paulbalaji wants to merge 14 commits intomainfrom
pb/selfrelay

Conversation

@paulbalaji
Copy link
Collaborator

Summary

  • Adds self-relay functionality for EVM-to-EVM messages using the new @hyperlane-xyz/relayer package
  • Integrates wallet connection via RainbowKit/wagmi
  • Shows "Self Relay" button on pending and failing messages

Dependencies

Known Limitations

  • Merkle root multisig ISM not yet supported in TS relayer (only message ID multisig)
  • S3 validator checkpoint fetching may have CORS issues on localhost (should work in production)

Test plan

  • Deploy to Vercel preview
  • Test with pending EVM-to-EVM message
  • Verify wallet connection flow
  • Verify relay transaction submission

🤖 Generated with Claude Code

- Add SelfRelayButton component for pending/failing messages
- Integrate @hyperlane-xyz/relayer beta package
- Add wallet connection via RainbowKit/wagmi
- Add EvmWalletContext provider with dynamic chain configs
- Show self-relay option for EVM-to-EVM messages

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Dec 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
hyperlane-explorer Ready Ready Preview, Comment Dec 25, 2025 2:49pm

@socket-security
Copy link

socket-security bot commented Dec 25, 2025

Explicitly add @wagmi/connectors@5.5.0 and @wagmi/core@2.16.0 to fix
ERR_MODULE_NOT_FOUND errors during Vercel deployment.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
RainbowKit dependencies (react-remove-scroll etc.) cause EMFILE errors
on Vercel when bundled during SSR. Dynamic import with ssr:false ensures
these are only loaded client-side.

Also fixed window.ethereum type conflict with wagmi by using type cast
instead of global declaration.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
paulbalaji and others added 3 commits December 25, 2025 14:09
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add outputFileTracingExcludes to prevent Next.js from tracing the
thousands of typechain factory files in @hyperlane-xyz/core, which
cause EMFILE errors on Vercel serverless functions.

Also import SelfRelayButton directly from file instead of barrel
to improve tree-shaking.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Keep only outputFileTracingExcludes to exclude typechain factories
from the serverless bundle without conflicting with transpilePackages.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The typechain files can't be excluded because they're required imports.
The EMFILE error is a Vercel serverless limitation with the beta
@hyperlane-xyz/core package size.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
paulbalaji and others added 2 commits December 25, 2025 14:36
Remove transpilePackages and experimental.optimizePackageImports
to match warp-ui-template config which doesn't have these.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Don't render Component during SSR to avoid bundling heavy dependencies
like @hyperlane-xyz/core for the server. OG tags are handled via API
routes. This matches the warp-ui-template approach.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Edge runtime doesn't allow dynamic code evaluation which is used by
@hyperlane-xyz/utils. Switch to nodejs runtime for compatibility.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@paulbalaji
Copy link
Collaborator Author

Self-Relay Implementation Status

✅ What Works

  • Self-relay functionality works locally - users can connect wallet and relay pending/failing messages
  • Button UI integrated into TransactionCard for Pending and Failing message states
  • Proper wallet connection flow (connects wallet first if needed, then triggers relay)
  • Error handling for common relay failures (validator signatures not ready, etc.)

❌ Vercel Deployment Issues

The deployment fails with EMFILE: too many open files errors. After extensive debugging, here's what we found:

Root Cause

The beta @hyperlane-xyz/core@10.1.4-beta package contains thousands of typechain factory files that exceed Vercel's serverless function file descriptor limits (~1024).

Attempted Fixes (None Worked)

Attempt Result
Dynamic import SelfRelayButton with ssr: false Still traces dependencies
Dynamic import EvmWalletContext with ssr: false Moved error to @hyperlane-xyz/core
serverExternalPackages in next.config.js Conflicts with transpilePackages
outputFileTracingExcludes for typechain dirs Breaks module resolution (core/index.js imports typechain/index.js)
Remove transpilePackages and optimizePackageImports Still EMFILE errors
Return empty <div> during SSR (like warp-ui-template) Still EMFILE errors
Switch OG API route to nodejs runtime Timeout errors + still EMFILE

Why warp-ui-template Works

The warp-ui-template does not use @hyperlane-xyz/core or @hyperlane-xyz/relayer at all. The explorer imports @hyperlane-xyz/core in 5+ files throughout the codebase (debugger, collateral, ICA, PI queries, message utils), so the large package gets bundled regardless of the self-relay feature.

📋 Recommended Courses of Action

  1. Wait for stable release (Recommended)

    • Keep this PR as draft
    • The stable @hyperlane-xyz/relayer release will likely have better optimization
    • Stable @hyperlane-xyz/core (10.0.5) worked fine on Vercel before
  2. Test locally only

    • Merge with understanding that self-relay only works in local dev
    • Add a note/disable the feature in production builds
  3. Deploy separately

    • Keep explorer on stable packages
    • Deploy self-relay as a standalone service/app
  4. Alternative deployment

    • Try deployment platforms with higher file limits
    • Or use Vercel's higher-tier plans that may have increased limits

🔧 Technical Notes

  • The @hyperlane-xyz/relayer package depends on @hyperlane-xyz/core for HyperlaneCore.fromAddressesMap()
  • The relayer's relayMessage() works but requires MESSAGE_ID_MULTISIG ISM (MERKLE_ROOT_MULTISIG not supported in TS relayer)
  • S3 validator storage fetches may fail due to CORS in browser environments

This comment summarizes findings from debugging session on 2024-12-25

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.

1 participant