[Bug]: Passed transaction nonce is ignored #9118
Labels
external-contributor
feature-request
Feature requested by the MetaMask community
team-transactions
Transactions team
Describe the bug
At the safe wallet, we are building a speed up TX function: safe-global/safe-wallet-web#3425
We are polling the RPC for the submitted TX and if we don't find it withing X seconds we offer the option to speed that transaction up. A transaction that needs to be sped up consist of mainly of {to, data, nonce} fields. Nonce is extremely important as it has to be the same as the TX that has been already submitted.
to speed up the transaction we call:
result = await signer.sendTransaction({ to, data, ...txOptions })
This works fine with the Metamask Browser Extension, but is buggy when used with Metamask Mobile.
Metamask mobile appears to ignore the provided nonce and just increase the nonce. I've looked around the MM-Mobile code and found where the problem comes from.
There are 2 cases.
Case 1:
The user has not enabled "customize transaction nonce" in the settings.
So here despite the fact that we've passed a nonce, the transaction.nonce is being reset to undefined:
metamask-mobile/app/components/Views/confirmations/Approval/index.js
Line 412 in 0e2c734
because showCustomNonce is not true.
Please note that the Browser extension actually works fine. If we send a nonce there, it is set as the nonce of the tx that the user is executing. From our perspective the MM-Mobile behaviour is not expected
Case 2:
"customize transaction nonce" is set to true. If this option is on, the TransactionReview component renders the TransactionReviewInformation component. On DidMount this component sets the TX nonce to the next network nonce:
metamask-mobile/app/components/Views/confirmations/components/TransactionReview/TransactionReviewInformation/index.js
Line 251 in 0e2c734
this now changes the provided transaction nonce, so we effectively end up again ignoring the nonce that the Dapp has provided.
This behaviour is also diverging from the MM Browser extension, where the nonce provided by the dapp is treated as the nonce for the "custom nonce" component.
We think that this behaviour is wrong and MM Mobile should behave as the MM Browser extension
Expected behavior
Provided dapp nonce should be used for submitting the TX.
Screenshots/Recordings
No response
Steps to reproduce
Note the wallet nonce
Error messages or log output
No response
Version
7.19.0(1292)
Build type
None
Device
Iphone and Android
Operating system
Other (please elaborate in the "Additional Context" section)
Additional context
Ios and Android Problem. Happens both on the current stable versions and with a build directly from the repo.
Severity
No response
The text was updated successfully, but these errors were encountered: