fix(perps): handle inactive Lighter market metadata by abretonc7s · Pull Request #10110 · MetaMask/core · GitHub
Skip to content

fix(perps): handle inactive Lighter market metadata - #10110

Merged
abretonc7s merged 2 commits into
mainfrom
fix/perps/lighter-inactive-market-metadata
Sep 4, 2026
Merged

fix(perps): handle inactive Lighter market metadata#10110
abretonc7s merged 2 commits into
mainfrom
fix/perps/lighter-inactive-market-metadata

Conversation

@abretonc7s

@abretonc7s abretonc7s commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Explanation

Lighter retains inactive markets for historical identity and can zero their order minimums and margin fractions. The strict response decoder rejected those retired rows, which prevented otherwise valid active markets from loading.

This change accepts zero constraints only for inactive rows, omits retired markets whose risk metadata cannot produce canonical market data, and preserves inactive rows with valid metadata as delisted. Positions left on retired markets remain readable using their current position leverage as a non-tradable cap. Active markets remain strict and fail closed on zero or malformed constraints.

Validated with:

  • 322 focused Lighter service/provider tests
  • Full @metamask/perps-controller test suite and Core build
  • Targeted ESLint, formatting, and changelog validation
  • Mobile yalc integration using package 16.1.0 (yalc.sig ee73aeec8330f58ce0a6e9c6b4cf42a3)
  • A 36/36-node iOS recipe covering Lighter and Hyperliquid on mainnet and testnet
  • Revalidated Lighter mainnet on iOS mm-1: live markets loaded and the invalid inactive-market metadata error was absent

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them — not applicable; this change is non-breaking

Note

Low Risk
Scoped to Lighter public market-metadata parsing and listing; active markets remain fail-closed on bad constraints, with no changes to signing, deposits, or position operations.

Overview
Fixes Lighter market loading when the venue returns inactive perp rows with zeroed minimum order sizes or margin fractions—metadata Lighter keeps for history but that previously made the strict HTTP decoder reject the whole response and block active markets.

LighterClientService now allows zero minimums and margin fractions only when status === 'inactive', with refine validators still requiring positive values for active markets. LighterProvider adds isInactiveMarketWithoutUsableRiskMetadata to drop those retired rows from getMarketDataWithPrices and margin caching, skips them in getMarkets when leverage metadata is omitted (instead of throwing), and still surfaces inactive markets with valid risk data as delisted. Tests cover both omission and preservation paths.

Reviewed by Cursor Bugbot for commit 445456c. Bugbot is set up for automated code reviews on this repo. Configure here.

@abretonc7s
abretonc7s force-pushed the fix/perps/lighter-inactive-market-metadata branch from ef8dd5b to 445456c Compare September 4, 2026 11:04
@abretonc7s
abretonc7s marked this pull request as ready for review September 4, 2026 11:06
@abretonc7s
abretonc7s requested review from a team as code owners September 4, 2026 11:06
@abretonc7s
abretonc7s deployed to default-branch September 4, 2026 11:07 — with GitHub Actions Active

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 445456c. Configure here.

Comment thread packages/perps-controller/src/providers/LighterProvider.ts
@abretonc7s
abretonc7s enabled auto-merge September 4, 2026 11:43
@abretonc7s
abretonc7s added this pull request to the merge queue Sep 4, 2026
Merged via the queue into main with commit 784ba54 Sep 4, 2026
46 checks passed
@abretonc7s
abretonc7s deleted the fix/perps/lighter-inactive-market-metadata branch September 4, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants