interface icon indicating copy to clipboard operation
interface copied to clipboard

Dropped transaction appear as "Pending" in Uniswap UI

Open tarekskr opened this issue 4 years ago • 16 comments

Bug Description If a transaction is dropped (by sending another one with more gas and same nonce), Uniswap will keep showing this transaction as "Pending"

Steps to Reproduce

  1. Using MetaMask, swap any asset using low Gwei
  2. Speed up transaction in MetaMask
  3. After new transaction is confirmed, check Uniswap UI. It will keep showing transaction as pending.

Expected Behavior Transaction should appear as "Dropped" instead of "Pending.

tarekskr avatar Aug 02 '20 05:08 tarekskr

Experiencing same.

sb777 avatar Aug 03 '20 22:08 sb777

Potential fix could be:

  • keep the account transaction count synced on a per-block basis
    • this transaction count may (or may not) just be eth_getTransactionCount in the case of smart wallets. we will need to read the nonce for smart contract wallets from the store.
    • ideally read this transaction count using a contract via multicall (useSingleContractCall)
  • store the transaction count at the time a transaction is submitted
  • if the account transaction count exceeds the transaction nonce, but the transaction has no receipt, we can assume it was dropped (show a question mark, or indicate that it was cancelled, from the transaction status modal)

moodysalem avatar Oct 01 '20 15:10 moodysalem

@moodysalem

  1. I'm not familiar w/ practical usage of smart contract wallets (and thus implications here) why might getTransactionCount not return the correct nonce in that case?
  2. Having trouble finding info on multicall, link me?

I wrote a dumb solution to this, but I initially assumed any tx of the same nonce would be necessarily a case of RBF, but that's not necessarily true. Will think about this more tomorrow.

JFrankfurt avatar Oct 02 '20 06:10 JFrankfurt

  • I'm not familiar w/ practical usage of smart contract wallets (and thus implications here) why might getTransactionCount not return the correct nonce in that case?

I don't know if internal transactions (i.e. messages) are included in eth_getTransactionCount

Having trouble finding info on multicall, link me?

Multicall is here

We use multicall to fetch all contract data, see for example https://github.com/Uniswap/uniswap-interface/blob/master/src/hooks/useCurrentBlockTimestamp.ts

It would be great if we could fetch the transaction count via a contract call (similar to how we detect Argent here)

moodysalem avatar Oct 02 '20 06:10 moodysalem

Bug Description If a transaction is dropped (by sending another one with more gas and same nonce), Uniswap will keep showing this transaction as "Pending"

Steps to Reproduce

  1. Using MetaMask, swap any asset using low Gwei
  2. Speed up transaction in MetaMask
  3. After new transaction is confirmed, check Uniswap UI. It will keep showing transaction as pending.

Expected Behavior Transaction should appear as "Dropped" instead of "Pending.

I am having this same problem. What did you do to solve it?

yield-farmer-jamie avatar Oct 30 '20 03:10 yield-farmer-jamie

I am having this same problem. What did you do to solve it?

@yield-farmer-jamie I believe there will be a "reset" button that will reset all pending transactions to zero.

tarekskr avatar Oct 30 '20 04:10 tarekskr

General solution would be using something like the Etherscan API or others (maybe infura logs) to find and display complete Uniswap V2/V1 transaction history

moodysalem avatar Jan 30 '21 03:01 moodysalem

If you monitor the stream of incoming blocks you can check each for a transaction with the nonce in question. Alternatively, on new latest block you can check the user's nonce to see if it is still less than the pending transaction's nonce.

MicahZoltu avatar Jan 30 '21 03:01 MicahZoltu

If you monitor the stream of incoming blocks you can check each for a transaction with the nonce in question. Alternatively, on new latest block you can check the user's nonce to see if it is still less than the pending transaction's nonce.

Similar to the previously suggested solution, checking the transaction count of the user. I tried implementing this at one point and ran into subtle issues but it's worth a second try.

moodysalem avatar Jan 30 '21 03:01 moodysalem

General solution would be using something like the Etherscan API or others (maybe infura logs) to find and display complete UniSwap V2/V1 transaction history

This is the suggestion that I would have put forward. Using the Etherscan API would have two big benefits:

  1. UI could display more detailed logs on pending transactions, duplicate nonces, etc. This would persist even when switching wallets through your client.
  2. If you clear your MetaMask (or other wallet) logs, you can view the current state of your account.

I don't even think the UniSwap log should necessarily even be limited to just UniSwap transactions. Ex: I make a UniSwap transaction (nonce=50), then interact with another DApp (nonce=51), then go back to UniSwap to add another Tx to the queue (nonce=52). If (while) I'm waiting for the transaction to get confirmed, UniSwap currently will only show nonce[50,52]. This isn't ideal as MetaMask often requires a reset, meaning more work for the user. I will try to use either Etherscan's API or monitoring the blockstream to get an output that looks something like this:

image

heyJonBray avatar Mar 20 '21 01:03 heyJonBray

having this same problem. how to solve it?

CivelXu avatar Mar 26 '21 16:03 CivelXu

@tarekskr has this been fixed?

JFrankfurt avatar Sep 21 '21 17:09 JFrankfurt

@JFrankfurt apologies, I accidentally closed this. Reopened now.

tarekskr avatar Sep 21 '21 17:09 tarekskr

I'm having this exact issue right now. The Uniswap won't let me approve until the Pending transaction has completed but the hash doesn't exist on Etherscan as I cancelled the transaction in MetaMask. Any solution?

trendespresso avatar Apr 08 '23 05:04 trendespresso

Clear your cache and cookies for uniswap. That fixes it

miaouxtoo avatar May 10 '23 04:05 miaouxtoo

Revoke the token approval for Uniswap. Everything will start over agin. It worked for me.

denkeni avatar Aug 04 '23 04:08 denkeni