refactor: migrate eip-5792 & capabilities middleware handlers into monorepo#35541
refactor: migrate eip-5792 & capabilities middleware handlers into monorepo#35541ffmcgee725 merged 8 commits intomainfrom
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
📊 Page Load Benchmark ResultsCurrent Commit: 📄 https://metamask.github.io/test-dapp/Samples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
|
@metamaskbot update-policies |
|
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
✨ Files requiring CODEOWNER review ✨🧩 @MetaMask/extension-devs (4 files, +40 -0)
📜 @MetaMask/policy-reviewers (4 files, +40 -0)
Tip Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers. 🔗 @MetaMask/supply-chain (4 files, +40 -0)
|
📊 Page Load Benchmark ResultsCurrent Commit: 📄 https://metamask.github.io/test-dapp/Samples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [39b6219]
UI Startup Metrics (1214 ± 82 ms)
Benchmark value 25 exceeds gate value 23 for chrome browserify home mean firstReactRender Benchmark value 7 exceeds gate value 1 for chrome browserify home mean initialActions Benchmark value 251 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 12 exceeds gate value 1.2 for chrome browserify home p95 initialActions Benchmark value 43 exceeds gate value 40 for chrome webpack home mean backgroundConnect Benchmark value 39 exceeds gate value 29 for chrome webpack home mean getState Benchmark value 2455 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 277 exceeds gate value 195 for chrome webpack home p95 getState Benchmark value 15 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 33 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 27 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 5 exceeds gate value 1 for firefox browserify home mean initialActions Benchmark value 10 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 227 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 83 exceeds gate value 70 for firefox browserify home p95 backgroundConnect Benchmark value 7 exceeds gate value 2 for firefox browserify home p95 initialActions Benchmark value 32 exceeds gate value 27 for firefox browserify home p95 setupStore Benchmark value 105 exceeds gate value 100 for firefox webpack home mean domInteractive Benchmark value 30 exceeds gate value 26 for firefox webpack home mean backgroundConnect Benchmark value 43 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 4 exceeds gate value 1 for firefox webpack home mean initialActions Benchmark value 265 exceeds gate value 156 for firefox webpack home p95 domInteractive Benchmark value 53 exceeds gate value 50 for firefox webpack home p95 firstReactRender Benchmark value 5 exceeds gate value 2 for firefox webpack home p95 initialActions Sum of mean exceeds: 281ms | Sum of p95 exceeds: 504.8ms Sum of all benchmark exceeds: 785.8ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
📊 Page Load Benchmark ResultsCurrent Commit: 📄 https://metamask.github.io/test-dapp/Samples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [b8d53ce]
UI Startup Metrics (1198 ± 61 ms)
Benchmark value 5 exceeds gate value 1 for chrome browserify home mean initialActions Benchmark value 252 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 10 exceeds gate value 1.2 for chrome browserify home p95 initialActions Benchmark value 33 exceeds gate value 29 for chrome webpack home mean getState Benchmark value 276 exceeds gate value 195 for chrome webpack home p95 getState Benchmark value 15 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 113 exceeds gate value 110 for firefox browserify home mean domInteractive Benchmark value 35 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 27 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 5 exceeds gate value 1 for firefox browserify home mean initialActions Benchmark value 241 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 12 exceeds gate value 2 for firefox browserify home p95 initialActions Benchmark value 108 exceeds gate value 100 for firefox webpack home mean domInteractive Benchmark value 33 exceeds gate value 26 for firefox webpack home mean backgroundConnect Benchmark value 44 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 6 exceeds gate value 1 for firefox webpack home mean initialActions Benchmark value 277 exceeds gate value 156 for firefox webpack home p95 domInteractive Benchmark value 51 exceeds gate value 50 for firefox webpack home p95 firstReactRender Benchmark value 9 exceeds gate value 2 for firefox webpack home p95 initialActions Sum of mean exceeds: 278ms | Sum of p95 exceeds: 516.8ms Sum of all benchmark exceeds: 794.8ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
📊 Page Load Benchmark ResultsCurrent Commit: 📄 https://metamask.github.io/test-dapp/Samples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
|
beautiful. LGTM after preview build is replaced with actual release |
|
@metamaskbot update-policies |
📊 Page Load Benchmark ResultsCurrent Commit: 📄 https://metamask.github.io/test-dapp/Samples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
|
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
📊 Page Load Benchmark ResultsCurrent Commit: 📄 https://metamask.github.io/test-dapp/Samples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [15c128d]
UI Startup Metrics (1229 ± 66 ms)
Benchmark value 1063 exceeds gate value 1061 for chrome browserify home mean domContentLoaded Benchmark value 242 exceeds gate value 10 for chrome browserify home mean backgroundConnect Benchmark value 24 exceeds gate value 23 for chrome browserify home mean firstReactRender Benchmark value 6 exceeds gate value 1 for chrome browserify home mean initialActions Benchmark value 256 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 13 exceeds gate value 1.2 for chrome browserify home p95 initialActions Benchmark value 40 exceeds gate value 29 for chrome webpack home mean getState Benchmark value 2488 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 284 exceeds gate value 195 for chrome webpack home p95 getState Benchmark value 9 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 32 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 27 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 4 exceeds gate value 1 for firefox browserify home mean initialActions Benchmark value 10 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 232 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 75 exceeds gate value 70 for firefox browserify home p95 backgroundConnect Benchmark value 26 exceeds gate value 24 for firefox browserify home p95 getState Benchmark value 9 exceeds gate value 2 for firefox browserify home p95 initialActions Benchmark value 104 exceeds gate value 100 for firefox webpack home mean domInteractive Benchmark value 31 exceeds gate value 26 for firefox webpack home mean backgroundConnect Benchmark value 44 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 3 exceeds gate value 1 for firefox webpack home mean initialActions Benchmark value 272 exceeds gate value 156 for firefox webpack home p95 domInteractive Benchmark value 8 exceeds gate value 2 for firefox webpack home p95 initialActions Sum of mean exceeds: 282ms | Sum of p95 exceeds: 547.8ms Sum of all benchmark exceeds: 829.8ms Bundle size diffs [🚀 Bundle size reduced!]
|
…po (#6422) ## Explanation We identified duplication in JSON RPC middleware logic between the mobile and extension clients, particularly around the 5792 middleware stack and capability handling. During recent Wallet API and Perps integration discussions, the team agreed this presents an opportunity to abstract and centralize this logic into a core monorepo module. The motivation here is to: * Reduce code duplication across mobile and extension clients * Create a client-agnostic foundation for capabilities (including auxiliary funds, capability advertising, and required assets) * Support the upcoming Metamask Pay (MM Pay) initiative by establishing a standardized middleware layer * Facilitate future multi-chain and auxiliary funds work without creating divergent patterns So the work done on this PR aims to: 1. Create a new core package `eip-5792-middleware` to host shared middleware logic. 2. Extract the 5792 middleware logic and capability handlers from both extension and mobile clients. a. [Extension](MetaMask/metamask-extension#35541) b. [Mobile](MetaMask/metamask-mobile#19064) 4. Refactor them to be client-agnostic and consumable by both clients. 5. Maintain feature parity with existing implementations while improving modularity and testability. 6. Include initial unit tests and integration hooks. <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes [#5698](MetaMask/MetaMask-planning#5698) --> * Fixes [#5698](MetaMask/MetaMask-planning#5698) ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
|
@metamaskbot update-policies |
|
No policy changes |
📊 Page Load Benchmark ResultsCurrent Commit: 📄 https://metamask.github.io/test-dapp/Samples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [89b7cbc]
UI Startup Metrics (1208 ± 61 ms)
Benchmark value 5 exceeds gate value 1 for chrome browserify home mean initialActions Benchmark value 256 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 14 exceeds gate value 1.2 for chrome browserify home p95 initialActions Benchmark value 2495 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 13 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 32 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 27 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 4 exceeds gate value 1 for firefox browserify home mean initialActions Benchmark value 10 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 252 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 11 exceeds gate value 2 for firefox browserify home p95 initialActions Benchmark value 28 exceeds gate value 27 for firefox browserify home p95 setupStore Benchmark value 32 exceeds gate value 26 for firefox webpack home mean backgroundConnect Benchmark value 42 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 6 exceeds gate value 1 for firefox webpack home mean initialActions Benchmark value 250 exceeds gate value 156 for firefox webpack home p95 domInteractive Benchmark value 10 exceeds gate value 2 for firefox webpack home p95 initialActions Sum of mean exceeds: 265ms | Sum of p95 exceeds: 466.8ms Sum of all benchmark exceeds: 731.8ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
We identified duplication in JSON RPC middleware logic between the mobile and extension clients, particularly around the 5792 middleware stack and capability handling. During recent Wallet API and Perps integration discussions, the team agreed this presents an opportunity to abstract and centralize this logic into a core monorepo module.
The motivation here is to:
So the work done on this PR aims to:
eip-5792-middlewarethat host shared middleware logic.Changelog
CHANGELOG entry: null
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/5698
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist