From 6aa0256e72c7c324a26fd8fa08094a2c5b1f60db Mon Sep 17 00:00:00 2001 From: Xaroz Date: Thu, 12 Dec 2024 11:40:18 -0600 Subject: [PATCH 1/4] fix: disable failing message for bytecode handler --- src/features/debugger/debugMessage.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/features/debugger/debugMessage.ts b/src/features/debugger/debugMessage.ts index d783ae7..bd92de9 100644 --- a/src/features/debugger/debugMessage.ts +++ b/src/features/debugger/debugMessage.ts @@ -172,15 +172,15 @@ async function debugMessageDelivery( const errorReason = extractReasonString(err); logger.debug(errorReason); - const bytecodeHasHandle = await tryCheckBytecodeHandle(destProvider, recipient); - if (!bytecodeHasHandle) { - logger.info('Bytecode does not have function matching handle sig'); - return { - status: MessageDebugStatus.RecipientNotHandler, - description: `Recipient contract should have handle function of signature: ${HANDLE_FUNCTION_SIG}. Check that recipient is not a proxy. Error: ${errorReason}`, - calldataDetails, - }; - } + // const bytecodeHasHandle = await tryCheckBytecodeHandle(destProvider, recipient); + // if (!bytecodeHasHandle) { + // logger.info('Bytecode does not have function matching handle sig'); + // return { + // status: MessageDebugStatus.RecipientNotHandler, + // description: `Recipient contract should have handle function of signature: ${HANDLE_FUNCTION_SIG}. Check that recipient is not a proxy. Error: ${errorReason}`, + // calldataDetails, + // }; + // } const icaCallErr = await tryDebugIcaMsg(sender, recipient, body, originDomain, destProvider); if (icaCallErr) { From 090edcc7deaf6bc0e8bb133c1f207f0004fcbcdd Mon Sep 17 00:00:00 2001 From: Xaroz Date: Thu, 12 Dec 2024 11:41:12 -0600 Subject: [PATCH 2/4] chore: comment out unused functions --- src/features/debugger/debugMessage.ts | 29 +++++++++++++-------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/features/debugger/debugMessage.ts b/src/features/debugger/debugMessage.ts index bd92de9..9d70dbd 100644 --- a/src/features/debugger/debugMessage.ts +++ b/src/features/debugger/debugMessage.ts @@ -16,7 +16,6 @@ import { errorToString, formatMessage, isValidAddress, - strip0x, trimToLength, } from '@hyperlane-xyz/utils'; @@ -29,7 +28,7 @@ import { GasPayment, IsmModuleTypes, MessageDebugResult, MessageDebugStatus } fr type Provider = providers.Provider; -const HANDLE_FUNCTION_SIG = 'handle(uint32,bytes32,bytes)'; +// const HANDLE_FUNCTION_SIG = 'handle(uint32,bytes32,bytes)'; const IGP_PAYMENT_CHECK_DELAY = 30_000; // 30 seconds export async function debugMessage( @@ -328,19 +327,19 @@ async function fetchGasPaymentEvents(provider: Provider, messageId: string) { return { contractToPayments, contractToTotalGas, numPayments, numIGPs }; } -async function tryCheckBytecodeHandle(provider: Provider, recipientAddress: string) { - try { - // scan bytecode for handle function selector - const bytecode = await provider.getCode(recipientAddress); - const msgRecipientInterface = MessageRecipientFactory.createInterface(); - const handleFunction = msgRecipientInterface.functions[HANDLE_FUNCTION_SIG]; - const handleSignature = msgRecipientInterface.getSighash(handleFunction); - return bytecode.includes(strip0x(handleSignature)); - } catch (error) { - logger.error('Error checking bytecode for handle fn', error); - return true; - } -} +// async function tryCheckBytecodeHandle(provider: Provider, recipientAddress: string) { +// try { +// // scan bytecode for handle function selector +// const bytecode = await provider.getCode(recipientAddress); +// const msgRecipientInterface = MessageRecipientFactory.createInterface(); +// const handleFunction = msgRecipientInterface.functions[HANDLE_FUNCTION_SIG]; +// const handleSignature = msgRecipientInterface.getSighash(handleFunction); +// return bytecode.includes(strip0x(handleSignature)); +// } catch (error) { +// logger.error('Error checking bytecode for handle fn', error); +// return true; +// } +// } async function tryDebugIcaMsg( sender: Address, From 8f907b3a0c3f4f9b63d3c9798b337ba0abb19025 Mon Sep 17 00:00:00 2001 From: Xaroz Date: Thu, 12 Dec 2024 13:01:56 -0600 Subject: [PATCH 3/4] feat: add ignored chains for debugger --- src/consts/config.ts | 2 ++ src/features/debugger/debugMessage.ts | 11 +++++++++++ src/features/debugger/strings.ts | 1 + src/features/debugger/types.ts | 1 + 4 files changed, 15 insertions(+) diff --git a/src/consts/config.ts b/src/consts/config.ts index 4ba1eb3..f3f9fda 100644 --- a/src/consts/config.ts +++ b/src/consts/config.ts @@ -21,3 +21,5 @@ export const config: Config = Object.freeze({ // Based on https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/typescript/infra/config/environments/mainnet3/agent.ts // Based on https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/typescript/infra/config/environments/testnet4/agent.ts export const unscrapedChainsInDb = ['proteustestnet', 'viction']; + +export const debugIgnoredChains = ['treasure']; diff --git a/src/features/debugger/debugMessage.ts b/src/features/debugger/debugMessage.ts index 9d70dbd..bea81c2 100644 --- a/src/features/debugger/debugMessage.ts +++ b/src/features/debugger/debugMessage.ts @@ -24,6 +24,7 @@ import { logger } from '../../utils/logger'; import { getMailboxAddress } from '../chains/utils'; import { isIcaMessage, tryDecodeIcaBody, tryFetchIcaAddress } from '../messages/ica'; +import { debugIgnoredChains } from '../../consts/config'; import { GasPayment, IsmModuleTypes, MessageDebugResult, MessageDebugStatus } from './types'; type Provider = providers.Provider; @@ -83,6 +84,7 @@ export async function debugMessage( recipient, senderBytes, body, + destName, ); if (deliveryResult.status && deliveryResult.description) return deliveryResult; else details.calldataDetails = deliveryResult.calldataDetails; @@ -144,6 +146,7 @@ async function debugMessageDelivery( recipient: Address, senderBytes: string, body: string, + destName: string, ) { const recipientContract = MessageRecipientFactory.connect(recipient, destProvider); const handleCalldata = recipientContract.interface.encodeFunctionData('handle', [ @@ -181,6 +184,14 @@ async function debugMessageDelivery( // }; // } + if (debugIgnoredChains.includes(destName)) { + return { + status: MessageDebugStatus.MessageNotDelivered, + description: 'Message not delivered, there may be an error', + calldataDetails, + }; + } + const icaCallErr = await tryDebugIcaMsg(sender, recipient, body, originDomain, destProvider); if (icaCallErr) { return { diff --git a/src/features/debugger/strings.ts b/src/features/debugger/strings.ts index 3e8b09d..7a575c9 100644 --- a/src/features/debugger/strings.ts +++ b/src/features/debugger/strings.ts @@ -9,4 +9,5 @@ export const debugStatusToDesc: Record = { [MessageDebugStatus.HandleCallFailure]: 'Error calling handle on the recipient contract', [MessageDebugStatus.MultisigIsmEmpty]: 'ISM has no validators and/or no quorum threshold', [MessageDebugStatus.GasUnderfunded]: 'Insufficient interchain gas has been paid for delivery', + [MessageDebugStatus.MessageNotDelivered]: 'Message was not delivered', }; diff --git a/src/features/debugger/types.ts b/src/features/debugger/types.ts index a7a28fc..07f1476 100644 --- a/src/features/debugger/types.ts +++ b/src/features/debugger/types.ts @@ -6,6 +6,7 @@ export enum MessageDebugStatus { HandleCallFailure = 'handleCallFailure', MultisigIsmEmpty = 'multisigIsmEmpty', GasUnderfunded = 'gasUnderfunded', + MessageNotDelivered = 'messageNotDelivered', } export interface MessageDebugResult { From 721e5dd14dd88325823cacfe829f2c39c1353ea6 Mon Sep 17 00:00:00 2001 From: Xaroz Date: Thu, 12 Dec 2024 14:19:34 -0600 Subject: [PATCH 4/4] chore: remove additional status --- src/features/debugger/debugMessage.ts | 4 ++-- src/features/debugger/strings.ts | 1 - src/features/debugger/types.ts | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/features/debugger/debugMessage.ts b/src/features/debugger/debugMessage.ts index bea81c2..a97fbb9 100644 --- a/src/features/debugger/debugMessage.ts +++ b/src/features/debugger/debugMessage.ts @@ -186,8 +186,8 @@ async function debugMessageDelivery( if (debugIgnoredChains.includes(destName)) { return { - status: MessageDebugStatus.MessageNotDelivered, - description: 'Message not delivered, there may be an error', + status: null, + description: '', calldataDetails, }; } diff --git a/src/features/debugger/strings.ts b/src/features/debugger/strings.ts index 7a575c9..3e8b09d 100644 --- a/src/features/debugger/strings.ts +++ b/src/features/debugger/strings.ts @@ -9,5 +9,4 @@ export const debugStatusToDesc: Record = { [MessageDebugStatus.HandleCallFailure]: 'Error calling handle on the recipient contract', [MessageDebugStatus.MultisigIsmEmpty]: 'ISM has no validators and/or no quorum threshold', [MessageDebugStatus.GasUnderfunded]: 'Insufficient interchain gas has been paid for delivery', - [MessageDebugStatus.MessageNotDelivered]: 'Message was not delivered', }; diff --git a/src/features/debugger/types.ts b/src/features/debugger/types.ts index 07f1476..a7a28fc 100644 --- a/src/features/debugger/types.ts +++ b/src/features/debugger/types.ts @@ -6,7 +6,6 @@ export enum MessageDebugStatus { HandleCallFailure = 'handleCallFailure', MultisigIsmEmpty = 'multisigIsmEmpty', GasUnderfunded = 'gasUnderfunded', - MessageNotDelivered = 'messageNotDelivered', } export interface MessageDebugResult {