metamask-mobile
metamask-mobile copied to clipboard
[Bug]: ERC20 swap attempt does not succeed on Ledger account when token spending approval is required
Describe the bug
Attempted to swap an ERC20 and the approval tx was presented to the Ledger device, and was approved on network. However, the actual swap transaction was never presented to the Ledger device. This was observed both with the default Ethereum app v1.10.3 setting of blind signing off, as well as when blind signing was enabled.
Initial attempt to swap Dai to Shib approval. Then I came back and attempted to swap Dai for Shib a second time relying on that earlier approval, and was successful after enabling blind signing on the Ledger Ethereum app. Then I observed this dangling approval when I attempted to swap GRT to USDC, and was left with just the approval and the actual swap was never presented to Ledger device.
Expected behavior
User attempting an ERC20 swap should have two approvals on the Ledger device. The first for the spending approval and the second for the actual swap.
Actual results: Approval is presented for signing, but swap itself is lost and never presented on Ledger
Screenshots/Recordings
Recording: https://recordit.co/Vg7MLtediW
Steps to reproduce
- Setup MMM with an existing SRP
- Add Ledger address to MMM
- Attempt mainnet swap of an ERC20 that requires a token spending approval
- Note that approval tx is sent to Ledger, but the swap itself never appears at the Ledger device or in the MMM activity for the token being swapped out
Error messages or log output
No response
Version
7.17.0
Build type
None
Device
Iphone Xs running iOS 17.3.1
Operating system
iOS
Additional context
This occurs regardless of whether blind signing is enabled or disabled in the Ledger Ethereum app (v1.10.3 tested)
Severity
No response
related https://github.com/MetaMask/metamask-mobile/pull/8246
ios specific issue
Waiting for Gustavo's response on the expected flow to determine if valid bug
In the observed scenario on the Polygon network, an approval transaction was successfully sent to the Ledger, but the actual swap transaction did not initially proceed. This was tested using an iPhone XS running iOS 17.3.1, and the LNX device running firmware version 2.2.3.
A detailed demonstration is provided in this video, where it was necessary to initiate the swap transaction a second time, following the successful approval. It's important to note that the video's resolution does not clearly showcase the LNX device's display, but it is crucial to highlight that the LNX screen displayed the transaction as Approval and indicated the amount in the ERC20 token (AAVE) being swapped. The transaction hash provided confirms that the displayed number, although difficult to read on the LNX device in the video, matches the 0.000194 custom spend limit entered into MMM, which is accurately represented as hex in the transaction data (...b07125162000).
Observed today with a swap on Polygon, using Android 14 Pixel 5a with LNX fw 2.2.3 and eth app 1.10.3. Approval is sent to Ledger device, but the actual swap does not appear.
https://www.loom.com/share/131276669965400585bbd41f99861705?sid=20ff5692-d211-421d-a5ba-f8858cff9d79
waiting for funds to retry the sceanrio.
Update on our latest findings:
- Ledger flow is specific as it needs the confirmation modal to be displayed twice (once for approval, once for swap transaction)
- We potentially need to modify the way the ledger confirmation modal is called and we need first to fully understand how this modal is triggered from the swap flow (we probably need some help from @gantunesr on this particular point)
Update from 29th of March This is some kind of UI only issue. We need to find a way for modal to be completely dismissed before opening it again (as it's routing driven, it's quite hard to manage)
Quick update: a temporary fix has been proposed (please see link above), but:
- we may try to integrate the recommended modal component to see if it helps resolving the issue
- IMO we should not have a succession of modal displayed but just one modal that will sit on screen until both transactions are confirmed (not sure if it's feasible though)