Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(cli): warp commands e2e tests #5121

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d0ae4b1
refactor(cli/test): moved core e2e tests to the core folder
xeno097 Dec 26, 2024
edee675
test(cli/test): added e2e tests for the core check command
xeno097 Dec 27, 2024
23b4cc9
test(cli/test): added core init cli tests
xeno097 Dec 27, 2024
325f71d
refactor(cli/test): updated the warp init tests to make it easier to …
xeno097 Dec 27, 2024
dd9b0ae
refactor(cli/test): updated the core init tests to use the handleProm…
xeno097 Dec 27, 2024
7f3ccb1
test(cli/test): started adding more tests to core dpeloy
xeno097 Dec 27, 2024
1328345
refactor(cli): removed the skip-confirmation flag from the core deplo…
xeno097 Dec 30, 2024
d0a18b3
tests(cli): added an HYP_KEY test for the core deploy e2e tests
xeno097 Dec 30, 2024
284b31a
test(cli): added an HYP_KEY test to the core init e2e test
xeno097 Dec 30, 2024
f9c5dfd
test(cli): updated core init tests
xeno097 Dec 30, 2024
3e509d4
refactor(cli/tests): defined the SETUP_CHAIN_SIGNERS_MANUALLY_STEPS u…
xeno097 Dec 30, 2024
036598f
chore: added new core e2e tests to the ci
xeno097 Dec 30, 2024
32997ee
fix(cli/test): fixed core check test
xeno097 Dec 30, 2024
79af52f
refactor(cli): moved warp commands e2e test to the warp folder
xeno097 Dec 30, 2024
a2fcc8b
test(cli): started working on the warp check e2e tests
xeno097 Dec 30, 2024
58afc33
feat(cli): started working on the warp send e2e tests
xeno097 Jan 2, 2025
1e3e570
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Jan 3, 2025
eba2b2d
test(cli): implemented warp send e2e test
xeno097 Jan 3, 2025
084f3c9
test(cli/test): added more e2e test fro the warp deploy commmand with…
xeno097 Jan 6, 2025
0a5ab5e
fix(cli): fixed skipConfirmation flag propagation in signer middleware
xeno097 Jan 6, 2025
d990b43
test(cli/test): implemented more tests for the warp read command with…
xeno097 Jan 7, 2025
49fafe7
test(cli/test): added more tests for the warp check command with diff…
xeno097 Jan 7, 2025
639e7bc
test(cli/test): minor refactor on the warp command utility
xeno097 Jan 7, 2025
a0af428
test(cli/test): deduped warp deploy file path var
xeno097 Jan 7, 2025
75a7437
test(cli): minor refactor on test assertion for warp check
xeno097 Jan 7, 2025
9ddf47d
chore: add new cli e2e to the ci
xeno097 Jan 7, 2025
9aab773
chore: maybe fix ci issues
xeno097 Jan 8, 2025
79dda83
chore: maybe fix ci part 2
xeno097 Jan 8, 2025
2c3d7bf
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Jan 9, 2025
695f14c
chore: removed focused tests for testing ci fix
xeno097 Jan 9, 2025
5e64afd
fix(cli/test): fixed test that hanged because it was missing an input
xeno097 Jan 9, 2025
31999e8
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Jan 14, 2025
3f21ddd
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Jan 14, 2025
1d0b638
chore: rossy pr review
xeno097 Jan 14, 2025
019d8d2
chore: fix: warp deplo e2e tests
xeno097 Jan 14, 2025
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
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,12 @@ jobs:
# Other commands
- relay
# Warp Commands
- warp-init
- warp-read
- warp-apply
- warp-check
- warp-deploy
- warp-init
- warp-read
- warp-send
steps:
- uses: actions/checkout@v4
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class MultiChainResolver implements ChainResolver {
argv.config ||= DEFAULT_WARP_ROUTE_DEPLOYMENT_CONFIG_PATH;
argv.context.chains = await this.getWarpRouteConfigChains(
argv.config.trim(),
argv.skipConfirmation,
argv.context.skipConfirmation,
);
return argv.context.chains;
}
Expand Down
24 changes: 21 additions & 3 deletions typescript/cli/src/tests/commands/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { ethers } from 'ethers';
import { $, ProcessOutput, ProcessPromise } from 'zx';

