Skip to content

Commit

Permalink
refactor: generic relayer tools
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed Oct 2, 2024
1 parent aae61c3 commit aa5cf0e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
22 changes: 11 additions & 11 deletions multichain-testing/test/ica-channel-close.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ const channelCloseInitScenario = test.macro({
vstorageClient,
retryUntilCondition,
useChain,
hermes,
relayer,
} = t.context;

// make an account so there's an ICA channel we can attempt to close
Expand Down Expand Up @@ -281,14 +281,14 @@ const channelCloseInitScenario = test.macro({
`Initiating channelCloseInit for dst: ${JSON.stringify(dst)} src: ${JSON.stringify(src)}`,
);
t.throws(
() => hermes.channelCloseInit(chainName, dst, src),
() => relayer.channelCloseInit(chainName, dst, src),
{ message: /Command failed/ },
'hermes channelCloseInit failed from agoric side for ICA',
'relayer channelCloseInit failed from agoric side for ICA',
);
t.throws(
() => hermes.channelCloseInit(chainName, src, dst),
() => relayer.channelCloseInit(chainName, src, dst),
{ message: /Command failed/ },
`hermes channelCloseInit failed from ${chainName} side for ICA`,
`relayer channelCloseInit failed from ${chainName} side for ICA`,
);

const remoteQueryClient = makeQueryClient(
Expand All @@ -298,7 +298,7 @@ const channelCloseInitScenario = test.macro({
() => remoteQueryClient.queryChannel(rPortID, rChannelID),
// @ts-expect-error ChannelSDKType.state is a string not a number
({ channel }) => channel?.state === 'STATE_OPEN',
'Hermes closeChannelInit failed so ICA channel is still open',
'Relayer closeChannelInit failed so ICA channel is still open',
);
t.log(channel);
t.is(
Expand Down Expand Up @@ -330,23 +330,23 @@ const channelCloseInitScenario = test.macro({
};
t.throws(
() =>
hermes.channelCloseInit(
relayer.channelCloseInit(
chainName,
dstTransferChannel,
srcTransferChannel,
),
{ message: /Command failed/ },
'hermes channelCloseInit failed from agoric side for transfer',
'relayer channelCloseInit failed from agoric side for transfer',
);
t.throws(
() =>
hermes.channelCloseInit(
relayer.channelCloseInit(
chainName,
srcTransferChannel,
dstTransferChannel,
),
{ message: /Command failed/ },
`hermes channelCloseInit failed from ${chainName} side for transfer`,
`relayer channelCloseInit failed from ${chainName} side for transfer`,
);

const { channel } = await retryUntilCondition(
Expand All @@ -357,7 +357,7 @@ const channelCloseInitScenario = test.macro({
),
// @ts-expect-error ChannelSDKType.state is a string not a number
({ channel }) => channel?.state === 'STATE_OPEN',
'Hermes closeChannelInit failed so transfer channel is still open',
'Relayer closeChannelInit failed so transfer channel is still open',
);
t.log(channel);
t.is(
Expand Down
6 changes: 3 additions & 3 deletions multichain-testing/test/support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { makeGetFile, makeSetupRegistry } from '../tools/registry.js';
import { generateMnemonic } from '../tools/wallet.js';
import { makeRetryUntilCondition } from '../tools/sleep.js';
import { makeDeployBuilder } from '../tools/deploy.js';
import { makeHermes } from '../tools/hermes-tools.js';
import { makeRelayer } from '../tools/relayer-tools.js';

export const FAUCET_POUR = 10_000n * 1_000_000n;

Expand Down Expand Up @@ -62,7 +62,7 @@ export const commonSetup = async (t: ExecutionContext) => {
log: t.log,
setTimeout: globalThis.setTimeout,
});
const hermes = makeHermes(childProcess);
const relayer = makeRelayer(childProcess);

/**
* Starts a contract if instance not found. Takes care of installing
Expand Down Expand Up @@ -97,7 +97,7 @@ export const commonSetup = async (t: ExecutionContext) => {
...keyring,
retryUntilCondition,
deployBuilder,
hermes,
relayer,
startContract,
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type ChannelCloseParams = {
};
};

export const makeHermes = ({ execFileSync }: { execFileSync: ExecSync }) => {
export const makeRelayer = ({ execFileSync }: { execFileSync: ExecSync }) => {
const exec = (
chainName: string,
args: string[],
Expand Down

0 comments on commit aa5cf0e

Please sign in to comment.