fix(anvil): fix multi-fork-url bootstrap race, stale docs, and RoundRobinService guard#14393
Merged
zerosnacks merged 1 commit intozerosnacks/multi-fork-urlfrom Apr 21, 2026
Conversation
…rvice guard - Fix bootstrap race condition: use primary URL only for discovery calls (get_chain_id, find_latest_fork_block, get_block), then rebuild with round-robin provider after the fork block is pinned. - Fix is_local detection in build_fallback() to use normalized/parsed URLs, consistent with build(). - Add panic guard for RoundRobinService::new() with empty transports. - Fix stale docs/comments that incorrectly referenced Alloy FallbackService and health-scored routing in CLI help, NodeConfig, ClientForkConfig, and build_fallback() docstring. Amp-Thread-ID: https://ampcode.com/threads/T-019db0c0-6038-7428-8483-365402ff31a3 Co-authored-by: Amp <amp@ampcode.com>
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.
Summary
Follow-up to #14280. Fixes medium and minor issues identified during review.
Changes
Bootstrap race condition fix
setup_fork_db_config()now uses the primary URL only for bootstrap/discovery calls (get_chain_id,find_latest_fork_block,get_block,get_gas_price). The round-robin provider is built after the fork block is pinned, preventing intermittent startup failures when endpoints are at slightly different chain tips.is_localdetection fixbuild_fallback()now uses normalized/parsed URLs forguess_local_url(), consistent with howbuild()computesis_local. Previously it ranguess_local_urlon raw input strings, which could misclassifylocalhost:8545, bare socket addresses, or IPC paths.RoundRobinService::new()guardAdded a panic guard for empty transport lists to prevent a
% 0panic incall().Stale docs/comments
Fixed all references to Alloy
FallbackServiceand health-scored routing:build_fallback()docstring → now describes round-robin + retry--fork-urlhelp text → removed "best-performing endpoint" claimNodeConfig.fork_urlscomment → "round-robin load balancing with retry-based failover"ClientForkConfig.fork_urlscomment → samesetup_fork_db_configdebug log → "round-robin" instead of "fallback"Testing