diff --git a/typescript/cli/src/deploy/core.ts b/typescript/cli/src/deploy/core.ts index f0848458f..09bd9c95f 100644 --- a/typescript/cli/src/deploy/core.ts +++ b/typescript/cli/src/deploy/core.ts @@ -14,11 +14,12 @@ import { import { MINIMUM_CORE_DEPLOY_GAS } from '../consts.js'; import { getOrRequestApiKeys } from '../context/context.js'; import { WriteCommandContext } from '../context/types.js'; -import { log, logBlue, logGray, logGreen } from '../logger.js'; +import { log, logBlue, logGray, logGreen, logRed } from '../logger.js'; import { runSingleChainSelectionStep } from '../utils/chains.js'; import { indentYamlOrJson } from '../utils/files.js'; import { + checkTechStackCoreConfigCompatibility, completeDeploy, prepareDeploy, runDeployPlanStep, @@ -81,6 +82,16 @@ export async function runCoreDeploy(params: DeployParams) { const userAddress = await signer.getAddress(); + const { technicalStack: chainTechnicalStack } = + context.multiProvider.getChainMetadata(chain); + + if (!checkTechStackCoreConfigCompatibility({ chainTechnicalStack, config })) { + logRed( + 'ERROR: CoreConfig is not compatible with the selected Chain Technical Stack!', + ); + return; + } + const initialBalances = await prepareDeploy(context, userAddress, [chain]); const contractVerifier = new ContractVerifier( diff --git a/typescript/cli/src/deploy/utils.ts b/typescript/cli/src/deploy/utils.ts index d8ced32dc..997da5b3b 100644 --- a/typescript/cli/src/deploy/utils.ts +++ b/typescript/cli/src/deploy/utils.ts @@ -5,9 +5,13 @@ import { ChainMap, ChainMetadata, ChainName, + ChainTechnicalStack, + CoreConfig, IsmConfig, + IsmType, MultisigConfig, getLocalProvider, + shouldSkipStaticDeployment, } from '@hyperlane-xyz/sdk'; import { Address, ProtocolType } from '@hyperlane-xyz/utils'; @@ -19,6 +23,7 @@ import { logGray, logGreen, logPink, + logRed, logTable, } from '../logger.js'; import { nativeBalancesAreSufficient } from '../utils/balances.js'; @@ -186,3 +191,29 @@ function transformChainMetadataForDisplay(chainMetadata: ChainMetadata) { 'Native Token: Decimals': chainMetadata.nativeToken?.decimals, }; } + +/** + * Checks if the given chain technical stack is compatible with the core configuration. + * + * @param {ChainTechnicalStack | undefined} params.chainTechnicalStack - The technical stack of the chain. + * @param {CoreConfig} params.config - The core configuration to check. + * @returns {boolean} True if the configuration is compatible, false otherwise. + */ +export function checkTechStackCoreConfigCompatibility({ + chainTechnicalStack, + config, +}: { + chainTechnicalStack: ChainTechnicalStack | undefined; + config: CoreConfig; +}): boolean { + // Static deployment is not available on certain chains (e.g., ZKSync) for aggregation ISMs. + if ( + shouldSkipStaticDeployment(chainTechnicalStack) && + typeof config.defaultIsm !== 'string' && + config.defaultIsm.type === IsmType.AGGREGATION + ) { + logRed('⛔ Static contract deployment not available on ZKSync!'); + return false; + } + return true; +} diff --git a/typescript/sdk/src/index.ts b/typescript/sdk/src/index.ts index 5389fdb0b..aa60bbb5f 100644 --- a/typescript/sdk/src/index.ts +++ b/typescript/sdk/src/index.ts @@ -541,3 +541,4 @@ export { export { EvmIsmModule } from './ism/EvmIsmModule.js'; export { AnnotatedEV5Transaction } from './providers/ProviderType.js'; export { EvmERC20WarpModule } from './token/EvmERC20WarpModule.js'; +export { shouldSkipStaticDeployment } from './deploy/protocolDeploymentConfig.js';