MetaMask / MetaMask/metamask-extension

[Bug]: New accounts being added automatically and labeled out of order

Open
#27,472 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-UI regression-main Sev2-normal team-notifications-deprecated type-bug
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

### Describe the bug

When I add my SRP. Many accounts appear. For this particular SRP, only the first account has mainnet assets. Any time I reload the extension more accounts appear. Also changing the active selected account can cause more accounts to show up.

Note that in the account picker, the appropriate HD Account 2 public address appears but often will be labeled as the highest account present. If the user tries to relabel it to Account 2 they will see an error about it being a reserved name.

- Observed this on PR [27097](https://github.com/MetaMask/metamask-extension/pull/27097) testing.
- Confirmed it was also present on develop.
- Results were negative on production v12.3.0, it does not have this problem.
- Results were [negative](https://www.loom.com/share/ea541cddcae14d508518b03503fdf7bd) on RC 12.4.0 commit [acc47b30a2dc5d88aa4f57c8b0fffcbc053cbd54](https://github.com/MetaMask/metamask-extension/pull/27287/commits/acc47b30a2dc5d88aa4f57c8b0fffcbc053cbd54)
- It was not introduced in the recent sync controller bump, the issue was present on develop in a dist build of commit 8e31bbc65ca79472f800c64bc8180651ca42e60d.

### Expected behavior

Accounts are auto-added at setup scanning each account for >$.01 USD value on mainnet, or the presence of ERC721 or 1155. Subsequent new HD accounts should not appear unless the user takes action to add them.

The SRP I was testing here is only expected to show Account 1 on initial import.

### Screenshots/Recordings

Branch under test [recording](https://www.loom.com/share/58c5915e79aa4423a1bd4de949ca5537)

Develop commit 1bd0b9e45c5e8bcece84edf01377adfa8ed58129 has the issue [recording](https://www.loom.com/share/738901074ce04d5bb4fc4fb5ce8ad775)
I failed to reopen console here, but you can also observe here that simply changing the active account can result in more accounts appearing in the picker list.

Latest production v12.3.0 not impacted (same SRP always shows just 1 account) [recording](https://www.loom.com/share/e818c9e50e764e379d4cb013cb95acc8)

### Steps to reproduce

1. Restore an SRP- preferably a fresh one or one you have familiarity with and know how many accounts to expect to see on setup
2. Get to wallet view and see how many accounts are present
3. Go to chrome://extensions/ in the browser window and reload MetaMask
4. Unlock MetaMask and see more HD accounts

### Error messages or log output

_No response_

### Detection stage

On the development branch

### Version

12.3.0

### Build type

Other (please specify exactly where you obtained this build in "Additional Context" section)

### Browser

Chrome

### Operating system

MacOS

### Hardware wallet

_No response_

### Additional context

Mac sonoma 14.6.1 with Chrome 129.0.6668.71
Made local dist builds with `yarn dist`

### Severity

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce on the development branch with a fresh SRP, using chrome://extensions to reload the extension and the account picker to observe added and mislabeled HD accounts. Compare the behavior with production v12.3.0 or the cited commits; done means reloads and account selection no longer add unexpected accounts, and Account 2 is labeled correctly without a reserved-name error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.