fix(backend): tolerate Soroban RPC ingestion lag in playground#36
Merged
miguelnietoa merged 2 commits intoJun 29, 2026
Merged
Conversation
The playground funds the demo account via Friendbot (confirmed through Horizon), then the SETUP mess step immediately reads it back over the Soroban RPC. That RPC is a separate node whose ledger ingestion lags a few seconds behind, so getAccount throws "Account not found" and the step fails with a 502 the UI surfaces as "rejected by the network". Slow confirmations hit the same lag and exceeded the 60s function limit while the poll budget is 90s, producing 504s. - wrap getAccount in buildSignSubmit with a bounded retry that treats "account not found" as transient and surfaces any other error at once - raise the mess route maxDuration to 120s so it covers the retry plus the full 90s confirmation poll - add unit tests reproducing the not-found-then-visible race
The app tsconfig set no `types`, so tsc auto-included @types/bun and its fetch overload, whose RequestInit lacks the web `cache` option used in the Horizon reads (account-live.ts, horizon-adapter.ts) - breaking `bun type-check`. The tests config (types: ["bun"]) hit the same wall on those files via transitive imports. - scope the app tsconfig to `types: ["node"]` so app code is checked against Node/DOM fetch (which has `cache`), not Bun's - give the tests config the dom lib so transitively imported app fetch calls still resolve under bun:test
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Problem
The playground died right after "Demo account funded" with "The transaction was rejected by the network" (502), and sometimes with a gateway timeout (504).
Root cause is Soroban RPC ingestion lag, not the transactions:
SETUPmess step immediately reads it back withserver.getAccount()over the Soroban RPC — a separate node whose ledger ingestion lags a few seconds. It throwsAccount not found→ 502 → UI shows "rejected by the network".maxDuration = 60, while the confirmation poll budget is 90s (POLL_MAX_ATTEMPTS × POLL_INTERVAL_MS) → 504FUNCTION_INVOCATION_TIMEOUT.The rest of the codebase already reads account state from Horizon precisely because "Horizon returns all of that ... with zero indexing lag for newly created accounts" (
account-live.ts); the playground was the one path still hitting the lag-prone RPCgetAccount.Changes
buildSignSubmitretriesgetAccountwith a bounded backoff (ACCOUNT_VISIBILITY_*), treatingaccount not foundas transient and surfacing any other error immediatelymessroutemaxDurationto 120s to cover the retry plus the full 90s confirmation pollbun type-checkwas failing on pre-existingcache: "no-store"fetch calls because the app tsconfig auto-included@types/bun. Scope the app config totypes: ["node"]and give the tests config thedomlib.Verification
bun type-check✅ ·bun lint✅ ·bun test tests/unit✅ (230 pass)Account not found; with the fix all mess steps return 200 and the playground reaches the demolish-ready state with real on-chain txs