MetaMask / metamask-mobile

Mobile web browser providing access to websites that use the Ethereum blockchain
https://metamask.io
Other
2.14k stars 1.1k forks source link

[Bug]: Nonce not updated after Speed Up and a pending Transaction #7312

Open seaona opened 1 year ago

seaona commented 1 year ago

Describe the bug

Problem: whenever I perform a transaction with low gas, and before being Confirmed, I perform another transaction, if I then Speed Up the first one, once they are both Confirmed, the next transaction I trigger will have an incorrect nonce value (1 less than expected). Example:

Expected behavior

Nonce should be updated always to the correct last value

Screenshots

https://github.com/MetaMask/metamask-mobile/assets/54408225/ee876c90-ca8c-43d2-a624-d1245088a239

Steps to reproduce

  1. Enable Nonce from Advanced Settings
  2. Perform a Send tx with low gas so it's not confirmed immediately
  3. Perform a Send tx with normal gas values, without first transaction being confirmed
  4. Speed up the first transactions
  5. Once 2 transactions are confirmed, initiate another Send tx
  6. See how nonce is not updated to the last value
  7. Try to perform the tx
  8. Get incorrect nonce error

Error messages or log output

No response

Version

main (possibly an old issue)

Build type

None

Device

Pixel 6

Operating system

Android

Additional context

No response

Severity

No response

github-actions[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 7 days. Thank you for your contributions.

github-actions[bot] commented 9 months ago

This issue was closed because there has been no follow activity in 7 days. If you feel this was closed in error please provide evidence on the current production app in a new issue or comment in the existing issue to a maintainer. Thank you for your contributions.

OGPoyraz commented 8 months ago

It correctly calculate the nonce on "Send tx" screen, and I was able to get tx confirmed properly. @sleepytanya may I ask if you could try this as well?

sleepytanya commented 8 months ago

@OGPoyraz I can consistently reproduce this bug. MetaMask v7.12.3, real Samsung device, custom nonce is enabled:

https://github.com/MetaMask/metamask-mobile/assets/104780023/711fca28-07dd-48cc-808c-9b7659ebff0c

OGPoyraz commented 8 months ago

This is 7.12.5 (current main) with iOS physical device. https://github.com/MetaMask/metamask-mobile/assets/7644512/b850f03b-320f-4873-a72e-9e7186000ec1

@sleepytanya as a last resort, could you please test it on latest version as well? (7.12.5) If you see the issue again then it could be Android issue (chances are low) so I could pass it to @vinistevam

sleepytanya commented 8 months ago

Current 7.12.5 physical Android device(still see the nonce error):

https://github.com/MetaMask/metamask-mobile/assets/104780023/2a54990f-a8cd-4291-86df-bea2150c910d

sleepytanya commented 8 months ago

Another physical Android, MetaMask 7.12.5 - the error:

https://github.com/MetaMask/metamask-mobile/assets/104780023/360f581d-baed-4ad7-98fa-159ec7f424c8

vinistevam commented 8 months ago

After a few tries I managed to reproduce it, on the latest release 7.12.5, however, not in the dev build even using the release branch 7.12.5 I can't reproduce it. I assume that locally the nonce is set to the latest tx nonce even if it is a lower nonce. I'm still investigating where is the place that is saving the nonce without checking if a higher nonce was saved previously.

https://github.com/MetaMask/metamask-mobile/assets/45455812/b0732f3b-1a1a-4dd4-b2b4-b9297c5c6213

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 7 days. Thank you for your contributions.

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 7 days. Thank you for your contributions.