-
Notifications
You must be signed in to change notification settings - Fork 5.4k
feat: Add account upgrade and check status RPC methods #36452
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. |
…into feat/account-upgrade-rpc
✨ Files requiring CODEOWNER review ✨✅ @MetaMask/confirmations (2 files, +52 -58)
🧩 @MetaMask/extension-devs (5 files, +35 -0)
📜 @MetaMask/policy-reviewers (5 files, +35 -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 (5 files, +35 -0)
|
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [0511ad1]
UI Startup Metrics (1234 ± 67 ms)
Benchmark value 253 exceeds gate value 10 for chrome browserify home mean backgroundConnect Benchmark value 26 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 270 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 19 exceeds gate value 1.2 for chrome browserify home p95 initialActions Benchmark value 22 exceeds gate value 17 for chrome browserify home p95 setupStore Benchmark value 2507 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 70 exceeds gate value 57 for chrome webpack home p95 domInteractive Benchmark value 271 exceeds gate value 195 for chrome webpack home p95 getState Benchmark value 11 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 30 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 28 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 224 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 6 exceeds gate value 2 for firefox browserify home p95 initialActions Benchmark value 1758 exceeds gate value 1615 for firefox webpack home mean uiStartup Benchmark value 1489 exceeds gate value 1380 for firefox webpack home mean load Benchmark value 1488 exceeds gate value 1380 for firefox webpack home mean domContentLoaded Benchmark value 124 exceeds gate value 100 for firefox webpack home mean domInteractive Benchmark value 36 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 1462 exceeds gate value 1360 for firefox webpack home mean loadScripts Benchmark value 16 exceeds gate value 13 for firefox webpack home mean setupStore Benchmark value 2051 exceeds gate value 1935 for firefox webpack home p95 uiStartup Benchmark value 1732 exceeds gate value 1660 for firefox webpack home p95 load Benchmark value 1731 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded Benchmark value 313 exceeds gate value 156 for firefox webpack home p95 domInteractive Benchmark value 50 exceeds gate value 49 for firefox webpack home p95 backgroundConnect Benchmark value 51 exceeds gate value 50 for firefox webpack home p95 firstReactRender Benchmark value 15 exceeds gate value 2 for firefox webpack home p95 initialActions Benchmark value 1708 exceeds gate value 1630 for firefox webpack home p95 loadScripts Benchmark value 30 exceeds gate value 28 for firefox webpack home p95 setupStore Sum of mean exceeds: 772ms | Sum of p95 exceeds: 964.8ms Sum of all benchmark exceeds: 1736.8ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
…into feat/account-upgrade-rpc
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [7c7c089]
UI Startup Metrics (1251 ± 87 ms)
Benchmark value 1081 exceeds gate value 1070 for chrome browserify home mean load Benchmark value 1073 exceeds gate value 1061 for chrome browserify home mean domContentLoaded Benchmark value 254 exceeds gate value 10 for chrome browserify home mean backgroundConnect Benchmark value 26 exceeds gate value 23 for chrome browserify home mean firstReactRender Benchmark value 5 exceeds gate value 1 for chrome browserify home mean initialActions Benchmark value 1406 exceeds gate value 1365 for chrome browserify home p95 uiStartup Benchmark value 1213 exceeds gate value 1190 for chrome browserify home p95 load Benchmark value 1206 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded Benchmark value 1189 exceeds gate value 1180 for chrome browserify home p95 firstPaint Benchmark value 275 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 34 exceeds gate value 33 for chrome browserify home p95 getState Benchmark value 13 exceeds gate value 1.2 for chrome browserify home p95 initialActions Benchmark value 955 exceeds gate value 940 for chrome browserify home p95 loadScripts Benchmark value 260 exceeds gate value 195 for chrome webpack home p95 getState Benchmark value 17 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 31 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 28 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 7 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 228 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 10 exceeds gate value 2 for firefox browserify home p95 initialActions Benchmark value 102 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 5 exceeds gate value 1 for firefox webpack home mean initialActions Benchmark value 287 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: 318ms | Sum of p95 exceeds: 636.8ms Sum of all benchmark exceeds: 954.8ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
…k/metamask-extension into feat/account-upgrade-rpc
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [244a65d]
UI Startup Metrics (1246 ± 75 ms)
Benchmark value 1076 exceeds gate value 1070 for chrome browserify home mean load Benchmark value 1069 exceeds gate value 1061 for chrome browserify home mean domContentLoaded Benchmark value 254 exceeds gate value 10 for chrome browserify home mean backgroundConnect Benchmark value 25 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 1372 exceeds gate value 1365 for chrome browserify home p95 uiStartup Benchmark value 1204 exceeds gate value 1190 for chrome browserify home p95 load Benchmark value 1197 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded Benchmark value 1207 exceeds gate value 1180 for chrome browserify home p95 firstPaint Benchmark value 268 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 21 exceeds gate value 17 for chrome browserify home p95 setupStore Benchmark value 2465 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 17 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 1534 exceeds gate value 1405 for firefox browserify home mean uiStartup Benchmark value 1307 exceeds gate value 1245 for firefox browserify home mean load Benchmark value 1307 exceeds gate value 1239 for firefox browserify home mean domContentLoaded Benchmark value 113 exceeds gate value 110 for firefox browserify home mean domInteractive Benchmark value 37 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 32 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 16 exceeds gate value 11 for firefox browserify home mean getState Benchmark value 5 exceeds gate value 1 for firefox browserify home mean initialActions Benchmark value 1280 exceeds gate value 1230 for firefox browserify home mean loadScripts Benchmark value 13 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 1933 exceeds gate value 1660 for firefox browserify home p95 uiStartup Benchmark value 250 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 103 exceeds gate value 70 for firefox browserify home p95 backgroundConnect Benchmark value 67 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 29 exceeds gate value 27 for firefox browserify home p95 setupStore Benchmark value 107 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 5 exceeds gate value 1 for firefox webpack home mean initialActions Benchmark value 298 exceeds gate value 156 for firefox webpack home p95 domInteractive Benchmark value 9 exceeds gate value 2 for firefox webpack home p95 initialActions Sum of mean exceeds: 637ms | Sum of p95 exceeds: 914.8ms Sum of all benchmark exceeds: 1551.8ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
…into feat/account-upgrade-rpc
Builds ready [4688eff]
UI Startup Metrics (1282 ± 82 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
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.
This is so good!
app/scripts/lib/rpc-method-middleware/handlers/wallet-upgrade-account.ts
Outdated
Show resolved
Hide resolved
| * @param {number} chainId - The chain ID for the upgrade | ||
| * @returns {Promise<{transactionHash: string, delegatedTo: string}>} | ||
| */ | ||
| async upgradeAccount(address, upgradeContractAddress, chainId) { |
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.
It might be worth decomposing these hooks out to avoid bloating metamask-controller.js
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.
I don't know this is the pattern used for all other implementations I would go with the same way.
app/scripts/lib/rpc-method-middleware/handlers/wallet-upgrade-account.ts
Outdated
Show resolved
Hide resolved
app/scripts/lib/rpc-method-middleware/handlers/wallet-upgrade-account.ts
Outdated
Show resolved
Hide resolved
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
## Explanation This PR adds RPC methods for upgrading Externally Owned Accounts (EOAs) to EIP-7702 delegator accounts. This functions are only callable by preinstalled snaps. It adds wallet_upgradeAccount for upgrading the account wallet_getAccountUpgradeStatus for checking if account is upgraded or not ## References Needed for: MetaMask/metamask-extension#36452 ## 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 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds new package implementing internal RPC methods `wallet_upgradeAccount` and `wallet_getAccountUpgradeStatus` for EIP-7702 account upgrades, with tests/docs and monorepo wiring (README, tsconfig, ownership). > > - **New package**: `packages/eip-7702-internal-rpc-middleware` > - **Methods**: `wallet_upgradeAccount`, `wallet_getAccountUpgradeStatus` > - **Core**: validation utils (`validateParams`, `validateAndNormalizeAddress`), constants (`METHOD_NAMES`, `DELEGATION_INDICATOR_PREFIX`), types, and hook-based handlers with error handling and EIP-7702 support checks/delegation code parsing. > - **Tooling**: Jest tests, Typedoc config, tsconfigs, package metadata, changelog, license. > - **Monorepo integration**: > - Update `README.md` (package list and graph) and add build reference in `tsconfig.build.json`. > - Add ownership: `.github/CODEOWNERS` and `teams.json` entries for the new package. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 453f439. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Elliot Winkler <[email protected]> Co-authored-by: Alex Donesky <[email protected]>
… into eip7702 utils
…into feat/account-upgrade-rpc
|
@metamaskbot update-policies |
|
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: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [b84fc46]
UI Startup Metrics (1271 ± 104 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
This PR adds RPC methods for upgrading Externally Owned Accounts (EOAs) to EIP-7702 delegator accounts. This functions are only callable by preinstalled snaps. It adds
wallet_upgradeAccountfor upgrading the accountwallet_getAccountUpgradeStatusfor checking if account is upgraded or notRelated Issues
Changelog
CHANGELOG entry: null
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Adds EIP-7702 account upgrade and status RPCs for preinstalled snaps, introduces shared EIP-7702 support/tx utils, and wires support into controller, transaction publishing, and UI hooks.
wallet_upgradeAccountandwallet_getAccountUpgradeStatusvia@metamask/eip-7702-internal-rpc-middlewareinmetamask-controller.getCurrentChainIdForDomain,getSelectedNetworkClientIdForChain,upgradeAccount, andisEip7702Supported.shared/lib/eip7702-support-utils.ts:findAtomicBatchSupportForChain,checkEip7702Support.shared/lib/eip7702-utils.ts: create upgrade/downgrade transactions,isAccountUpgraded, andEIP_7702_REVOKE_ADDRESS.delegation-7702-publish.tsto use shared EIP-7702 support utils and handleupgradeContractAddressoptionality.useEIP7702Accountto consume shared utils; propagaterequireApproval; exportEIP_7702_REVOKE_ADDRESS.controllers/permissions/specifications.js.@metamask/eip-7702-internal-rpc-middlewaredependency.controller-init/utils.tsto stringify controller name.Written by Cursor Bugbot for commit b84fc46. This will update automatically on new commits. Configure here.