From 160b71eb55970b16370bab51bad386e54ebfc2f1 Mon Sep 17 00:00:00 2001 From: Le Yu <6251863+ltyu@users.noreply.github.com> Date: Tue, 21 Jan 2025 16:04:15 -0500 Subject: [PATCH 01/11] Add exportConfigs script --- .../warp/configGetters/exportConfigs.ts | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 typescript/infra/config/environments/mainnet3/warp/configGetters/exportConfigs.ts diff --git a/typescript/infra/config/environments/mainnet3/warp/configGetters/exportConfigs.ts b/typescript/infra/config/environments/mainnet3/warp/configGetters/exportConfigs.ts new file mode 100644 index 0000000000..4cbd9301cf --- /dev/null +++ b/typescript/infra/config/environments/mainnet3/warp/configGetters/exportConfigs.ts @@ -0,0 +1,33 @@ +import { getArgs, withOutputFile } from '../../../../../scripts/agent-utils.js'; +import { + getEnvironmentConfig, + getHyperlaneCore, +} from '../../../../../scripts/core-utils.js'; +import { getRegistry } from '../../../../registry.js'; +import { getWarpConfig, warpConfigGetterMap } from '../../../../warp.js'; + +async function main() { + const { environment } = await withOutputFile(getArgs()).argv; + const { multiProvider } = await getHyperlaneCore(environment); + const envConfig = getEnvironmentConfig(environment); + + const warpIdsToCheck = Object.keys(warpConfigGetterMap); + for (const warpRouteId of warpIdsToCheck) { + console.log(`Generating Warp config for ${warpRouteId}`); + + const warpConfig = await getWarpConfig( + multiProvider, + envConfig, + warpRouteId, + ); + + const registry = getRegistry(); + const configFileName = `${warpRouteId}.yaml`; + registry.addWarpRouteConfig(warpConfig, configFileName); + console.log( + `Warp config successfully created at ${registry.getUri()}/${registry.getWarpRoutesConfigPath()}/${configFileName}`, + ); + } +} + +main().catch((err) => console.error('Error:', err)); From 8dc8ab121dc5503cf3ff442a236441bd71b91ab9 Mon Sep 17 00:00:00 2001 From: Le Yu <6251863+ltyu@users.noreply.github.com> Date: Tue, 21 Jan 2025 16:33:11 -0500 Subject: [PATCH 02/11] Move getRegistry --- .../environments/mainnet3/warp/configGetters/exportConfigs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript/infra/config/environments/mainnet3/warp/configGetters/exportConfigs.ts b/typescript/infra/config/environments/mainnet3/warp/configGetters/exportConfigs.ts index 4cbd9301cf..c129d65335 100644 --- a/typescript/infra/config/environments/mainnet3/warp/configGetters/exportConfigs.ts +++ b/typescript/infra/config/environments/mainnet3/warp/configGetters/exportConfigs.ts @@ -10,6 +10,7 @@ async function main() { const { environment } = await withOutputFile(getArgs()).argv; const { multiProvider } = await getHyperlaneCore(environment); const envConfig = getEnvironmentConfig(environment); + const registry = getRegistry(); const warpIdsToCheck = Object.keys(warpConfigGetterMap); for (const warpRouteId of warpIdsToCheck) { @@ -21,7 +22,6 @@ async function main() { warpRouteId, ); - const registry = getRegistry(); const configFileName = `${warpRouteId}.yaml`; registry.addWarpRouteConfig(warpConfig, configFileName); console.log( From a7bc98c54850e9aba36e20913849b5b74f0e98b5 Mon Sep 17 00:00:00 2001 From: Le Yu <6251863+ltyu@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:54:49 -0500 Subject: [PATCH 03/11] Move exportConfigs to script and rename --- .../warp-routes/export-warp-configs.ts} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename typescript/infra/{config/environments/mainnet3/warp/configGetters/exportConfigs.ts => scripts/warp-routes/export-warp-configs.ts} (89%) diff --git a/typescript/infra/config/environments/mainnet3/warp/configGetters/exportConfigs.ts b/typescript/infra/scripts/warp-routes/export-warp-configs.ts similarity index 89% rename from typescript/infra/config/environments/mainnet3/warp/configGetters/exportConfigs.ts rename to typescript/infra/scripts/warp-routes/export-warp-configs.ts index c129d65335..05a1dee100 100644 --- a/typescript/infra/config/environments/mainnet3/warp/configGetters/exportConfigs.ts +++ b/typescript/infra/scripts/warp-routes/export-warp-configs.ts @@ -22,10 +22,10 @@ async function main() { warpRouteId, ); - const configFileName = `${warpRouteId}.yaml`; + const configFileName = `${warpRouteId}-deploy-config.yaml`; registry.addWarpRouteConfig(warpConfig, configFileName); console.log( - `Warp config successfully created at ${registry.getUri()}/${registry.getWarpRoutesConfigPath()}/${configFileName}`, + `Warp config successfully created at ${registry.getUri()}/${registry.getWarpRoutesPath()}/${configFileName}`, ); } } From 415b733be73ed841b057a5cbc14602b044fb599f Mon Sep 17 00:00:00 2001 From: Le Yu <6251863+ltyu@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:56:39 -0500 Subject: [PATCH 04/11] Fix import paths --- .../infra/scripts/warp-routes/export-warp-configs.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/typescript/infra/scripts/warp-routes/export-warp-configs.ts b/typescript/infra/scripts/warp-routes/export-warp-configs.ts index 05a1dee100..cfd28a5e53 100644 --- a/typescript/infra/scripts/warp-routes/export-warp-configs.ts +++ b/typescript/infra/scripts/warp-routes/export-warp-configs.ts @@ -1,10 +1,7 @@ -import { getArgs, withOutputFile } from '../../../../../scripts/agent-utils.js'; -import { - getEnvironmentConfig, - getHyperlaneCore, -} from '../../../../../scripts/core-utils.js'; -import { getRegistry } from '../../../../registry.js'; -import { getWarpConfig, warpConfigGetterMap } from '../../../../warp.js'; +import { getRegistry } from '../../config/registry.js'; +import { getWarpConfig, warpConfigGetterMap } from '../../config/warp.js'; +import { getArgs, withOutputFile } from '../agent-utils.js'; +import { getEnvironmentConfig, getHyperlaneCore } from '../core-utils.js'; async function main() { const { environment } = await withOutputFile(getArgs()).argv; From 4c9b7babb665065a2aa961eb818593d00e16037e Mon Sep 17 00:00:00 2001 From: Le Yu <6251863+ltyu@users.noreply.github.com> Date: Wed, 22 Jan 2025 17:48:06 -0500 Subject: [PATCH 05/11] Add sortMapEntries to yamlStringify --- typescript/utils/src/objects.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/typescript/utils/src/objects.ts b/typescript/utils/src/objects.ts index 97d9d99db6..78e377b2e9 100644 --- a/typescript/utils/src/objects.ts +++ b/typescript/utils/src/objects.ts @@ -224,7 +224,10 @@ export function stringifyObject( if (format === 'json') { return json; } - return yamlStringify(JSON.parse(json), null, space); + return yamlStringify(JSON.parse(json), null, { + indent: space, + sortMapEntries: true, + }); } interface ObjectDiffOutput { From 924f0b5e1a54208cece3b6782f8cf7e91529130f Mon Sep 17 00:00:00 2001 From: Le Yu <6251863+ltyu@users.noreply.github.com> Date: Wed, 22 Jan 2025 17:48:26 -0500 Subject: [PATCH 06/11] Set spacing to 2 explictly --- typescript/infra/src/utils/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript/infra/src/utils/utils.ts b/typescript/infra/src/utils/utils.ts index 50e0e364ed..db1830f444 100644 --- a/typescript/infra/src/utils/utils.ts +++ b/typescript/infra/src/utils/utils.ts @@ -169,7 +169,7 @@ export function writeJsonAtPath(filepath: string, obj: any) { } export function writeYamlAtPath(filepath: string, obj: any) { - const content = stringifyObject(obj, 'yaml'); + const content = stringifyObject(obj, 'yaml', 2); writeToFile(filepath, content); } From 538b2adcd2dcbaa42209900d98982b078c1a258f Mon Sep 17 00:00:00 2001 From: Le Yu <6251863+ltyu@users.noreply.github.com> Date: Thu, 23 Jan 2025 11:48:58 -0500 Subject: [PATCH 07/11] Update Registry to 7.1.0 --- typescript/cli/package.json | 2 +- typescript/infra/package.json | 2 +- typescript/widgets/package.json | 2 +- yarn.lock | 16 +++++++++++++--- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/typescript/cli/package.json b/typescript/cli/package.json index 1c9b87d5c6..cea798237b 100644 --- a/typescript/cli/package.json +++ b/typescript/cli/package.json @@ -5,7 +5,7 @@ "dependencies": { "@aws-sdk/client-kms": "^3.577.0", "@aws-sdk/client-s3": "^3.577.0", - "@hyperlane-xyz/registry": "6.18.0", + "@hyperlane-xyz/registry": "7.1.0", "@hyperlane-xyz/sdk": "8.2.0", "@hyperlane-xyz/utils": "8.2.0", "@inquirer/core": "9.0.10", diff --git a/typescript/infra/package.json b/typescript/infra/package.json index e48a843230..637c926bae 100644 --- a/typescript/infra/package.json +++ b/typescript/infra/package.json @@ -14,7 +14,7 @@ "@ethersproject/providers": "*", "@google-cloud/secret-manager": "^5.5.0", "@hyperlane-xyz/helloworld": "8.2.0", - "@hyperlane-xyz/registry": "6.18.0", + "@hyperlane-xyz/registry": "7.1.0", "@hyperlane-xyz/sdk": "8.2.0", "@hyperlane-xyz/utils": "8.2.0", "@inquirer/prompts": "3.3.2", diff --git a/typescript/widgets/package.json b/typescript/widgets/package.json index ab1c0ed5fd..c1b9548454 100644 --- a/typescript/widgets/package.json +++ b/typescript/widgets/package.json @@ -27,7 +27,7 @@ "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", "@eslint/js": "^9.15.0", - "@hyperlane-xyz/registry": "6.18.0", + "@hyperlane-xyz/registry": "7.1.0", "@storybook/addon-essentials": "^7.6.14", "@storybook/addon-interactions": "^7.6.14", "@storybook/addon-links": "^7.6.14", diff --git a/yarn.lock b/yarn.lock index cf72bf2284..33bd7376ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7320,7 +7320,7 @@ __metadata: "@eslint/js": "npm:^9.15.0" "@ethersproject/abi": "npm:*" "@ethersproject/providers": "npm:*" - "@hyperlane-xyz/registry": "npm:6.18.0" + "@hyperlane-xyz/registry": "npm:7.1.0" "@hyperlane-xyz/sdk": "npm:8.2.0" "@hyperlane-xyz/utils": "npm:8.2.0" "@inquirer/core": "npm:9.0.10" @@ -7475,7 +7475,7 @@ __metadata: "@ethersproject/providers": "npm:*" "@google-cloud/secret-manager": "npm:^5.5.0" "@hyperlane-xyz/helloworld": "npm:8.2.0" - "@hyperlane-xyz/registry": "npm:6.18.0" + "@hyperlane-xyz/registry": "npm:7.1.0" "@hyperlane-xyz/sdk": "npm:8.2.0" "@hyperlane-xyz/utils": "npm:8.2.0" "@inquirer/prompts": "npm:3.3.2" @@ -7547,6 +7547,16 @@ __metadata: languageName: node linkType: hard +"@hyperlane-xyz/registry@npm:7.1.0": + version: 7.1.0 + resolution: "@hyperlane-xyz/registry@npm:7.1.0" + dependencies: + yaml: "npm:2.4.5" + zod: "npm:^3.21.2" + checksum: 10/94b594ecd5734bc564e1a9ad220f4e5c9f04a98cd768cd4472afbaffe91009ae0680b8c4ffb01c13dbe913030dd730b22d5a73d7bfc88d6405df1e9f842ef939 + languageName: node + linkType: hard + "@hyperlane-xyz/sdk@npm:8.2.0, @hyperlane-xyz/sdk@workspace:typescript/sdk": version: 0.0.0-use.local resolution: "@hyperlane-xyz/sdk@workspace:typescript/sdk" @@ -7642,7 +7652,7 @@ __metadata: "@emotion/styled": "npm:^11.13.0" "@eslint/js": "npm:^9.15.0" "@headlessui/react": "npm:^2.1.8" - "@hyperlane-xyz/registry": "npm:6.18.0" + "@hyperlane-xyz/registry": "npm:7.1.0" "@hyperlane-xyz/sdk": "npm:8.2.0" "@hyperlane-xyz/utils": "npm:8.2.0" "@interchain-ui/react": "npm:^1.23.28" From 702cd8d7bc9c2d7aa9f2e9f570ffd4e45228e014 Mon Sep 17 00:00:00 2001 From: Le Yu <6251863+ltyu@users.noreply.github.com> Date: Thu, 23 Jan 2025 11:50:37 -0500 Subject: [PATCH 08/11] hardcode path --- .../infra/scripts/warp-routes/export-warp-configs.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/typescript/infra/scripts/warp-routes/export-warp-configs.ts b/typescript/infra/scripts/warp-routes/export-warp-configs.ts index cfd28a5e53..9fee050577 100644 --- a/typescript/infra/scripts/warp-routes/export-warp-configs.ts +++ b/typescript/infra/scripts/warp-routes/export-warp-configs.ts @@ -3,6 +3,7 @@ import { getWarpConfig, warpConfigGetterMap } from '../../config/warp.js'; import { getArgs, withOutputFile } from '../agent-utils.js'; import { getEnvironmentConfig, getHyperlaneCore } from '../core-utils.js'; +// Writes the warp configs into the Registry async function main() { const { environment } = await withOutputFile(getArgs()).argv; const { multiProvider } = await getHyperlaneCore(environment); @@ -19,10 +20,12 @@ async function main() { warpRouteId, ); - const configFileName = `${warpRouteId}-deploy-config.yaml`; + const configFileName = `${warpRouteId}-deploy.yaml`; registry.addWarpRouteConfig(warpConfig, configFileName); + + // TODO: Use registry.getWarpRoutesPath() to dynamically generate path by removing "protected" console.log( - `Warp config successfully created at ${registry.getUri()}/${registry.getWarpRoutesPath()}/${configFileName}`, + `Warp config successfully created at ${registry.getUri()}/deployments/warp_routes/${configFileName}`, ); } } From 0b83ecdd609b900b84b9603a82aee0761a68fe38 Mon Sep 17 00:00:00 2001 From: Le Yu <6251863+ltyu@users.noreply.github.com> Date: Thu, 23 Jan 2025 11:53:10 -0500 Subject: [PATCH 09/11] Update Registry ver for helloworld --- typescript/helloworld/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typescript/helloworld/package.json b/typescript/helloworld/package.json index f3863608a0..4656142f6b 100644 --- a/typescript/helloworld/package.json +++ b/typescript/helloworld/package.json @@ -4,7 +4,7 @@ "version": "8.2.0", "dependencies": { "@hyperlane-xyz/core": "5.9.2", - "@hyperlane-xyz/registry": "6.18.0", + "@hyperlane-xyz/registry": "7.1.0", "@hyperlane-xyz/sdk": "8.2.0", "@openzeppelin/contracts-upgradeable": "^4.9.3", "ethers": "^5.7.2" @@ -73,4 +73,4 @@ "@types/node": "*", "@types/sinon-chai": "*" } -} +} \ No newline at end of file From 87097acc929c1d4ad8fcf889eeacf9e5b56fcc74 Mon Sep 17 00:00:00 2001 From: Le Yu <6251863+ltyu@users.noreply.github.com> Date: Thu, 23 Jan 2025 11:56:09 -0500 Subject: [PATCH 10/11] Update Registry ver yarnlock for helloworld --- typescript/helloworld/package.json | 2 +- yarn.lock | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/typescript/helloworld/package.json b/typescript/helloworld/package.json index 4656142f6b..c95e09fa9f 100644 --- a/typescript/helloworld/package.json +++ b/typescript/helloworld/package.json @@ -73,4 +73,4 @@ "@types/node": "*", "@types/sinon-chai": "*" } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 33bd7376ea..54fa622784 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7424,7 +7424,7 @@ __metadata: dependencies: "@eslint/js": "npm:^9.15.0" "@hyperlane-xyz/core": "npm:5.9.2" - "@hyperlane-xyz/registry": "npm:6.18.0" + "@hyperlane-xyz/registry": "npm:7.1.0" "@hyperlane-xyz/sdk": "npm:8.2.0" "@nomiclabs/hardhat-ethers": "npm:^2.2.3" "@nomiclabs/hardhat-waffle": "npm:^2.0.6" @@ -7537,16 +7537,6 @@ __metadata: languageName: unknown linkType: soft -"@hyperlane-xyz/registry@npm:6.18.0": - version: 6.18.0 - resolution: "@hyperlane-xyz/registry@npm:6.18.0" - dependencies: - yaml: "npm:2.4.5" - zod: "npm:^3.21.2" - checksum: 10/0090afeffa60cf1891b1c7178d5f91d80db96a85595ba9a4ad7160cdc830737efc54022e11d416da4f4d9f7c032fde6f7aef678ae99e4a1f6142cdc06c50ccbc - languageName: node - linkType: hard - "@hyperlane-xyz/registry@npm:7.1.0": version: 7.1.0 resolution: "@hyperlane-xyz/registry@npm:7.1.0" From 79182737fbaffa938baa70c25822bd852214e8c7 Mon Sep 17 00:00:00 2001 From: Le Yu <6251863+ltyu@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:43:08 -0500 Subject: [PATCH 11/11] Use nullish for indent --- typescript/utils/src/objects.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript/utils/src/objects.ts b/typescript/utils/src/objects.ts index 78e377b2e9..17fd134a18 100644 --- a/typescript/utils/src/objects.ts +++ b/typescript/utils/src/objects.ts @@ -225,7 +225,7 @@ export function stringifyObject( return json; } return yamlStringify(JSON.parse(json), null, { - indent: space, + indent: space ?? 2, sortMapEntries: true, }); }