import { ERC20Test__factory, ERC4626Test__factory } from '@hyperlane-xyz/core';
import { ChainAddresses } from '@hyperlane-xyz/registry';
import {
ERC20Test,
ERC20Test__factory,
ERC4626Test__factory,
} from '@hyperlane-xyz/core';
import {
ChainAddresses,
createWarpRouteConfigId,
} from '@hyperlane-xyz/registry';
import {
HypTokenRouterConfig,
WarpCoreConfig,
Expand Down Expand Up @@ -41,8 +48,19 @@ export const CHAIN_3_METADATA_PATH = `${REGISTRY_PATH}/chains/${CHAIN_NAME_3}/me

export const WARP_CONFIG_PATH_EXAMPLE = `${EXAMPLES_PATH}/warp-route-deployment.yaml`;
export const WARP_CONFIG_PATH_2 = `${TEMP_PATH}/${CHAIN_NAME_2}/warp-route-deployment-anvil2.yaml`;
export const WARP_DEPLOY_OUTPUT_PATH = `${TEMP_PATH}/warp-route-deployment.yaml`;
export const WARP_CORE_CONFIG_PATH_2 = `${REGISTRY_PATH}/deployments/warp_routes/ETH/anvil2-config.yaml`;

export function getCombinedWarpRoutePath(
tokenSymbol: string,
chains: string[],
): string {
return `${REGISTRY_PATH}/deployments/warp_routes/${createWarpRouteConfigId(
tokenSymbol.toUpperCase(),
chains,
)}-config.yaml`;
}

export const DEFAULT_E2E_TEST_TIMEOUT = 100_000; // Long timeout since these tests can take a while

export enum KeyBoardKeys {
Expand Down Expand Up @@ -258,7 +276,7 @@ export async function deployToken(
privateKey: string,
chain: string,
decimals = 18,
) {
): Promise<ERC20Test> {
const { multiProvider } = await getContext({
registryUri: REGISTRY_PATH,
registryOverrideUri: '',
Expand Down
111 changes: 95 additions & 16 deletions typescript/cli/src/tests/commands/warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,37 @@ export function hyperlaneWarpInit(warpCorePath: string): ProcessPromise {
/**
* Deploys the Warp route to the specified chain using the provided config.
*/
export async function hyperlaneWarpDeploy(warpCorePath: string) {
// --overrides is " " to allow local testing to work
return $`yarn workspace @hyperlane-xyz/cli run hyperlane warp deploy \
export function hyperlaneWarpDeployRaw({
warpCorePath,
hypKey,
skipConfirmationPrompts,
privateKey,
}: {
warpCorePath?: string;
hypKey?: string;
skipConfirmationPrompts?: boolean;
privateKey?: string;
}): ProcessPromise {
return $`${
hypKey ? ['HYP_KEY=' + hypKey] : ''
} yarn workspace @hyperlane-xyz/cli run hyperlane warp deploy \
--registry ${REGISTRY_PATH} \
--overrides " " \
--config ${warpCorePath} \
--key ${ANVIL_KEY} \
${warpCorePath ? ['--config', warpCorePath] : ''} \
${privateKey ? ['--key', privateKey] : ''} \
--verbosity debug \
--yes`;
${skipConfirmationPrompts ? ['--yes'] : ''}`;
}

/**
* Deploys the Warp route to the specified chain using the provided config.
*/
export function hyperlaneWarpDeploy(warpCorePath: string): ProcessPromise {
return hyperlaneWarpDeployRaw({
privateKey: ANVIL_KEY,
warpCorePath: warpCorePath,
skipConfirmationPrompts: true,
});
}

/**
Expand All @@ -55,27 +77,83 @@ export async function hyperlaneWarpApply(
--yes`;
}

export async function hyperlaneWarpRead(
export function hyperlaneWarpReadRaw({
chain,
warpAddress,
outputPath,
privateKey,
symbol,
}: {
chain?: string;
symbol?: string;
privateKey?: string;
warpAddress?: string;
outputPath?: string;
}): ProcessPromise {
return $`yarn workspace @hyperlane-xyz/cli run hyperlane warp read \
--registry ${REGISTRY_PATH} \
--overrides " " \
${warpAddress ? ['--address', warpAddress] : ''} \
${chain ? ['--chain', chain] : ''} \
${symbol ? ['--symbol', symbol] : ''} \
${privateKey ? ['--key', privateKey] : ''} \
--verbosity debug \
${outputPath ? ['--config', outputPath] : ''}`;
}

export function hyperlaneWarpRead(
chain: string,
warpAddress: string,
warpDeployPath: string,
) {
return $`yarn workspace @hyperlane-xyz/cli run hyperlane warp read \
): ProcessPromise {
return hyperlaneWarpReadRaw({
chain,
warpAddress,
outputPath: warpDeployPath,
privateKey: ANVIL_KEY,
});
}

export function hyperlaneWarpCheckRaw({
warpDeployPath,
symbol,
privateKey,
hypKey,
}: {
symbol?: string;
privateKey?: string;
warpDeployPath?: string;
hypKey?: string;
}): ProcessPromise {
return $`${
hypKey && !privateKey ? ['HYP_KEY=' + hypKey] : ''
} yarn workspace @hyperlane-xyz/cli run hyperlane warp check \
--registry ${REGISTRY_PATH} \
--overrides " " \
--address ${warpAddress} \
--chain ${chain} \
--key ${ANVIL_KEY} \
${symbol ? ['--symbol', symbol] : ''} \
${privateKey && !hypKey ? ['--key', privateKey] : ''} \
--verbosity debug \
--config ${warpDeployPath}`;
${warpDeployPath ? ['--config', warpDeployPath] : ''}`;
}

export function hyperlaneWarpCheck(
warpDeployPath: string,
symbol: string,
): ProcessPromise {
return hyperlaneWarpCheckRaw({
warpDeployPath,
privateKey: ANVIL_KEY,
symbol,
});
}

export async function hyperlaneWarpSendRelay(
export function hyperlaneWarpSendRelay(
origin: string,
destination: string,
warpCorePath: string,
relay = true,
) {
value = 1,
): ProcessPromise {
return $`yarn workspace @hyperlane-xyz/cli run hyperlane warp send \
${relay ? '--relay' : ''} \
--registry ${REGISTRY_PATH} \
Expand All @@ -85,7 +163,8 @@ export async function hyperlaneWarpSendRelay(
--warp ${warpCorePath} \
--key ${ANVIL_KEY} \
--verbosity debug \
--yes`;
--yes \
--amount ${value}`;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions typescript/cli/src/tests/core/core-check.e2e-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('hyperlane core check e2e tests', async function () {
);

expect(output.exitCode).to.equal(0);
expect(output.text().includes('No violations found')).to.be.true;
expect(output.text()).to.includes('No violations found');
});

it('should find differences between the local and onchain config', async () => {
Expand All @@ -69,8 +69,8 @@ describe('hyperlane core check e2e tests', async function () {
).nothrow();

expect(output.exitCode).to.equal(1);
expect(output.text().includes(expectedDiffText)).to.be.true;
expect(output.text().includes(expectedActualText)).to.be.true;
expect(output.text()).to.include(expectedDiffText);
expect(output.text()).to.include(expectedActualText);
});

it('should successfully check the config when provided with a custom mailbox', async () => {
Expand All @@ -88,6 +88,6 @@ describe('hyperlane core check e2e tests', async function () {
);

expect(output.exitCode).to.equal(0);
expect(output.text().includes('No violations found')).to.be.true;
expect(output.text()).to.includes('No violations found');
});
});
Loading
Loading