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: swaps approval checking for approvals between 0 and unlimited #28680

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

jclancy93
Copy link
Contributor

@jclancy93 jclancy93 commented Nov 25, 2024

Description

For approval amounts that were greater than 0, but less than the amount the user was trying to swap. The swaps controller was filtering out quotes for users. This PR fixes a longstanding bug in the swaps controller, where we only checked if the approval amount was 0. Instead of when the approval is 0 OR approval amount is less than swap amount. This PR updates the logic to correctly reflect this case

Open in GitHub Codespaces

Related issues

Fixes issue reported in Slack here https://consensys.slack.com/archives/C0220SURQ3E/p1732474780474849

Manual testing steps

Testing wallet with seeded state:

  1. Load this wallet into your MetaMask
  2. Try and Swap 1 USDC for Polygon on Polygon
  3. Quotes should be returned

New Testing Wallet

  1. Create a swaps approval for some small amount
  2. Try and swap a larger amount
  3. Swaps quotes should be returned

Screenshots/Recordings

Before

image

After

image

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.

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.

@jclancy93 jclancy93 marked this pull request as ready for review November 25, 2024 11:43
@jclancy93 jclancy93 requested a review from a team as a code owner November 25, 2024 11:43
@metamaskbot
Copy link
Collaborator

Builds ready [84447ae]
Page Load Metrics (2098 ± 95 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint30824871999426204
domContentLoaded17852495205419292
load18222499209819895
domInteractive25199493818
backgroundConnect11100413215
firstReactRender631571112211
getState87325209
initialActions01000
loadScripts12511814149514871
setupStore765202110
uiStartup200628722338228110
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 24 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [c888749]
Page Load Metrics (1774 ± 75 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint46321441715322155
domContentLoaded15502087174214670
load15942144177415775
domInteractive245735115
backgroundConnect1182362311
firstReactRender722811304923
getState66818189
initialActions00000
loadScripts11071597128112560
setupStore614821
uiStartup174626462015211101
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 24 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link
Contributor

@infiniteflower infiniteflower left a comment

Choose a reason for hiding this comment

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

Tested and working!

@jclancy93 jclancy93 added this pull request to the merge queue Nov 25, 2024
Merged via the queue into develop with commit 42c132e Nov 25, 2024
75 checks passed
@jclancy93 jclancy93 deleted the jc/fix-swaps-approval-checking branch November 25, 2024 16:17
@github-actions github-actions bot locked and limited conversation to collaborators Nov 25, 2024
@metamaskbot metamaskbot added the release-12.9.0 Issue or pull request that will be included in release 12.9.0 label Nov 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.9.0 Issue or pull request that will be included in release 12.9.0 team-bridge team-swaps
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants