Skip to content

[pull] main from MetaMask:main#878

Merged
pull[bot] merged 2 commits into
dmrazzy:mainfrom
MetaMask:main
Jun 30, 2026
Merged

[pull] main from MetaMask:main#878
pull[bot] merged 2 commits into
dmrazzy:mainfrom
MetaMask:main

Conversation

@pull

@pull pull Bot commented Jun 30, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

sirtimid and others added 2 commits June 30, 2026 05:49
…oke test (#9255)

## Explanation

The final landing slice for `@metamask/wallet-cli`, after the scaffold
(#9065), persistence (#9067), transport (#9108), and factory (#9226)
slices. It adds the user-facing command surface so the package is
runnable:

- **`src/commands/daemon/{start,stop,status,purge,call}.ts`** (+ tests)
— the `mm daemon` command suite over the daemon layers already on
`main`: `start` spawns the daemon and reports its socket,
`status`/`stop` ping and tear it down, `purge` deletes the daemon state
files, and `call` dispatches an arbitrary `Controller:method` messenger
action.
- **`bin/dev.mjs` + `bin/dev.cmd`** — the dev-mode launchers deferred
from the scaffold slice, run via the `tsx` loader (`knip`
`ignoreDependencies: ['tsx']`).
- **`wallet-factory.e2e.test.ts`** — a smoke test that feeds the wired
`instanceOptions` into a **real** `Wallet` (no mock) against `:memory:`,
imports the SRP, and dispatches a messenger action — closing the gap
flagged in #9226 review. Offline/CI-safe (neither construction nor
`wallet.init()` reaches the network).
- **`src/test/run-command.ts`** + a README **Usage** section.

## Checklist

- [x] `build`, `test` (100% coverage), `lint`, and `changelog:validate`
pass.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> New CLI paths accept wallet secrets and can invoke arbitrary messenger
actions over a local socket; `purge` deletes persisted wallet state,
though safeguards limit deletion when the daemon is still responsive.
> 
> **Overview**
> Adds the runnable **`mm daemon`** command surface on top of the
existing spawn/client/stop layers: **`start`** (Infura/password/SRP via
flags or env), **`stop`**, **`status`** (orphan-PID and stale-PID
warnings), **`purge`** (confirm/`--force`, whitelist-only file deletion,
refuses purge while the daemon still responds), and **`call`** (JSON-RPC
`call` with optional JSON-array args and timeout, TTY vs piped JSON
output).
> 
> Also ships **`bin/dev.mjs`/`dev.cmd`** (oclif dev mode via **`tsx`**),
a **`runCommand`** oclif test harness, a **real `Wallet` `:memory:`
e2e** for `createWallet`, Jest **Web Crypto polyfill** environment for
KeyringController tests, README **Usage**, and knip/tsconfig tweaks for
**`wallet-cli`**.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
15fbe92. 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: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
## Explanation

This PR adds exact-range account group alignment. This is mainly done to
fix Sentry unnecessary spam, but can also improve performance slightly.

## References

Fixes: https://consensyssoftware.atlassian.net/browse/MUL-1939

## 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/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**
> Changes core wallet alignment and account-creation scheduling;
behavior is more selective but miscomputed sub-ranges could leave groups
misaligned until a later align run.
> 
> **Overview**
> Wallet **alignment** no longer calls `createAccounts` for every
provider across the full group index range. It now derives **contiguous
sub-ranges** where each provider is missing an account and only invokes
creation for those gaps.
> 
> `MultichainAccountGroup` gains **`isProviderAligned(provider)`**, and
group `isAligned()` is implemented via that helper.
`MultichainAccountWallet` refactors the shared build path from
`#buildGroupStateForRange` to **`#buildGroupState`** with a
`getSubRanges` callback: alignment supplies
**`#getUnalignedSubRangesForProvider`**, while group creation still
passes the full `[from, to]` range. Providers that are already aligned
for all indices in the range are skipped entirely (fewer traces / Sentry
noise).
> 
> Tests cover single missing indices, fully aligned providers, and
**non-contiguous** missing indices (separate `createAccounts` calls per
gap).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
851ec05. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@pull pull Bot locked and limited conversation to collaborators Jun 30, 2026
@pull pull Bot added the ⤵️ pull label Jun 30, 2026
@pull pull Bot merged commit dbb2ac2 into dmrazzy:main Jun 30, 2026
1 check failed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants