Skip to content

[Bug]: Rounding issue in approval amount (use site suggestion)  #8199

@RanGojo

Description

@RanGojo

Describe the bug

While testing our dApp using metamask webview / metamask android, I saw that the approval transaction amount is modified by metamask even if the user clicks on "Use site suggestion".
I believe there is a rounding issue when metamask decodes and encodes the user amount.

For example, this is the tx data which is generated by dApp:

0x095ea7b300000000000000000000000069460570c93f9de5e2edbc3052bf10125f0ca22d000000000000000000000000000000000000000000000000576129d2d21d64a5

and this is the final data used by metamask even if user clicks on use site suggestion:

0x095ea7b300000000000000000000000069460570c93f9de5e2edbc3052bf10125f0ca22d000000000000000000000000000000000000000000000000576129d2d21d6400

as you can see, the amount part is slightly changed.
Expected amount based on original data: 6.296359739485676709
Metamask modified version: 6.296359739485676544

Screenshots/Recordings

None

Expected behavior

I think when user clicks on use site suggestion, dapp transaction data should not be changed.

Steps to reproduce

  1. Go to Metamask Webview
  2. Send an approval transaction with this 'data' (0x095ea7b300000000000000000000000069460570c93f9de5e2edbc3052bf10125f0ca22d000000000000000000000000000000000000000000000000576129d2d21d64a5)
  3. Click on use site suggested amount and accept the approval transaction.
  4. Final transaction data is changed by mistake to this one:
    (0x095ea7b300000000000000000000000069460570c93f9de5e2edbc3052bf10125f0ca22d000000000000000000000000000000000000000000000000576129d2d21d6400)

Error messages or log output

There is no specific error log.

Version

7.12.3

Build type

None

Device

Samsung S21

Operating system

Android

Additional context

I faced this bug in Metamask android version several times, but I'm not sure if it is only related to Metamask mobile or the android version.

Severity

It creates some bugs during the next steps of dapps transactions flow.

Metadata

Metadata

Assignees

Labels

Sev1-highAn issue that may have caused fund loss or access to wallet in the past & may still be ongoingexternal-contributorregression-prod-7.12.3Regression bug that was found in production in release 7.12.3release-7.17.0Issue or pull request that will be included in release 7.17.0team-confirmationsPush issues to confirmations teamteam-confirmations-secure-ux-deprecatedDEPRECATED: please use "team-confirmations" insteadtype-bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions