Skip to content

feat: add RPC failover support with per-request error recovery - #662

Open
MayurK-cmd wants to merge 3 commits into
solana-foundation:mainfrom
MayurK-cmd:rpc-failover-661
Open

feat: add RPC failover support with per-request error recovery#662
MayurK-cmd wants to merge 3 commits into
solana-foundation:mainfrom
MayurK-cmd:rpc-failover-661

Conversation

@MayurK-cmd

Copy link
Copy Markdown

Closes #661

Summary

Implement multi-endpoint RPC failover to eliminate single point of failure.
Adds FailoverRpcClient for endpoint management, FailoverRpcCallWrapper for
per-request failover on 5xx/transport errors, CLI support for RPC_URLS
config, and maintains backward compatibility with single RPC_URL.

Changes

  • FailoverRpcClient: manages multiple endpoints with round-robin rotation
  • FailoverRpcCallWrapper: wraps RPC calls with error detection and retry logic
  • CLI support for RPC_URLS comma-separated endpoints
  • Updated main.rs to use failover factory function

Testing

  • All 973 existing tests pass with no regressions
  • 11 new unit tests for failover and error detection
  • Tested error detection for 5xx, 429, connection, and timeout errors

@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds configuration and library scaffolding for multiple Solana RPC endpoints, including endpoint selection, rotation state, retry classification, and CLI integration.

  • Adds comma-separated RPC_URLS support while preserving RPC_URL and its localhost default.
  • Introduces failover client and per-call retry wrapper types.
  • Updates CLI startup and command paths to construct and share the selected RPC client.
  • Fixes the endpoint fixture types and duplicate endpoint-vector consumption identified in prior reviews.

Confidence Score: 5/5

No accepted new issue from the changes since the previous review blocks merging.

The recent changes correct the CLI fixture type mismatch and endpoint-vector ownership problem without introducing a distinct new failure. All previous threads were manually resolved without explanation, so they are not treated as outstanding.

Important Files Changed

Filename Overview
crates/cli/src/args.rs Adds multi-endpoint argument resolution while preserving the legacy localhost default and corrects all new test fixtures.
crates/cli/src/main.rs Constructs the configured RPC client once and shares its selected client across mutually exclusive command paths.
crates/lib/src/rpc.rs Adds a factory and enum for single-endpoint and multi-endpoint RPC client configurations.
crates/lib/src/rpc_failover.rs Adds shared endpoint storage and atomic round-robin rotation state.
crates/lib/src/rpc_failover_wrapper.rs Adds per-call retry orchestration and retryable error classification without logging raw external errors.

Reviews (3): Last reviewed commit: "feat: add RPC failover support with per-..." | Re-trigger Greptile

Comment thread crates/cli/src/main.rs Outdated
Comment thread crates/lib/src/rpc.rs Outdated
Comment thread crates/cli/src/args.rs Outdated
Comment thread crates/lib/src/rpc_failover_wrapper.rs
Comment thread crates/cli/src/args.rs
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.

Support a fallback RPC endpoint (single RPC_URL is a paymaster SPOF)

1 participant