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]: Multichain - when there are three unapproved transactions across different networks, confirming the first one causes MetaMask to break with an error: 'Message: Minified React error #185; ...' #25596

Closed
sleepytanya opened this issue Jun 29, 2024 · 9 comments
Labels
regression-RC-12.0.0 release-blocker This bug is blocking the next release Sev2-normal Normal severity; minor loss of service or inconvenience. team-wallet-ux type-bug

Comments

@sleepytanya
Copy link
Contributor

sleepytanya commented Jun 29, 2024

Describe the bug

When there are three unapproved transactions across different networks, confirming the first one causes MetaMask to break with an error: Message: Minified React error #185; visit https://reactjs.org/docs/error-decoder.html?invariant=185 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
STX toggle is OFF.
Latest v12.0.0 build

Expected behavior

Screenshots/Recordings

err.mov
Screenshot 2024-06-29 at 02 08 41

Steps to reproduce

  1. Connect to Polygon on Uniswap
  2. Connect to BNB Chain on Pancakeswap
  3. Connect to Linea on Sushiswap
  4. Start a transaction on Uniswap, do not approve
  5. Start a transaction on Sushiswap, do not approve
  6. Start a transaction on Pancakeswap
  7. Blue badge on MetaMask icon displays '3' transaction
  8. Access the first transaction (created on Polygon) and confirm it
  9. See the error

Error messages or log output

No response

Version

12.0.0

Build type

None

Browser

Chrome

Operating system

MacOS

Hardware wallet

No response

Additional context

No response

Severity

No response

@sleepytanya sleepytanya changed the title [Bug]: Multichain - when there are three unapproved transactions across different networks, confirming the first one causes MetaMask to break with an error: 'Message: Minified React error #185; visit https://reactjs.org/docs/error-decoder.html?invariant=185 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.' [Bug]: Multichain - when there are three unapproved transactions across different networks, confirming the first one causes MetaMask to break with an error: 'Message: Minified React error #185; ...' Jun 29, 2024
@sleepytanya
Copy link
Contributor Author

sleepytanya commented Jun 29, 2024

Another scenario where the Minified React error #185 doesn't happen and second transaction is created (and submitted) on the wrong network. Sometimes one of the three txs is not submitted (can't be seen in the Activity list).

  1. Start tx on BNB Chain (Pancakeswaps), do not approve
  2. Start tx on Linea (Sushiswaps), do not approve
  3. Start tx on Ethereum (Uniswap)
  4. Approve first transaction (BNB)
  5. MM popup showing next tx on Ethereum (nonce 1835 in the video, the amount (0.000 000 1) matches second tx, confirmation page shows sushi.com) confirm this transaction
  6. MM popup shows third transaction (nonce 1836, amount and dapp match the third transaction)
  7. Within the Activity you can see 1 tx on BNB Chain (I think I had 1 previous tx on BNB), two txs on Ethereum, no transactions on Linea.
twoOnSameNet.mov

First tx:

firstTx

Second tx:

secondTx

Third tx:

thirdTx

@sleepytanya
Copy link
Contributor Author

sleepytanya commented Jul 1, 2024

The bug is present in this v12.0.0 build as well: #25098 (comment)

Only two txs submitted:

3tx.mov

@seaona seaona added the release-blocker This bug is blocking the next release label Jul 1, 2024
@gauthierpetetin gauthierpetetin added the Sev2-normal Normal severity; minor loss of service or inconvenience. label Jul 1, 2024
@darkwing
Copy link
Contributor

darkwing commented Jul 1, 2024

I merged a PR for this exact scenario last week. 🤔. Will track this down ASAP #25536

darkwing added a commit that referenced this issue Jul 2, 2024
…dRequestCount (#25614)

## **Description**

There's a case where there could be a race condition between the
`QueuedRequestController`'s network switching and the Routes' network
switching. The root issue is that the use of `getUnapprovedTransactions`
only gets transactions on the `current` chain, thus triggering Routes to
switch networks once the last transaction of the current chain is done,
but there could be more transactions on other chains which we should
allow QRC to handle network switching for.

Thus, this PR lets QRC control network switching until there are
absolutely no transactions or queued requests left.

[This PR includes an
**E2E](#25536 for
the scenario where there are multiple queued transactions but since this
is a race issue, it's difficult to reproduce in a provable E2E

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25614?quickstart=1)

## **Related issues**

Possibly related:
#25596

## **Manual testing steps**

1. Open `Tab 1`, connect to `Uniswap` on `Ethereum Mainnet`
2. Open `Tab 2`, connect to `PancakeSwap` on `BNB Chain`
3. Open `Tab 3`, connect to `Test Dapp` on `Sepolia`
4. Initiate a swap on `Tab 1` and `Tab 2` *BUT DO NOT CONFIRM IT, JUST
MOVE ON TO THE NEXT TAB*
5. Initiate a send on `Tab 3` *BUT DO NOT CONFIRM IT*
6. On the confirmation screen, you should still see the first
confirmation from `Tab 1` (`Uniswap`) on `Ethereum Mainnet`; confirm or
reject it. See the confirmation window close
7. A new confirmation popup should come up with the `PancakeSwap`/ `Tab
2` confirmation on `BNB` chain; confirm or reject it. See the
confirmation window close
8. See one last confirmation screen pop up for the `Tab 3` / `Test Dapp`
send on `Sepolia`. Confirm or reject it.

Create transactions on different networks, reject and/or confirm them,
click around between popup and notification window, ensure nothing
unexpected occurs


## **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
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.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.
darkwing added a commit that referenced this issue Jul 2, 2024
…dRequestCount (#25614)

## **Description**

There's a case where there could be a race condition between the
`QueuedRequestController`'s network switching and the Routes' network
switching. The root issue is that the use of `getUnapprovedTransactions`
only gets transactions on the `current` chain, thus triggering Routes to
switch networks once the last transaction of the current chain is done,
but there could be more transactions on other chains which we should
allow QRC to handle network switching for.

Thus, this PR lets QRC control network switching until there are
absolutely no transactions or queued requests left.

[This PR includes an
**E2E](#25536 for
the scenario where there are multiple queued transactions but since this
is a race issue, it's difficult to reproduce in a provable E2E

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25614?quickstart=1)

## **Related issues**

Possibly related:
#25596

## **Manual testing steps**

1. Open `Tab 1`, connect to `Uniswap` on `Ethereum Mainnet`
2. Open `Tab 2`, connect to `PancakeSwap` on `BNB Chain`
3. Open `Tab 3`, connect to `Test Dapp` on `Sepolia`
4. Initiate a swap on `Tab 1` and `Tab 2` *BUT DO NOT CONFIRM IT, JUST
MOVE ON TO THE NEXT TAB*
5. Initiate a send on `Tab 3` *BUT DO NOT CONFIRM IT*
6. On the confirmation screen, you should still see the first
confirmation from `Tab 1` (`Uniswap`) on `Ethereum Mainnet`; confirm or
reject it. See the confirmation window close
7. A new confirmation popup should come up with the `PancakeSwap`/ `Tab
2` confirmation on `BNB` chain; confirm or reject it. See the
confirmation window close
8. See one last confirmation screen pop up for the `Tab 3` / `Test Dapp`
send on `Sepolia`. Confirm or reject it.

Create transactions on different networks, reject and/or confirm them,
click around between popup and notification window, ensure nothing
unexpected occurs


## **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
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.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.
@darkwing
Copy link
Contributor

darkwing commented Jul 2, 2024

I can no longer reproduce any of these issues after this PR.#25641

darkwing added a commit that referenced this issue Jul 3, 2024
…hainId doesn't match current chainId (#25634)

## **Description**

This PR adds a safety rail to the confirmation screen such that an error
is thrown if the user is seeing a confirmation for a transaction
triggered on another chain.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25634?quickstart=1)

## **Related issues**

Related:  #25596

## **Manual testing steps**

1. This state should be impossible to get to via the UI, thus no
reasonable manual testing steps. Unit test included.

## **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
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.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.
darkwing added a commit that referenced this issue Jul 3, 2024
…hainId doesn't match current chainId (#25634)

## **Description**

This PR adds a safety rail to the confirmation screen such that an error
is thrown if the user is seeing a confirmation for a transaction
triggered on another chain.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25634?quickstart=1)

## **Related issues**

Related:  #25596

## **Manual testing steps**

1. This state should be impossible to get to via the UI, thus no
reasonable manual testing steps. Unit test included.

## **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
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.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.
@sleepytanya
Copy link
Contributor Author

sleepytanya commented Jul 4, 2024

@darkwing

I think popup behavior looks acceptable for now? (correct me if I'm wrong). I don't see any errors in all scenarios I've tried.

multipleUnapproved.mov

@bschorchit
Copy link

Popup behavior above is being addressed by this PR: #25619

@bschorchit
Copy link

Should we close this issue since it was reported to be fixed by this PR: #25641 ?

@sleepytanya
Copy link
Contributor Author

@bschorchit I think so!

@darkwing
Copy link
Contributor

darkwing commented Jul 9, 2024

Closing with Tanya's recommendation.

@darkwing darkwing closed this as completed Jul 9, 2024
danjm pushed a commit that referenced this issue Jul 9, 2024
…orks and QueuedRequestCount (#25614) (#25641)

## **Description**

There's a case where there could be a race condition between the
`QueuedRequestController`'s network switching and the Routes' network
switching. The root issue is that the use of `getUnapprovedTransactions`
only gets transactions on the `current` chain, thus triggering Routes to
switch networks once the last transaction of the current chain is done,
but there could be more transactions on other chains which we should
allow QRC to handle network switching for.

Thus, this PR lets QRC control network switching until there are
absolutely no transactions or queued requests left.

[This PR includes an
**E2E](#25536 for
the scenario where there are multiple queued transactions but since this
is a race issue, it's difficult to reproduce in a provable E2E

[![Open in GitHub

Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25614?quickstart=1)

## **Related issues**

Possibly related:
#25596

## **Manual testing steps**

1. Open `Tab 1`, connect to `Uniswap` on `Ethereum Mainnet`
2. Open `Tab 2`, connect to `PancakeSwap` on `BNB Chain`
3. Open `Tab 3`, connect to `Test Dapp` on `Sepolia`
4. Initiate a swap on `Tab 1` and `Tab 2` *BUT DO NOT CONFIRM IT, JUST
MOVE ON TO THE NEXT TAB*
5. Initiate a send on `Tab 3` *BUT DO NOT CONFIRM IT*
6. On the confirmation screen, you should still see the first
confirmation from `Tab 1` (`Uniswap`) on `Ethereum Mainnet`; confirm or
reject it. See the confirmation window close
7. A new confirmation popup should come up with the `PancakeSwap`/ `Tab
2` confirmation on `BNB` chain; confirm or reject it. See the
confirmation window close
8. See one last confirmation screen pop up for the `Tab 3` / `Test Dapp`
send on `Sepolia`. Confirm or reject it.

Create transactions on different networks, reject and/or confirm them,
click around between popup and notification window, ensure nothing
unexpected occurs


## **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
Extension Coding

Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.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.


<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25641?quickstart=1)

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **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
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.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.
danjm pushed a commit that referenced this issue Jul 10, 2024
…hainId doesn't match current chainId (#25634)

## **Description**

This PR adds a safety rail to the confirmation screen such that an error
is thrown if the user is seeing a confirmation for a transaction
triggered on another chain.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25634?quickstart=1)

## **Related issues**

Related:  #25596

## **Manual testing steps**

1. This state should be impossible to get to via the UI, thus no
reasonable manual testing steps. Unit test included.

## **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
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.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
regression-RC-12.0.0 release-blocker This bug is blocking the next release Sev2-normal Normal severity; minor loss of service or inconvenience. team-wallet-ux type-bug
Projects
Archived in project
Development

No branches or pull requests

5 participants