Skip to content

Retry the Squid token list when it fails to load at boot - #1391

Merged
ebma merged 3 commits into
stagingfrom
fix/api-squid-token-list-retry
Oct 1, 2026
Merged

ebma merged 3 commits into
stagingfrom
fix/api-squid-token-list-retry

Conversation

@ebma

@ebma ebma commented Sep 29, 2026

Copy link
Copy Markdown
Member

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 in GET /v1/supported-cryptocurrencies and 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.
  • At boot the API waits for the first attempt only, then retries every 60 s in the background until the list loads (apps/api/src/config/evmTokens.ts).
  • Security spec: 05-integrations/squid-router.md invariant 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 test in packages/shared, apps/api config 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

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.
@netlify

netlify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vrtx-dashboard canceled.

Name Link
🔨 Latest commit 9c1de90
🔍 Latest deploy log https://app.netlify.com/projects/vrtx-dashboard/deploys/6abbc47328c53700085330ea

@netlify

netlify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vortex-sandbox ready!

Name Link
🔨 Latest commit 9c1de90
🔍 Latest deploy log https://app.netlify.com/projects/vortex-sandbox/deploys/6abbc473eb2c41000851d89b
😎 Deploy Preview https://deploy-preview-1391--vortex-sandbox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vortexfi ready!

Name Link
🔨 Latest commit 9c1de90
🔍 Latest deploy log https://app.netlify.com/projects/vortexfi/deploys/6abbc4738ec2c80008a9a31d
😎 Deploy Preview https://deploy-preview-1391--vortexfi.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@ebma ebma mentioned this pull request Sep 29, 2026
6 of 9 tasks
@ebma
ebma merged commit 39e4226 into staging Oct 1, 2026
6 checks passed
@ebma
ebma deleted the fix/api-squid-token-list-retry branch October 1, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant