From 77f88628b9ebc09336d5d69641d29ec97c0deccd Mon Sep 17 00:00:00 2001 From: katspaugh <381895+katspaugh@users.noreply.github.com> Date: Mon, 23 Oct 2023 19:34:12 +0200 Subject: [PATCH] Fix: uncaught exception in ApprovalEditor (#2674) --- src/services/exceptions/ErrorCodes.ts | 1 + src/utils/transactions.ts | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/services/exceptions/ErrorCodes.ts b/src/services/exceptions/ErrorCodes.ts index cf24e6b433..c09f87f345 100644 --- a/src/services/exceptions/ErrorCodes.ts +++ b/src/services/exceptions/ErrorCodes.ts @@ -55,6 +55,7 @@ enum ErrorCodes { _806 = '806: Failed to remove module', _807 = '807: Failed to remove guard', _808 = '808: Failed to get transaction origin', + _809 = '809: Failed decoding transaction', _900 = '900: Error loading Safe App', _901 = '901: Error processing Safe Apps SDK request', diff --git a/src/utils/transactions.ts b/src/utils/transactions.ts index 172cfa78ec..cf60ab4c7d 100644 --- a/src/utils/transactions.ts +++ b/src/utils/transactions.ts @@ -253,10 +253,16 @@ export const decodeMultiSendTxs = (encodedMultiSendData: string): BaseTransactio )}` // Decode operation, to, value, dataLength - const [, txTo, txValue, txDataBytesLength] = ethers.utils.defaultAbiCoder.decode( - ['uint8', 'address', 'uint256', 'uint256'], - ethers.utils.hexZeroPad(txDataEncoded, 32 * 4), - ) + let txTo, txValue, txDataBytesLength + try { + ;[, txTo, txValue, txDataBytesLength] = ethers.utils.defaultAbiCoder.decode( + ['uint8', 'address', 'uint256', 'uint256'], + ethers.utils.hexZeroPad(txDataEncoded, 32 * 4), + ) + } catch (e) { + logError(Errors._809, e) + continue + } // Each byte is represented by two characters const dataLength = Number(txDataBytesLength) * 2