Uniswap / Uniswap/interface

Got warning when sending transaction by smart contract wallet

Open
#5,776 6 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
5.5k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

Bug Description
I'm creating a smart contract wallet based on ERC-4337, the way smart contract wallet sends transaction is different from a EOA wallet. Smart Contract wallet sends the transaction to bundler then wait the transaction to be done, so the "data" property in the transaction entity will be different, too. I found the code in Uniswap/interface will check if the "data" in the returned transaction is the same with the "data" in the initial transaction, otherwise a warning will showup: Your swap was modified through your wallet. If this was a mistake, please cancel immediately or risk losing your funds.

The "data" check is on 126-131 line in the useSendSwapTransaction.tsx, could you have a check why we need this check and is it possibile to remove it? Since the mechanism of smart contract wallet won't be able to return the same "data" with the "data" in the initial transaction.

Steps to Reproduce

  1. I submitted a trsanction to bundler:
    { "gas": "0x21032", "from": "0xbe30496bc78304ffb7d8698f1051ac0b59405307", "to": "0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45", "data": "0x5ae401dc0000000000000000000000000000000000000000000000000000000063b39cb800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e404e45aaf000000000000000000000000b4fbf271143f4fbf7b91a5ded31805e42b2208d60000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f98400000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000be30496bc78304ffb7d8698f1051ac0b5940530700000000000000000000000000000000000000000000000000038d7ea4c680000000000000000000000000000000000000000000000000000004d107132bc61b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "maxFeePerGas": "0x21032", "maxPriorityFeePerGas": "0x21032", "value": "0x0" }

  2. The returned transaction info is:
    { "hash": "0x959176dccd1c7200be0038eec9ae07ba9e6e57c43d8a02262f2fb996859752d0", "type": 2, "accessList": [], "blockHash": null, "blockNumber": null, "transactionIndex": null, "confirmations": 0, "from": "0x780DA774eD5AA25Dd2E290eEA43A8CCB82d3De22", "gasPrice": { "type": "BigNumber", "hex": "0x59682f24" }, "maxPriorityFeePerGas": { "type": "BigNumber", "hex": "0x59682f00" }, "maxFeePerGas": { "type": "BigNumber", "hex": "0x59682f24" }, "gasLimit": { "type": "BigNumber", "hex": "0x989680" }, "to": "0x5C8b3e2232768d991Ea02ac8bEACaf824aEF0b7d", "value": { "type": "BigNumber", "hex": "0x00" }, "nonce": 122, "data": "0x1fad948c000000000000000000000000000000000000000000000000000000000000004000000000000000000000000021f8c63f8aa848baba3b5d4e19f879221e7a027500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000be30496bc78304ffb7d8698f1051ac0b59405307000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000001f565000000000000000000000000000000000000000000000000000000000002580000000000000000000000000000000000000000000000000000000000000249f000000000000000000000000000000000000000000000000000000000000210320000000000000000000000000000000000000000000000000000000000021032000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024480c5c7d000000000000000000000000068b3465833fb72a70ecdf485e0e4c7bd8665fc450000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001a45ae401dc0000000000000000000000000000000000000000000000000000000063b39cb800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e404e45aaf000000000000000000000000b4fbf271143f4fbf7b91a5ded31805e42b2208d60000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f98400000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000be30496bc78304ffb7d8698f1051ac0b5940530700000000000000000000000000000000000000000000000000038d7ea4c680000000000000000000000000000000000000000000000000000004d107132bc61b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000146c8ac88860fa6cebfb44c598c3e2c55cee08b734000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000008e9b3815bc1772a210f0aa3890fde0cef313c57a00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041439423925b6a0a5f1e1ec18911e7e2810a84014db23f7a6c2ed51f76d6432e107950befb4f2a1691a8ee6e3bc22c935b6fbb3380fec5d8d8ab6562503e3a90041b00000000000000000000000000000000000000000000000000000000000000", "r": "0x426235e71dea6bf09a4a97029bae090561ba52fd89213b975692751b16eb2513", "s": "0x67ac62bf36a83660f46e3843dfbad43e6c48f38f46a86c6687776f1740ad0d72", "v": 1, "creates": null, "chainId": 5 }

  3. The "data" returned is different from the initial one, so I got this warning: Your swap was modified through your wallet. If this was a mistake, please cancel immediately or risk losing your funds.

Expected Behavior
A success modal should popup since this is an expected behavior in a smart contract wallet.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in useSendSwapTransaction.tsx around lines 126-131 and trace why the returned transaction data is compared with the initial transaction data. Reproduce the comparison with the ERC-4337 transaction examples in this issue, then determine how expected smart contract wallet behavior should affect the warning. Done means the expected wallet flow shows a success modal without weakening the protection against genuinely modified swaps.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.