Skip to content

fix(network-enablement-controller): preserve network selection when auto-enabled network is added - #10763

Merged
Prithpal-Sooriya merged 3 commits into
mainfrom
feature/use-memory-see-this-tku
Oct 9, 2026
Merged

Prithpal-Sooriya merged 3 commits into
mainfrom
feature/use-memory-see-this-tku

Conversation

@Prithpal-Sooriya

@Prithpal-Sooriya Prithpal-Sooriya commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

When networks are auto-added by the Config Registry (such as Arc), NetworkEnablementController's #onAddNetwork previously treated them like user-added custom networks, either switching to them exclusively or altering enablement unexpectedly.

This PR checks if the newly added network is an EVM auto-enabled network via selectEvmAutoEnabledNetworksChainIds(this.messenger.call('ConfigRegistryController:getState')). If so, it preserves the existing enablement map and selection without forcing a switch.

Related discussion: MetaMask/metamask-extension#46928 (comment)

Changes

  • In NetworkEnablementController.#onAddNetwork, check selectEvmAutoEnabledNetworksChainIds from @metamask/config-registry-controller.
  • If the network being added is a registry auto-enabled network, set its enablement to false if unset without disrupting existing network selections.
  • Add comprehensive unit test coverage in NetworkEnablementController.test.ts.

Video Walkthrough

pr-10763.mp4

🤖 AI-generated walkthrough — script, animation, and voice made by an agent


Note

Medium Risk
Changes when enabledNetworkMap is updated on networkAdded, which affects which networks appear active in the wallet; scope is limited to registry auto-enabled EVM networks with new test coverage.

Overview
Fixes network enablement when Config Registry auto-adds EVM networks (e.g. Arc) so they no longer follow the user “add custom network” path that disables other chains or forces a switch.

In #onAddNetwork, the controller now detects registry auto-enabled chains via selectEvmAutoEnabledNetworksChainIds on ConfigRegistryController state. For those additions it only ensures an entry exists (??= false), leaving current enablement and selection intact; existing popular-network vs single-network logic still applies for other adds. Native asset identifiers continue to be updated on add.

Unit tests cover auto-enabled adds in single-network and popular-network modes, plus preserving a pre-existing enabled state. Changelog updated under Fixed.

Reviewed by Cursor Bugbot for commit a9771ae. Bugbot is set up for automated code reviews on this repo. Configure here.

@Prithpal-Sooriya
Prithpal-Sooriya requested a review from a team as a code owner October 8, 2026 22:48
@Prithpal-Sooriya
Prithpal-Sooriya requested a review from a team as a code owner October 8, 2026 22:49
@Prithpal-Sooriya
Prithpal-Sooriya added this pull request to the merge queue Oct 9, 2026
Merged via the queue into main with commit a6be37c Oct 9, 2026
63 checks passed
@Prithpal-Sooriya
Prithpal-Sooriya deleted the feature/use-memory-see-this-tku branch October 9, 2026 10:01
@Kriys94 Kriys94 mentioned this pull request Oct 29, 2026
1 of 2 tasks
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Nov 4, 2026
## Explanation

Release 1377.0.0. This PR only bumps versions, finalizes changelogs,
updates dependency ranges, and refreshes `yarn.lock`. The behavior
shipped here is already on `main`.

Three packages are major releases because their unreleased changelogs
include breaking changes:

- `@metamask/transaction-controller` `72.3.0` → `73.0.0`. Simulation now
goes through `SentinelApiService:simulateTransactions`. Consumers must
construct a `SentinelApiService` and delegate that action.
`getSimulationConfig` now returns `{ newUrl?: string }` only
([MetaMask#9476](MetaMask#9476)).
- `@metamask/core-backend` `12.3.0` → `13.0.0`.
`OHLCV_SERVICE_ALLOWED_ACTIONS` no longer includes
`BackendWebSocketService:getConnectionInfo` or
`BackendWebSocketService:findSubscriptionsByChannelPrefix`
([MetaMask#10884](MetaMask#10884)). This release
also adds `fetchV5MultiAccountTransactions`
([MetaMask#11194](MetaMask#11194)),
`LaunchpadTokenDetailsService`, and `ChannelSubscriptionManager`
([MetaMask#10884](MetaMask#10884)).
- `@metamask/wallet` `20.0.0` → `21.0.0`. Default initialization now
includes `NetworkEnablementController`, and the wallet messenger
delegates `SentinelApiService:simulateTransactions`. Clients must
register `MultichainNetworkController:getState` and
`SentinelApiService:simulateTransactions` on the wallet messenger
([MetaMask#10997](MetaMask#10997),
[MetaMask#9476](MetaMask#9476)).

These packages are included so they can depend on
`transaction-controller` `^73.0.0` and, where they use it,
`core-backend` `^13.0.0`:

| Package | Version |
| --- | --- |
| `@metamask/assets-controller` | `20.1.0` |
| `@metamask/assets-controllers` | `113.0.1` |
| `@metamask/bridge-controller` | `83.1.3` |
| `@metamask/bridge-status-controller` | `78.0.1` |
| `@metamask/client-utils` | `3.1.0` |
| `@metamask/eip-5792-middleware` | `4.1.0` |
| `@metamask/gator-permissions-controller` | `6.1.0` |
| `@metamask/money-account-utils` | `2.2.0` |
| `@metamask/network-enablement-controller` | `7.1.0` |
| `@metamask/phishing-controller` | `18.3.0` |
| `@metamask/profile-metrics-controller` | `5.2.1` |
| `@metamask/shield-controller` | `7.1.1` |
| `@metamask/smart-transactions-controller` | `27.2.1` |
| `@metamask/social-controllers` | `3.14.1` |
| `@metamask/subscription-controller` | `15.1.2` |
| `@metamask/transaction-pay-controller` | `30.3.2` |
| `@metamask/transaction-pay-middleware` | `2.0.1` |
| `@metamask/user-operation-controller` | `42.1.0` |

Notable changes besides the dependency bumps:

- `@metamask/assets-controller`: optional `pricePercentChange5m` and
`pricePercentChange4h` on `FungibleAssetPrice`
([MetaMask#11201](MetaMask#11201)).
- `@metamask/client-utils`: `predictionSettled` on `ActivityKind`
([MetaMask#11169](MetaMask#11169)), plus fee fixes
for contract-interaction fallback and OP Stack L1/operator fees
([MetaMask#11013](MetaMask#11013),
[MetaMask#9630](MetaMask#9630)).
- `@metamask/network-enablement-controller`: preserve enablement when a
config-registry network is auto-enabled
([MetaMask#10763](MetaMask#10763)).
- `@metamask/phishing-controller`: Arc (`0x13b2`) token scanning
([MetaMask#11144](MetaMask#11144)).
- `@metamask/transaction-pay-controller`: shared recipient resolution
and Hyperliquid perps deposit detection
([MetaMask#10887](MetaMask#10887),
[MetaMask#11026](MetaMask#11026)).

`@metamask/earn-controller`, `@metamask/money-account-mfa-whitelist`,
`@metamask/money-account-upgrade-controller`,
`@metamask/network-connection-banner-controller`,
`@metamask/perps-controller`, and `@metamask/signature-controller` only
have dependency ranges updated. They are not version-bumped and are not
published in this release.

## References

* [MetaMask#9476](MetaMask#9476)
* [MetaMask#9630](MetaMask#9630)
* [MetaMask#10763](MetaMask#10763)
* [MetaMask#10884](MetaMask#10884)
* [MetaMask#10887](MetaMask#10887)
* [MetaMask#10997](MetaMask#10997)
* [MetaMask#11013](MetaMask#11013)
* [MetaMask#11026](MetaMask#11026)
* [MetaMask#11144](MetaMask#11144)
* [MetaMask#11169](MetaMask#11169)
* [MetaMask#11194](MetaMask#11194)
* [MetaMask#11201](MetaMask#11201)

## 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
-->

- [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**
> The diff is low-risk mechanically, but the published majors force
client upgrades around transaction simulation, backend WebSocket
actions, and wallet messenger registration—areas that affect core wallet
behavior.
> 
> **Overview**
> This PR cuts **release 1377.0.0** by bumping the root monorepo
version, publishing new semver tags for many `@metamask/*` packages,
moving unreleased changelog entries into versioned sections, updating
inter-package dependency ranges, and refreshing **`yarn.lock`**. There
is **no new application logic** in the diff—only release bookkeeping for
work already on `main`.
> 
> The release centers on three **major** packages whose changelogs
document breaking changes: **`@metamask/transaction-controller`
`73.0.0`** (simulation via `SentinelApiService:simulateTransactions`;
`getSimulationConfig` shape change), **`@metamask/core-backend`
`13.0.0`** (WebSocket allowed-actions cleanup plus new backend
APIs/services), and **`@metamask/wallet` `21.0.0`** (default
`NetworkEnablementController` wiring and Sentinel simulation delegation
on the wallet messenger). Dozens of other packages are **minor/patch
bumped** mainly to depend on **`transaction-controller` `^73.0.0`** and,
where applicable, **`core-backend` `^13.0.0`**.
> 
> Several workspaces only have **`package.json` dependency range
updates** (e.g. `earn-controller`, `money-account-upgrade-controller`,
`signature-controller`) without a version bump in this PR. A few
packages also document **feature fixes** in their new changelog sections
(e.g. `assets-controller` price change fields, `client-utils` activity
kinds/fees, `phishing-controller` Arc scanning) as part of the versions
being published here.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
5a253e4. 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: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants