diff --git a/typescript/cli/src/commands/options.ts b/typescript/cli/src/commands/options.ts index 8d628b5957..1d5317656a 100644 --- a/typescript/cli/src/commands/options.ts +++ b/typescript/cli/src/commands/options.ts @@ -123,7 +123,7 @@ export const dryRunOption: Options = { type: 'string', description: 'Chain name to fork and simulate deployment. Please ensure an anvil node instance is running during execution via `anvil`.', - alias: ['d'], + alias: 'd', }; export const chainCommandOption: Options = { diff --git a/typescript/cli/src/config/warp.ts b/typescript/cli/src/config/warp.ts index 2410915d0d..19f1a1fbde 100644 --- a/typescript/cli/src/config/warp.ts +++ b/typescript/cli/src/config/warp.ts @@ -2,12 +2,14 @@ import { confirm, input } from '@inquirer/prompts'; import { ethers } from 'ethers'; import { + ChainMetadata, TokenType, WarpCoreConfig, WarpCoreConfigSchema, WarpRouteDeployConfig, WarpRouteDeployConfigSchema, } from '@hyperlane-xyz/sdk'; +import { objFilter } from '@hyperlane-xyz/utils'; import { CommandContext } from '../context/types.js'; import { errorRed, logBlue, logGreen } from '../logger.js'; @@ -66,8 +68,12 @@ export async function createWarpRouteDeployConfig({ ? ethers.constants.AddressZero : await input({ message: addressMessage }); - const syntheticChains = await runMultiChainSelectionStep( + const metadataWithoutBase = objFilter( context.chainMetadata, + (chain, _): _ is ChainMetadata => chain !== baseChain, + ); + const syntheticChains = await runMultiChainSelectionStep( + metadataWithoutBase, 'Select chains to which the base token will be connected', ); diff --git a/typescript/cli/src/context/context.ts b/typescript/cli/src/context/context.ts index e3984408cb..d26c89390c 100644 --- a/typescript/cli/src/context/context.ts +++ b/typescript/cli/src/context/context.ts @@ -2,9 +2,11 @@ import { ethers } from 'ethers'; import { IRegistry } from '@hyperlane-xyz/registry'; import { ChainName, MultiProvider } from '@hyperlane-xyz/sdk'; +import { isNullish } from '@hyperlane-xyz/utils'; import { isSignCommand } from '../commands/signCommands.js'; import { forkNetworkToMultiProvider } from '../deploy/dry-run.js'; +import { logBlue } from '../logger.js'; import { MergedRegistry } from '../registry/MergedRegistry.js'; import { runSingleChainSelectionStep } from '../utils/chains.js'; import { getImpersonatedSigner, getSigner } from '../utils/keys.js'; @@ -16,7 +18,7 @@ import { } from './types.js'; export async function contextMiddleware(argv: Record) { - const isDryRun = !!argv.dryRun; + const isDryRun = !isNullish(argv.dryRun); const requiresKey = isSignCommand(argv); const settings: ContextSettings = { registryUri: argv.registry, @@ -79,6 +81,8 @@ export async function getDryRunContext( ); } + logBlue(`Dry-running against chain: ${chain}`); + const multiProvider = await getMultiProvider(registry); await forkNetworkToMultiProvider(multiProvider, chain); const { key: impersonatedKey, signer: impersonatedSigner } = diff --git a/typescript/cli/src/send/transfer.ts b/typescript/cli/src/send/transfer.ts index 161c37cb24..dcd3aa6fd7 100644 --- a/typescript/cli/src/send/transfer.ts +++ b/typescript/cli/src/send/transfer.ts @@ -138,7 +138,7 @@ async function executeDelivery({ sender: senderAddress, }); if (errors) { - logRed('Unable to validate transfer', errors); + logRed('Error validating transfer', JSON.stringify(errors)); throw new Error('Error validating transfer'); } diff --git a/typescript/cli/src/utils/chains.ts b/typescript/cli/src/utils/chains.ts index e3eeecfaeb..85f5c75628 100644 --- a/typescript/cli/src/utils/chains.ts +++ b/typescript/cli/src/utils/chains.ts @@ -18,7 +18,7 @@ export async function runSingleChainSelectionStep( const chain = (await select({ message, choices, - pageSize: 20, + pageSize: 30, })) as string; handleNewChain([chain]); return chain; @@ -35,7 +35,7 @@ export async function runMultiChainSelectionStep( const chains = (await checkbox({ message, choices, - pageSize: 20, + pageSize: 30, })) as string[]; handleNewChain(chains); if (requireMultiple && chains?.length < 2) { diff --git a/typescript/sdk/src/utils/fork.ts b/typescript/sdk/src/utils/fork.ts index 38660a6c50..51ed576e0c 100644 --- a/typescript/sdk/src/utils/fork.ts +++ b/typescript/sdk/src/utils/fork.ts @@ -5,8 +5,6 @@ import { Address, isValidAddressEvm, rootLogger } from '@hyperlane-xyz/utils'; import { MultiProvider } from '../providers/MultiProvider.js'; import { ChainName } from '../types.js'; -const logger = rootLogger.child({ module: 'fork-utils' }); - const ENDPOINT_PREFIX = 'http'; const DEFAULT_ANVIL_ENDPOINT = 'http://127.0.0.1:8545'; @@ -21,7 +19,7 @@ export enum ANVIL_RPC_METHODS { * Resets the local node to it's original state (anvil [31337] at block zero). */ export const resetFork = async (anvilIPAddr?: string, anvilPort?: number) => { - logger.info(`Resetting forked network...`); + rootLogger.info(`Resetting forked network...`); const provider = getLocalProvider(anvilIPAddr, anvilPort); await provider.send(ANVIL_RPC_METHODS.RESET, [ @@ -32,7 +30,7 @@ export const resetFork = async (anvilIPAddr?: string, anvilPort?: number) => { }, ]); - logger.info(`✅ Successfully reset forked network`); + rootLogger.info(`✅ Successfully reset forked network`); }; /** @@ -46,7 +44,7 @@ export const setFork = async ( anvilIPAddr?: string, anvilPort?: number, ) => { - logger.info(`Forking ${chain} for dry-run...`); + rootLogger.info(`Forking ${chain} for dry-run...`); const provider = getLocalProvider(anvilIPAddr, anvilPort); const currentChainMetadata = multiProvider.metadata[chain]; @@ -61,7 +59,7 @@ export const setFork = async ( multiProvider.setProvider(chain, provider); - logger.info(`✅ Successfully forked ${chain} for dry-run`); + rootLogger.info(`✅ Successfully forked ${chain} for dry-run`); }; /** @@ -74,12 +72,12 @@ export const impersonateAccount = async ( anvilIPAddr?: string, anvilPort?: number, ): Promise => { - logger.info(`Impersonating account (${address})...`); + rootLogger.info(`Impersonating account (${address})...`); const provider = getLocalProvider(anvilIPAddr, anvilPort); await provider.send(ANVIL_RPC_METHODS.IMPERSONATE_ACCOUNT, [address]); - logger.info(`✅ Successfully impersonated account (${address})`); + rootLogger.info(`✅ Successfully impersonated account (${address})`); return provider.getSigner(address); }; @@ -93,7 +91,7 @@ export const stopImpersonatingAccount = async ( anvilIPAddr?: string, anvilPort?: number, ) => { - logger.info(`Stopping account impersonation for address (${address})...`); + rootLogger.info(`Stopping account impersonation for address (${address})...`); if (isValidAddressEvm(address)) throw new Error( @@ -105,7 +103,7 @@ export const stopImpersonatingAccount = async ( address.substring(2), ]); - logger.info( + rootLogger.info( `✅ Successfully stopped account impersonation for address (${address})`, ); }; @@ -125,7 +123,7 @@ export const getLocalProvider = ( envUrl = `${ENDPOINT_PREFIX}${anvilIPAddr}:${anvilPort}`; if (urlOverride && !urlOverride.startsWith(ENDPOINT_PREFIX)) { - logger.warn( + rootLogger.warn( `⚠️ Provided URL override (${urlOverride}) does not begin with ${ENDPOINT_PREFIX}. Defaulting to ${ envUrl ?? DEFAULT_ANVIL_ENDPOINT }`,