Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions src/features/debugger/debugMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { IRegistry } from '@hyperlane-xyz/registry';
import {
ChainMap,
ChainMetadata,
isProxy,
MAILBOX_VERSION,
MultiProtocolProvider,
isProxy,
proxyImplementation,
} from '@hyperlane-xyz/sdk';
import {
Expand All @@ -30,7 +30,7 @@ import {
import { Message } from '../../types';
import { logger } from '../../utils/logger';
import { getMailboxAddress } from '../chains/utils';
import { isIcaMessage, tryDecodeIcaBody, tryFetchIcaAddress } from '../messages/ica';
import { decodeIcaBody, IcaMessageType, isIcaMessage } from '../messages/ica';

import { debugIgnoredChains } from '../../consts/config';
import { GasPayment, IsmModuleTypes, MessageDebugResult, MessageDebugStatus } from './types';
Expand Down Expand Up @@ -393,27 +393,35 @@ async function tryDebugIcaMsg(
sender: Address,
recipient: Address,
body: string,
originDomainId: DomainId,
_originDomainId: DomainId,
destinationProvider: Provider,
) {
if (!isIcaMessage({ sender, recipient })) return null;
logger.debug('Message is for an ICA');

const decodedBody = tryDecodeIcaBody(body);
const decodedBody = decodeIcaBody(body);
if (!decodedBody) return null;

const { sender: originalSender, calls } = decodedBody;
// Only debug CALLS type messages - COMMITMENT and REVEAL have different flows
if (decodedBody.messageType !== IcaMessageType.CALLS) {
logger.debug('Skipping ICA debug for non-CALLS message type');
return null;
}

const { calls } = decodedBody;

const icaAddress = await tryFetchIcaAddress(originDomainId, originalSender, destinationProvider);
if (!icaAddress) return null;
// Note: We can't easily get the ICA address without making a contract call
// to the destination router. For now, we skip ICA address verification
// and just check if the calls can be executed.
// TODO: Add ICA address computation if needed for debugging

for (let i = 0; i < calls.length; i++) {
const call = calls[i];
logger.debug(`Checking ica call ${i + 1} of ${calls.length}`);
const errorReason = await tryCheckIcaCall(
icaAddress,
call.destinationAddress,
call.callBytes,
recipient, // Use recipient (ICA router) as a proxy for now
call.to,
call.data,
destinationProvider,
);
if (errorReason) {
Expand Down
4 changes: 2 additions & 2 deletions src/features/messages/MessageDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function MessageDetails({ messageId, message: messageFromUrlParams }: Pro
const isFetching = isGraphQlFetching || isPiFetching;
const isError = isGraphQlError || isPiError;
const blur = !isMessageFound;
const isIcaMsg = useIsIcaMessage(_message);
const isIcaMsg = useIsIcaMessage({ sender: _message.sender, recipient: _message.recipient });

// If message isn't delivered, attempt to check for
// more recent updates and possibly debug info
Expand Down Expand Up @@ -138,6 +138,7 @@ export function MessageDetails({ messageId, message: messageFromUrlParams }: Pro
warpRouteDetails={warpRouteDetails}
blur={blur}
/>
{isIcaMsg && <IcaDetailsCard message={message} blur={blur} />}
<ContentDetailsCard message={message} blur={blur} />
<GasDetailsCard
message={message}
Expand All @@ -147,7 +148,6 @@ export function MessageDetails({ messageId, message: messageFromUrlParams }: Pro
{debugResult?.ismDetails && (
<IsmDetailsCard ismDetails={debugResult.ismDetails} blur={blur} />
)}
{isIcaMsg && <IcaDetailsCard message={message} blur={blur} />}
</div>
</>
);
Expand Down
Loading