Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Stale settings causing error when switching to a new chain #29430

Open
pedromcunha opened this issue Jan 3, 2025 · 3 comments
Open

[Bug]: Stale settings causing error when switching to a new chain #29430

pedromcunha opened this issue Jan 3, 2025 · 3 comments
Labels
external-contributor regression-prod-7.1.0 Regression bug that was found in production in release 7.1.0 Sev1-high High severity; partial loss of service with severe impact upon users, with no workaround. team-wallet-api-platform type-bug

Comments

@pedromcunha
Copy link

pedromcunha commented Jan 3, 2025

Describe the bug

Summary of the issue:
The new chain restriction permission doesn't clean up settings of deleted chains. This causes an error Couldn't find networkClientId for chainId to happen when trying to switch chains (in this case via viem's method for switching evm chains). This error happens because chain restriction permissions are iterated and validated, but when removing a chain the permission persists.

Expected behavior

Chain switching shouldn't be impacted by the permissions from a deleted chain

Screenshots/Recordings

Here's also a jam that follows the steps above:
https://jam.dev/c/45b53f97-5e11-46da-84b5-c821ee0418e0

Steps to reproduce

Steps to reproduce:

  1. Connect to a dApp but only give permission to a single chain, in this example Ethereum Mainnet
  2. Navigate to the site’s permission within Metamask and enable any chain’s permission, in this case Arbitrum
  3. Navigate to the chain selector and delete the same chain from step 2
  4. Switch to a chain other than Ethereum Mainnet (this is to force metamask to switch chains programatically)
  5. Attempt to execute a transaction

You can reproduce this on relay.link

Error messages or log output

console-1735936059454.log

Couldn't find networkClientId for chainId

Detection stage

In production (default)

Version

7.1.0

Build type

None

Browser

Chrome

Operating system

MacOS

Hardware wallet

No response

Additional context

No response

Severity

High severity as it's preventing users from completing transactions

@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by severity Jan 3, 2025
@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by team Jan 3, 2025
@metamaskbot metamaskbot added external-contributor regression-prod-7.1.0 Regression bug that was found in production in release 7.1.0 labels Jan 3, 2025
@danjm
Copy link
Contributor

danjm commented Jan 6, 2025

Thanks for the report @pedromcunha

You said this occured on version 7.1.0, I assume that was a typo. What version of the extension were you using when you experienced this bug?

@pedromcunha
Copy link
Author

Sorry I should have written 12.9.3

@jiexi
Copy link
Contributor

jiexi commented Jan 6, 2025

@DanielTech21 DanielTech21 added the Sev1-high High severity; partial loss of service with severe impact upon users, with no workaround. label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external-contributor regression-prod-7.1.0 Regression bug that was found in production in release 7.1.0 Sev1-high High severity; partial loss of service with severe impact upon users, with no workaround. team-wallet-api-platform type-bug
Projects
Status: To be fixed
Status: To be fixed
Development

No branches or pull requests

7 participants
@jiexi @pedromcunha @danjm @metamaskbot @DanielTech21 and others