Skip to content

feat: remove all MYX protocol from core - #10038

Open
abretonc7s wants to merge 4 commits into
mainfrom
TAT-3892-feat-remove-myx-protocol-core
Open

feat: remove all MYX protocol from core#10038
abretonc7s wants to merge 4 commits into
mainfrom
TAT-3892-feat-remove-myx-protocol-core

Conversation

@abretonc7s

@abretonc7s abretonc7s commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Explanation

@metamask/perps-controller shipped a full MYX protocol implementation alongside HyperLiquid and
Lighter. MYX is being dropped as a venue, and keeping it cost real weight: an optional
@myx-trade/sdk dependency, a dynamic-import + webpackIgnore workaround plus three
!dist/*MYX* files exclusions so extension bundles could skip the provider, and 'myx'
branches threaded through the controller, the provider router, and the provider-type unions.

This PR removes MYX from the package. It deletes MYXProvider, MYXClientService,
MYXWalletService, the MYX adapter, and the MYX config and type modules along with their test
suites; drops the @myx-trade/sdk dependency and the packaging exclusions it required; and
de-wires the controller — #isMYXProviderEnabled, the dynamic-import registration path,
registerMYXProvider, handleMYXImportError, resolveMyxAuthConfig, and the 'myx' routing and
cache-key branches all go. Net: ~8,700 lines removed across 42 files.

Notable API effects, all breaking for consumers that used MYX:

  • PerpsProviderType is now 'hyperliquid' | 'lighter'. switchProvider('myx') returns
    { success: false, error: 'Provider myx not available' }. A 'myx' value restored from
    persisted state falls back to 'hyperliquid' and rewrites the persisted value, so existing
    MYX users self-heal on next launch rather than getting a broken perps tab.
  • The MYXCredentials type and providerCredentials.myx option are gone.
  • All MYX_* constants, getMYXChainId / getMYXHttpEndpoint, the fromMYX* / toMYX*
    converters, and the MYX-only USDT_BNB_TESTNET / USDT_BNB_MAINNET collateral addresses are no
    longer exported.
  • PROVIDER_CONFIG.MYX_TESTNET_ONLY is removed; buildProviderCacheKey no longer special-cases
    'myx'.
  • The perpsMyxProviderEnabled remote flag and MM_PERPS_MYX_PROVIDER_ENABLED env override are
    no longer read, so clients can retire both.

Two changes may not be obvious:

  • packages/authenticated-user-storage is touched deliberately. PerpsWatchlistMarkets.myx
    is a server-persisted preference schema, not protocol code, and blobs already stored remotely
    contain a myx key. Deleting the required field would have failed validation on that existing
    data. It is instead made optional() and @deprecated: nothing writes it any more, stored
    blobs still validate, and perps-controller is left with zero MYX references.
  • The files field is now plain ["dist/"]. With the MYX exclusions gone, everything emitted
    into dist/ publishes — so a stale dist/ from a previous build would ship MYX artifacts. The
    validation below uses yarn build:clean (which wipes packages/*/dist first) and asserts the
    emitted tree contains no MYX file at all.

HyperLiquid and Lighter behavior is unchanged. Where MYX served only as "a second provider" in
multi-provider aggregation, routing, and cache tests, those cases were repointed at Lighter rather
than deleted, so multi-provider coverage is preserved.

Validation

  • yarn workspace @metamask/perps-controller run test79 suites, 3399 passed, 0 failures,
    coverage thresholds met (89.4% lines vs 80% required, 81.54% branches vs 69%, 85.58% functions
    vs 78%).
  • yarn workspace @metamask/authenticated-user-storage run jest44 passed, 0 failures.
  • yarn build:clean (root ts-bridge) — exit 0, "Project built successfully"; the emitted
    packages/perps-controller/dist contains no MYX file, and dist/index.d.cts / dist/index.cjs
    export no MYX symbol.
  • ESLint over changed files — 0 errors. Prettier — clean. yarn changelog:validate — passes.
  • An end-to-end proof recipe asserts the removal (no MYX in src//tests/, none in the manifest,
    none in the built dist/) and then reads live HyperLiquid testnet positions, orders, and
    account state through the de-wired controller to show the removal caused no regression. The
    assertions were confirmed to fail against the pre-change tree, so a revert of this diff breaks
    the recipe.

References

Client follow-ups needed before/alongside adoption:

  • Mobile and extension must drop any providerCredentials.myx, activeProvider: 'myx', or
    providerId: 'myx' usage and remove MYX from provider pickers.
  • The perpsMyxProviderEnabled remote feature flag can be retired once clients are updated.
  • A future AUS schema migration can drop the deprecated myx watchlist key entirely once no
    stored blob relies on it.

