Skip to content

Commit c094f7f

Browse files
authored
feat(cli): allow --ica check with non-deployed warp routes (#7919)
1 parent fdf0baf commit c094f7f

3 files changed

Lines changed: 56 additions & 5 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperlane-xyz/cli': minor
3+
---
4+
5+
Allowed `warp check --ica` to validate ICA ownership on chains before warp apply/extension by moving config filtering after the ICA check.

typescript/cli/src/commands/warp.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,12 +454,8 @@ export const check: CommandModuleWithContext<
454454
warpCoreConfigPath: warp,
455455
});
456456

457-
({ warpCoreConfig, warpDeployConfig } = filterWarpConfigsToMatchingChains(
458-
warpDeployConfig,
459-
warpCoreConfig,
460-
));
461-
462457
// If --ica flag is set, run ICA owner check instead of the regular config check
458+
// Note: ICA check uses full warpDeployConfig (not filtered) to support pre-deployed chains
463459
if (ica) {
464460
assert(origin, '--origin is required when using --ica');
465461

@@ -474,6 +470,11 @@ export const check: CommandModuleWithContext<
474470
process.exit(0);
475471
}
476472

473+
({ warpCoreConfig, warpDeployConfig } = filterWarpConfigsToMatchingChains(
474+
warpDeployConfig,
475+
warpCoreConfig,
476+
));
477+
477478
const deployedRoutersAddresses =
478479
getRouterAddressesFromWarpCoreConfig(warpCoreConfig);
479480

typescript/cli/src/tests/ethereum/warp/warp-check-ica.e2e-test.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
type ChainMetadata,
1515
InterchainAccount,
1616
TokenType,
17+
type WarpCoreConfig,
1718
type WarpRouteDeployConfig,
1819
} from '@hyperlane-xyz/sdk';
1920
import {
@@ -374,4 +375,48 @@ describe('hyperlane warp check --ica e2e tests', async function () {
374375
expect(output.text()).to.include('EXPECTED');
375376
expect(output.text()).to.include(normalizeAddressEvm(nonConfigOwnerIca));
376377
});
378+
379+
it('should work with non-deployed chains using deploy config and empty warpCoreConfig', async function () {
380+
// Create a warp deploy config WITHOUT deploying it
381+
// This tests that --ica works before warp apply/extension
382+
const nonDeployedConfig: WarpRouteDeployConfig = {
383+
[CHAIN_NAME_2]: {
384+
type: TokenType.collateral,
385+
token: token.address,
386+
mailbox: chain2Addresses.mailbox,
387+
owner: icaOwnerAddress,
388+
},
389+
[CHAIN_NAME_3]: {
390+
type: TokenType.synthetic,
391+
mailbox: chain3Addresses.mailbox,
392+
owner: expectedIcaAddress,
393+
},
394+
};
395+
396+
const warpDeployPath = combinedWarpCoreConfigPath.replace(
397+
'-config.yaml',
398+
'-ica-non-deployed-deploy.yaml',
399+
);
400+
writeYamlOrJson(warpDeployPath, nonDeployedConfig);
401+
402+
// Create an empty warpCoreConfig (no deployed tokens yet)
403+
const emptyWarpCoreConfig: WarpCoreConfig = { tokens: [] };
404+
const warpCorePath = combinedWarpCoreConfigPath.replace(
405+
'-config.yaml',
406+
'-ica-non-deployed-core.yaml',
407+
);
408+
writeYamlOrJson(warpCorePath, emptyWarpCoreConfig);
409+
410+
// Run ICA check with both configs - the deploy config has chains, warpCoreConfig is empty
411+
// This simulates checking ICA ownership before warp apply/extension
412+
const output = await hyperlaneWarpCheckRaw({
413+
warpDeployPath,
414+
warpCoreConfigPath: warpCorePath,
415+
ica: true,
416+
origin: CHAIN_NAME_2,
417+
}).nothrow();
418+
419+
expect(output.exitCode).to.equal(0);
420+
expect(output.text()).to.include('No violations found');
421+
});
377422
});

0 commit comments

Comments
 (0)