Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Speed up and replacement tx detection #10

Closed
st4cks1defl0w opened this issue Aug 15, 2021 · 1 comment · Fixed by #11
Closed

Speed up and replacement tx detection #10

st4cks1defl0w opened this issue Aug 15, 2021 · 1 comment · Fixed by #11

Comments

@st4cks1defl0w
Copy link

Problem:
When a user triggers speed-up-a-tx or cancel-a-tx option in metamask, d0x dapps using this module are unable to detect the new state and hence all UI elements keep listening to old tx forever (until it's out of mempool?), practically requiring localstorage cleanup on user side.

Solution:
I've spent some time researching d0x modules related to the issue, and found out it's best to address it in this module in ::watch-events as a hash-replacing fn.
On web3 side the issue is well-known and being worked on (web3/web3.js#3585 (comment)), however as of now there is no separate event that web3 provider can notify us of (e.g. original tx hash listener resolving with failure).

I looked for existing solutions, IMO gnosis handled it nicely via https://github.com/gnosis/safe-react/pull/2473/files, there is this findSpeedupTx function that I started to implement; basically what it does is search pending block for tx by same nonce + sender and input data (if input data diverges it's a replacement tx, not a speed-up).

tl;dr working on adding a findSpeedupTx fn to tx-watcher in this module to detect speed-up + replacement tx, based on a gnosis PR

@st4cks1defl0w st4cks1defl0w linked a pull request Aug 28, 2021 that will close this issue
@st4cks1defl0w
Copy link
Author

Forgot to link EIP (WIP) web3/web3.js#3723

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant