Skip to content

fix: Rounding issue in approval amount (use site suggestion)#8485

Merged
blackdevelopa merged 9 commits into
mainfrom
8199/rounding_approve_value
Feb 6, 2024
Merged

fix: Rounding issue in approval amount (use site suggestion)#8485
blackdevelopa merged 9 commits into
mainfrom
8199/rounding_approve_value

Conversation

@blackdevelopa

@blackdevelopa blackdevelopa commented Jan 31, 2024

Copy link
Copy Markdown
Contributor

Description

There is an issue that shows that really large dapp proposed value is rounded off for approve transaction. Noticed that this happens when hexToBN value is wrapped using the Number function. This PR specifies add a boolean to prevent this for approve transactions while other use cases should act as it is.

Related issues

Fixes: #8199

Manual testing steps

  1. Enable input customisation for erc20 token. See
  2. Enter a really large value
  3. See it doesn't round off the dapp proposed value

Screenshots/Recordings

Before

https://recordit.co/l0DWAilLla

After

https://recordit.co/gEKmKf9Yq7

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.

@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@codecov-commenter

codecov-commenter commented Jan 31, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4dd9073) 40.62% compared to head (c233df5) 40.76%.
Report is 21 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8485      +/-   ##
==========================================
+ Coverage   40.62%   40.76%   +0.13%     
==========================================
  Files        1239     1242       +3     
  Lines       29989    30056      +67     
  Branches     2870     2878       +8     
==========================================
+ Hits        12182    12251      +69     
+ Misses      17109    17102       -7     
- Partials      698      703       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@blackdevelopa blackdevelopa self-assigned this Feb 2, 2024
@blackdevelopa blackdevelopa added the team-confirmations-secure-ux-PR PR from the confirmations team label Feb 2, 2024
@blackdevelopa blackdevelopa marked this pull request as ready for review February 2, 2024 11:41
@blackdevelopa blackdevelopa requested a review from a team as a code owner February 2, 2024 11:41
@blackdevelopa blackdevelopa added the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Feb 2, 2024
@github-actions

github-actions Bot commented Feb 2, 2024

Copy link
Copy Markdown
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/4f45a076-8b6d-42f4-a921-f4b8eba11879
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

Comment thread app/util/number/index.test.ts Outdated
jpuri
jpuri previously approved these changes Feb 2, 2024

@jpuri jpuri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be n ice to have more testing on this change.

Comment thread app/util/number/index.js Outdated
Comment thread app/util/number/index.js Outdated
Comment thread app/util/number/index.test.ts
Comment thread app/util/number/index.js Outdated
jpuri
jpuri previously approved these changes Feb 6, 2024
Comment thread app/util/number/index.test.ts Outdated
Comment thread app/util/number/index.test.ts Outdated

@segun segun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments to follow guidelines.

Co-authored-by: Olusegun Akintayo <akintayo.segun@gmail.com>
Co-authored-by: Olusegun Akintayo <akintayo.segun@gmail.com>
@sonarqubecloud

sonarqubecloud Bot commented Feb 6, 2024

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

1 New issue
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

@blackdevelopa blackdevelopa merged commit cc43911 into main Feb 6, 2024
@blackdevelopa blackdevelopa deleted the 8199/rounding_approve_value branch February 6, 2024 17:13
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 6, 2024
@github-actions github-actions Bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Feb 6, 2024
@metamaskbot metamaskbot added the release-7.17.0 Issue or pull request that will be included in release 7.17.0 label Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.17.0 Issue or pull request that will be included in release 7.17.0 team-confirmations-secure-ux-PR PR from the confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

7 participants