diff --git a/typescript/cli/src/deploy/warp.ts b/typescript/cli/src/deploy/warp.ts index a11fbbaedc..c14c39adcb 100644 --- a/typescript/cli/src/deploy/warp.ts +++ b/typescript/cli/src/deploy/warp.ts @@ -53,6 +53,7 @@ import { Address, ProtocolType, assert, + concurrentMap, objFilter, objKeys, objMap, @@ -624,43 +625,42 @@ async function enrollRemoteRouters( (_, contracts) => getRouter(contracts).address, ); const allChains = Object.keys(deployedRouters); + await concurrentMap(1, allChains, async (chain) => { + const contracts = deployedContractsMap[chain]; + const router = getRouter(contracts); // Assume deployedContract always has 1 value + + // Mutate the config.remoteRouters by setting it to all other routers to update + const warpRouteReader = new EvmERC20WarpRouteReader(multiProvider, chain); + const mutatedWarpRouteConfig = await warpRouteReader.deriveWarpRouteConfig( + router.address, + ); + const evmERC20WarpModule = new EvmERC20WarpModule(multiProvider, { + config: mutatedWarpRouteConfig, + chain, + addresses: { deployedTokenRoute: router.address }, + }); - await promiseObjAll( - objMap(deployedContractsMap, async (chain, contracts) => { - const router = getRouter(contracts); // Assume deployedContract always has 1 value + const otherChains = multiProvider + .getRemoteChains(chain) + .filter((c) => allChains.includes(c)); - // Mutate the config.remoteRouters by setting it to all other routers to update - const warpRouteReader = new EvmERC20WarpRouteReader(multiProvider, chain); - const mutatedWarpRouteConfig = - await warpRouteReader.deriveWarpRouteConfig(router.address); - const evmERC20WarpModule = new EvmERC20WarpModule(multiProvider, { - config: mutatedWarpRouteConfig, - chain, - addresses: { deployedTokenRoute: router.address }, - }); - - const otherChains = multiProvider - .getRemoteChains(chain) - .filter((c) => allChains.includes(c)); + mutatedWarpRouteConfig.remoteRouters = otherChains.reduce( + (remoteRouters, chain) => { + remoteRouters[multiProvider.getDomainId(chain)] = + deployedRouters[chain]; + return remoteRouters; + }, + {}, + ); + const mutatedConfigTxs: AnnotatedEV5Transaction[] = + await evmERC20WarpModule.update(mutatedWarpRouteConfig); - mutatedWarpRouteConfig.remoteRouters = otherChains.reduce( - (remoteRouters, chain) => { - remoteRouters[multiProvider.getDomainId(chain)] = - deployedRouters[chain]; - return remoteRouters; - }, - {}, + if (mutatedConfigTxs.length == 0) + return logGreen( + `Warp config on ${chain} is the same as target. No updates needed.`, ); - const mutatedConfigTxs: AnnotatedEV5Transaction[] = - await evmERC20WarpModule.update(mutatedWarpRouteConfig); - - if (mutatedConfigTxs.length == 0) - return logGreen( - `Warp config on ${chain} is the same as target. No updates needed.`, - ); - await submitWarpApplyTransactions(chain, params, mutatedConfigTxs); - }), - ); + await submitWarpApplyTransactions(chain, params, mutatedConfigTxs); + }); } function getRouter(contracts: HyperlaneContracts) {