@hyperlane-xyz/deploy-sdk 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/AltVMCoreModule.d.ts +94 -0
  2. package/dist/AltVMCoreModule.d.ts.map +1 -0
  3. package/dist/AltVMCoreModule.js +328 -0
  4. package/dist/AltVMCoreModule.js.map +1 -0
  5. package/dist/AltVMCoreReader.d.ts +17 -0
  6. package/dist/AltVMCoreReader.d.ts.map +1 -0
  7. package/dist/AltVMCoreReader.js +31 -0
  8. package/dist/AltVMCoreReader.js.map +1 -0
  9. package/dist/AltVMHookModule.d.ts +41 -0
  10. package/dist/AltVMHookModule.d.ts.map +1 -0
  11. package/dist/AltVMHookModule.js +176 -0
  12. package/dist/AltVMHookModule.js.map +1 -0
  13. package/dist/AltVMHookReader.d.ts +17 -0
  14. package/dist/AltVMHookReader.d.ts.map +1 -0
  15. package/dist/AltVMHookReader.js +76 -0
  16. package/dist/AltVMHookReader.js.map +1 -0
  17. package/dist/AltVMIsmModule.d.ts +41 -0
  18. package/dist/AltVMIsmModule.d.ts.map +1 -0
  19. package/dist/AltVMIsmModule.js +255 -0
  20. package/dist/AltVMIsmModule.js.map +1 -0
  21. package/dist/AltVMIsmReader.d.ts +19 -0
  22. package/dist/AltVMIsmReader.d.ts.map +1 -0
  23. package/dist/AltVMIsmReader.js +101 -0
  24. package/dist/AltVMIsmReader.js.map +1 -0
  25. package/dist/AltVMWarpDeployer.d.ts +14 -0
  26. package/dist/AltVMWarpDeployer.d.ts.map +1 -0
  27. package/dist/AltVMWarpDeployer.js +69 -0
  28. package/dist/AltVMWarpDeployer.js.map +1 -0
  29. package/dist/AltVMWarpModule.d.ts +96 -0
  30. package/dist/AltVMWarpModule.d.ts.map +1 -0
  31. package/dist/AltVMWarpModule.js +329 -0
  32. package/dist/AltVMWarpModule.js.map +1 -0
  33. package/dist/AltVMWarpModule.test.d.ts +2 -0
  34. package/dist/AltVMWarpModule.test.d.ts.map +1 -0
  35. package/dist/AltVMWarpModule.test.js +403 -0
  36. package/dist/AltVMWarpModule.test.js.map +1 -0
  37. package/dist/AltVMWarpRouteReader.d.ts +52 -0
  38. package/dist/AltVMWarpRouteReader.d.ts.map +1 -0
  39. package/dist/AltVMWarpRouteReader.js +145 -0
  40. package/dist/AltVMWarpRouteReader.js.map +1 -0
  41. package/dist/core-module.d.ts +5 -0
  42. package/dist/core-module.d.ts.map +1 -0
  43. package/dist/core-module.js +28 -0
  44. package/dist/core-module.js.map +1 -0
  45. package/dist/hook-module.d.ts +5 -0
  46. package/dist/hook-module.d.ts.map +1 -0
  47. package/dist/hook-module.js +35 -0
  48. package/dist/hook-module.js.map +1 -0
  49. package/dist/index.d.ts +16 -0
  50. package/dist/index.d.ts.map +1 -0
  51. package/dist/index.js +16 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/ism-module.d.ts +5 -0
  54. package/dist/ism-module.d.ts.map +1 -0
  55. package/dist/ism-module.js +35 -0
  56. package/dist/ism-module.js.map +1 -0
  57. package/dist/protocol.d.ts +3 -0
  58. package/dist/protocol.d.ts.map +1 -0
  59. package/dist/protocol.js +23 -0
  60. package/dist/protocol.js.map +1 -0
  61. package/dist/utils/validation.d.ts +37 -0
  62. package/dist/utils/validation.d.ts.map +1 -0
  63. package/dist/utils/validation.js +66 -0
  64. package/dist/utils/validation.js.map +1 -0
  65. package/dist/warp-module.d.ts +5 -0
  66. package/dist/warp-module.d.ts.map +1 -0
  67. package/dist/warp-module.js +28 -0
  68. package/dist/warp-module.js.map +1 -0
  69. package/package.json +46 -0
