gitcoinco / web

Grow Open Source
https://gitcoin.co
Other
1.78k stars 771 forks source link

Grants - Showing pending for dropped and replaced transactions #5741

Closed LefterisJP closed 3 years ago

LefterisJP commented 4 years ago

Describe the bug

When a transaction for a gitcoin grant is dropped and replaced by a new one the contribution is still shown as pending in the UI.

To Reproduce

Expected behavior

After a transaction has been dropped and successfully replaced I would expect it to no longer be pending in the UI.

owocki commented 4 years ago

right now we use infuras API to make sure tx's were confirmed.. ill have to double check but i dont tihnk it provides the dropped/replaced tx info

from dashboard.utils import get_web3

web3 = get_web3(network)
tx = web3.eth.getTransactionReceipt(txid)
print(tx)

yields

In [6]: from dashboard.utils import get_web3
   ...:
   ...: web3 = get_web3(network)
   ...: tx = web3.eth.getTransactionReceipt(txid)
   ...: print(tx)
   ...:
   ...:
None
owocki commented 4 years ago

hmmm etherscan API doesnt provide replacement tx info either.. https://bits.owocki.com/wbukX6rQ

LefterisJP commented 4 years ago

Handling validity of on-chain transactions can be tricky and unfortunately differs per ethereum client implementation.

If the transaction receipt of a transaction is None you have to assume it's not mined.

owocki commented 4 years ago

it'd be great if there was an easy way to get the replacment tx ID programmatically.. looks like etherscans API doesnt show this (even though their UI does)

LefterisJP commented 4 years ago

Perhaps we can ask their opinion on this. If it would also be possible for them to expose this via their API?

If you are not the one sending the pending transaction, so that you also get the new hash for the replaced transaction I am not really sure how to query for the new transaction either programmatically.

Even if say you kept the nonce of the pending transaction, I am not aware of a way to query a transaction for an address by nonce. I guess only archive nodes that index a lot more data per account may have this data. Unless I am missing something obvious in the JSON RPC spec

owocki commented 4 years ago

ill ask them here => https://twitter.com/owocki/status/1217193346763911168

LefterisJP commented 4 years ago

Nice! I think you may have also already seen it but two services came up in Twitter:

owocki commented 4 years ago

nice; blocknative looks the most promising to me.

i think the best move from here might be to get someone to pull down their python API and have a go at this :)