Commit 086b7f0
feat(keyring-controller): add
## Explanation
Another approach for `withKeyringV2` where we actually extend the
existing list of keyring instances to have an optional `keyringV2`
field.
This allow to keep them in memory and have the same lifecycle than v1
keyring instance (and since all v2 implementations are wrappers for now,
they are "bound" to v1 instances anyway).
Original PR:
- #8372
## References
N/A
## Checklist
- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Introduces new V2 keyring selection/execution paths and caches V2
adapters alongside legacy keyrings, which could affect keyring
lifecycle, rollback/persistence behavior, and error handling. Dependency
bumps to keyring packages may also subtly change signing/account
behavior.
>
> **Overview**
> Adds first-class `KeyringV2` support by storing an optional in-memory
V2 adapter next to each legacy keyring entry and creating/destroying
these adapters during keyring create/restore/clear flows.
>
> Introduces `withKeyringV2` (locked, persisted/rollback) and
`withKeyringV2Unsafe` (lock-free, no rollback) APIs plus messenger
action types, including a new `KeyringSelectorV2`
(`type`/`address`/`id`/`filter`) and a `KeyringV2NotSupported` error
when no V2 builder exists for a selected keyring.
>
> Updates tests to cover selector variants, lock/rollback semantics, and
messenger callability; bumps
`@metamask/eth-hd-keyring`/`@metamask/eth-simple-keyring` versions and
adjusts Jest coverage thresholds accordingly.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
d8bc565. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Mathieu Artu <mathieu.artu@consensys.net>withKeyringV2 support (#8390)1 parent 96955b7 commit 086b7f0
10 files changed
Lines changed: 947 additions & 93 deletions
File tree
- packages
- keyring-controller
- src
- multichain-account-service
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
15 | 25 | | |
16 | 26 | | |
17 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
Lines changed: 68 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
313 | 378 | | |
314 | 379 | | |
315 | 380 | | |
| |||
334 | 399 | | |
335 | 400 | | |
336 | 401 | | |
337 | | - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
0 commit comments