Repository navigation
[simplex]: show the BRIDGE balance as soon as a top-up is delivered - #1403
Merged
Merged
Conversation
The Hyperbridge balance is not part of the per-minute EVM refresh: trackHyperbridgeBalance reads it once at boot and then on its own interval. That left the dashboard showing the pre-top-up balance for up to a minute after delivery — the UI reloads balances the moment the delivered stage is seen, but the snapshot's hyperbridge field was whatever the last interval tick had read. BalanceProvider.refreshHyperbridgeBalance() is the interval read, made public and safe to call any time (a no-op until tracking initializes; a failed read keeps the last snapshot). BridgeTopUp takes an optional refreshBridgeBalance and awaits it, best-effort, where readDelivery transitions the record to delivered, wired in boot.ts. Awaiting it inside the sync is what makes the dashboard's follow-up balances read fresh instead of racing a fire-and-forget refresh.
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.
The dashboard's BRIDGE balance stayed stale for up to a minute after a top-up completed.
Why: the Hyperbridge balance is not part of
BalanceProvider.refresh().trackHyperbridgeBalancereads it once at boot and then on the same once-a-minute interval as the EVM chains, because the substrate read is cheap to cache and rarely urgent. When a top-up flips todelivered, the UI reloads balances immediately (OperatorOverview callsonBalancesChangedon thedeliveredtransition, andGET /api/balances?refresh=1re-reads the EVM chains) — but the snapshot'shyperbridgefield was whatever the last interval tick had read.Fix:
BalanceProvider.refreshHyperbridgeBalance()— the interval's read, now public and safe to call any time. No-op until tracking is initialized; a failed read keeps the last snapshot.BridgeTopUptakes an optionalrefreshBridgeBalancedep, called — best-effort and awaited — inreadDeliverywhere the record transitions todelivered. Awaited inside the sync is what makes the dashboard's follow-up/api/balancesread fresh rather than racing a fire-and-forget refresh.boot.tsto the balance provider.Validation
tscshows only the pre-existing errors on main (verified by stashing).