fix: harden ip table failover and config verification under extreme networks#12529
Open
originalix wants to merge 20 commits into
Open
fix: harden ip table failover and config verification under extreme networks#12529originalix wants to merge 20 commits into
originalix wants to merge 20 commits into
Conversation
originalix
requested review from
ezailWang,
huhuanming,
revan-zhang and
sidmorizon
as code owners
July 16, 2026 12:14
originalix
commented
Jul 16, 2026
originalix
commented
Jul 16, 2026
originalix
commented
Jul 16, 2026
sidmorizon
reviewed
Jul 16, 2026
originalix
commented
Jul 17, 2026
originalix
commented
Jul 17, 2026
originalix
commented
Jul 17, 2026
originalix
commented
Jul 17, 2026
originalix
commented
Jul 17, 2026
originalix
commented
Jul 17, 2026
originalix
commented
Jul 17, 2026
originalix
commented
Jul 17, 2026
originalix
commented
Jul 17, 2026
originalix
commented
Jul 17, 2026
originalix
commented
Jul 17, 2026
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.
Background
Production incident on 2026-07-16 (Slack #C09JEQE8P2L): on mainland-China Wi-Fi without a proxy, tapping a ticker left every request loading forever. Log analysis confirmed two independent root causes:
@ethersprojectsegment (seg:nm.@ethersprojectis owned bymainin the split-bundle manifest); a catch-all swallowed the error and reported it as "signature verification failed", misleading the investigation toward the CDN. (The segment-ownership fix lands in a separate branch; this PR covers the observability and resilience side.)Changes (by commit)
decideEndpoint: reachability beats latency (real-traffic failures override the 30% threshold), symmetric 30% hysteresis against flapping; includes an incident-scenario regression testcurrentSelection === undefineddeadlock that could block speed tests forever; persists lastBestIp on every speed testno_configgap (60 occurrences in the incident log); HTTP error responses don't count; failing requests are never replayed (wallet POST double-send risk); recovery on first domain successverifier_load_failed/signer_mismatch/malformed_signature/missing_signature) — this log line alone would have pinpointed the incident on day one; canonicalization now uses an allowlist of signed fields (extra server-side metadata no longer breaks verification — validated against the real signer); shape guard on the CDN responseconfig.onekeycn.comis fetched through the adapter-backed client instead of plain axios, giving the config-delivery path the same wall resistance as business trafficendpointSwitched/adapterFailover/configVerifyFailedLogToServer events (no PII), so regional failover and verify-failure rates are visible without asking users to upload logsdisableIpTableFailoverdev setting + Dev Settings UI entry — the new behaviors can be turned off in production without a rollbackTesting
incident regression: domain failing real traffic beats 30% threshold,verifier import failure -> verifier_load_failed (split-bundle incident)yarn agent:check --profile prlocal checks all passOut of scope (tracked separately)
@ethersproject+ the mirrored sentry issue) — separate task/PRRisk & verification suggestions
The largest risk surface is the adapter fail-open (shared by appApiClient / analytics / hardware configFetcher). Constraints: only transport-level errors count, threshold 3 + 5min TTL, exits on first success, kill switch available. Suggested QA: regress the core request paths both with the direct domain blackholed (hosts entry for wallet.onekeycn.com) and on a normal network to confirm no behavior change in the healthy case.