Conversation
Closed
There was a problem hiding this comment.
Pull request overview
This PR implements a multi-RPC provider solution to handle RPC endpoint failures through automatic failover. The implementation replaces single RPC URLs with indexed environment variables (SOURCE_RPC_URL_1, SOURCE_RPC_URL_2, etc.) and introduces a new MultiRpcWeb3Provider class that manages sequential failover across multiple RPC endpoints with exponential backoff.
Changes:
- Introduced
MultiRpcWeb3Providerclass with automatic failover, rate limit handling, and chain ID validation - Updated configuration to parse indexed RPC URLs (SOURCE_RPC_URL_1, _2, _3, etc.) using
parse_indexed_rpc_urls - Refactored
PollingEventListener,ProofManager, andROFLRelayerto useMultiRpcWeb3Providerinstead of direct Web3 instances - Added comprehensive test coverage for failover scenarios, rate limiting, and integration with relayer components
- Updated documentation, compose files, and error messages to reflect the new multi-RPC configuration
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
paymaster_relayer/utils/multi_rpc_provider.py |
New provider class implementing sequential failover with exponential backoff, rate limit handling, and chain ID validation |
paymaster_relayer/config.py |
Added parse_indexed_rpc_urls function to parse numbered environment variables and updated SourceChainConfig to use list of URLs |
paymaster_relayer/utils/polling_event_listener.py |
Refactored to accept MultiRpcWeb3Provider and execute operations within failover context for consistency |
paymaster_relayer/proof_manager.py |
Updated to use source_provider.execute_with_failover for all Web3 operations instead of direct w3_source calls |
paymaster_relayer/relayer.py |
Changed initialization to create MultiRpcWeb3Provider for source chain and pass provider to listeners |
paymaster_relayer/__main__.py |
Updated error messages to reference indexed environment variables |
paymaster_relayer/event_processor.py |
Minor formatting improvements (line wrapping for readability) |
paymaster_relayer/utils/contract_utility.py |
Minor formatting change (line wrapping) |
tests/test_multi_rpc_provider.py |
Comprehensive unit tests for failover scenarios, rate limiting, backoff, and error handling |
tests/test_multi_rpc_integration.py |
Integration tests for relayer and event listener using multi-RPC provider |
tests/test_config.py |
Tests for indexed URL parsing including edge cases (gaps, order, legacy URLs) |
tests/test_retry_logic.py |
Updated mocks to use MultiRpcWeb3Provider with proper execute_with_failover simulation |
tests/test_proof_generation.py |
Updated to create MultiRpcWeb3Provider and use source_provider instead of w3_source |
tests/test_relayer.py |
Updated to pass MultiRpcWeb3Provider to PollingEventListener |
compose.yaml |
Changed SOURCE_RPC_URL to SOURCE_RPC_URL_1 for all relayer services |
compose.local.yaml |
Changed SOURCE_RPC_URL to SOURCE_RPC_URL_1 for all relayer services |
README.md |
Updated documentation to describe indexed RPC URL environment variables |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
matevz
reviewed
Feb 9, 2026
paymaster-relayer/paymaster_relayer/utils/multi_rpc_provider.py
Outdated
Show resolved
Hide resolved
paymaster-relayer/paymaster_relayer/utils/multi_rpc_provider.py
Outdated
Show resolved
Hide resolved
matevz
approved these changes
Feb 9, 2026
16c41dd to
ca16cfc
Compare
Sequential failover across multiple RPC endpoints with exponential backoff. Replaces single SOURCE_RPC_URL with comma-delimited SOURCE_RPC_URLS. Retries indefinitely on network failures with graceful shutdown support.
ca16cfc to
601bd6e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements a mulit rpc solution