chore: add missing Infura networks#8680
Conversation
|
@metamaskbot publish-previews |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bd05e8d. Configure here.
| 'monad-mainnet': 'monad-mainnet', | ||
| 'megaeth-mainnet': 'megaeth-mainnet', | ||
| 'avalanche-mainnet': 'avalanche-mainnet', | ||
| 'zksync-mainnet': 'zksync-mainnet', |
There was a problem hiding this comment.
BUILT_IN_NETWORKS missing new Infura network entries
Medium Severity
Four new networks (monad-mainnet, megaeth-mainnet, avalanche-mainnet, zksync-mainnet) are added to InfuraNetworkType but the publicly exported BUILT_IN_NETWORKS constant in constants.ts is not updated with corresponding entries. This object is documented as "Map of all build-in Infura networks" and every previous Infura network has an entry. The test helper in packages/network-controller/tests/network-client/helpers.ts accesses BUILT_IN_NETWORKS[infuraNetwork] where infuraNetwork is typed as InfuraNetworkType — passing any of the new networks would return undefined, causing a runtime crash when accessing .chainId or .ticker.
Reviewed by Cursor Bugbot for commit bd05e8d. Configure here.
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> Additional Infura networks have been added in MetaMask#8680, but the `BUILT_IN_NETWORKS` object was missed. This object is not used outside of tests in `core`, though it’s exported by `controller-utils` and used by clients. This PR adds the networks to `BUILT_IN_NETWORKS` as well ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## 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] > **Low Risk** > Low risk: adds new entries to exported network constants and updates the changelog; behavior changes only for consumers referencing these newly supported networks. > > **Overview** > Adds the previously-missing Infura mainnet networks (`monad-mainnet`, `zksync-mainnet`, `megaeth-mainnet`, `avalanche-mainnet`) to `BUILT_IN_NETWORKS`, including their `chainId`, `ticker`, and `blockExplorerUrl` mappings. > > Updates the `@metamask/controller-utils` changelog entry to reflect the expanded `BUILT_IN_NETWORKS` coverage. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 4cb1018. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->


Explanation
Adding networks to
controller-utilsthat are included in the dynamic registry but were missing from the package Infura networks list. This addition is necessary to get passed the validation checks inNetworkControllerwhen adding these networks from the dynamic registry (https://client-config.api.cx.metamask.io/v1/config/networks).References
Checklist
Note
Medium Risk
Moderate risk because it expands the set of built-in Infura networks (chain IDs, tickers, explorer URLs, nicknames), which can affect network validation and default network configuration behavior for consumers.
Overview
Adds missing Infura-supported mainnet networks to
controller-utilsby extendingInfuraNetworkTypeand related constants (BuiltInNetworkName,ChainId,NetworksTicker,BlockExplorerUrl,NetworkNickname) formegaeth-mainnet,monad-mainnet,avalanche-mainnet, andzksync-mainnet.Updates
NetworkControllertest snapshots/expectations so these networks are included in default state/config and corresponding Infura network clients, and records the change in thecontroller-utilschangelog.Reviewed by Cursor Bugbot for commit bd05e8d. Bugbot is set up for automated code reviews on this repo. Configure here.