Skip to content

Conversation

@Cal-L
Copy link
Contributor

@Cal-L Cal-L commented Jul 14, 2025

Description

This PR is originally from @Nodonisko from Margelo

This PR uses new faster memoized functions for working with address checksum.

There is already significant boost in AccountList performance and it should be even better when MetaMask/core#6054 is released and also when we fix Blockies Avatars.

Related issues

Fixes: #15560

Manual testing steps

  1. Open Account List
  2. It should feel faster than before

Screenshots/Recordings

Before

You can set that before then was lot of interrupted work before Account List modal is even displayed. It takes around ~7s from click to modal to be actually visible.

Screenshot 2025-07-03 at 21 36 06

After

Here it takes only around ~3s to mount. (still slow but much better than before)

Screenshot 2025-07-03 at 21 38 16

Pre-merge author checklist

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.

Description

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

## **Description**

This PR uses new faster memoized functions for working with address
checksum.

There is already significant boost in AccountList performance and it
should be even better when MetaMask/core#6054 is
released and also when we fix Blockies Avatars.

## **Related issues**

Fixes: #15560

## **Manual testing steps**

1. Open Account List
2. It should feel faster than before

## **Screenshots/Recordings**

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

### **Before**
You can set that before then was lot of interrupted work before Account
List modal is even displayed. It takes around ~7s from click to modal to
be actually visible.

<img width="1324" alt="Screenshot 2025-07-03 at 21 36 06"
src="https://github.com/user-attachments/assets/7c624f31-db84-4ade-9df6-a116bff9a68f"
/>


### **After**

Here it takes only around ~3s to mount. (still slow but much better than
before)

<img width="1325" alt="Screenshot 2025-07-03 at 21 38 16"
src="https://github.com/user-attachments/assets/96a5a4f1-59b7-4cfa-b58c-ac84eb238654"
/>

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

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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.
@Cal-L Cal-L requested review from a team as code owners July 14, 2025 19:08
@metamaskbot metamaskbot added the team-mobile-platform Mobile Platform team label Jul 14, 2025
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@Cal-L Cal-L added No QA Needed Apply this label when your PR does not need any QA effort. needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) no changelog required No changelog entry is required for this change labels Jul 14, 2025
@github-project-automation github-project-automation bot moved this to Needs dev review in PR review queue Jul 14, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jul 14, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 7fae5e5
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/f463a46d-66f1-46b9-866e-93668548e547

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

matthewwalsh0
matthewwalsh0 previously approved these changes Jul 15, 2025
brianacnguyen
brianacnguyen previously approved these changes Jul 16, 2025
vinnyhoward
vinnyhoward previously approved these changes Jul 17, 2025
infiniteflower
infiniteflower previously approved these changes Jul 17, 2025
@Cal-L Cal-L enabled auto-merge July 17, 2025 18:41
@Cal-L
Copy link
Contributor Author

Cal-L commented Jul 17, 2025

No need to re-run e2e since merged conflicts from main and e2e passed before

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Null Safety and Address Formatting Issues

The commit unconditionally calls toFormattedAddress with selectedAddress, which can be null or undefined, removing the prior null-safety fallback. This may cause runtime errors or unexpected behavior. Furthermore, replacing the !isNonEvmAddress check with toFormattedAddress changes the address formatting logic, potentially leading to incorrect formatting for non-EVM addresses and breaking balance lookups.

app/selectors/earnController/earn/index.ts#L192-L200

// TODO: balance logic, extract to utils then use when we are clear to add token
const formattedAddress = toFormattedAddress(selectedAddress as Hex);
const rawAccountBalance = selectedAddress
? accountsByChainId[token?.chainId as Hex]?.[formattedAddress]?.balance
: '0';
const rawStakedAccountBalance = selectedAddress
? accountsByChainId[token?.chainId as Hex]?.[formattedAddress]
?.stakedBalance
: '0';

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@sonarqubecloud
Copy link

@Cal-L Cal-L added this pull request to the merge queue Jul 22, 2025
@github-project-automation github-project-automation bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Jul 22, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 22, 2025
@Cal-L Cal-L added this pull request to the merge queue Jul 22, 2025
Merged via the queue into main with commit 55bc8a6 Jul 22, 2025
53 checks passed
@Cal-L Cal-L deleted the margelo/faster-address-checksum branch July 22, 2025 16:12
@github-actions github-actions bot locked and limited conversation to collaborators Jul 22, 2025
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Jul 22, 2025
@metamaskbot metamaskbot added the release-7.53.0 Issue or pull request that will be included in release 7.53.0 label Jul 22, 2025
@metamaskbot metamaskbot added release-7.52.0 Issue or pull request that will be included in release 7.52.0 and removed release-7.53.0 Issue or pull request that will be included in release 7.53.0 labels Sep 3, 2025
@metamaskbot
Copy link
Collaborator

Missing release label release-7.52.0 on PR. Adding release label release-7.52.0 on PR and removing other release labels(release-7.53.0), as PR was cherry-picked in branch 7.52.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no changelog required No changelog entry is required for this change No QA Needed Apply this label when your PR does not need any QA effort. release-7.52.0 Issue or pull request that will be included in release 7.52.0 team-mobile-platform Mobile Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[EPIC]: Margelo platform performance optimizations