@@ -0,0 +1,176 @@
1
+ import { MUTABLE_HOOK_TYPE, } from '@hyperlane-xyz/provider-sdk/hook';
2
+ import { assert, deepEquals, isZeroishAddress, normalizeConfig, rootLogger, } from '@hyperlane-xyz/utils';
3
+ import { AltVMHookReader } from './AltVMHookReader.js';
4
+ export class AltVMHookModule {
5
+ chainLookup;
6
+ args;
7
+ signer;
8
+ logger = rootLogger.child({
9
+ module: 'AltVMHookModule',
10
+ });
11
+ reader;
12
+ // Cached chain name
13
+ chain;
14
+ constructor(chainLookup, args, signer) {
15
+ this.chainLookup = chainLookup;
16
+ this.args = args;
17
+ this.signer = signer;
18
+ this.reader = new AltVMHookReader(chainLookup.getChainMetadata, signer);
19
+ const metadata = chainLookup.getChainMetadata(this.args.chain);
20
+ this.chain = metadata.name;
21
+ }
22
+ async read() {
23
+ return this.reader.deriveHookConfig(this.args.addresses.deployedHook);
24
+ }
25
+ serialize() {
26
+ return this.args.addresses;
27
+ }
28
+ async update(targetConfig) {
29
+ if (typeof targetConfig === 'string' && isZeroishAddress(targetConfig)) {
30
+ return Promise.resolve([]);
31
+ }
32
+ // Do not support updating to a custom Hook address
33
+ if (typeof targetConfig === 'string') {
34
+ throw new Error('Invalid targetConfig: Updating to a custom Hook address is not supported. Please provide a valid Hook configuration.');
35
+ }
36
+ this.args.config = targetConfig;
37
+ // We need to normalize the current and target configs to compare.
38
+ const normalizedCurrentConfig = normalizeConfig(await this.read());
39
+ const normalizedTargetConfig = normalizeConfig(targetConfig);
40
+ if (deepEquals(normalizedCurrentConfig, normalizedTargetConfig)) {
41
+ return [];
42
+ }
43
+ if (!MUTABLE_HOOK_TYPE.includes(normalizedTargetConfig.type)) {
44
+ this.args.addresses.deployedHook = await this.deploy({
45
+ config: normalizedTargetConfig,
46
+ });
47
+ return [];
48
+ }
49
+ return this.updateMutableHook({
50
+ current: normalizedCurrentConfig,
51
+ target: normalizedTargetConfig,
52
+ });
53
+ }
54
+ async updateMutableHook(configs) {
55
+ const { current, target } = configs;
56
+ let updateTxs;
57
+ assert(current.type === target.type, `Mutable hook update requires both hook configs to be of the same type. Expected ${current.type}, got ${target.type}`);
58
+ assert(MUTABLE_HOOK_TYPE.includes(current.type), 'Expected update config to be of mutable hook type');
59
+ // Checking both objects type fields to help typescript narrow the type down correctly
60
+ if (current.type === 'interchainGasPaymaster' &&
61
+ target.type === 'interchainGasPaymaster') {
62
+ updateTxs = await this.updateIgpHook({
63
+ currentConfig: current,
64
+ targetConfig: target,
65
+ });
66
+ }
67
+ else {
68
+ throw new Error(`Unsupported hook type: ${target.type}`);
69
+ }
70
+ return updateTxs;
71
+ }
72
+ async updateIgpHook({ currentConfig, targetConfig, }) {
73
+ const updateTxs = [];
74
+ for (const [remote, c] of Object.entries(targetConfig.oracleConfig)) {
75
+ if (deepEquals(currentConfig.oracleConfig[remote], c)) {
76
+ continue;
77
+ }
78
+ const remoteDomain = this.chainLookup.getDomainId(remote);
79
+ if (remoteDomain === null) {
80
+ this.logger.warn(`Skipping gas oracle ${this.chain} -> ${remote}.`);
81
+ continue;
82
+ }
83
+ updateTxs.push({
84
+ annotation: `Setting gas params for ${this.chain}`,
85
+ ...(await this.signer.getSetDestinationGasConfigTransaction({
86
+ signer: currentConfig.owner,
87
+ hookAddress: this.args.addresses.deployedHook,
88
+ destinationGasConfig: {
89
+ remoteDomainId: remoteDomain,
90
+ gasOracle: {
91
+ tokenExchangeRate: c.tokenExchangeRate,
92
+ gasPrice: c.gasPrice,
93
+ },
94
+ gasOverhead: targetConfig.overhead[remote].toString(),
95
+ },
96
+ })),
97
+ });
98
+ }
99
+ // Lastly, check if the resolved owner is different from the current owner
100
+ if (currentConfig.owner !== targetConfig.owner) {
101
+ updateTxs.push({
102
+ annotation: 'Transferring ownership of ownable Hook...',
103
+ ...(await this.signer.getSetInterchainGasPaymasterHookOwnerTransaction({
104
+ signer: currentConfig.owner,
105
+ hookAddress: this.args.addresses.deployedHook,
106
+ newOwner: targetConfig.owner,
107
+ })),
108
+ });
109
+ }
110
+ return updateTxs;
111
+ }
112
+ static async create({ chain, config, addresses, chainLookup, signer, }) {
113
+ const module = new AltVMHookModule(chainLookup, { addresses, chain, config }, signer);
114
+ module.args.addresses.deployedHook = await module.deploy({ config });
115
+ return module;
116
+ }
117
+ async deploy({ config, }) {
118
+ if (typeof config === 'string') {
119
+ return config;
120
+ }
121
+ const hookType = config.type;
122
+ this.logger.info(`Deploying ${hookType} to ${this.chain}`);
123
+ switch (hookType) {
124
+ case 'interchainGasPaymaster':
125
+ return this.deployIgpHook({ config });
126
+ case 'merkleTreeHook':
127
+ return this.deployMerkleTreeHook();
128
+ default:
129
+ throw new Error(`Hook type ${hookType} is not supported on AltVM`);
130
+ }
131
+ }
132
+ async deployIgpHook({ config, }) {
133
+ this.logger.debug('Deploying IGP as hook...');
134
+ const { nativeToken } = this.chainLookup.getChainMetadata(this.chain);
135
+ assert(nativeToken?.denom, `found no native token for chain ${this.chain}`);
136
+ const { hookAddress } = await this.signer.createInterchainGasPaymasterHook({
137
+ mailboxAddress: this.args.addresses.mailbox,
138
+ denom: nativeToken.denom,
139
+ });
140
+ for (const [remote, c] of Object.entries(config.oracleConfig)) {
141
+ const remoteDomain = this.chainLookup.getDomainId(remote);
142
+ if (remoteDomain === null) {
143
+ this.logger.warn(`Skipping gas oracle ${this.chain} -> ${remote}.`);
144
+ continue;
145
+ }
146
+ await this.signer.setDestinationGasConfig({
147
+ hookAddress,
148
+ destinationGasConfig: {
149
+ remoteDomainId: remoteDomain,
150
+ gasOverhead: config.overhead[remote].toString(),
151
+ gasOracle: {
152
+ tokenExchangeRate: c.tokenExchangeRate,
153
+ gasPrice: c.gasPrice,
154
+ },
155
+ },
156
+ });
157
+ }
158
+ if (this.signer.getSignerAddress() !== config.owner) {
159
+ await this.signer.setInterchainGasPaymasterHookOwner({
160
+ hookAddress,
161
+ newOwner: config.owner,
162
+ });
163
+ }
164
+ this.logger.debug(`Deployed IGP hook to ${hookAddress}`);
165
+ return hookAddress;
166
+ }
167
+ async deployMerkleTreeHook() {
168
+ this.logger.debug('Deploying Merkle Tree Hook...');
169
+ const { hookAddress } = await this.signer.createMerkleTreeHook({
170
+ mailboxAddress: this.args.addresses.mailbox,
171
+ });
172
+ this.logger.debug(`Deployed merkle tree hook to ${hookAddress}`);
173
+ return hookAddress;
174
+ }
175
+ }
176
+ //# sourceMappingURL=AltVMHookModule.js.map
@@ -0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uB,CAAC;gBACxC,WAAW;gBACX,oBAAoB,EAAE;oBACpB,cAAc,EAAE,YAAY;oBAC5B,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;oBAC/C,SAAS,EAAE;wBACT,iBAAiB,EAAE,CAAC,CAAC,iBAAiB;wBACtC,QAAQ,EAAE,CAAC,CAAC,QAAQ;qBACrB;iBACF;aACF,CAAC,CAAC;QACL,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC;YACpD,MAAM,IAAI,CAAC,MAAM,CAAC,kCAAkC,CAAC;gBACnD,WAAW;gBACX,QAAQ,EAAE,MAAM,CAAC,KAAK;aACvB,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,WAAW,EAAE,CAAC,CAAC;QACzD,OAAO,WAAW,CAAC;IACrB,CAAC;IAES,KAAK,CAAC,oBAAoB;QAClC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAEnD,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;YAC7D,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO;SAC5C,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,WAAW,EAAE,CAAC,CAAC;QACjE,OAAO,WAAW,CAAC;IACrB,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ import { AltVM } from '@hyperlane-xyz/provider-sdk';
2
+ import { ChainMetadataLookup } from '@hyperlane-xyz/provider-sdk/chain';
3
+ import { DerivedHookConfig, HookConfig, HookModuleType } from '@hyperlane-xyz/provider-sdk/hook';
4
+ import { HypReader } from '@hyperlane-xyz/provider-sdk/module';
5
+ import { Address, Logger } from '@hyperlane-xyz/utils';
6
+ export declare class AltVMHookReader implements HypReader<HookModuleType> {
7
+ protected readonly getChainMetadata: ChainMetadataLookup;
8
+ protected readonly provider: AltVM.IProvider;
9
+ protected readonly logger: Logger;
10
+ constructor(getChainMetadata: ChainMetadataLookup, provider: AltVM.IProvider);
11
+ read(address: string): Promise<DerivedHookConfig>;
12
+ deriveHookConfigFromAddress(address: Address): Promise<DerivedHookConfig>;
13
+ deriveHookConfig(config: HookConfig | Address): Promise<DerivedHookConfig>;
14
+ private deriveIgpConfig;
15
+ private deriveMerkleTreeConfig;
16
+ }
17
+ //# sourceMappingURL=AltVMHookReader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AltVMHookReader.d.ts","sourceRoot":"","sources":["../src/AltVMHookReader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,EAA2B,MAAM,sBAAsB,CAAC;AAEhF,qBAAa,eAAgB,YAAW,SAAS,CAAC,cAAc,CAAC;IAM7D,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,mBAAmB;IACxD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS;IAN9C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAE9B;gBAGkB,gBAAgB,EAAE,mBAAmB,EACrC,QAAQ,EAAE,KAAK,CAAC,SAAS;IAGxC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIjD,2BAA2B,CAC/B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,iBAAiB,CAAC;IAoBvB,gBAAgB,CACpB,MAAM,EAAE,UAAU,GAAG,OAAO,GAC3B,OAAO,CAAC,iBAAiB,CAAC;YAOf,eAAe;YAoCf,sBAAsB;CAYrC"}
@@ -0,0 +1,76 @@
1
+ import { AltVM } from '@hyperlane-xyz/provider-sdk';
2
+ import { rootLogger } from '@hyperlane-xyz/utils';
3
+ export class AltVMHookReader {
4
+ getChainMetadata;
5
+ provider;
6
+ logger = rootLogger.child({
7
+ module: 'AltVMHookReader',
8
+ });
9
+ constructor(getChainMetadata, provider) {
10
+ this.getChainMetadata = getChainMetadata;
11
+ this.provider = provider;
12
+ }
13
+ async read(address) {
14
+ return this.deriveHookConfig(address);
15
+ }
16
+ async deriveHookConfigFromAddress(address) {
17
+ try {
18
+ const hook_type = await this.provider.getHookType({
19
+ hookAddress: address,
20
+ });
21
+ switch (hook_type) {
22
+ case AltVM.HookType.MERKLE_TREE:
23
+ return this.deriveMerkleTreeConfig(address);
24
+ case AltVM.HookType.INTERCHAIN_GAS_PAYMASTER:
25
+ return this.deriveIgpConfig(address);
26
+ default:
27
+ throw new Error(`Unknown Hook Type: ${hook_type}`);
28
+ }
29
+ }
30
+ catch (error) {
31
+ this.logger.error(`Failed to derive Hook config for ${address}`, error);
32
+ throw error;
33
+ }
34
+ }
35
+ async deriveHookConfig(config) {
36
+ if (typeof config === 'string')
37
+ return this.deriveHookConfigFromAddress(config);
38
+ return config;
39
+ }
40
+ async deriveIgpConfig(address) {
41
+ const igp = await this.provider.getInterchainGasPaymasterHook({
42
+ hookAddress: address,
43
+ });
44
+ const overhead = {};
45
+ const oracleConfig = {};
46
+ Object.keys(igp.destinationGasConfigs).forEach((domain_id) => {
47
+ const { name, nativeToken } = this.getChainMetadata(domain_id);
48
+ overhead[name] = parseInt(igp.destinationGasConfigs[domain_id].gasOverhead);
49
+ oracleConfig[name] = {
50
+ gasPrice: igp.destinationGasConfigs[domain_id].gasOracle?.gasPrice ?? '',
51
+ tokenExchangeRate: igp.destinationGasConfigs[domain_id].gasOracle?.tokenExchangeRate ??
52
+ '',
53
+ tokenDecimals: nativeToken?.decimals,
54
+ };
55
+ });
56
+ return {
57
+ type: 'interchainGasPaymaster',
58
+ owner: igp.owner,
59
+ beneficiary: igp.owner,
60
+ oracleKey: igp.owner,
61
+ overhead,
62
+ oracleConfig,
63
+ address: igp.address,
64
+ };
65
+ }
66
+ async deriveMerkleTreeConfig(address) {
67
+ const merkle_tree_hook = await this.provider.getMerkleTreeHook({
68
+ hookAddress: address,
69
+ });
70
+ return {
71
+ type: 'merkleTreeHook',
72
+ address: merkle_tree_hook.address,
73
+ };
74
+ }
75
+ }
76
+ //# sourceMappingURL=AltVMHookReader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AltVMHookReader.js","sourceRoot":"","sources":["../src/AltVMHookReader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAUpD,OAAO,EAAgC,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEhF,MAAM,OAAO,eAAe;IAML;IACA;IANF,MAAM,GAAW,UAAU,CAAC,KAAK,CAAC;QACnD,MAAM,EAAE,iBAAiB;KAC1B,CAAC,CAAC;IAEH,YACqB,gBAAqC,EACrC,QAAyB;QADzB,qBAAgB,GAAhB,gBAAgB,CAAqB;QACrC,aAAQ,GAAR,QAAQ,CAAiB;IAC3C,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,OAAe;QACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,2BAA2B,CAC/B,OAAgB;QAEhB,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;gBAChD,WAAW,EAAE,OAAO;aACrB,CAAC,CAAC;YAEH,QAAQ,SAAS,EAAE,CAAC;gBAClB,KAAK,KAAK,CAAC,QAAQ,CAAC,WAAW;oBAC7B,OAAO,IAAI,CAAC,sBAAsB,CAAC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,EACf,GAAG,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,iBAAiB;oBACjE,EAAE;gBACJ,aAAa,EAAE,WAAW,EAAE,QAAQ;aACrC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,IAAI,EAAE,wBAAwB;YAC9B,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,WAAW,EAAE,GAAG,CAAC,KAAK;YACtB,SAAS,EAAE,GAAG,CAAC,KAAK;YACpB,QAAQ;YACR,YAAY;YACZ,OAAO,EAAE,GAAG,CAAC,OAAO;SACrB,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,sBAAsB,CAClC,OAAgB;QAEhB,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC;YAC7D,WAAW,EAAE,OAAO;SACrB,CAAC,CAAC;QAEH,OAAO;YACL,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,gBAAgB,CAAC,OAAO;SAClC,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,41 @@
1
+ import { AltVM } from '@hyperlane-xyz/provider-sdk';
2
+ import { ChainLookup } from '@hyperlane-xyz/provider-sdk/chain';
3
+ import { DerivedIsmConfig, DomainRoutingIsmConfig, IsmConfig, IsmModuleAddresses, IsmModuleType, MultisigIsmConfig } from '@hyperlane-xyz/provider-sdk/ism';
4
+ import { AnnotatedTx, HypModule, HypModuleArgs, TxReceipt } from '@hyperlane-xyz/provider-sdk/module';
5
+ import { Address, Logger, rootLogger } from '@hyperlane-xyz/utils';
6
+ import { AltVMIsmReader } from './AltVMIsmReader.js';
7
+ export declare class AltVMIsmModule implements HypModule<IsmModuleType> {
8
+ protected readonly chainLookup: ChainLookup;
9
+ private readonly args;
10
+ protected readonly signer: AltVM.ISigner<AnnotatedTx, TxReceipt>;
11
+ protected readonly logger: Logger;
12
+ protected readonly reader: AltVMIsmReader;
13
+ protected readonly mailbox: Address;
14
+ readonly chain: string;
15
+ constructor(chainLookup: ChainLookup, args: HypModuleArgs<IsmModuleType>, signer: AltVM.ISigner<AnnotatedTx, TxReceipt>);
16
+ read(): Promise<DerivedIsmConfig>;
17
+ serialize(): IsmModuleAddresses;
18
+ update(expectedConfig: IsmConfig | string): Promise<AnnotatedTx[]>;
19
+ static create({ chain, config, addresses, chainLookup, signer, }: {
20
+ chain: string;
21
+ config: IsmConfig | string;
22
+ addresses: {
23
+ mailbox: string;
24
+ };
25
+ chainLookup: ChainLookup;
26
+ signer: AltVM.ISigner<AnnotatedTx, TxReceipt>;
27
+ }): Promise<AltVMIsmModule>;
28
+ protected deploy({ config, }: {
29
+ config: IsmConfig | string;
30
+ }): Promise<Address>;
31
+ protected deployMerkleRootMultisigIsm(config: MultisigIsmConfig): Promise<Address>;
32
+ protected deployMessageIdMultisigIsm(config: MultisigIsmConfig): Promise<Address>;
33
+ protected deployRoutingIsm(config: DomainRoutingIsmConfig): Promise<Address>;
34
+ protected updateRoutingIsm({ actual, expected, logger, }: {
35
+ actual: DomainRoutingIsmConfig;
36
+ expected: DomainRoutingIsmConfig;
37
+ logger: ReturnType<typeof rootLogger.child<never>>;
38
+ }): Promise<AnnotatedTx[]>;
39
+ protected deployNoopIsm(): Promise<Address>;
40
+ }
41
+ //# sourceMappingURL=AltVMIsmModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AltVMIsmModule.d.ts","sourceRoot":"","sources":["../src/AltVMIsmModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,SAAS,EACT,kBAAkB,EAClB,aAAa,EAEb,iBAAiB,EAElB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,WAAW,EACX,SAAS,EACT,aAAa,EACb,SAAS,EACV,MAAM,oCAAoC,CAAC;AAC5C,OAAO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P,EAAE;QACD,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC;KAC5B,GAAG,OAAO,CAAC,OAAO,CAAC;cA+BJ,2BAA2B,CACzC,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,OAAO,CAAC;cAcH,0BAA0B,CACxC,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,OAAO,CAAC;cAcH,gBAAgB,CAC9B,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,OAAO,CAAC;cAmCH,gBAAgB,CAAC,EAC/B,MAAM,EACN,QAAQ,EACR,MAAM,GACP,EAAE;QACD,MAAM,EAAE,sBAAsB,CAAC;QAC/B,QAAQ,EAAE,sBAAsB,CAAC;QACjC,MAAM,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;KACpD,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;cAwFV,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;CAMlD"}
@@ -0,0 +1,255 @@
1
+ import { STATIC_ISM_TYPES, } from '@hyperlane-xyz/provider-sdk/ism';
2
+ import { assert, deepEquals, eqAddress, intersection, normalizeConfig, rootLogger, sleep, } from '@hyperlane-xyz/utils';
3
+ import { AltVMIsmReader } from './AltVMIsmReader.js';
4
+ import { validateIsmConfig } from './utils/validation.js';
5
+ // Determines the domains to enroll and unenroll to update the current ISM config
6
+ // to match the target ISM config.
7
+ function calculateDomainRoutingDelta(current, target) {
8
+ const domainsToEnroll = [];
9
+ for (const origin of Object.keys(target.domains)) {
10
+ if (!current.domains[origin]) {
11
+ domainsToEnroll.push(origin);
12
+ }
13
+ else {
14
+ const subModuleMatches = deepEquals(current.domains[origin], target.domains[origin]);
15
+ if (!subModuleMatches)
16
+ domainsToEnroll.push(origin);
17
+ }
18
+ }
19
+ const domainsToUnenroll = Object.keys(current.domains).reduce((acc, origin) => {
20
+ if (!Object.keys(target.domains).includes(origin)) {
21
+ acc.push(origin);
22
+ }
23
+ return acc;
24
+ }, []);
25
+ return {
26
+ domainsToEnroll,
27
+ domainsToUnenroll,
28
+ };
29
+ }
30
+ export class AltVMIsmModule {
31
+ chainLookup;
32
+ args;
33
+ signer;
34
+ logger = rootLogger.child({
35
+ module: 'AltVMIsmModule',
36
+ });
37
+ reader;
38
+ mailbox;
39
+ // Cached chain name
40
+ chain;
41
+ constructor(chainLookup, args, signer) {
42
+ this.chainLookup = chainLookup;
43
+ this.args = args;
44
+ this.signer = signer;
45
+ this.mailbox = this.args.addresses.mailbox;
46
+ const metadata = chainLookup.getChainMetadata(this.args.chain);
47
+ this.chain = metadata.name;
48
+ this.reader = new AltVMIsmReader(chainLookup.getChainName, this.signer);
49
+ }
50
+ async read() {
51
+ return this.reader.deriveIsmConfig(this.args.addresses.deployedIsm);
52
+ }
53
+ serialize() {
54
+ return this.args.addresses;
55
+ }
56
+ // whoever calls update() needs to ensure that targetConfig has a valid owner
57
+ async update(expectedConfig) {
58
+ // Do not support updating to a custom ISM address
59
+ if (typeof expectedConfig === 'string') {
60
+ throw new Error('Invalid targetConfig: Updating to a custom ISM address is not supported. Please provide a valid ISM configuration.');
61
+ }
62
+ // Validate ISM configuration is supported by provider-sdk
63
+ validateIsmConfig(expectedConfig, this.chain, 'ISM update');
64
+ // if there is no ism deployed yet we deploy one
65
+ if (!this.args.addresses.deployedIsm) {
66
+ this.args.addresses.deployedIsm = await this.deploy({
67
+ config: expectedConfig,
68
+ });
69
+ return [];
70
+ }
71
+ // save current config for comparison
72
+ // normalize the config to ensure it's in a consistent format for comparison
73
+ const actualConfig = normalizeConfig(await this.read());
74
+ expectedConfig = normalizeConfig(expectedConfig);
75
+ assert(typeof expectedConfig === 'object', 'normalized expectedConfig should be an object');
76
+ // Update the config
77
+ this.args.config = expectedConfig;
78
+ // If configs match, no updates needed
79
+ if (deepEquals(actualConfig, expectedConfig)) {
80
+ return [];
81
+ }
82
+ // if the ISM is a static ISM we can not update it, instead
83
+ // it needs to be recreated with the expected config
84
+ if (STATIC_ISM_TYPES.includes(expectedConfig.type)) {
85
+ this.args.addresses.deployedIsm = await this.deploy({
86
+ config: expectedConfig,
87
+ });
88
+ return [];
89
+ }
90
+ let updateTxs = [];
91
+ if (expectedConfig.type === 'domainRoutingIsm') {
92
+ const logger = this.logger.child({
93
+ destination: this.chain,
94
+ ismType: expectedConfig.type,
95
+ });
96
+ logger.debug(`Updating ${expectedConfig.type} on ${this.chain}`);
97
+ updateTxs = await this.updateRoutingIsm({
98
+ actual: actualConfig,
99
+ expected: expectedConfig,
100
+ logger,
101
+ });
102
+ }
103
+ return updateTxs;
104
+ }
105
+ // manually write static create function
106
+ static async create({ chain, config, addresses, chainLookup, signer, }) {
107
+ const module = new AltVMIsmModule(chainLookup, {
108
+ addresses: {
109
+ ...addresses,
110
+ deployedIsm: '',
111
+ },
112
+ chain,
113
+ config,
114
+ }, signer);
115
+ module.args.addresses.deployedIsm = await module.deploy({ config });
116
+ return module;
117
+ }
118
+ async deploy({ config, }) {
119
+ if (typeof config === 'string') {
120
+ return config;
121
+ }
122
+ // Validate ISM configuration before deployment
123
+ validateIsmConfig(config, this.chain, 'ISM deployment');
124
+ const ismType = config.type;
125
+ this.logger.info(`Deploying ${ismType} to ${this.chain}`);
126
+ switch (ismType) {
127
+ case 'merkleRootMultisigIsm': {
128
+ return this.deployMerkleRootMultisigIsm(config);
129
+ }
130
+ case 'messageIdMultisigIsm': {
131
+ return this.deployMessageIdMultisigIsm(config);
132
+ }
133
+ case 'domainRoutingIsm': {
134
+ return this.deployRoutingIsm(config);
135
+ }
136
+ case 'testIsm': {
137
+ return this.deployNoopIsm();
138
+ }
139
+ default:
140
+ throw new Error(`ISM type ${ismType} is not supported on AltVM`);
141
+ }
142
+ }
143
+ async deployMerkleRootMultisigIsm(config) {
144
+ assert(config.threshold <= config.validators.length, `threshold (${config.threshold}) for merkle root multisig ISM is greater than number of validators (${config.validators.length})`);
145
+ const { ismAddress } = await this.signer.createMerkleRootMultisigIsm({
146
+ validators: config.validators,
147
+ threshold: config.threshold,
148
+ });
149
+ this.logger.debug(`Deployed merkle root multisig ISM to ${ismAddress}`);
150
+ return ismAddress;
151
+ }
152
+ async deployMessageIdMultisigIsm(config) {
153
+ assert(config.threshold <= config.validators.length, `threshold (${config.threshold}) for message id multisig ISM is greater than number of validators (${config.validators.length})`);
154
+ const { ismAddress } = await this.signer.createMessageIdMultisigIsm({
155
+ validators: config.validators,
156
+ threshold: config.threshold,
157
+ });
158
+ this.logger.debug(`Deployed message id multisig ISM to ${ismAddress}`);
159
+ return ismAddress;
160
+ }
161
+ async deployRoutingIsm(config) {
162
+ const routes = [];
163
+ // deploy ISMs for each domain
164
+ for (const chainName of Object.keys(config.domains)) {
165
+ const domainId = this.chainLookup.getDomainId(chainName);
166
+ if (!domainId) {
167
+ this.logger.warn(`Unknown chain ${chainName}, skipping ISM configuration`);
168
+ continue;
169
+ }
170
+ const address = await this.deploy({ config: config.domains[chainName] });
171
+ routes.push({
172
+ ismAddress: address,
173
+ domainId: domainId,
174
+ });
175
+ }
176
+ const { ismAddress } = await this.signer.createRoutingIsm({
177
+ routes,
178
+ });
179
+ if (!eqAddress(this.signer.getSignerAddress(), config.owner)) {
180
+ await this.signer.setRoutingIsmOwner({
181
+ ismAddress,
182
+ newOwner: config.owner,
183
+ });
184
+ }
185
+ this.logger.debug(`Deployed routing ISM to ${ismAddress}`);
186
+ return ismAddress;
187
+ }
188
+ async updateRoutingIsm({ actual, expected, logger, }) {
189
+ this.logger.debug(`Start creating routing ISM update transactions`);
190
+ const updateTxs = [];
191
+ const knownChains = new Set(this.chainLookup.getKnownChainNames());
192
+ const { domainsToEnroll, domainsToUnenroll } = calculateDomainRoutingDelta(actual, expected);
193
+ const knownEnrolls = intersection(knownChains, new Set(domainsToEnroll));
194
+ // Enroll domains
195
+ for (const origin of knownEnrolls) {
196
+ logger.debug(`Reconfiguring preexisting routing ISM for origin ${origin}...`);
197
+ const ismAddress = await this.deploy({
198
+ config: expected.domains[origin],
199
+ });
200
+ const { blocks } = this.chainLookup.getChainMetadata(this.chain);
201
+ if (blocks) {
202
+ // we assume at least one confirmation
203
+ const confirmations = blocks.confirmations ?? 1;
204
+ const estimateBlockTime = blocks.estimateBlockTime ?? 0;
205
+ await sleep(confirmations * estimateBlockTime);
206
+ }
207
+ const domainId = this.chainLookup.getDomainId(origin);
208
+ assert(domainId !== null, `Domain ID not found for chain ${origin}`);
209
+ updateTxs.push({
210
+ annotation: `Setting new ISM for origin ${origin}...`,
211
+ ...(await this.signer.getSetRoutingIsmRouteTransaction({
212
+ signer: actual.owner,
213
+ ismAddress: this.args.addresses.deployedIsm,
214
+ route: {
215
+ ismAddress,
216
+ domainId,
217
+ },
218
+ })),
219
+ });
220
+ }
221
+ const knownUnenrolls = intersection(knownChains, new Set(domainsToUnenroll));
222
+ // Unenroll domains
223
+ for (const origin of knownUnenrolls) {
224
+ const domainId = this.chainLookup.getDomainId(origin);
225
+ assert(domainId !== null, `Domain ID not found for chain ${origin}`);
226
+ updateTxs.push({
227
+ annotation: `Unenrolling originDomain ${domainId} from preexisting routing ISM at ${this.args.addresses.deployedIsm}...`,
228
+ ...(await this.signer.getRemoveRoutingIsmRouteTransaction({
229
+ signer: actual.owner,
230
+ ismAddress: this.args.addresses.deployedIsm,
231
+ domainId,
232
+ })),
233
+ });
234
+ }
235
+ // Update ownership
236
+ if (actual.owner !== expected.owner) {
237
+ updateTxs.push({
238
+ annotation: `Transferring ownership of ISM from ${actual.owner} to ${expected.owner}`,
239
+ ...(await this.signer.getSetRoutingIsmOwnerTransaction({
240
+ signer: actual.owner,
241
+ ismAddress: this.args.addresses.deployedIsm,
242
+ newOwner: expected.owner,
243
+ })),
244
+ });
245
+ }
246
+ this.logger.debug(`Created ${updateTxs.length} update routing ISM transactions.`);
247
+ return updateTxs;
248
+ }
249
+ async deployNoopIsm() {
250
+ const { ismAddress } = await this.signer.createNoopIsm({});
251
+ this.logger.debug(`Deployed noop ISM to ${ismAddress}`);
252
+ return ismAddress;
253
+ }
254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,MAAM,EAAE,MAAM,CAAC,KAAK;oBACpB,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW;oBAC3C,QAAQ,EAAE,QAAQ,CAAC,KAAK;iBACzB,CAAC,CAAC;aACJ,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,WAAW,SAAS,CAAC,MAAM,mCAAmC,CAC/D,CAAC;QAEF,OAAO,SAAS,CAAC;IACnB,CAAC;IAES,KAAK,CAAC,aAAa;QAC3B,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAE3D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,UAAU,EAAE,CAAC,CAAC;QACxD,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
@@ -0,0 +1,19 @@
1
+ import { AltVM } from '@hyperlane-xyz/provider-sdk';
2
+ import { ChainNameLookup } from '@hyperlane-xyz/provider-sdk/chain';
3
+ import { DerivedIsmConfig, IsmConfig, IsmModuleType } from '@hyperlane-xyz/provider-sdk/ism';
4
+ import { HypReader } from '@hyperlane-xyz/provider-sdk/module';
5
+ import { Address, Logger } from '@hyperlane-xyz/utils';
6
+ export declare class AltVMIsmReader implements HypReader<IsmModuleType> {
7
+ protected readonly getChainName: ChainNameLookup;
8
+ protected readonly provider: AltVM.IProvider;
9
+ protected readonly logger: Logger;
10
+ constructor(getChainName: ChainNameLookup, provider: AltVM.IProvider);
11
+ read(address: string): Promise<DerivedIsmConfig>;
12
+ deriveIsmConfigFromAddress(address: Address): Promise<DerivedIsmConfig>;
13
+ deriveIsmConfig(config: IsmConfig | string): Promise<DerivedIsmConfig>;
14
+ private deriveMerkleRootMultisigConfig;
15
+ private deriveMessageIdMultisigConfig;
16
+ private deriveRoutingConfig;
17
+ private deriveTestConfig;
18
+ }
19
+ //# sourceMappingURL=AltVMIsmReader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AltVMIsmReader.d.ts","sourceRoot":"","sources":["../src/AltVMIsmReader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EACL,gBAAgB,EAEhB,SAAS,EACT,aAAa,EAEd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,EAA2B,MAAM,sBAAsB,CAAC;AAEhF,qBAAa,cAAe,YAAW,SAAS,CAAC,aAAa,CAAC;IAM3D,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,eAAe;IAChD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS;IAN9C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAE9B;gBAGkB,YAAY,EAAE,eAAe,EAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS;IAGxC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIhD,0BAA0B,CAC9B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,gBAAgB,CAAC;IA0BtB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;YAgB9D,8BAA8B;YAe9B,6BAA6B;YAe7B,mBAAmB;YAiCnB,gBAAgB;CAM/B"}