feat: Network & Gas & Assets & Utils controllers update
Description
-
Network Controller updated to v^17.2.0
-
Gas Fee Controller updated to v^13.0.0
-
Controller utils v^8
-
Assets Controllers v^26
-
Updated the patch of Network Controller, now it adds an export a type
-
Gas Fee Controller now uses
NetworkController:networkDidChangeevent instead ofNetworkController:stateChangeevent. -
Removed resolution for transaction controller and replaced it with a small change via patch
-
Assets Controllers already with Reservoir changes of this PR
-
Assets Controllers patch cleaner and smaller
-
Token Detection Controller and Token Balances Controller updated on Engine and Engine Service since now they extend BaseController v2
-
Added to the patch of assets controllers work around for TokenBalancesController and TokenRatesController listening the TokensController events wrongly since TokensController is not extending BaseControllerV2
Created a new core branch to follow up the assets-controllers version: patch/mobile-assets-controllers-26
Related issues
Fixes:
- https://github.com/MetaMask/mobile-planning/issues/1691
- https://github.com/MetaMask/mobile-planning/issues/1692
- https://github.com/MetaMask/mobile-planning/issues/1694
- https://github.com/MetaMask/mobile-planning/issues/1690
Manual testing steps
- Sendflow Transaction On linea sepolia
- Test dapp transaction On sepolia
- Switch networks in general
- Add custom network
- add networks from popular list
- Remove network
- Add network throught dapp
- Add tokens with auto detect feature, with token list, custom token fields and via dapp
- Added nfts with auto detect NFTS, play around with display nft media and ipfs gateway toggles to check privacy is still working as expected. Also added nft with custom fields
- Switched accounts when on dapp and check if permission systems is working (it should be able to switch accounts when switching dapp that have different accounts connected)
Screenshots/Recordings
Adding a custom network:
https://github.com/MetaMask/metamask-mobile/assets/46944231/8ac6a11f-c93e-46e6-8b62-188f7df89a02
Playing around with tokens & multiple networks (auto detect, add from dapp, custom add and add from token list):
https://github.com/MetaMask/metamask-mobile/assets/46944231/4e5d12e6-6ba7-4fba-a1ca-51d2b3c2d61c
https://github.com/MetaMask/metamask-mobile/assets/46944231/160eb191-d952-4cd4-a6a0-0687fd76095e
Dapp sepolia transaction:
https://github.com/MetaMask/metamask-mobile/assets/46944231/0acc6c90-326b-4fcf-bbaf-170873741439
Linea sepolia transcation:
https://github.com/MetaMask/metamask-mobile/assets/46944231/3fdd3e47-85d9-46d9-8fa6-9b62ce5028fd
NFT & privacy playground:
https://github.com/MetaMask/metamask-mobile/assets/46944231/9ed68b4f-06d3-41ef-93dc-ced2a1ee2c7e
Before
After
Pre-merge author checklist
- [x] I’ve followed MetaMask Coding Standards.
- [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 format if applicable
- [x] I’ve applied the right labels on the PR (see labeling guidelines). 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.
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.
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 5a53b3936b4b859bc9a4dd2c2f11ec6f0f52c535 Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/2caf62ff-44ed-47f2-87ae-201ad2d477d6
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 1780fabcbb15abfb0ff8e6696afe7b885c1677da Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/666bc4b7-eb75-4f74-a2bb-de158c000a78
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Please retry analysis of this Pull-Request directly on SonarCloud
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 0a4e7c5f57b71d5528de39fe6cc3a0184ada0e59 Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/09085ee3-591d-4321-abb4-36a3816cf36d
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
E2E is failling and it seems to be because of hexToBN function that was changed on the bump of ethereumjs-util on this PR
It seems that it was changing the BN on ethereumjs util to the bn.js library
I can see on the PR description that no change should happen from the bn change " Remove the first category by importing BN directly from bn.js instead of via ethereumjs-util. The version is the same. No user-facing changes. "
I see that we are using version ^5.1.2 on controller utils and we were on that version of ethereumjs-util , so it's probably not from this change
We also changed "stripHexPrefix" for "remove0x" This is the function strpHexPrefix
function stripHexPrefix(str) {
if (typeof str !== 'string') {
return str;
}
return isHexPrefixed(str) ? str.slice(2) : str;
}
This is the function remove0x
export function remove0x(hexadecimal: string): string {
if (hexadecimal.startsWith('0x') || hexadecimal.startsWith('0X')) {
return hexadecimal.substring(2);
}
return hexadecimal;
}
It seems we do not check on the remove0x if it's a string, that could be the reason
It was nothing to do with the BN or ethereumjs util, it is indeed because the token balances that price api is not fetching, digging into it right now
It was not the reason the E2E keeps failing will revert the patch
This is actually a bigger issue regarding ERC20, they are not big number anymore on the state TokenBalancesController contractBalances. They are now strings (it seems they are always Hexadecimal values)
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 2a70a85404ee8cb055c3494429685fed80548135 Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/bd531cce-317d-4831-ad44-5d6fd0b12b72
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 1f59d8425e0ae8296991632da186070ca392596f Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/df08bac1-9c4c-4e21-a949-891d8fa8201e
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Solved the E2E issue by discovering that it was needed to handle the state property contractBalances of TokenBalancesController, as the balance is no longer is a BN but yes a string (it is always appearing as hexadecimal)
Addressed on this commit
Recording with the fix: https://github.com/MetaMask/metamask-mobile/assets/46944231/db6bf991-55eb-4b6b-86f5-fdc2074315e3
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 41609adeb4d08e681e9c692dcee4f34d24d5342d Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/bac3e60f-1485-4024-b7a6-cc858ac62bbe
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 2e2c065d90b3f51c67cc7a1cb3ece0b9f4e6c744 Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/44262263-2680-4634-8f03-a3183f36ff6c
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: ff4544add771e5974839a33758ff06b4b8ebb5e1 Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/c934cd3c-bef1-4191-9675-e8f96a6503f5
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅
Commit hash: 3d38c2a9f1273facc94748d1caa49998e7e4f7af Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/899ba8f9-0b90-4ede-94f9-5d28d14f398f
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Created also a regression E2E build: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/97ab095e-1d38-4e76-9bf9-7da5cb7635bf
Bitrise
✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅
Commit hash: 3b83b10184171efdddda1abd72698510e5beca8b Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/907d823f-f569-4ec0-851f-1f0cdc98a84e
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅
Commit hash: 3291839fa89ffc726d20579555d844ce418b12fc Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/d89002f5-ee62-4e2e-9cfc-c66ad9dabdd5
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
| Package | New capabilities | Transitives | Size | Publisher |
|---|---|---|---|---|
| npm/@metamask/[email protected] | None | +5 |
1.29 MB | metamaskbot |
| npm/@metamask/[email protected] | None | +6 |
826 kB | metamaskbot |
| npm/@metamask/[email protected] | environment Transitive: network | +10 |
1.12 MB | metamaskbot |
| npm/@metamask/[email protected] | None | 0 |
52.5 kB | metamaskbot |
🚮 Removed packages: npm/@metamask/[email protected], npm/@metamask/[email protected], npm/@metamask/[email protected], npm/@metamask/[email protected]
Bitrise
✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅
Commit hash: 428201475f16ccd9b2d6d87030d68564eac603ba Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/5f69683d-70ab-417f-90cd-f3d880014161
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Looks good for SDK 👍
Quality Gate passed
Issues
1 New issue
0 Accepted issues
Measures
0 Security Hotspots
76.5% Coverage on New Code
0.0% Duplication on New Code
Bitrise
✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅
Commit hash: 586e3a3280de4f56049eee8f0a3815a82b4062cb Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/e8dd589c-bc62-4a9c-b25f-9b33005e0096
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request