-
Notifications
You must be signed in to change notification settings - Fork 5k
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
fix: bring back exception if invalid address passed in eth_accounts #30213
base: main
Are you sure you want to change the base?
Conversation
* @param {string[]} accounts - The accounts associated with the caveat. | ||
* @param {() => Record<string, import('@metamask/keyring-internal-api').InternalAccount>} getInternalAccounts - | ||
* Gets all AccountsController InternalAccounts. | ||
* TODO: Remove this function once permission refactor/factory differ work is merged into main |
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.
* TODO: Remove this function once permission refactor/factory differ work is merged into main | |
* TODO: Remove this function once the CAIP-25 permission refactor/factory differ work is merged into main |
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.
resolved in c9df79b
PermissionSpecifications.validateCaveatAccounts.mockImplementation( | ||
() => ({}), | ||
); |
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.
do we need to specify anything at all for validateCaveatAccounts? The default mock already does not throw
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.
in this case we do, otherwise the mock from the previous block persists and we throw the accounts error instead of the chains one
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.
odd... well being extra explicit in tests is fine with me. can we make this return undefined instead of empty object? (nit)
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.
resolved in 7a9a4a3
❌ API Spec Test Failed. View the report here. |
❌ API Spec Test Failed. View the report here. |
Builds ready [84df286]
Page Load Metrics (1743 ± 70 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [6a7ef36]
Page Load Metrics (1725 ± 42 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [7a9a4a3]
Page Load Metrics (1515 ± 45 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
This commit fixes the following issue which is currently a release blocker for v12.12.9
The eth accounts and permitted chains caveat validation in this PR was originally removed as part of the CAIP-25 Permission Migration PR here, but is being restored in order to fix a regression in the API behavior. Originally, making a wallet_requestPermissions request with invalid caveat values for eth_accounts or endowment:permitted-chains would result in an immediate error returned back to the dapp specifying which value was invalid, i.e. not found in the wallet. This PR restores that behavior.
Additionally, the changes in this PR are temporary and will be removed as part of a follow up refactor that cleans up the CAIP-25 approval/request permission flow.
Description
Related issues
Fixes:
Manual testing steps
Unlock MM
Open test dapp console
Paste the following command
See error
Screenshots/Recordings
Before
After
Screen.Recording.2025-02-07.at.19.54.15.mov
Pre-merge author checklist
Pre-merge reviewer checklist