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: Permit Simulation should include decimals in fiat calculation and show tooltip if shortened #26523

Merged
merged 3 commits into from
Aug 20, 2024

Conversation

digiwand
Copy link
Contributor

@digiwand digiwand commented Aug 19, 2024

Description

Open in GitHub Codespaces

Related issues

Fixes: #26520

Manual testing steps

  1. Go to test-dapp
  2. Use ethereum mainnet network
  3. Test malicious permit

to test lengthier value:

  1. run yarn storybook
  2. go to http://localhost:6006/?path=/story/pages-confirmations-confirm-signatures-signedtypeddatav3orv4--permit-story&args=msgParams.data:3.0001231231212312e+22
  3. copy and paste the following into data
"{\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"version\",\"type\":\"string\"},{\"name\":\"chainId\",\"type\":\"uint256\"},{\"name\":\"verifyingContract\",\"type\":\"address\"}],\"Permit\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"spender\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"},{\"name\":\"nonce\",\"type\":\"uint256\"},{\"name\":\"deadline\",\"type\":\"uint256\"}]},\"primaryType\":\"Permit\",\"domain\":{\"name\":\"MyToken\",\"version\":\"1\",\"verifyingContract\":\"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC\",\"chainId\":1},\"message\":{\"owner\":\"0x935e73edb9ff52e23bac7f7e043a1ecd06d05477\",\"spender\":\"0x5B38Da6a701c568545dCfcB03FcB875f56beddC4\",\"value\":30001231231212312138768,\"nonce\":0,\"deadline\":50000000000}}"

Screenshots/Recordings

Before

After

After with tooltip showing on lengthy fiat value

Pre-merge author checklist

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.

@digiwand digiwand requested a review from a team as a code owner August 19, 2024 19:00
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.

@metamaskbot metamaskbot added the team-confirmations Push issues to confirmations team label Aug 19, 2024
Copy link

sonarcloud bot commented Aug 19, 2024

@metamaskbot
Copy link
Collaborator

Builds ready [07a02f1]
Page Load Metrics (89 ± 11 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint811711192512
domContentLoaded49151872412
load55151892411
domInteractive127033136
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 206 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented Aug 19, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 69.96%. Comparing base (81af2e8) to head (07a02f1).

Files Patch % Lines
...typed-sign/permit-simulation/permit-simulation.tsx 0.00% 2 Missing ⚠️
...ons/components/simulation-details/fiat-display.tsx 66.67% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #26523      +/-   ##
===========================================
- Coverage    69.96%   69.96%   -0.00%     
===========================================
  Files         1405     1405              
  Lines        48996    49000       +4     
  Branches     13697    13699       +2     
===========================================
+ Hits         34280    34282       +2     
- Misses       14716    14718       +2     

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

@digiwand digiwand added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Aug 20, 2024
@danjm danjm merged commit fc3da74 into develop Aug 20, 2024
80 checks passed
@danjm danjm deleted the fix-permit-simulation-fiat-should-calc-with-decimals branch August 20, 2024 12:51
@github-actions github-actions bot locked and limited conversation to collaborators Aug 20, 2024
@metamaskbot metamaskbot added the release-12.5.0 Issue or pull request that will be included in release 12.5.0 label Aug 20, 2024
@digiwand digiwand added rc-cherry-picked and removed release-12.5.0 Issue or pull request that will be included in release 12.5.0 labels Aug 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
rc-cherry-picked release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-confirmations Push issues to confirmations team
Projects
None yet
4 participants