Closed sentry-io[bot] closed 9 months ago
@sirpy @johnsmith-gooddollar question was: Can it be that we are passing non TXs here? like feed? for some reason tx hash is empty?
I have been going through the flow to see what could be causing the null txHash.
The flow:
Additional notes: So from some of the sentry reports you can see the replay where this is triggered by users going through the claim flow maybe I am seeing something which is not there, but there could be correlation between 'claim-failed' and above error (close amount of event counts): https://gooddollar.sentry.io/issues/?environment=production&project=1829798&query=claiming+failed&referrer=issue-list&statsPeriod=24h
my guess(es) so far are:
Receipt is only fetched for 'mined' transactions so any pending transactions that we fetch would result in a null txHash when we run getTransactionReceipt.
I am not necessarily sure what the cleanest way to handle this is
@L03TJ3 The error is because notifyReceipt fails. notifyReceipt fails because the input TX hash is null. the only reason it can be null is that one of the input events to notifyEvents doesnt have the field transactionhash.
hash
and not transactionHash, just a guess. ie go over again the explorer/tatum/blockchain event format/data@sirpy I explain why it likely happens. The api calls we do for all transactions and events includes pending 'unmined' transactions', they already have a txHash. Then in notifyReceipt it does the 'getReceiptWithLogs' Receipt is only available after mining! so if there is a pending transaction, it will not find the transactionHash!
/**
* @return an existing (non-pending) transaction receipt information + human readable logs of the transaction
* @param transactionHash The TX hash to return the data for
*/
async getReceiptWithLogs(transactionHash: string) {
const chainId = this.networkId
const transactionReceipt = await retryCall(() => this.wallet.eth.getTransactionReceipt(transactionHash))
if (!transactionReceipt) {
return null
}
const logs = filter(abiDecoder.decodeLogs(transactionReceipt.logs))
return { ...transactionReceipt, logs, chainId } //add network id in case of wallet provider network switch
}
We wrap this with retryCall. it attempts it three times and then throws the error here: https://github.com/GoodDollar/GoodDAPP/blob/04b2bed1655932add667df9096acc3e73ed6502b/src/lib/utils/async.js#L67
Resulting in the catch from _notifyReceipt being triggered, with the value of 'null' (that is what web3.getTransactionReceipt returns for pending transasctions. Ref: https://web3js.readthedocs.io/en/v1.2.11/web3-eth.html#gettransactionreceipt
So no. the inputs are not the only reason. the api calls are fully aligned with the documentation and all the 'hash' or 'transactionsHash' fields are mapped correctly as far as I could tell
optional alternative fix could be to replace getTransactionReceipt with getTransactionByHash
As discussed left over todo's are:
added log and is available on dev
@vldkhh verify on prod
@vldkhh verify on prod
@L03TJ3 you can already look at errors on sentry and check why it fails. I see that either event is defined well or that fetching the TX from the rpc fails.
It is still strange to me why fetching from rpc fails with so many rpcs and retries...
we can also try to add a fallback to fetch TX from the explorers in getReceiptWithLogs
to handle the rpc issues
@L03TJ3 I'm monitoring this error, need more time
8 events per 24h. closed
It looks like we are passing a non tx hash to fetching receipt or an empty hash
Invalid params: invalid type: null, expected a 0x-prefixed hex string with length of 64
andinvalid characters encountered in Hex string
Can it be that we are passing non TXs here? like feed? for some reason tx hash is empty? It would be good to add the txhash as a parameter in the error log
Sentry Issue: GOODDAPP-19ZYR