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]: MM is sending RPC requests to another custom network, aside from the one that's currently selected #17040

Closed
seaona opened this issue Dec 22, 2022 · 16 comments · Fixed by #29045
Assignees
Labels
release-12.11.0 Issue or pull request that will be included in release 12.11.0 Sev2-normal Normal severity; minor loss of service or inconvenience. team-extension-platform team-wallet-framework type-bug type-security

Comments

@seaona
Copy link
Contributor

seaona commented Dec 22, 2022

Describe the bug

Problem: after adding a custom localhost network, if I change to another network and terminate the ganache server for localhost, I still can see how requests are being send to the localhost custom network together with the requests to the currently selected network.

requests-to-other-net.mp4

Steps to reproduce

[investigating]

  1. Setup a ganache server with a different port number than the default ganache port 8546
  2. On MM, go to Add Network
  3. Add the new server pointing to localhost 8546
  4. Change to another network
  5. Terminate ganache server
  6. Observe network requests on the background console -- requests to the localhost net are still being sent, alongside with requests to the current selected network

Error messages or log output

No response

Version

10.24.0

Build type

None

Browser

Chrome

Operating system

Linux

Hardware wallet

No response

Additional context

@seaona seaona added this to the v10.24.0 milestone Dec 22, 2022
@seaona
Copy link
Contributor Author

seaona commented Dec 22, 2022

Added 10.24.0 to have eyes on it, but cannot confirm it's an RC regression. Issue is hard to repro

@hilvmason hilvmason removed this from the v10.24.0 milestone Jan 25, 2023
@danjm danjm added team-extension-platform Sev2-normal Normal severity; minor loss of service or inconvenience. labels Feb 6, 2023
@seaona
Copy link
Contributor Author

seaona commented Mar 10, 2023

Another example here:

netowrk-mix.mp4

@github-actions
Copy link
Contributor

github-actions bot commented Oct 4, 2023

This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 45 days if there is no further activity. The MetaMask team intends on reviewing this issue before close, and removing the stale label if it is still a bug. We welcome new comments on this issue. We do not intend on closing issues if they report bugs that are still reproducible. Thank you for your contributions.

@github-actions github-actions bot added the stale issues and PRs marked as stale label Oct 4, 2023
Copy link
Contributor

This issue was closed because there has been no follow up activity in the last 45 days. If you feel this was closed in error, please reopen and provide evidence on the latest release of the extension. Thank you for your contributions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2023
@seaona
Copy link
Contributor Author

seaona commented Feb 23, 2024

This issue is still happening. I just encountered it again in prod 11.10, having a Tenderly network selected, which was not working, then switching to Mainnet, and I still see failed requests being sent to Tenderly RPC

rpc-reqs-mixed.mp4

@seaona seaona reopened this Feb 23, 2024
@seaona seaona removed the stale issues and PRs marked as stale label Feb 23, 2024
@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by severity Feb 23, 2024
@gauthierpetetin
Copy link
Contributor

This duplicate ticket also provides steps to reproduce: #23415

@mcmire
Copy link
Contributor

mcmire commented Jun 11, 2024

04c2e90 (from #24861) is the commit that upgraded @metamask/network-controller to a new version that switched from eth-block-tracker to @metamask/eth-block-tracker, incorporating the fix made in MetaMask/eth-block-tracker#208. I tested the commit before this and the commit after this, and confirmed that the problem went away with that fix to @metamask/eth-block-tracker.

Closing.

@mcmire mcmire closed this as completed Jun 11, 2024
@github-project-automation github-project-automation bot moved this from To be fixed to Fixed in Bugs by severity Jun 11, 2024
@github-project-automation github-project-automation bot moved this from To be fixed to Fixed in Bugs by team Jun 11, 2024
@mcmire
Copy link
Contributor

mcmire commented Jun 11, 2024

I have confirmed that #24861 will go into 12.0.0.

@Gudahtt
Copy link
Member

Gudahtt commented Jun 20, 2024

Unfortunately I am still able to reproduce this bug even on v9.0.3 of eth-block-tracker. I was able to reproduce it using these steps:

  • Add BNB and switch to it
  • Block requests to that domain in the dev console
  • Rapidly switch back and forth between networks until I see it get into a failing loop

It's inconsistent, it can take many attempts. Usually I just see 3 failures after switching, and then it stops. But it can get stuck in an infinite loop of failures still.

@Gudahtt Gudahtt reopened this Jun 20, 2024
@github-project-automation github-project-automation bot moved this from Fixed to To be fixed in Bugs by severity Jun 20, 2024
@github-project-automation github-project-automation bot moved this from Fixed to To be fixed in Bugs by team Jun 20, 2024
@desi
Copy link
Contributor

desi commented Jun 27, 2024

Note: For reference weekly checkin recording for WF team - time 9:25 discussion around this issue.

@desi desi unassigned mcmire Jul 11, 2024
@mikesposito mikesposito self-assigned this Jul 18, 2024
@desi
Copy link
Contributor

desi commented Jul 18, 2024

@mikesposito - reference from Mark MetaMask/eth-block-tracker#163

@DDDDDanica
Copy link
Contributor

Update: this issue is still occurring on 11.16.15

network-request.mov

@mikesposito
Copy link
Member

mikesposito commented Sep 9, 2024

I'm unable to repro this on v12.1.2 - I'm trying to see if I can find the commit that potentially fixed it

EDIT: The issue is still present unfortunately, though it is not visible if background.html is used instead of a service worker (e.g. when running yarn webpack --watch

@mikesposito
Copy link
Member

This PR represents the first step to fix this: MetaMask/eth-block-tracker#284

mikesposito added a commit to MetaMask/core that referenced this issue Dec 5, 2024
## Explanation

This PR bumps `@metamask/eth-block-tracker` to `^11.0.3` across core
packages.

The only change that is being pulled is:
```
- Avoid risk of infinite retry loops when fetching new blocks ([#284](MetaMask/eth-block-tracker#284))
  - When the provider returns an error and `PollingBlockTracker` or `SubscribeBlockTracker` is destroyed, the promise returned by the `getLatestBlock` method will be rejected.
  ```

Related to: MetaMask/metamask-extension#17040
## 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
-->

## Changelog

<!--
If you're making any consumer-facing changes, list those changes here as if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or FIXED. For security-related issues, follow the Security Advisory process.)

Please take care to name the exact pieces of the API you've added or changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests, you may replace the template below with "None".
-->

### `@metamask/network-controller`

- **CHANGED**: Bump `@metamask/eth-block-tracker` from `^11.0.2` to `^11.0.3`

## 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 highlighted breaking changes using the "BREAKING" category above as appropriate
- [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
mikesposito added a commit to MetaMask/core that referenced this issue Dec 6, 2024
…5037)

## 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?
-->
Bumping `@metamask/eth-json-rpc-middleware` from `^15.0.0` to `^15.0.1`
```
### Changed
- Bump `@metamask/eth-block-tracker` from `^11.0.1` to `^11.0.3` ([#347](MetaMask/eth-json-rpc-middleware#347))
```

## 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
-->
* Related to MetaMask/metamask-extension#17040

## Changelog

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

### `@metamask/network-controller`

- **CHANGED**: Bump `@metamask/eth-json-rpc-middleware` from `^15.0.0`
to `^15.0.1`


## 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 highlighted breaking changes using the "BREAKING" category
above as appropriate
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
shane-t pushed a commit to MetaMask/core that referenced this issue Dec 6, 2024
…5037)

## 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?
-->
Bumping `@metamask/eth-json-rpc-middleware` from `^15.0.0` to `^15.0.1`
```
### Changed
- Bump `@metamask/eth-block-tracker` from `^11.0.1` to `^11.0.3` ([#347](MetaMask/eth-json-rpc-middleware#347))
```

## 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
-->
* Related to MetaMask/metamask-extension#17040

## Changelog

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

### `@metamask/network-controller`

- **CHANGED**: Bump `@metamask/eth-json-rpc-middleware` from `^15.0.0`
to `^15.0.1`


## 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 highlighted breaking changes using the "BREAKING" category
above as appropriate
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
github-merge-queue bot pushed a commit that referenced this issue Dec 18, 2024
…#29045)

<!--
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?
-->
This PR bumps `@metamask/network-controller` and
`@metamask/eth-json-rpc-middleware` by a patch version to fix an issue
related to `@metamask/eth-block-tracker`, used to listen to new blocks
emitted by networks.

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

## **Related issues**

Fixes: #17040

## **Manual testing steps**

This only applies to views that show a single chain: since now the
wallet home shows all networks, requests will be fired regardless of the
globally selected network. To test this, the chain filter in the home
should be set to a specific chain, instead of all

1. Add a local ganache network 
2. Turn off the local ganache server
3. Observe requests failing when navigating to the home of the wallet
(while showing all networks)
4. Filter a single chain which is not the local one (e.g. mainnet)
5. Polling to localhost should stop

## **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/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-extension/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.
@github-project-automation github-project-automation bot moved this from To be fixed to Fixed in Bugs by team Dec 18, 2024
@metamaskbot metamaskbot added the release-12.11.0 Issue or pull request that will be included in release 12.11.0 label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-12.11.0 Issue or pull request that will be included in release 12.11.0 Sev2-normal Normal severity; minor loss of service or inconvenience. team-extension-platform team-wallet-framework type-bug type-security
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

14 participants