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: Max approval and array value spending cap bugs #27573

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

pedronfigueiredo
Copy link
Contributor

@pedronfigueiredo pedronfigueiredo commented Oct 2, 2024

Description

This PR fixes two bugs.

The first happens when the user approves a token for the max amount. This value is decoded by sourcify and is tipically expressed in scientific notation. However, this number has more than 15 significant digits. The fix is to coerce the number to a string (also accepted by bignumber js), forcing it to be expressed with 15 significant digits only.

Screenshot 2024-10-02 at 17 26 55

The second bug happens because sometimes the decoded data from sourcify expresses a value of a param as an array of elements. An exception was added to the param lookup, so that we don't try to use an array value as the spending cap to be displayed.

Screenshot 2024-10-02 at 17 13 34

Open in GitHub Codespaces

Related issues

Fixes: #27535

Manual testing steps

First bug

  1. Go to Uniswap
  2. Select a token that hasn't been approved yet, and click to approve
  3. The app shouldn't crash

Second bug

  1. Go to https://ethereumfilm.xyz/ethereum-stories
  2. Click mint on one of the posters or mini-movies
  3. The app shouldn't crash

Screenshots/Recordings

Before

After

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.

@pedronfigueiredo pedronfigueiredo added the team-confirmations Push issues to confirmations team label Oct 2, 2024
@pedronfigueiredo pedronfigueiredo self-assigned this Oct 2, 2024
@pedronfigueiredo pedronfigueiredo requested a review from a team as a code owner October 2, 2024 16:47
Copy link
Contributor

github-actions bot commented Oct 2, 2024

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.

@pedronfigueiredo pedronfigueiredo changed the title fix: Max approval bug fix: Max approval and array value spending cap bugs Oct 2, 2024
Copy link

sonarcloud bot commented Oct 2, 2024

@metamaskbot
Copy link
Collaborator

Builds ready [ef82e3e]
Page Load Metrics (1876 ± 99 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint25624141802410197
domContentLoaded14452399185019895
load14532402187620699
domInteractive176931147
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 39 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@pedronfigueiredo pedronfigueiredo added this pull request to the merge queue Oct 3, 2024
Merged via the queue into develop with commit 537b3fe Oct 3, 2024
90 checks passed
@pedronfigueiredo pedronfigueiredo deleted the pnf/27535 branch October 3, 2024 14:26
@github-actions github-actions bot locked and limited conversation to collaborators Oct 3, 2024
@metamaskbot metamaskbot added the release-12.6.0 Issue or pull request that will be included in release 12.6.0 label Oct 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.6.0 Issue or pull request that will be included in release 12.6.0 team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Max Approval causes crash
4 participants