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

refactor: remove global network from transaction controller #12321

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Nov 17, 2024

Description

Upgrade @metamask/transaction-controller to remove all usages of the global network.

Specifically:

  • Create global network utils including:
    • getGlobalChainId
    • getGlobalNetworkClientId
    • getGlobalEthQuery
  • Add networkClientId to calls to:
    • addTransaction
    • estimateGas
    • getNonceLock
    • startIncomingTransactionPolling
    • updateIncomingTransactions
  • Update calls to:
    • getTransactions
    • wipeTransactions
  • Add networkClientId to Redux transaction object.
  • Add networkClientId to Stake type in StakeContext.
  • Add networkClientId argument to transaction utils:
    • getMethodData
    • isSmartContractAddress
  • Add networkClientId to test data.

Related issues

Fixes: #3499

Manual testing steps

Full regression of all transaction flows.

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.

Include network client ID in addTransaction calls.
Include network client ID in updateIncomingTransactions calls.
Include network client Id in getNetworkNonce calls.
Update calls to wipeTransactions.
Create global network utils.
Move getGlobalEthQuery to global network utils.
Add network client ID to test data.
@metamaskbot metamaskbot added the team-confirmations Push issues to confirmations team label Nov 17, 2024
Fix Yarn duplication.
@matthewwalsh0 matthewwalsh0 added the Run Smoke E2E Triggers smoke e2e on Bitrise label Nov 17, 2024
Copy link

socket-security bot commented Nov 17, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/[email protected] network 0 264 kB metamaskbot

🚮 Removed packages: npm/@metamask/[email protected]

View full report↗︎

@matthewwalsh0 matthewwalsh0 added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Nov 18, 2024
Copy link
Contributor

github-actions bot commented Nov 18, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 93dde7c
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/743430ce-5215-4107-882e-c4cf472944c3

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 added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label Nov 19, 2024
@MetaMask MetaMask deleted a comment from sonarcloud bot Nov 19, 2024
@MetaMask MetaMask deleted a comment from github-actions bot Nov 19, 2024
@matthewwalsh0 matthewwalsh0 added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Nov 19, 2024
Copy link
Contributor

github-actions bot commented Nov 19, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 753e7a4
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/b04c4fe3-cdd6-47ad-a83a-2cc9e3980695

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

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

Copy link

sonarcloud bot commented Nov 19, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
57.4% Coverage on New Code (required ≥ 60%)

See analysis details on SonarQube Cloud

@matthewwalsh0 matthewwalsh0 added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Nov 19, 2024
Copy link
Contributor

github-actions bot commented Nov 19, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 0ec8217
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/3914c865-c651-46f7-a9ce-ac9b1edcb5ed

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 requested review from a team as code owners November 19, 2024 13:44
@sleepytanya
Copy link
Contributor

sleepytanya commented Nov 19, 2024

Bitrise QA builds https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/256a579f-cde8-4d78-a063-4c08f56d1da8?tab=workflows

  1. Speed up / Cancel /queueing work normally

  2. When a user attempts to customize the transaction nonce, the nonce values are displayed as "Undefined" or "Not a Number":

Screenshot 2024-11-19 at 22 15 23

iOS

iosNonce.mov

Android

androidNonce.mov
  1. After completing several successful transactions, chainID error appears, preventing further transactions from being created, present on all Popular networks:

iOS

IMG_0311

Android

Screen_Recording_20241119_220654_MetaMask.mp4

@sleepytanya
Copy link
Contributor

@matthewwalsh0 the undefined is not an object (evaluating n.chainId) is also present in RC 7.36.0

2.mov

@sleepytanya
Copy link
Contributor

Main build https://app.bitrise.io/app/be69d4368ee7e86d/installable-artifacts/b2bf9484b6bdf580

Nonce error is not present:

Screenshot 2024-11-22 at 10 45 52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Run Smoke E2E Triggers smoke e2e on Bitrise skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants