-
Notifications
You must be signed in to change notification settings - Fork 5.2k
refactor: dedupe common middleware hooks between Eip1193 and CAIP engines #32904
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
base: main
Are you sure you want to change the base?
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. |
I have read the CLA Document and I hereby sign the CLA |
Builds ready [64f1145]
UI Startup Metrics (1205 ± 69 ms)
Benchmark value 1188 exceeds gate value 1180 for chrome browserify home p95 firstPaint Benchmark value 20 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 2265 exceeds gate value 2192 for chrome webpack home mean uiStartup Benchmark value 1776 exceeds gate value 1711 for chrome webpack home mean load Benchmark value 1769 exceeds gate value 1704 for chrome webpack home mean domContentLoaded Benchmark value 1754 exceeds gate value 1699 for chrome webpack home mean loadScripts Benchmark value 2553 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 2074 exceeds gate value 2030 for chrome webpack home p95 load Benchmark value 2063 exceeds gate value 2005 for chrome webpack home p95 domContentLoaded Benchmark value 192 exceeds gate value 90 for chrome webpack home p95 backgroundConnect Benchmark value 1994 exceeds gate value 1970 for chrome webpack home p95 loadScripts Sum of mean exceeds: 258ms | Sum of p95 exceeds: 338ms Sum of all benchmark exceeds: 596ms Bundle size diffs [🚀 Bundle size reduced!]
|
Builds ready [64f1145]
UI Startup Metrics (1185 ± 66 ms)
Benchmark value 18 exceeds gate value 17 for chrome browserify home p95 setupStore Benchmark value 2201 exceeds gate value 2192 for chrome webpack home mean uiStartup Benchmark value 1714 exceeds gate value 1711 for chrome webpack home mean load Benchmark value 1705 exceeds gate value 1704 for chrome webpack home mean domContentLoaded Benchmark value 1700 exceeds gate value 1699 for chrome webpack home mean loadScripts Benchmark value 12 exceeds gate value 11 for firefox browserify home mean getState Benchmark value 10 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 34 exceeds gate value 27 for firefox browserify home p95 setupStore Sum of mean exceeds: 16ms | Sum of p95 exceeds: 14ms Sum of all benchmark exceeds: 30ms Bundle size diffs [🚀 Bundle size reduced!]
|
Builds ready [19c3130]
UI Startup Metrics (1178 ± 57 ms)
Benchmark value 2199 exceeds gate value 2192 for chrome webpack home mean uiStartup Benchmark value 338 exceeds gate value 334 for chrome webpack home p95 firstPaint Benchmark value 181 exceeds gate value 65 for chrome webpack home p95 setupStore Sum of mean exceeds: 7ms | Sum of p95 exceeds: 123ms Sum of all benchmark exceeds: 130ms Bundle size diffs [🚀 Bundle size reduced!]
|
* @param {string} origin - The connection's origin string. | ||
* @returns {object} The shared hooks. | ||
*/ | ||
setupCommonMiddlewareHooks(origin) { |
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.
thoughts on regrouping these by type and bringing back the comments describing each group? like // network configuration-related
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.
good call! lmk if I got it right 🙏
Builds ready [81f2b65]
UI Startup Metrics (1232 ± 62 ms)
Benchmark value 22 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 2225 exceeds gate value 2192 for chrome webpack home mean uiStartup Benchmark value 1757 exceeds gate value 1711 for chrome webpack home mean load Benchmark value 1748 exceeds gate value 1704 for chrome webpack home mean domContentLoaded Benchmark value 1743 exceeds gate value 1699 for chrome webpack home mean loadScripts Benchmark value 2515 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 2064 exceeds gate value 2030 for chrome webpack home p95 load Benchmark value 98 exceeds gate value 90 for chrome webpack home p95 backgroundConnect Benchmark value 1991 exceeds gate value 1970 for chrome webpack home p95 loadScripts Sum of mean exceeds: 175ms | Sum of p95 exceeds: 128ms Sum of all benchmark exceeds: 303ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
The Eip1193 and CAIP RPC engines share several equal hooks between them which are currently duplicated. This pr creates a method to setup these common hooks in order to avoid duplication.
Related issues
Fixes:
https://github.com/MetaMask/MetaMask-planning/issues/4102
Manual testing steps
There should be no difference for users or dapps, all functionality should work as it did previously.
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist