Skip to content

Conversation

Prithpal-Sooriya
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented Aug 6, 2025

Explanation

We have had issues on Mobile where fetching native and ERC balances were cached as we were never making calls with the latest block number.

Similar to the ERC-20 balance update fix (#6197), we will now force a block tracker update to ensure we grab the latest block before making RPC calls.

Long term we need to investigate and resolve the mobile block tracker not updating issue.

  • Ideally we should have a single isolated block tracker (per chain) running to get blocks (either every block or every 20s).

References

Changelog

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, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@Prithpal-Sooriya Prithpal-Sooriya force-pushed the fix/account-tracker-controller-latest-block branch from 3380fdd to 47d6be5 Compare August 6, 2025 14:29
@Prithpal-Sooriya Prithpal-Sooriya marked this pull request as ready for review August 6, 2025 14:36
@Prithpal-Sooriya Prithpal-Sooriya requested review from a team as code owners August 6, 2025 14:36
@Prithpal-Sooriya Prithpal-Sooriya enabled auto-merge (squash) August 7, 2025 16:33
@Prithpal-Sooriya Prithpal-Sooriya merged commit a5e3c38 into main Aug 7, 2025
223 checks passed
@Prithpal-Sooriya Prithpal-Sooriya deleted the fix/account-tracker-controller-latest-block branch August 7, 2025 16:39
@amitabh94 amitabh94 mentioned this pull request Aug 7, 2025
4 tasks
amitabh94 added a commit that referenced this pull request Aug 8, 2025
## Explanation

Bumps @metamask/assets-controllers to 73.1.0 to add comprehensive
balance selectors for multichain account groups and wallets, along with
dependency updates and bug fixes.

## References

- [#6235](#6235) - Comprehensive
balance selectors for multichain account groups and wallets
- [#6248](#6248) - Bump keyring-api
dependency
- [#6242](#6242) - Fix
DeFiPositionsController polling rate
- [#6250](#6250) - Fix
AccountTrackerController cache invalidation

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by updating changelogs
for packages I've changed, highlighting breaking changes as necessary
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Aug 8, 2025
…alls (#18092)

## **Description**

Fixes an issue where the native token balances were not updating.

Also updated the `AccountTrackerController.refresh` calls we make.

The controller patch will be removed once this core package change is
released
MetaMask/core#6250

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: fix: native token balance updates and optimise
controller calls

## **Related issues**

Fixes: #17958

## **Manual testing steps**

Please test native token transfers.

1. On extension, send tokens between accounts
2. On mobile, do you see the native token update after <3 min? Does the
"swipe to refresh" update the native token?

## **Screenshots/Recordings**

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

### **Before**

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


https://www.loom.com/share/4e09abee586a46bfb584b9ae5adfc7c2?sid=1596d3dc-7e5a-4552-8ac2-bd1c6d9b7420

### **After**


https://www.loom.com/share/f17e067b35d74e71a1002bf177844b8f?sid=72499fc2-a31a-4cc9-b9db-5fd500343a5c

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

## **Pre-merge author checklist**

- [x] 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).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] 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.
runway-github bot added a commit to MetaMask/metamask-mobile that referenced this pull request Aug 8, 2025
…ler calls (#18092)

## **Description**

Fixes an issue where the native token balances were not updating.

Also updated the `AccountTrackerController.refresh` calls we make.

The controller patch will be removed once this core package change is
released
MetaMask/core#6250

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: fix: native token balance updates and optimise
controller calls

## **Related issues**

Fixes: #17958

## **Manual testing steps**

Please test native token transfers.

1. On extension, send tokens between accounts
2. On mobile, do you see the native token update after <3 min? Does the
"swipe to refresh" update the native token?

## **Screenshots/Recordings**

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

### **Before**

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


https://www.loom.com/share/4e09abee586a46bfb584b9ae5adfc7c2?sid=1596d3dc-7e5a-4552-8ac2-bd1c6d9b7420

### **After**


https://www.loom.com/share/f17e067b35d74e71a1002bf177844b8f?sid=72499fc2-a31a-4cc9-b9db-5fd500343a5c

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

## **Pre-merge author checklist**

- [x] 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).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] 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.
runway-github bot added a commit to MetaMask/metamask-mobile that referenced this pull request Aug 8, 2025
…ler calls (#18092)

## **Description**

Fixes an issue where the native token balances were not updating.

Also updated the `AccountTrackerController.refresh` calls we make.

The controller patch will be removed once this core package change is
released
MetaMask/core#6250

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: fix: native token balance updates and optimise
controller calls

## **Related issues**

Fixes: #17958

## **Manual testing steps**

Please test native token transfers.

1. On extension, send tokens between accounts
2. On mobile, do you see the native token update after <3 min? Does the
"swipe to refresh" update the native token?

## **Screenshots/Recordings**

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

### **Before**

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

https://www.loom.com/share/4e09abee586a46bfb584b9ae5adfc7c2?sid=1596d3dc-7e5a-4552-8ac2-bd1c6d9b7420

### **After**

https://www.loom.com/share/f17e067b35d74e71a1002bf177844b8f?sid=72499fc2-a31a-4cc9-b9db-5fd500343a5c

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

## **Pre-merge author checklist**

- [x] 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).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] 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.
runway-github bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Aug 8, 2025
…s and optimise controller calls (#18092)

## **Description**

Fixes an issue where the native token balances were not updating.

Also updated the `AccountTrackerController.refresh` calls we make.

The controller patch will be removed once this core package change is
released
MetaMask/core#6250

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: fix: native token balance updates and optimise
controller calls

## **Related issues**

Fixes: #17958

## **Manual testing steps**

Please test native token transfers.

1. On extension, send tokens between accounts
2. On mobile, do you see the native token update after <3 min? Does the
"swipe to refresh" update the native token?

## **Screenshots/Recordings**

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

### **Before**

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


https://www.loom.com/share/4e09abee586a46bfb584b9ae5adfc7c2?sid=1596d3dc-7e5a-4552-8ac2-bd1c6d9b7420

### **After**


https://www.loom.com/share/f17e067b35d74e71a1002bf177844b8f?sid=72499fc2-a31a-4cc9-b9db-5fd500343a5c

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

## **Pre-merge author checklist**

- [x] 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).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] 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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants