Gate balance effects and FIO refresh on engine readiness (wallet cache v2)#6080
Open
j0ntz wants to merge 1 commit into
Open
Gate balance effects and FIO refresh on engine readiness (wallet cache v2)#6080j0ntz wants to merge 1 commit into
j0ntz wants to merge 1 commit into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Author
j0ntz
force-pushed
the
jon/wallet-cache-v2
branch
from
July 18, 2026 01:10
00faa89 to
7f1149f
Compare
Contributor
Author
With the core's wallet cache (wallet cache v2 phase 1), wallet objects
exist before their engines load, and waitForAllWallets resolves in that
window. Three login-path surfaces consumed engine state immediately:
- The action queue's address-balance effect read balanceMap right after
awaiting the wallet, which could evaluate a balance effect against
cached, possibly stale balances. It now reports not-yet-effective
until the engine has fully synced, matching the conservatism the loan
flow already applies.
- The FIO address refresh called otherMethods on pre-engine wallets,
which is {} in that window. Services now waits for each FIO wallet's
engine-backed otherMethods (bounded by a generous safety-valve
timeout) before refreshing.
- FioService's periodic expired-domain check called
otherMethods.getFioAddresses the same way (caught live on the sim).
It now skips pre-engine wallets and lets the next 30s cycle retry,
which also avoids wedging its one-shot expiredChecking latch.
j0ntz
force-pushed
the
jon/wallet-cache-v2
branch
from
July 18, 2026 01:31
7f1149f to
0a089ca
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0a089ca. Configure here.
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.





CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
EdgeApp/edge-core-js#733
Requirements
If you have made any visual changes to the GUI. Make sure you have:
Description
GUI-side patches for wallet cache v2 phase 1 (TDD section 7: immutable snapshot). With EdgeApp/edge-core-js#733, wallet objects exist before their engines load and
waitForAllWalletsresolves in that window, so the login-path surfaces that consumed engine state at resolve-time are gated on engine readiness:checkActionEffect.ts(address-balance): reported the effect againstbalanceMapimmediately after awaiting the wallet, which could now evaluate cached, possibly stale balances. It reports not-yet-effective until the engine has fully synced (same conservatism as the loan flow'swaitForLoanAccountSyncand the existing< 1treatment in spend paths, TDD 7.4), letting the action queue's normal 15s poll re-check.Services.tsx: the post-waitForAllWalletsFIO refreshes (refreshConnectedWallets,refreshAllFioAddresses) callwallet.otherMethods.*, which the core guarantees is{}pre-engine. A newwaitForWalletOtherMethodsutil watchesotherMethodsuntil the engine's methods land (10-minute safety-valve timeout, roughly matching how longwaitForAllWalletscould already take on large accounts before the cache existed).FioService.ts: the periodic expired-domain check callsotherMethods.getFioAddressesthe same way. This one was NOT in the TDD's section-7 audit; it was caught live on the simulator (red dev alertwallet.otherMethods.getFioAddresses is not a functionseconds after a warm cached login). Being a 30s periodic task, it skips pre-engine wallets and lets the next cycle retry, which also avoids wedging its one-shotexpiredCheckinglatch when no wallet is ready yet.Remaining
otherMethodscall sites (FIO scenes, staking, WalletConnect) are user-navigation surfaces audited in the TDD as safe (null-probes, or flows that imply an engine exists) and are unchanged.Tested on the iOS simulator against the linked core build (edge-funds, 194 wallets): cold login wrote all 194
walletCache.jsonfiles; warm relaunch rendered the full wallet list with names and balances from the cache while engines were still loading; no FIO alert through 140s of runtime; drilling into a wallet shows live engine-backed data on the same wallet object. Screenshots attached below.Asana: https://app.asana.com/1/9976422036640/project/1213843652804305/task/1216673467164267
Note
Medium Risk
Touches login-time FIO refresh and action-queue balance gating on engine/sync state; mistakes could delay automations or skip FIO updates, but changes are conservative (wait/retry, no user-auth changes).
Overview
Adapts the GUI for wallet cache v2, where wallet objects appear before their engines finish loading and
waitForAllWalletscan resolve in that window.Action queue:
address-balanceeffects no longer compare balances immediately afterwaitForCurrencyWallet. They stay not effective untilsyncStatus.totalRatioreachesDONE_THRESHOLD, so cached balances are not used; the existing 15s poll retries.Login FIO path: After
waitForAllWallets,Serviceswaits per FIO wallet via newwaitForWalletOtherMethods(watchesotherMethods, 10‑minute timeout, per-wallet errors logged) and bails if the account logged out before runningrefreshConnectedWallets/refreshAllFioAddresses.FioService: The periodic expired-domain check only runs against wallets where
getFioAddressesexists, uses try/finally soexpiredCheckingcannot stick, and retries on later cycles. ESLint no longer exemptsFioService.tsfrom the services lint list.Reviewed by Cursor Bugbot for commit 0a089ca. Bugbot is set up for automated code reviews on this repo. Configure here.