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

fix: revert nonce logic in transaction controller #7651

Merged
merged 1 commit into from
Oct 31, 2023

Conversation

matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Oct 31, 2023

Description

The TransactionController was recently upgraded to a version using the NonceTracker package.

This looks at local transactions for the same address and chain to determine the best nonce value.

Since the mobile client monitors incoming token transfers, this was resulting in incorrect nonce values due to the associated transactions having the from address of the account sending the balance, rather than the address of the account creating the transaction.

The temporary fix is to revert the nonce logic in the TransactionController by removing usage of the NonceTracker.

Related issues

Fixes: #7646

Manual testing steps

  1. Add account X to the wallet.
  2. Add a token balance to account X.
  3. Send an approve transaction from account X for the same token to account Y.
  4. Send a transferFrom transaction from account Y (ideally from a different wallet), that transfers the token from account X.
  5. Wait for the incoming transaction to be detected, this is not visible in the activity list but polled every ~30 seconds.
  6. Try and send any transaction from account X and confirm the nonce is not the transfer nonce from account Y + 1.

Screenshots/Recordings

Before

After

See comments.

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

@matthewwalsh0 matthewwalsh0 requested a review from a team as a code owner October 31, 2023 15:31
@matthewwalsh0 matthewwalsh0 added the team-confirmations-system DEPRECATED: please use "team-confirmations" label instead label Oct 31, 2023
Copy link
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/fcc151f8-ef03-46f8-9752-1bf17ba962fd
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

Copy link

sonarcloud bot commented Oct 31, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@seaona
Copy link
Contributor

seaona commented Oct 31, 2023

QA passed. Confirming performing a transferFrom for ERC20 and ERC721 with Account 1 (from Account 2) and then a subsequent transaction with Account 2, has the correct nonce set for both cases

erc20transferfrom.mp4
erc721transferfrom.mp4

@matthewwalsh0 matthewwalsh0 added QA Passed A successful QA run through has been done and removed QA Passed A successful QA run through has been done labels Oct 31, 2023
@matthewwalsh0 matthewwalsh0 merged commit 7469f8f into main Oct 31, 2023
40 checks passed
@matthewwalsh0 matthewwalsh0 deleted the fix/7646-nonce-errors-incoming-transactions branch October 31, 2023 22:28
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2023
@metamaskbot metamaskbot added the release-7.11.0 Issue or pull request that will be included in release 7.11.0 label Oct 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
QA Passed A successful QA run through has been done release-7.11.0 Issue or pull request that will be included in release 7.11.0 team-confirmations-system DEPRECATED: please use "team-confirmations" label instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Transaction stuck in 'Submitted' state due to nonce mishandling
5 participants