Skip to content

Commit

Permalink
fix: handle unknown error messages (#222)
Browse files Browse the repository at this point in the history
* handle unknown error messages;

Signed-off-by: tcar <[email protected]>

* lint code;

Signed-off-by: tcar <[email protected]>

---------

Signed-off-by: tcar <[email protected]>
  • Loading branch information
tcar121293 authored Sep 20, 2024
1 parent 1636834 commit ee21e26
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/indexer/utils/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,19 @@ export async function getFee(provider: Provider, feeHandlerRouterAddress: string
export function parseFailedHandlerExecution(log: Log, decodedLog: LogDescription, blockUnixTimestamp: number): DecodedFailedHandlerExecution {
const originDomainID = decodedLog.args.originDomainID as number
const errorData = decodedLog.args.lowLevelData as ArrayBuffer
let errMsg

try {
errMsg = ethers.decodeBytes32String("0x" + Buffer.from(errorData.slice(-64)).toString())
} catch (err) {
errMsg = "Unknown error type, raw data:" + errorData.toString()
}

return {
domainId: originDomainID.toString(),
depositNonce: Number(decodedLog.args.depositNonce as string),
txHash: log.transactionHash,
message: ethers.decodeBytes32String("0x" + Buffer.from(errorData.slice(-64)).toString()),
message: errMsg,
blockNumber: log.blockNumber,
timestamp: blockUnixTimestamp,
}
Expand Down

0 comments on commit ee21e26

Please sign in to comment.