Retry the Squid token list when it fails to load at boot - #1391
Merged
Merged
Conversation
A failed Squid fetch installed the static-only fallback and set isLoaded, which turned every later initializeEvmTokens() call into a no-op. Squid-only tokens such as PAXG then stayed unlisted and unquotable until the process restarted, and the fetch had no timeout, so a hung request stalled boot. Track whether the Squid list itself loaded, guard on that instead, resolve to whether it did, and bound the fetch at 10 s. The static fallback on failure is unchanged.
Boot awaited a single initializeEvmTokens() call, so one failed Squid request left the API on static tokens until the next restart. Wait for the first attempt only, then retry every 60 s until the list loads.
✅ Deploy Preview for vrtx-dashboard canceled.
|
✅ Deploy Preview for vortex-sandbox ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for vortexfi ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
6 of 9 tasks
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
PAXG is not in the static EVM token config; it only exists once the API has loaded Squid's token list at boot. When that single request failed,
initializeEvmTokens()installed the static-only fallback and marked itself loaded, so every later call was a no-op. PAXG then stayed unlisted inGET /v1/supported-cryptocurrenciesand unquotable ("Invalid token details for EVM bridge") until the next restart, which disables the gold app's buy and sell buttons. The fetch also had no timeout, so a hung Squid request stalled API boot.initializeEvmTokens()now resolves to whether the Squid list loaded, and keeps fetching on later calls until it does. The static fallback still applies in the meantime. The fetch is bounded at 10 s.apps/api/src/config/evmTokens.ts).05-integrations/squid-router.mdinvariant 18 and a threat-table row.Found while reviewing the gold app (#1388 follow-ups).
Test plan
dynamicEvmTokens.test.ts: failed fetch and 502 resolve false with static tokens kept; a later success loads PAXG (18 decimals) and notifies listeners; no fetch after success; a hung fetch is aborted by the timeout. All five fail on staging.evmTokens.test.ts: no retry after an initial success; retries until success, then stops.bun testinpackages/shared,apps/apiconfig tests,bun typecheck,bun verify.The frontend and dashboard also get the 10 s timeout (they fall back to static tokens instead of hanging) but still do not retry; out of scope here.
🤖 Generated with Claude Code