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]: Not allowed to add a new network where the symbol (ticker) consists of one letter #11217

Open
paintoshi opened this issue Sep 16, 2024 · 0 comments
Labels
external-contributor Sev2-normal An issue that may lead to users misunderstanding some limited risks they are taking team-assets type-bug Something isn't working

Comments

@paintoshi
Copy link

Describe the bug

When switching to a network that is not yet added to MM, it asks the user to add it. That works fine for any network, but not if the symbol (such as ETH) is one character long. This is a big problem with the upcoming Sonic (https://www.soniclabs.com) that will go live in Nov/Dec 2024, and may be the first network to use one-letter ticker. The ticker/symbol is S in this case.

Using $S, SS or SSS works fine, but not just S. It also works fine adding it in the chrome version of MM (or other wallets), but not in the mobile version of MM which makes me believe this is an unintended error.

I'm using the built-in browser in metamask, so I don't think this relies on the WalletConnect API since it uses the injected provider. And it fails the same way if connecting over WalletConnect from another browser.

Expected behavior

It should ask the user to add the new network, not refusing because of a short symbol.

Screenshots/Recordings

image
image

This is the expected screenshot when using a longer symbol like $S:
image

Steps to reproduce

Minimal reproduction. Maybe this sandbox won't work on mobile, but it can be downloaded and run locally. See the index.tsx under config for how the symbol is defined.
https://stackblitz.com/edit/stackblitz-starters-x16geb?file=config%2Findex.tsx

  1. Clone any chain from wagmi (or any wallet library)
  2. Change the symbol under nativeCurrency to a single letter such as S for the chain config
  3. Run a method to switch network or add network (for the example app, just connect and switch network to Sonic using the second button)
  4. Metamask will refuse to add the network unless the symbol contains 2 or more characters

Error messages or log output

Switch can be declined if chain is not supported by a wallet

Detection stage

In production (default)

Version

7.30.0 (1410)

Build type

None

Device

iPhone 14 pro max

Operating system

iOS

Additional context

The same issue can be seen on https://testnet.soniclabs.com/account when adding the testnet to MM mobile (as long as they are using symbol S).

Severity

It will be severe when the network goes live because the symbol is set to be S, but if nobody can use the network on mobile, it's a serious issue for any developer given it's very hard to track down what the cause is.

@paintoshi paintoshi added the type-bug Something isn't working label Sep 16, 2024
@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by severity Sep 16, 2024
@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by team Sep 19, 2024
@gauthierpetetin gauthierpetetin added team-assets Sev2-normal An issue that may lead to users misunderstanding some limited risks they are taking labels Oct 2, 2024
github-merge-queue bot pushed a commit that referenced this issue Nov 7, 2024
## **Description**

When adding a network with wallet_addEthereumChain, MetaMask was
requiring the chain's symbol to be minimum of 2 characters. But there
are networks with single character symbols.

## **Related issues**

- Equivalent PR on extension:
MetaMask/metamask-extension#24872
-  #11217

## **Manual testing steps**



## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external-contributor Sev2-normal An issue that may lead to users misunderstanding some limited risks they are taking team-assets type-bug Something isn't working
Projects
Status: To be fixed
Status: To be fixed
Development

No branches or pull requests

3 participants