Skip to content

feat: add RPC fallback resilience for unchained outages#12017

Draft
0xApotheosis wants to merge 1 commit intodevelopfrom
feat/rpc-fallback-resilience
Draft

feat: add RPC fallback resilience for unchained outages#12017
0xApotheosis wants to merge 1 commit intodevelopfrom
feat/rpc-fallback-resilience

Conversation

@0xApotheosis
Copy link
Member

Description

When unchained's MoralisService returns 503 errors, all first-class EVM chains break because their VITE_*_NODE_URL env vars point to unchained's /api/v1/jsonrpc proxy. This PR adds public fallback RPCs at both the viem transport layer and the chain adapter layer so the app degrades gracefully instead of failing completely.

Three layers of change:

  1. viemClient.ts — Added FALLBACK_RPC_URLS constants and createFallbackTransport() helper. All 32 EVM chain viem clients now have public fallback RPCs (LlamaRPC, official chain RPCs). Previously only ETH, BSC, and Base had any.

  2. EvmBaseAdapter.ts — Added fallback paths for getAccount(), broadcastTransaction(), and getGasFeeData() that route through the viem client (which now has public fallback transports) when unchained fails. Token balances and tx history gracefully degrade to empty during outage.

  3. CSP connect-src — Created headers/csps/chains/fallbackRpcUrls.ts as a shared constants file. All 32 chain CSP configs now import and spread fallback RPC origins from this file.

Issue (if applicable)

Risk

Medium — Adds fallback network paths but does not modify any happy-path behavior. When unchained is healthy, no change in behavior. Fallbacks only activate on unchained failure.

Affects all first-class EVM chain adapters (ETH, AVAX, MATIC, ARB, OP, BSC, GNOSIS, BASE) and all second-class EVM chains. No new on-chain transactions or contract interactions introduced — fallback uses the same RPC calls that unchained proxies.

Testing

Engineering

  1. To simulate an unchained outage, temporarily set a first-class chain's node URL to a failing endpoint in .env:
    VITE_ETHEREUM_NODE_URL=https://httpstat.us/503
    
  2. yarn dev and connect a wallet with ETH
  3. Verify on this branch: Native ETH balance loads, console shows Unchained getAccount failed for eip155:1, falling back to direct RPC
  4. Verify on develop: Balance fails to load, no fallback
  5. Optionally test broadcast and fee estimation with the same broken URL
  6. Restore the env var and confirm normal behavior is unchanged

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

This is infrastructure resilience — no user-facing UI changes. When unchained is healthy, behavior is identical. When unchained is down, users will see native balances (but not token balances) and can still send transactions, vs a completely broken experience today.

Screenshots (if applicable)

N/A — no UI changes

🤖 Generated with Claude Code

When unchained's RPC proxy returns 503s, first-class EVM chains lose all
functionality. This adds public fallback RPCs so the app degrades
gracefully instead of breaking completely.

- Add FALLBACK_RPC_URLS constants and public fallback endpoints for all
  32 EVM chains in viemClient.ts (viem transport layer)
- Add EvmBaseAdapter fallback for getAccount, broadcastTransaction, and
  getGasFeeData that routes through the viem client when unchained fails
- Add CSP connect-src entries for all fallback RPC origins via a shared
  fallbackRpcUrls.ts constants file

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/rpc-fallback-resilience

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.

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