Skip to content

Commit

Permalink
feat: add ignored chains for debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaroz committed Dec 12, 2024
1 parent 090edcc commit 8f907b3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/consts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
11 changes: 11 additions & 0 deletions src/features/debugger/debugMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -83,6 +84,7 @@ export async function debugMessage(
recipient,
senderBytes,
body,
destName,
);
if (deliveryResult.status && deliveryResult.description) return deliveryResult;
else details.calldataDetails = deliveryResult.calldataDetails;
Expand Down Expand Up @@ -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', [
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/features/debugger/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export const debugStatusToDesc: Record<MessageDebugStatus, string> = {
[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',
};
1 change: 1 addition & 0 deletions src/features/debugger/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export enum MessageDebugStatus {
HandleCallFailure = 'handleCallFailure',
MultisigIsmEmpty = 'multisigIsmEmpty',
GasUnderfunded = 'gasUnderfunded',
MessageNotDelivered = 'messageNotDelivered',
}

export interface MessageDebugResult {
Expand Down

0 comments on commit 8f907b3

Please sign in to comment.