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

fix: warp configure infinite loop #3929

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
5 changes: 5 additions & 0 deletions .changeset/sharp-geckos-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

Fix createDefaultWarpIsmConfig to default to trusted relayer and fallback routing without prompts
33 changes: 21 additions & 12 deletions typescript/cli/src/config/warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
WarpRouteDeployConfig,
WarpRouteDeployConfigSchema,
} from '@hyperlane-xyz/sdk';
import { assert, objMap, promiseObjAll } from '@hyperlane-xyz/utils';
import { Address, assert, objMap, promiseObjAll } from '@hyperlane-xyz/utils';

import { CommandContext } from '../context/types.js';
import { errorRed, log, logBlue, logGreen } from '../logger.js';
Expand All @@ -26,11 +26,7 @@ import {
writeYamlOrJson,
} from '../utils/files.js';

import {
createAdvancedIsmConfig,
createRoutingConfig,
createTrustedRelayerConfig,
} from './ism.js';
import { createAdvancedIsmConfig } from './ism.js';

const TYPE_DESCRIPTIONS: Record<TokenType, string> = {
[TokenType.synthetic]: 'A new ERC20 with remote transfer functionality',
Expand Down Expand Up @@ -151,7 +147,7 @@ export async function createWarpRouteDeployConfig({

const interchainSecurityModule = advanced
? await createAdvancedIsmConfig(context)
: await createDefaultWarpIsmConfig(context);
: await createDefaultWarpIsmConfig(owner);

switch (type) {
case TokenType.collateral:
Expand Down Expand Up @@ -205,14 +201,27 @@ export function readWarpRouteConfig(filePath: string): WarpCoreConfig {
return WarpCoreConfigSchema.parse(config);
}

async function createDefaultWarpIsmConfig(
context: CommandContext,
): Promise<IsmConfig> {
/**
* Creates a default configuration for an ISM with a TRUSTED_RELAYER and FALLBACK_ROUTING.
*
* Properties relayer and owner are both set as input owner.
*
* @param owner - The address of the owner of the ISM.
* @returns The default Aggregation ISM configuration.
*/
async function createDefaultWarpIsmConfig(owner: Address): Promise<IsmConfig> {
ltyu marked this conversation as resolved.
Show resolved Hide resolved
return {
type: IsmType.AGGREGATION,
modules: [
await createTrustedRelayerConfig(context),
await createRoutingConfig(context, IsmType.FALLBACK_ROUTING),
{
type: IsmType.TRUSTED_RELAYER,
relayer: owner,
},
{
type: IsmType.FALLBACK_ROUTING,
domains: {},
owner,
},
],
threshold: 1,
};
Expand Down
Loading