feat: add backup RPC fallback support for MLS validation service#3415
Open
xmtp-coder-agent wants to merge 7 commits intoxmtp:mainfrom
Open
feat: add backup RPC fallback support for MLS validation service#3415xmtp-coder-agent wants to merge 7 commits intoxmtp:mainfrom
xmtp-coder-agent wants to merge 7 commits intoxmtp:mainfrom
Conversation
Support multiple RPC endpoints per chain with automatic fallback on retryable errors. Adds FallbackSmartContractWalletVerifier that tries RPCs sequentially, backward-compatible JSON parsing (single string or array), and comma-separated env var support for CHAIN_RPC_X overrides. Resolves xmtp#3355 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
std::io::Error doesn't implement RetryableError, so it can't be boxed into VerifierError::Other. Use the Io variant which accepts io::Error directly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
neekolas
reviewed
Apr 8, 2026
…er::new Return an error early if an empty Vec is passed, rather than creating a verifier that would panic at runtime. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
neekolas
reviewed
Apr 8, 2026
Replace VerifierError::Io with a new VerifierError::Configuration variant for config validation errors (empty URL lists). Io errors should represent actual I/O failures, not invalid configuration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…_verifier - ValidationResponse needs Debug for unwrap_err() in tests - Replace unwrap() with remove(0) to satisfy clippy::unwrap-used Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3415 +/- ##
==========================================
- Coverage 83.21% 83.15% -0.07%
==========================================
Files 378 378
Lines 51940 52098 +158
==========================================
+ Hits 43224 43323 +99
- Misses 8716 8775 +59 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
neekolas
reviewed
Apr 9, 2026
| use super::*; | ||
|
|
||
| #[test] | ||
| fn test_parse_chain_urls_array_format() { |
Contributor
There was a problem hiding this comment.
Let's convert this to a table-based test. Should be easier to read
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.
Resolves #3355
Summary
FallbackSmartContractWalletVerifier— new verifier that wraps multipleRpcSmartContractWalletVerifierinstances per chain and tries them sequentially, falling back on retryable errors (IO, Provider)"eip155:1": "url") and new array format ("eip155:1": ["url1", "url2"]) viaserde(untagged)enumCHAIN_RPC_X=url1,url2,url3creates a fallback chain; single URLs continue to work as beforechain_urls_default.jsonto use array formatChanges
crates/xmtp_id/src/scw_verifier/chain_rpc_verifier.rsFallbackSmartContractWalletVerifier+ unit testscrates/xmtp_id/src/scw_verifier/mod.rsUrlOrUrlsdeserializer,make_verifier()helper, updatednew()toHashMap<String, Vec<Url>>,parse_chain_urls(), comma-separated env var parsing inupgrade(), unit testscrates/xmtp_id/src/scw_verifier/chain_urls_default.jsonFallback Behavior
RpcSmartContractWalletVerifierdirectly (no overhead)Test Plan
make_verifierhandles single, multiple, and empty URL listsMultiSmartContractSignatureVerifier::newwith multi-URL mapNote
Add backup RPC fallback support for MLS validation service
FallbackSmartContractWalletVerifierin chain_rpc_verifier.rs that holds multipleRpcSmartContractWalletVerifierinstances and tries each in order, skipping to the next on retryable errors and short-circuiting on non-retryable ones.MultiSmartContractSignatureVerifierto accept multiple RPC URLs per chain (viaVec<Url>instead of a singleUrl), using a newmake_verifierhelper to pick single or fallback verifier based on URL count.CHAIN_RPC_{eip_id}env var parsing to support comma-separated URLs, enabling fallback behavior at runtime without code changes.UrlOrUrlsenum so both formats remain valid in config files.MultiSmartContractSignatureVerifier::newnow takesHashMap<String, Vec<Url>>; callers constructing it directly must update their argument type.Macroscope summarized a9c0298.