-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(perps): HIP-3 upgrade with webData3 migration and performance improvements #22041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
… enhance cache management in PerpsConnectionManager - Simplified the client initialization process in HyperLiquidProvider by removing error handling and logging, ensuring the clientsInitialized flag is set only after successful initialization. - Added cache clearing for oiCaps in PerpsConnectionManager to improve data management during reconnections.
…LiquidSubscriptionService
- Updated PerpsOrderView to prevent error toast during initial market data load. - Enhanced HyperLiquidProvider to avoid disabling DEX abstraction on network errors, ensuring the flag remains intact for future order verification. - Added checks to handle transfer errors more gracefully, allowing for better management of DEX abstraction status.
…ion parameters - Updated PerpsOICapWarning component to use localized strings for open interest cap messages. - Refactored subscribeToOICaps method signatures in PerpsController, HyperLiquidProvider, and HyperLiquidSubscriptionService to utilize a new SubscribeOICapsParams type for better clarity and maintainability. - Added new localization entries for open interest cap reached and description in en.json.
michalconsensys
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
|





Description
What is the reason for the change?
This PR upgrades MetaMask Mobile's Perps implementation to full HIP-3 protocol support by migrating to SDK v0.25.7 and adopting the new webData3 subscription system. This upgrade delivers significant performance improvements and enables new protocol features like open interest cap monitoring.
What is the improvement/solution?
HIP-3 Protocol Upgrade:
Performance Improvements:
New Feature: Open Interest Cap Warning
SDK Compatibility Fixes:
addressproperty)Architecture Migration:
Changelog
CHANGELOG entry: Upgraded HIP-3 support with webData3 migration and performance improvements
Related issues
Fixes: [Issue number if applicable]
Performance Improvements
webData3 Migration Benefits:
PerpsStreamManager Pattern:
Protocol Feature Extraction:
Measured Benefits:
Manual testing steps
Screenshots/Recordings
Before
After
Files Changed
HIP-3 SDK Migration: 6 files
package.json(SDK v0.25.7 upgrade)shim.js(FinalizationRegistry polyfill)HyperLiquidWalletService.ts(wallet adapter interface fix)HyperLiquidProvider.ts(lazy initialization)webData3 Subscription Migration: 5 files
HyperLiquidSubscriptionService.ts(webData3 implementation)PerpsStreamManager.tsx(unified subscription pattern)PerpsConnectionManager.ts(prewarm integration)OI Cap Feature: 9 files
usePerpsOICap.ts(hook with PerpsStreamManager pattern) (NEW)PerpsOICapWarning/components (banner + inline variants) (NEW)PerpsMarketDetailsView.tsx(banner integration)PerpsOrderView.tsx(inline warning + button disable)Architecture Improvements: 3 files
PerpsStreamManager.tsx(centralized subscription manager)Bug Fixes: 2 files
PerpsOrderView.tsx(race condition fix for transient toast errors)HyperLiquidProvider.ts(DEX abstraction error handling improvements)Total: 7 new files, 18 modified, ~800 lines
Pre-merge author checklist
Pre-merge reviewer checklist
Implementation Details
HIP-3 Protocol Support
webData3 Subscription:
SDK v0.25.7 Features:
Architecture Benefits
PerpsStreamManager Pattern:
Performance Optimizations:
Developer Experience:
__DEV__toggles for testing UI statesOI Cap Feature Details
Real-time Monitoring:
UI Integration:
Reusable Components:
PerpsOICapWarningwith banner/inline variantsPerformance Impact
Memory:
CPU:
Network:
Re-renders:
Testing Coverage
Unit Tests:
Integration Tests:
Manual Testing Checklist:
npx eslint app/components/UI/Perps/yarn lint:tscMigration Notes
Breaking Changes:
Deprecations:
Rollback Plan:
Future Enhancements
Enabled by This Upgrade:
Performance Opportunities:
Note
Migrates Perps to webData3 for unified multi-DEX streaming, adds open interest cap detection with UI warnings/disabled actions, upgrades SDK and stream architecture for performance and reliability.
webData2/clearinghouseStatewith unifiedwebData3inHyperLiquidSubscriptionService(aggregated positions, orders, account, OI caps across all DEXs).subscribeToOICapsAPI; expose viaPerpsController/HyperLiquidProviderandPerpsStreamManager(oiCapschannel, prewarm/clear, pause/resume tests).HyperLiquidProvider; improve DEX abstraction handling and fresh data fetches for mutations; addsubscribeToOICapspassthrough.oiCapsand includes it in reconnection cleanup.usePerpsOICaphook andPerpsOICapWarningcomponent (inline/banner) with zero extra network overhead.PerpsMarketDetailsViewandPerpsOrderView; disable Long/Short and Place Order whenisAtOICap.VALIDATION_DEBOUNCE_MS1000→300); order book processor null-safety.@nktkas/hyperliquidto0.25.7; addFinalizationRegistrypolyfill; wallet adapter now suppliesaddressand uses account util.Written by Cursor Bugbot for commit 377b0f0. This will update automatically on new commits. Configure here.