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: fix hex to BN conversion #8734

Merged
merged 2 commits into from
Feb 27, 2024
Merged

fix: fix hex to BN conversion #8734

merged 2 commits into from
Feb 27, 2024

Conversation

salimtb
Copy link
Contributor

@salimtb salimtb commented Feb 26, 2024

Description

conversion from hex to BN doesn't work for very large numbers, because the convertHexToDecimal function uses parseInt to convert from hex to decimal, but for numbers greater than 54 digits this may send an incorrect result.

the fix was to use toHexBN function

Related issues

Fixes: #8703

Manual testing steps

  1. Click on any token where you hold a large amount
    2.Go to the received/sen activity

Screenshots/Recordings

Before

After

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.

@salimtb salimtb added team-mobile-ux DEPRECATED: please use "team-wallet-ux" label instead team-assets labels Feb 26, 2024
@salimtb salimtb requested a review from a team as a code owner February 26, 2024 19:27
Copy link
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.

@salimtb salimtb added the Run Smoke E2E Triggers smoke e2e on Bitrise label Feb 26, 2024
Copy link
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/bca0d0cf-c909-4f3d-bb9a-d78ee8f9aee1
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

Small comment

app/components/UI/TransactionElement/utils.test.js Outdated Show resolved Hide resolved
@salimtb salimtb requested a review from Cal-L February 26, 2024 20:29
Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.53%. Comparing base (4869690) to head (e2aaea3).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8734      +/-   ##
==========================================
+ Coverage   41.46%   41.53%   +0.07%     
==========================================
  Files        1264     1268       +4     
  Lines       30622    30663      +41     
  Branches     3008     3011       +3     
==========================================
+ Hits        12697    12737      +40     
  Misses      17172    17172              
- Partials      753      754       +1     

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

Copy link

sonarcloud bot commented Feb 26, 2024

@salimtb salimtb merged commit 01c6724 into main Feb 27, 2024
28 checks passed
@salimtb salimtb deleted the fix-bn-hex-conversion branch February 27, 2024 11:02
@github-actions github-actions bot locked and limited conversation to collaborators Feb 27, 2024
@metamaskbot metamaskbot added the release-7.18.0 Issue or pull request that will be included in release 7.18.0 label Feb 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.18.0 Issue or pull request that will be included in release 7.18.0 Run Smoke E2E Triggers smoke e2e on Bitrise team-assets team-mobile-ux DEPRECATED: please use "team-wallet-ux" label instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: Assertion failed
4 participants