{{ message }}
fix(perps): stabilize Lighter account loading - #10119
Open
abretonc7s wants to merge 1 commit into
Open
Conversation
abretonc7s
force-pushed
the
fix/perps/lighter-account-loading
branch
from
September 4, 2026 15:50
f84b740 to
7b91634
Compare
abretonc7s
marked this pull request as ready for review
September 4, 2026 15:50
abretonc7s
enabled auto-merge
September 4, 2026 15:50
abretonc7s
force-pushed
the
fix/perps/lighter-account-loading
branch
from
September 4, 2026 16:27
7b91634 to
dcf7cc6
Compare
Contributor
Author
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.

Explanation
Lighter account discovery can return sparse balance fields, and API code
21100authoritatively means the selected wallet has no venue account. The provider previously rejected funded accounts during discovery and left no-account subscribers waiting indefinitely.This change validates only identity fields during address discovery, queries all API-key slots so non-default registrations are found, emits empty account state only for confirmed no-account responses, and preserves existing state for transport, auth, and integrity failures. REST trade decoding now permits an omitted counterparty PnL while the fill adapter still requires the selected account's PnL. It also removes the per-frame Lighter price debug log.
Validated with:
@metamask/perps-controllersuite (89.48% line coverage) and full Core monorepo build109/109), targeted ESLint, Prettier, and package changelog validation16.1.0(yalc.sig12ffef2527e5de1f35bb8b3cff91fa02)mm-1no-account settlement ondev7: markets rendered with no balance, positions, orders, or activity5beed0f35busing publishedmm-harness@0.47.1: BTC order242458746910186, position0.00012at81267.2, close68943931413978, final state flat (26/26recipe nodes)References
Checklist
Note
Medium Risk
Changes Lighter account-binding, empty-state emission, and API-key discovery paths that affect trading readiness and live subscriptions; behavior is narrowed with tests but mistakes could show wrong balances or block registration.
Overview
Fixes Lighter account discovery and subscriber settlement so wallets with funded venue accounts are not rejected on sparse discovery payloads, and UI no longer spins forever when the wallet truly has no Lighter account.
Account resolution:
accountsByL1Addressnow validates only identity fields (AccountSummaryStruct/LighterAccountSummary), while fullaccountreads stay strict. API code 21100 and emptysubAccountsmap toLighterAccountNotFoundError. On channel setup, that case emits authoritative empty account/positions/orders; transport, auth, capability, and malformed responses keep the last snapshot.Trading readiness: Venue key checks call
getApiKeys(accountIndex)(all slots) instead of probing a single unused slot, which previously returnedapi key not foundand blocked first-time registration.History / noise: REST trade decoding allows omitted
askAccountPnl/bidAccountPnl; the fill adapter still requires PnL for the selected account. Per-frame Lighter price-stream debug logging is removed.Reviewed by Cursor Bugbot for commit dcf7cc6. Bugbot is set up for automated code reviews on this repo. Configure here.