feat: Implement dynamic weighted RPC load balancing for enhanced resilience #6128
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.
Summary
This PR introduces dynamic weight adjustment for RPC providers, improving failover and resilience by adapting to real-time provider health. The system now dynamically adjusts provider selection weights based on health metrics including latency, error rates, and consecutive failures.
This enhancement builds upon the static weighted RPC steering implemented in #6126, making the RPC management more adaptive and robust.
Changes
Core Implementation
chain/ethereum/src/health.rs
): New module to track RPC provider health metricsIntegration Points
Dynamic Weight Adjustment (
chain/ethereum/src/network.rs
): Integrated health metrics into provider selection logicHealth Checker Initialization (
node/src/network_setup.rs
): Setup and management of health checkers for Ethereum RPC adaptersDependencies
tokio
dependency tochain/ethereum
andnode
crates for asynchronous health checksTesting
chain/ethereum/src/network.rs
to accommodate dynamic weighting behaviorRelated Issues
Builds on #6126 - Weighted RPC load balancing
Test Plan
🤖 Generated with Claude Code