@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.
- package/dist/AltVMCoreModule.d.ts +94 -0
- package/dist/AltVMCoreModule.d.ts.map +1 -0
- package/dist/AltVMCoreModule.js +328 -0
- package/dist/AltVMCoreModule.js.map +1 -0
- package/dist/AltVMCoreReader.d.ts +17 -0
- package/dist/AltVMCoreReader.d.ts.map +1 -0
- package/dist/AltVMCoreReader.js +31 -0
- package/dist/AltVMCoreReader.js.map +1 -0
- package/dist/AltVMHookModule.d.ts +41 -0
- package/dist/AltVMHookModule.d.ts.map +1 -0
- package/dist/AltVMHookModule.js +176 -0
- package/dist/AltVMHookModule.js.map +1 -0
- package/dist/AltVMHookReader.d.ts +17 -0
- package/dist/AltVMHookReader.d.ts.map +1 -0
- package/dist/AltVMHookReader.js +76 -0
- package/dist/AltVMHookReader.js.map +1 -0
- package/dist/AltVMIsmModule.d.ts +41 -0
- package/dist/AltVMIsmModule.d.ts.map +1 -0
- package/dist/AltVMIsmModule.js +255 -0
- package/dist/AltVMIsmModule.js.map +1 -0
- package/dist/AltVMIsmReader.d.ts +19 -0
- package/dist/AltVMIsmReader.d.ts.map +1 -0
- package/dist/AltVMIsmReader.js +101 -0
- package/dist/AltVMIsmReader.js.map +1 -0
- package/dist/AltVMWarpDeployer.d.ts +14 -0
- package/dist/AltVMWarpDeployer.d.ts.map +1 -0
- package/dist/AltVMWarpDeployer.js +69 -0
- package/dist/AltVMWarpDeployer.js.map +1 -0
- package/dist/AltVMWarpModule.d.ts +96 -0
- package/dist/AltVMWarpModule.d.ts.map +1 -0
- package/dist/AltVMWarpModule.js +329 -0
- package/dist/AltVMWarpModule.js.map +1 -0
- package/dist/AltVMWarpModule.test.d.ts +2 -0
- package/dist/AltVMWarpModule.test.d.ts.map +1 -0
- package/dist/AltVMWarpModule.test.js +403 -0
- package/dist/AltVMWarpModule.test.js.map +1 -0
- package/dist/AltVMWarpRouteReader.d.ts +52 -0
- package/dist/AltVMWarpRouteReader.d.ts.map +1 -0
- package/dist/AltVMWarpRouteReader.js +145 -0
- package/dist/AltVMWarpRouteReader.js.map +1 -0
- package/dist/core-module.d.ts +5 -0
- package/dist/core-module.d.ts.map +1 -0
- package/dist/core-module.js +28 -0
- package/dist/core-module.js.map +1 -0
- package/dist/hook-module.d.ts +5 -0
- package/dist/hook-module.d.ts.map +1 -0
- package/dist/hook-module.js +35 -0
- package/dist/hook-module.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/ism-module.d.ts +5 -0
- package/dist/ism-module.d.ts.map +1 -0
- package/dist/ism-module.js +35 -0
- package/dist/ism-module.js.map +1 -0
- package/dist/protocol.d.ts +3 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +23 -0
- package/dist/protocol.js.map +1 -0
- package/dist/utils/validation.d.ts +37 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +66 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/warp-module.d.ts +5 -0
- package/dist/warp-module.d.ts.map +1 -0
- package/dist/warp-module.js +28 -0
- package/dist/warp-module.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { AltVM } from '@hyperlane-xyz/provider-sdk';
|
|
2
|
+
import { ChainLookup } from '@hyperlane-xyz/provider-sdk/chain';
|
|
3
|
+
import { CoreConfig, CoreModuleType, DeployedCoreAddresses, DerivedCoreConfig } from '@hyperlane-xyz/provider-sdk/core';
|
|
4
|
+
import { DerivedHookConfig, HookConfig } from '@hyperlane-xyz/provider-sdk/hook';
|
|
5
|
+
import { DerivedIsmConfig, IsmConfig } from '@hyperlane-xyz/provider-sdk/ism';
|
|
6
|
+
import { AnnotatedTx, HypModule, HypModuleArgs, TxReceipt } from '@hyperlane-xyz/provider-sdk/module';
|
|
7
|
+
import { Address, Logger } from '@hyperlane-xyz/utils';
|
|
8
|
+
import { AltVMCoreReader } from './AltVMCoreReader.js';
|
|
9
|
+
export declare class AltVMCoreModule implements HypModule<CoreModuleType> {
|
|
10
|
+
protected readonly chainLookup: ChainLookup;
|
|
11
|
+
protected readonly signer: AltVM.ISigner<AnnotatedTx, TxReceipt>;
|
|
12
|
+
private readonly args;
|
|
13
|
+
protected logger: Logger;
|
|
14
|
+
protected coreReader: AltVMCoreReader;
|
|
15
|
+
readonly chainName: string;
|
|
16
|
+
constructor(chainLookup: ChainLookup, signer: AltVM.ISigner<AnnotatedTx, TxReceipt>, args: HypModuleArgs<CoreModuleType>);
|
|
17
|
+
/**
|
|
18
|
+
* Reads the core configuration from the mailbox address
|
|
19
|
+
* @returns The core config.
|
|
20
|
+
*/
|
|
21
|
+
read(): Promise<DerivedCoreConfig>;
|
|
22
|
+
serialize(): DeployedCoreAddresses;
|
|
23
|
+
/**
|
|
24
|
+
* Deploys the Core contracts.
|
|
25
|
+
* @returns The created AltVMCoreModule instance.
|
|
26
|
+
*/
|
|
27
|
+
static create(params: {
|
|
28
|
+
chain: string;
|
|
29
|
+
config: CoreConfig;
|
|
30
|
+
chainLookup: ChainLookup;
|
|
31
|
+
signer: AltVM.ISigner<AnnotatedTx, TxReceipt>;
|
|
32
|
+
}): Promise<AltVMCoreModule>;
|
|
33
|
+
/**
|
|
34
|
+
* Deploys the core Hyperlane contracts.
|
|
35
|
+
* @returns The deployed core contract addresses.
|
|
36
|
+
*/
|
|
37
|
+
static deploy(params: {
|
|
38
|
+
config: CoreConfig;
|
|
39
|
+
chainLookup: ChainLookup;
|
|
40
|
+
chain: string;
|
|
41
|
+
signer: AltVM.ISigner<AnnotatedTx, TxReceipt>;
|
|
42
|
+
}): Promise<DeployedCoreAddresses>;
|
|
43
|
+
/**
|
|
44
|
+
* Updates the core contracts with the provided configuration.
|
|
45
|
+
*
|
|
46
|
+
* @param expectedConfig - The configuration for the core contracts to be updated.
|
|
47
|
+
* @returns An array of transactions that were executed to update the contract.
|
|
48
|
+
*/
|
|
49
|
+
update(expectedConfig: CoreConfig): Promise<AnnotatedTx[]>;
|
|
50
|
+
private createMailboxOwnerUpdateTxs;
|
|
51
|
+
/**
|
|
52
|
+
* Create a transaction to update an existing ISM config, or deploy a new ISM and return a tx to setDefaultIsm
|
|
53
|
+
*
|
|
54
|
+
* @param actualConfig - The on-chain router configuration, including the ISM configuration, and address.
|
|
55
|
+
* @param expectedConfig - The expected token router configuration, including the ISM configuration.
|
|
56
|
+
* @returns Transaction that need to be executed to update the ISM configuration.
|
|
57
|
+
*/
|
|
58
|
+
createDefaultIsmUpdateTxs(actualConfig: DerivedCoreConfig, expectedConfig: CoreConfig): Promise<AnnotatedTx[]>;
|
|
59
|
+
/**
|
|
60
|
+
* Updates or deploys the ISM using the provided configuration.
|
|
61
|
+
*
|
|
62
|
+
* @returns Object with deployedIsm address, and update Transactions
|
|
63
|
+
*/
|
|
64
|
+
deployOrUpdateIsm(actualDefaultIsmConfig: DerivedIsmConfig, expectDefaultIsmConfig: IsmConfig | string): Promise<{
|
|
65
|
+
deployedIsm: Address;
|
|
66
|
+
ismUpdateTxs: AnnotatedTx[];
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Create a transaction to update an existing Hook config, or deploy a new Hook and return a tx to setDefaultHook
|
|
70
|
+
*
|
|
71
|
+
* @param actualConfig - The on-chain router configuration, including the Hook configuration, and address.
|
|
72
|
+
* @param expectedConfig - The expected token router configuration, including the Hook configuration.
|
|
73
|
+
* @returns Transaction that need to be executed to update the Hook configuration.
|
|
74
|
+
*/
|
|
75
|
+
createDefaultHookUpdateTxs(actualConfig: DerivedCoreConfig, expectedConfig: CoreConfig): Promise<AnnotatedTx[]>;
|
|
76
|
+
/**
|
|
77
|
+
* Create a transaction to update an existing Hook config, or deploy a new Hook and return a tx to setRequiredHook
|
|
78
|
+
*
|
|
79
|
+
* @param actualConfig - The on-chain router configuration, including the Hook configuration, and address.
|
|
80
|
+
* @param expectedConfig - The expected token router configuration, including the Hook configuration.
|
|
81
|
+
* @returns Transaction that need to be executed to update the Hook configuration.
|
|
82
|
+
*/
|
|
83
|
+
createRequiredHookUpdateTxs(actualConfig: DerivedCoreConfig, expectedConfig: CoreConfig): Promise<AnnotatedTx[]>;
|
|
84
|
+
/**
|
|
85
|
+
* Updates or deploys the Hook using the provided configuration.
|
|
86
|
+
*
|
|
87
|
+
* @returns Object with deployedHook address, and update Transactions
|
|
88
|
+
*/
|
|
89
|
+
deployOrUpdateHook(actualHookConfig: DerivedHookConfig, expectHookConfig: HookConfig | string): Promise<{
|
|
90
|
+
deployedHook: Address;
|
|
91
|
+
hookUpdateTxs: AnnotatedTx[];
|
|
92
|
+
}>;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=AltVMCoreModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AltVMCoreModule.d.ts","sourceRoot":"","sources":["../src/AltVMCoreModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EACL,UAAU,EACV,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,iBAAiB,EACjB,UAAU,EACX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EACL,WAAW,EACX,SAAS,EACT,aAAa,EACb,SAAS,EACV,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAc,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAKvD,qBAAa,eAAgB,YAAW,SAAS,CAAC,cAAc,CAAC;IAQ7D,SAAS,C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A+BzB;;;;OAIG;IACU,iBAAiB,CAC5B,sBAAsB,EAAE,gBAAgB,EACxC,sBAAsB,EAAE,SAAS,GAAG,MAAM,GACzC,OAAO,CAAC;QACT,WAAW,EAAE,OAAO,CAAC;QACrB,YAAY,EAAE,WAAW,EAAE,CAAC;KAC7B,CAAC;IAwBF;;;;;;OAMG;IACG,0BAA0B,CAC9B,YAAY,EAAE,iBAAiB,EAC/B,cAAc,EAAE,UAAU,GACzB,OAAO,CAAC,WAAW,EAAE,CAAC;IA+BzB;;;;;;OAMG;IACG,2BAA2B,CAC/B,YAAY,EAAE,iBAAiB,EAC/B,cAAc,EAAE,UAAU,GACzB,OAAO,CAAC,WAAW,EAAE,CAAC;IA+BzB;;;;OAIG;IACU,kBAAkB,CAC7B,gBAAgB,EAAE,iBAAiB,EACnC,gBAAgB,EAAE,UAAU,GAAG,MAAM,GACpC,OAAO,CAAC;QACT,YAAY,EAAE,OAAO,CAAC;QACtB,aAAa,EAAE,WAAW,EAAE,CAAC;KAC9B,CAAC;CAuBH"}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { rootLogger } from '@hyperlane-xyz/utils';
|
|
2
|
+
import { AltVMCoreReader } from './AltVMCoreReader.js';
|
|
3
|
+
import { AltVMHookModule } from './AltVMHookModule.js';
|
|
4
|
+
import { AltVMIsmModule } from './AltVMIsmModule.js';
|
|
5
|
+
import { validateIsmConfig } from './utils/validation.js';
|
|
6
|
+
export class AltVMCoreModule {
|
|
7
|
+
chainLookup;
|
|
8
|
+
signer;
|
|
9
|
+
args;
|
|
10
|
+
logger = rootLogger.child({ module: 'AltVMCoreModule' });
|
|
11
|
+
coreReader;
|
|
12
|
+
// Cached chain name
|
|
13
|
+
chainName;
|
|
14
|
+
constructor(chainLookup, signer, args) {
|
|
15
|
+
this.chainLookup = chainLookup;
|
|
16
|
+
this.signer = signer;
|
|
17
|
+
this.args = args;
|
|
18
|
+
const metadata = chainLookup.getChainMetadata(args.chain);
|
|
19
|
+
this.chainName = metadata.name;
|
|
20
|
+
this.coreReader = new AltVMCoreReader(chainLookup, signer);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Reads the core configuration from the mailbox address
|
|
24
|
+
* @returns The core config.
|
|
25
|
+
*/
|
|
26
|
+
async read() {
|
|
27
|
+
return this.coreReader.deriveCoreConfig(this.args.addresses.mailbox);
|
|
28
|
+
}
|
|
29
|
+
serialize() {
|
|
30
|
+
return this.args.addresses;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Deploys the Core contracts.
|
|
34
|
+
* @returns The created AltVMCoreModule instance.
|
|
35
|
+
*/
|
|
36
|
+
static async create(params) {
|
|
37
|
+
const addresses = await AltVMCoreModule.deploy(params);
|
|
38
|
+
return new AltVMCoreModule(params.chainLookup, params.signer, {
|
|
39
|
+
addresses,
|
|
40
|
+
chain: params.chain,
|
|
41
|
+
config: params.config,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Deploys the core Hyperlane contracts.
|
|
46
|
+
* @returns The deployed core contract addresses.
|
|
47
|
+
*/
|
|
48
|
+
static async deploy(params) {
|
|
49
|
+
const { config, chainLookup, chain, signer } = params;
|
|
50
|
+
const metadata = chainLookup.getChainMetadata(chain);
|
|
51
|
+
const chainName = metadata.name;
|
|
52
|
+
const domainId = metadata.domainId;
|
|
53
|
+
// Validate ISM configuration before deployment
|
|
54
|
+
validateIsmConfig(config.defaultIsm, chainName, 'core default ISM');
|
|
55
|
+
// 1. Deploy default ISM
|
|
56
|
+
const ismModule = await AltVMIsmModule.create({
|
|
57
|
+
chain: chainName,
|
|
58
|
+
config: config.defaultIsm,
|
|
59
|
+
addresses: {
|
|
60
|
+
mailbox: '',
|
|
61
|
+
},
|
|
62
|
+
chainLookup,
|
|
63
|
+
signer,
|
|
64
|
+
});
|
|
65
|
+
const { deployedIsm: defaultIsm } = ismModule.serialize();
|
|
66
|
+
// 2. Deploy Mailbox with initial configuration
|
|
67
|
+
const mailbox = await signer.createMailbox({
|
|
68
|
+
domainId: domainId,
|
|
69
|
+
defaultIsmAddress: defaultIsm,
|
|
70
|
+
});
|
|
71
|
+
// 3. Deploy default hook
|
|
72
|
+
const defaultHookModule = await AltVMHookModule.create({
|
|
73
|
+
chain: chainName,
|
|
74
|
+
config: config.defaultHook,
|
|
75
|
+
addresses: {
|
|
76
|
+
deployedHook: '',
|
|
77
|
+
mailbox: mailbox.mailboxAddress,
|
|
78
|
+
},
|
|
79
|
+
chainLookup,
|
|
80
|
+
signer,
|
|
81
|
+
});
|
|
82
|
+
const { deployedHook: defaultHook } = defaultHookModule.serialize();
|
|
83
|
+
// 4. Deploy required hook
|
|
84
|
+
const requiredHookModule = await AltVMHookModule.create({
|
|
85
|
+
chain: chainName,
|
|
86
|
+
config: config.requiredHook,
|
|
87
|
+
addresses: {
|
|
88
|
+
deployedHook: '',
|
|
89
|
+
mailbox: mailbox.mailboxAddress,
|
|
90
|
+
},
|
|
91
|
+
chainLookup,
|
|
92
|
+
signer,
|
|
93
|
+
});
|
|
94
|
+
const { deployedHook: requiredHook } = requiredHookModule.serialize();
|
|
95
|
+
// 5. Update the configuration with the newly created hooks
|
|
96
|
+
await signer.setDefaultIsm({
|
|
97
|
+
mailboxAddress: mailbox.mailboxAddress,
|
|
98
|
+
ismAddress: defaultIsm,
|
|
99
|
+
});
|
|
100
|
+
await signer.setDefaultHook({
|
|
101
|
+
mailboxAddress: mailbox.mailboxAddress,
|
|
102
|
+
hookAddress: defaultHook,
|
|
103
|
+
});
|
|
104
|
+
await signer.setRequiredHook({
|
|
105
|
+
mailboxAddress: mailbox.mailboxAddress,
|
|
106
|
+
hookAddress: requiredHook,
|
|
107
|
+
});
|
|
108
|
+
if (signer.getSignerAddress() !== config.owner) {
|
|
109
|
+
await signer.setMailboxOwner({
|
|
110
|
+
mailboxAddress: mailbox.mailboxAddress,
|
|
111
|
+
newOwner: config.owner,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
const validatorAnnounce = await signer.createValidatorAnnounce({
|
|
115
|
+
mailboxAddress: mailbox.mailboxAddress,
|
|
116
|
+
});
|
|
117
|
+
const addresses = {
|
|
118
|
+
mailbox: mailbox.mailboxAddress,
|
|
119
|
+
staticMerkleRootMultisigIsmFactory: '',
|
|
120
|
+
proxyAdmin: '',
|
|
121
|
+
staticMerkleRootWeightedMultisigIsmFactory: '',
|
|
122
|
+
staticAggregationHookFactory: '',
|
|
123
|
+
staticAggregationIsmFactory: '',
|
|
124
|
+
staticMessageIdMultisigIsmFactory: '',
|
|
125
|
+
staticMessageIdWeightedMultisigIsmFactory: '',
|
|
126
|
+
validatorAnnounce: validatorAnnounce.validatorAnnounceId,
|
|
127
|
+
testRecipient: '',
|
|
128
|
+
interchainAccountRouter: '',
|
|
129
|
+
domainRoutingIsmFactory: '',
|
|
130
|
+
};
|
|
131
|
+
if (config.defaultIsm && typeof config.defaultIsm !== 'string') {
|
|
132
|
+
switch (config.defaultIsm.type) {
|
|
133
|
+
case 'merkleRootMultisigIsm': {
|
|
134
|
+
addresses.staticMerkleRootMultisigIsmFactory = defaultIsm;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
case 'messageIdMultisigIsm': {
|
|
138
|
+
addresses.staticMessageIdMultisigIsmFactory = defaultIsm;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case 'domainRoutingIsm': {
|
|
142
|
+
addresses.domainRoutingIsmFactory = defaultIsm;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (config.defaultHook && typeof config.defaultHook !== 'string') {
|
|
148
|
+
switch (config.defaultHook.type) {
|
|
149
|
+
case 'interchainGasPaymaster': {
|
|
150
|
+
addresses.interchainGasPaymaster = defaultHook;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case 'merkleTreeHook': {
|
|
154
|
+
addresses.merkleTreeHook = defaultHook;
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (config.requiredHook && typeof config.requiredHook !== 'string') {
|
|
160
|
+
switch (config.requiredHook.type) {
|
|
161
|
+
case 'interchainGasPaymaster': {
|
|
162
|
+
addresses.interchainGasPaymaster = requiredHook;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
case 'merkleTreeHook': {
|
|
166
|
+
addresses.merkleTreeHook = requiredHook;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return addresses;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Updates the core contracts with the provided configuration.
|
|
175
|
+
*
|
|
176
|
+
* @param expectedConfig - The configuration for the core contracts to be updated.
|
|
177
|
+
* @returns An array of transactions that were executed to update the contract.
|
|
178
|
+
*/
|
|
179
|
+
async update(expectedConfig) {
|
|
180
|
+
const actualConfig = await this.read();
|
|
181
|
+
const transactions = [];
|
|
182
|
+
transactions.push(...(await this.createDefaultIsmUpdateTxs(actualConfig, expectedConfig)), ...(await this.createDefaultHookUpdateTxs(actualConfig, expectedConfig)), ...(await this.createRequiredHookUpdateTxs(actualConfig, expectedConfig)), ...(await this.createMailboxOwnerUpdateTxs(actualConfig, expectedConfig)));
|
|
183
|
+
return transactions;
|
|
184
|
+
}
|
|
185
|
+
async createMailboxOwnerUpdateTxs(actualConfig, expectedConfig) {
|
|
186
|
+
if (actualConfig.owner === expectedConfig.owner) {
|
|
187
|
+
return [];
|
|
188
|
+
}
|
|
189
|
+
return [
|
|
190
|
+
{
|
|
191
|
+
annotation: `Transferring ownership of Mailbox from ${actualConfig.owner} to ${expectedConfig.owner}`,
|
|
192
|
+
...(await this.signer.getSetMailboxOwnerTransaction({
|
|
193
|
+
signer: actualConfig.owner,
|
|
194
|
+
mailboxAddress: this.args.addresses.mailbox,
|
|
195
|
+
newOwner: expectedConfig.owner,
|
|
196
|
+
})),
|
|
197
|
+
},
|
|
198
|
+
];
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Create a transaction to update an existing ISM config, or deploy a new ISM and return a tx to setDefaultIsm
|
|
202
|
+
*
|
|
203
|
+
* @param actualConfig - The on-chain router configuration, including the ISM configuration, and address.
|
|
204
|
+
* @param expectedConfig - The expected token router configuration, including the ISM configuration.
|
|
205
|
+
* @returns Transaction that need to be executed to update the ISM configuration.
|
|
206
|
+
*/
|
|
207
|
+
async createDefaultIsmUpdateTxs(actualConfig, expectedConfig) {
|
|
208
|
+
const updateTransactions = [];
|
|
209
|
+
const actualDefaultIsmConfig = actualConfig.defaultIsm;
|
|
210
|
+
// Try to update (may also deploy) Ism with the expected config
|
|
211
|
+
const { deployedIsm, ismUpdateTxs } = await this.deployOrUpdateIsm(actualDefaultIsmConfig, expectedConfig.defaultIsm);
|
|
212
|
+
if (ismUpdateTxs.length) {
|
|
213
|
+
updateTransactions.push(...ismUpdateTxs);
|
|
214
|
+
}
|
|
215
|
+
const newIsmDeployed = actualDefaultIsmConfig.address !== deployedIsm;
|
|
216
|
+
if (newIsmDeployed) {
|
|
217
|
+
const { mailbox } = this.serialize();
|
|
218
|
+
updateTransactions.push({
|
|
219
|
+
annotation: `Updating default ISM of Mailbox from ${actualDefaultIsmConfig.address} to ${deployedIsm}`,
|
|
220
|
+
...(await this.signer.getSetDefaultIsmTransaction({
|
|
221
|
+
signer: actualConfig.owner,
|
|
222
|
+
mailboxAddress: mailbox,
|
|
223
|
+
ismAddress: deployedIsm,
|
|
224
|
+
})),
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
return updateTransactions;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Updates or deploys the ISM using the provided configuration.
|
|
231
|
+
*
|
|
232
|
+
* @returns Object with deployedIsm address, and update Transactions
|
|
233
|
+
*/
|
|
234
|
+
async deployOrUpdateIsm(actualDefaultIsmConfig, expectDefaultIsmConfig) {
|
|
235
|
+
const { mailbox } = this.serialize();
|
|
236
|
+
const ismModule = new AltVMIsmModule(this.chainLookup, {
|
|
237
|
+
addresses: {
|
|
238
|
+
mailbox: mailbox,
|
|
239
|
+
deployedIsm: actualDefaultIsmConfig.address,
|
|
240
|
+
},
|
|
241
|
+
chain: this.chainName,
|
|
242
|
+
config: actualDefaultIsmConfig.address,
|
|
243
|
+
}, this.signer);
|
|
244
|
+
this.logger.info(`Comparing target ISM config with ${this.args.chain} chain`);
|
|
245
|
+
const ismUpdateTxs = await ismModule.update(expectDefaultIsmConfig);
|
|
246
|
+
const { deployedIsm } = ismModule.serialize();
|
|
247
|
+
return { deployedIsm, ismUpdateTxs };
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Create a transaction to update an existing Hook config, or deploy a new Hook and return a tx to setDefaultHook
|
|
251
|
+
*
|
|
252
|
+
* @param actualConfig - The on-chain router configuration, including the Hook configuration, and address.
|
|
253
|
+
* @param expectedConfig - The expected token router configuration, including the Hook configuration.
|
|
254
|
+
* @returns Transaction that need to be executed to update the Hook configuration.
|
|
255
|
+
*/
|
|
256
|
+
async createDefaultHookUpdateTxs(actualConfig, expectedConfig) {
|
|
257
|
+
const updateTransactions = [];
|
|
258
|
+
const actualDefaultHookConfig = actualConfig.defaultHook;
|
|
259
|
+
// Try to update (may also deploy) Hook with the expected config
|
|
260
|
+
const { deployedHook, hookUpdateTxs } = await this.deployOrUpdateHook(actualDefaultHookConfig, expectedConfig.defaultHook);
|
|
261
|
+
if (hookUpdateTxs.length) {
|
|
262
|
+
updateTransactions.push(...hookUpdateTxs);
|
|
263
|
+
}
|
|
264
|
+
const newHookDeployed = actualDefaultHookConfig.address !== deployedHook;
|
|
265
|
+
if (newHookDeployed) {
|
|
266
|
+
const { mailbox } = this.serialize();
|
|
267
|
+
updateTransactions.push({
|
|
268
|
+
annotation: `Updating default Hook of Mailbox from ${actualDefaultHookConfig.address} to ${deployedHook}`,
|
|
269
|
+
...(await this.signer.getSetDefaultHookTransaction({
|
|
270
|
+
signer: actualConfig.owner,
|
|
271
|
+
mailboxAddress: mailbox,
|
|
272
|
+
hookAddress: deployedHook,
|
|
273
|
+
})),
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
return updateTransactions;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Create a transaction to update an existing Hook config, or deploy a new Hook and return a tx to setRequiredHook
|
|
280
|
+
*
|
|
281
|
+
* @param actualConfig - The on-chain router configuration, including the Hook configuration, and address.
|
|
282
|
+
* @param expectedConfig - The expected token router configuration, including the Hook configuration.
|
|
283
|
+
* @returns Transaction that need to be executed to update the Hook configuration.
|
|
284
|
+
*/
|
|
285
|
+
async createRequiredHookUpdateTxs(actualConfig, expectedConfig) {
|
|
286
|
+
const updateTransactions = [];
|
|
287
|
+
const actualRequiredHookConfig = actualConfig.requiredHook;
|
|
288
|
+
// Try to update (may also deploy) Hook with the expected config
|
|
289
|
+
const { deployedHook, hookUpdateTxs } = await this.deployOrUpdateHook(actualRequiredHookConfig, expectedConfig.requiredHook);
|
|
290
|
+
if (hookUpdateTxs.length) {
|
|
291
|
+
updateTransactions.push(...hookUpdateTxs);
|
|
292
|
+
}
|
|
293
|
+
const newHookDeployed = actualRequiredHookConfig.address !== deployedHook;
|
|
294
|
+
if (newHookDeployed) {
|
|
295
|
+
const { mailbox } = this.serialize();
|
|
296
|
+
updateTransactions.push({
|
|
297
|
+
annotation: `Updating required Hook of Mailbox from ${actualRequiredHookConfig.address} to ${deployedHook}`,
|
|
298
|
+
...(await this.signer.getSetRequiredHookTransaction({
|
|
299
|
+
signer: actualConfig.owner,
|
|
300
|
+
mailboxAddress: mailbox,
|
|
301
|
+
hookAddress: deployedHook,
|
|
302
|
+
})),
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
return updateTransactions;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Updates or deploys the Hook using the provided configuration.
|
|
309
|
+
*
|
|
310
|
+
* @returns Object with deployedHook address, and update Transactions
|
|
311
|
+
*/
|
|
312
|
+
async deployOrUpdateHook(actualHookConfig, expectHookConfig) {
|
|
313
|
+
const { mailbox } = this.serialize();
|
|
314
|
+
const hookModule = new AltVMHookModule(this.chainLookup, {
|
|
315
|
+
addresses: {
|
|
316
|
+
mailbox: mailbox,
|
|
317
|
+
deployedHook: actualHookConfig.address,
|
|
318
|
+
},
|
|
319
|
+
chain: this.chainName,
|
|
320
|
+
config: actualHookConfig.address,
|
|
321
|
+
}, this.signer);
|
|
322
|
+
this.logger.info(`Comparing target Hook config with ${this.args.chain} chain`);
|
|
323
|
+
const hookUpdateTxs = await hookModule.update(expectHookConfig);
|
|
324
|
+
const { deployedHook } = hookModule.serialize();
|
|
325
|
+
return { deployedHook, hookUpdateTxs };
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
//# sourceMappingURL=AltVMCoreModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AltVMCoreModule.js","sourceRoot":"","sources":["../src/AltVMCoreModule.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAmB,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,OAAO,eAAe;IAQL;IACA;IACF;IATT,MAAM,GAAW,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IACjE,UAAU,CAAkB;IAEtC,oBAAoB;IACJ,SAAS,CAAS;IAElC,YACqB,WAAwB,EACxB,MAA6C,EAC/C,IAAmC;QAFjC,gBAAW,GAAX,WAAW,CAAa;QACxB,WAAM,GAAN,MAAM,CAAuC;QAC/C,SAAI,GAAJ,IAAI,CAA+B;QAEpD,MAAM,QAAQ,GAAG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}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AltVM } from '@hyperlane-xyz/provider-sdk';
|
|
2
|
+
import { ChainLookup } from '@hyperlane-xyz/provider-sdk/chain';
|
|
3
|
+
import { CoreModuleType, DerivedCoreConfig } from '@hyperlane-xyz/provider-sdk/core';
|
|
4
|
+
import { HypReader } from '@hyperlane-xyz/provider-sdk/module';
|
|
5
|
+
import { Address, Logger } from '@hyperlane-xyz/utils';
|
|
6
|
+
import { AltVMHookReader } from './AltVMHookReader.js';
|
|
7
|
+
import { AltVMIsmReader } from './AltVMIsmReader.js';
|
|
8
|
+
export declare class AltVMCoreReader implements HypReader<CoreModuleType> {
|
|
9
|
+
protected readonly provider: AltVM.IProvider;
|
|
10
|
+
protected readonly logger: Logger;
|
|
11
|
+
protected ismReader: AltVMIsmReader;
|
|
12
|
+
protected hookReader: AltVMHookReader;
|
|
13
|
+
constructor(chainLookup: ChainLookup, provider: AltVM.IProvider);
|
|
14
|
+
read(address: string): Promise<DerivedCoreConfig>;
|
|
15
|
+
deriveCoreConfig(mailboxAddress: Address): Promise<DerivedCoreConfig>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=AltVMCoreReader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AltVMCoreReader.d.ts","sourceRoot":"","sources":["../src/AltVMCoreReader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EACL,cAAc,EACd,iBAAiB,EAClB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAc,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,qBAAa,eAAgB,YAAW,SAAS,CAAC,cAAc,CAAC;IAS7D,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS;IAR9C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAE9B;IACH,SAAS,CAAC,SAAS,EAAE,cAAc,CAAC;IACpC,SAAS,CAAC,UAAU,EAAE,eAAe,CAAC;gBAGpC,WAAW,EAAE,WAAW,EACL,QAAQ,EAAE,KAAK,CAAC,SAAS;IAYxC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIjD,gBAAgB,CAAC,cAAc,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAc5E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { rootLogger } from '@hyperlane-xyz/utils';
|
|
2
|
+
import { AltVMHookReader } from './AltVMHookReader.js';
|
|
3
|
+
import { AltVMIsmReader } from './AltVMIsmReader.js';
|
|
4
|
+
export class AltVMCoreReader {
|
|
5
|
+
provider;
|
|
6
|
+
logger = rootLogger.child({
|
|
7
|
+
module: 'AltVMCoreReader',
|
|
8
|
+
});
|
|
9
|
+
ismReader;
|
|
10
|
+
hookReader;
|
|
11
|
+
constructor(chainLookup, provider) {
|
|
12
|
+
this.provider = provider;
|
|
13
|
+
this.ismReader = new AltVMIsmReader(chainLookup.getChainName, this.provider);
|
|
14
|
+
this.hookReader = new AltVMHookReader(chainLookup.getChainMetadata, this.provider);
|
|
15
|
+
}
|
|
16
|
+
async read(address) {
|
|
17
|
+
return this.deriveCoreConfig(address);
|
|
18
|
+
}
|
|
19
|
+
async deriveCoreConfig(mailboxAddress) {
|
|
20
|
+
const mailbox = await this.provider.getMailbox({
|
|
21
|
+
mailboxAddress: mailboxAddress,
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
owner: mailbox.owner,
|
|
25
|
+
defaultIsm: await this.ismReader.deriveIsmConfig(mailbox.defaultIsm),
|
|
26
|
+
defaultHook: await this.hookReader.deriveHookConfig(mailbox.defaultHook),
|
|
27
|
+
requiredHook: await this.hookReader.deriveHookConfig(mailbox.requiredHook),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=AltVMCoreReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AltVMCoreReader.js","sourceRoot":"","sources":["../src/AltVMCoreReader.ts"],"names":[],"mappings":"AAOA,OAAO,EAAmB,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,OAAO,eAAe;IASL;IARF,MAAM,GAAW,UAAU,CAAC,KAAK,CAAC;QACnD,MAAM,EAAE,iBAAiB;KAC1B,CAAC,CAAC;IACO,SAAS,CAAiB;IAC1B,UAAU,CAAkB;IAEtC,YACE,WAAwB,EACL,QAAyB;QAAzB,aAAQ,GAAR,QAAQ,CAAiB;QAE5C,IAAI,CAAC,SAAS,GAAG,IAAI,cAAc,CACjC,WAAW,CAAC,YAAY,EACxB,IAAI,CAAC,QAAQ,CACd,CAAC;QACF,IAAI,CAAC,UAAU,GAAG,IAAI,eAAe,CACnC,WAAW,CAAC,gBAAgB,EAC5B,IAAI,CAAC,QAAQ,CACd,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAe;QACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,cAAuB;QAC5C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC7C,cAAc,EAAE,cAAc;SAC/B,CAAC,CAAC;QAEH,OAAO;YACL,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,UAAU,EAAE,MAAM,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC;YACpE,WAAW,EAAE,MAAM,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC;YACxE,YAAY,EAAE,MAAM,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAClD,OAAO,CAAC,YAAY,CACrB;SACF,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 { DerivedHookConfig, HookConfig, HookModuleAddresses, HookModuleType, IgpHookConfig } from '@hyperlane-xyz/provider-sdk/hook';
|
|
4
|
+
import { AnnotatedTx, HypModule, HypModuleArgs, TxReceipt } from '@hyperlane-xyz/provider-sdk/module';
|
|
5
|
+
import { Address, Logger } from '@hyperlane-xyz/utils';
|
|
6
|
+
import { AltVMHookReader } from './AltVMHookReader.js';
|
|
7
|
+
export declare class AltVMHookModule implements HypModule<HookModuleType> {
|
|
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: AltVMHookReader;
|
|
13
|
+
readonly chain: string;
|
|
14
|
+
constructor(chainLookup: ChainLookup, args: HypModuleArgs<HookModuleType>, signer: AltVM.ISigner<AnnotatedTx, TxReceipt>);
|
|
15
|
+
read(): Promise<DerivedHookConfig>;
|
|
16
|
+
serialize(): HookModuleAddresses;
|
|
17
|
+
update(targetConfig: HookConfig | Address): Promise<AnnotatedTx[]>;
|
|
18
|
+
protected updateMutableHook(configs: {
|
|
19
|
+
current: Exclude<HookConfig, string>;
|
|
20
|
+
target: Exclude<HookConfig, string>;
|
|
21
|
+
}): Promise<AnnotatedTx[]>;
|
|
22
|
+
protected updateIgpHook({ currentConfig, targetConfig, }: {
|
|
23
|
+
currentConfig: IgpHookConfig;
|
|
24
|
+
targetConfig: IgpHookConfig;
|
|
25
|
+
}): Promise<AnnotatedTx[]>;
|
|
26
|
+
static create({ chain, config, addresses, chainLookup, signer, }: {
|
|
27
|
+
chain: string;
|
|
28
|
+
config: HookConfig | string;
|
|
29
|
+
addresses: HookModuleAddresses;
|
|
30
|
+
chainLookup: ChainLookup;
|
|
31
|
+
signer: AltVM.ISigner<AnnotatedTx, TxReceipt>;
|
|
32
|
+
}): Promise<AltVMHookModule>;
|
|
33
|
+
protected deploy({ config, }: {
|
|
34
|
+
config: HookConfig | string;
|
|
35
|
+
}): Promise<Address>;
|
|
36
|
+
protected deployIgpHook({ config, }: {
|
|
37
|
+
config: IgpHookConfig;
|
|
38
|
+
}): Promise<Address>;
|
|
39
|
+
protected deployMerkleTreeHook(): Promise<Address>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=AltVMHookModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AltVMHookModule.d.ts","sourceRoot":"","sources":["../src/AltVMHookModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EACnB,cAAc,EAEd,aAAa,EAEd,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,WAAW,EACX,SAAS,EACT,aAAa,EACb,SAAS,EACV,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,OAAO,EACP,MAAM,EAMP,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,qBAAa,eAAgB,YAAW,SAAS,CAAC,cAAc,CAAC;IAU7D,SAAS,CAAC,Q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