Checklist

  • I've updated the test suite for new or updated code as appropriate
    • MYX-only suites deleted; shared multi-provider tests repointed at Lighter so aggregation,
      routing, and cache coverage is preserved.
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
    • JSDoc examples that used 'myx' as a sample provider now use 'lighter'; comments in the
      Lighter provider, wallet service, and adapter that referenced MYX as their template were
      rewritten to stand alone.
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
    • perps-controller (Removed, **BREAKING:**) and authenticated-user-storage (Changed).
  • I've introduced breaking changes in this PR and have prepared draft pull requests for
    clients and consumer packages to resolve them
    • Breaking changes are introduced and documented above, but the client draft PRs are not yet
      open. They are listed under References and should land before this is adopted.

Screenshots/Recordings


Note

Medium Risk
Breaking public API and large deletion in perps routing/initialization; mitigated by persisted-provider fallback and optional deprecated AUS myx key for stored preferences.

Overview
Removes the MYX perpetuals venue from @metamask/perps-controller: provider, client/wallet services, adapters, config/types, SDK optional dependency, dynamic registration, and all public MYX_* exports. PerpsProviderType is now 'hyperliquid' | 'lighter'; MYXCredentials / providerCredentials.myx, the perpsMyxProviderEnabled flag, and related env overrides are gone.

#assignActiveProvider no longer throws on an unknown persisted activeProvider—it falls back to HyperLiquid and rewrites state so older 'myx' selections self-heal. AUS watchlist writes no longer seed a myx entry; multi-provider tests that used MYX were repointed to Lighter.

In authenticated-user-storage, PerpsWatchlistMarkets.myx is @deprecated and optional in types and validators so existing server preference blobs still validate; new compat tests cover both shapes.

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

MYX is no longer a supported perps venue. Removing it drops the optional
@myx-trade/sdk dependency, the dynamic-import plus webpackIgnore workaround,
and the three !dist/*MYX* packaging exclusions that existed only to keep the
provider out of published bundles.

Deletes MYXProvider, MYXClientService, MYXWalletService, the MYX adapter, and
the MYX config and type modules with their test suites, and de-wires the
controller: #isMYXProviderEnabled, the dynamic import, registerMYXProvider,
handleMYXImportError, resolveMyxAuthConfig, and every 'myx' routing and
cache-key branch. PerpsProviderType narrows to 'hyperliquid' | 'lighter'.

BREAKING CHANGE: removes the MYXCredentials type, the providerCredentials.myx
option, PROVIDER_CONFIG.MYX_TESTNET_ONLY, and all MYX_* constant, endpoint,
converter, and asset-config exports. Setting activeProvider: 'myx' or passing
providerId: 'myx' now throws Unsupported provider.

PerpsWatchlistMarkets.myx in authenticated-user-storage is made optional and
deprecated rather than removed: it is a server-persisted schema, and blobs
already stored with a myx watchlist must keep validating. Nothing writes it
any more. A regression test pins both shapes.

Where MYX served only as a second provider in aggregation, routing, and cache
tests, those cases were repointed at Lighter so multi-provider coverage is
preserved. HyperLiquid and Lighter behavior is unchanged.
`activeProvider` is persisted, and before this fix a value restored from an
older version whose venue has since been removed — notably 'myx' — fell
through to the `Unsupported provider` throw. That throw happens inside
performInitialization, so it was caught by the retry loop, burned every
attempt with backoff, and ended at InitializationState.Failed without ever
rewriting the persisted value. Perps stayed broken on every launch, not just
the first, until the client cleared state.

Make the fallback the default branch instead: any direct provider that is not
registered falls back to hyperliquid and rewrites the persisted value, which
is how 'myx' behaved before it was removed. The compile-time break is
unaffected — PerpsProviderType still does not admit 'myx'.

Also corrects the changelog, which claimed the controller throws for 'myx':
switchProvider returns { success: false, error: 'Provider myx not available' }
and persisted state now self-heals.
@abretonc7s abretonc7s changed the title chore: prepare farmslot publication pkg-d01ea91d-mti36iqj Sep 1, 2026
@abretonc7s
abretonc7s marked this pull request as ready for review September 1, 2026 05:59
@abretonc7s
abretonc7s requested review from a team as code owners September 1, 2026 05:59
@abretonc7s
abretonc7s deployed to default-branch September 1, 2026 05:59 — with GitHub Actions Active
Remove the removed venue's name from the two explanatory comments left by
the self-heal fix; the fallback is generic, so the comments describe it
generically. The one remaining 'myx' literal is the regression test's
input — it reproduces the value real users have in persisted state, so
replacing it would stop the test proving upgrade behaviour.

Condense the changelog entry from implementation narration to migration
instructions, and drop the nested BREAKING prefixes now that the parent
entry carries one.
@cursor
cursor Bot requested review from geositta and michalconsensys September 1, 2026 06:02
MYX was an unused protocol, so its removal is filed as a plain Removed
entry rather than a breaking change.

Point both changelog links at the real PR (#10038); they were written
against a guessed number before the PR existed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant