Skip to content

Commit 83767b9

Browse files
xeno097claude
andauthored
feat(deploy-sdk, cli): deploy sdk core artifact api integration (#8148)
Co-authored-by: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
1 parent c58b97f commit 83767b9

14 files changed

Lines changed: 657 additions & 691 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@hyperlane-xyz/deploy-sdk': major
3+
'@hyperlane-xyz/provider-sdk': minor
4+
'@hyperlane-xyz/cli': patch
5+
---
6+
7+
Removed `AltVMCoreModule`, `AltVMCoreReader`, and `coreModuleProvider` from deploy-sdk in favor of the new core artifact API (`CoreWriter`, `createCoreReader`). Added `coreConfigToArtifact` and `coreResultToDeployedAddresses` helpers to provider-sdk. Updated CLI core deploy and read commands to use the new API.

.github/workflows/test-cli-e2e.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ jobs:
234234
# Core Commands
235235
- core-deploy
236236
- core-apply
237+
- core-apply-updates
237238
# ISM Commands
238239
- ism
239240
# Warp Commands

typescript/cli/src/deploy/core.ts

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import { stringify as yamlStringify } from 'yaml';
22

33
import { buildArtifact as coreBuildArtifact } from '@hyperlane-xyz/core/buildArtifact.js';
4-
import { AltVMCoreModule } from '@hyperlane-xyz/deploy-sdk';
5-
import { GasAction, ProtocolType } from '@hyperlane-xyz/provider-sdk';
4+
import { createCoreWriter } from '@hyperlane-xyz/deploy-sdk';
5+
import {
6+
GasAction,
7+
ProtocolType,
8+
coreConfigToArtifact,
9+
coreResultToDeployedAddresses,
10+
} from '@hyperlane-xyz/provider-sdk';
611
import { type ChainAddresses } from '@hyperlane-xyz/registry';
712
import {
813
type ChainName,
@@ -29,6 +34,7 @@ import {
2934
validateCoreIsmCompatibility,
3035
} from './utils.js';
3136
import { getSubmitterByStrategy } from './warp.js';
37+
import { ArtifactState } from '@hyperlane-xyz/provider-sdk/artifact';
3238

3339
interface DeployParams {
3440
context: WriteCommandContext;
@@ -111,17 +117,18 @@ export async function runCoreDeploy(params: DeployParams) {
111117
const userAddress = signer.getSignerAddress();
112118
const initialBalances = await getBalances(context, [chain], userAddress);
113119

114-
const coreModule = await AltVMCoreModule.create({
115-
chain,
116-
config: validateCoreConfigForAltVM(config, chain),
117-
chainLookup: altVmChainLookup(multiProvider),
118-
signer,
119-
});
120+
const validatedConfig = validateCoreConfigForAltVM(config, chain);
121+
const chainLookup = altVmChainLookup(multiProvider);
122+
const metadata = chainLookup.getChainMetadata(chain);
123+
124+
const coreWriter = createCoreWriter(metadata, chainLookup, signer);
125+
const coreArtifact = coreConfigToArtifact(validatedConfig, chainLookup);
126+
const [result] = await coreWriter.create(coreArtifact);
120127

121128
await completeDeploy(context, 'core', initialBalances, userAddress, [
122129
chain,
123130
]);
124-
deployedAddresses = coreModule.serialize();
131+
deployedAddresses = coreResultToDeployedAddresses(result);
125132
}
126133
}
127134

@@ -178,18 +185,18 @@ export async function runCoreApply(params: ApplyParams) {
178185
});
179186

180187
const validatedConfig = validateCoreConfigForAltVM(config, chain);
181-
182-
const coreModule = new AltVMCoreModule(
183-
altVmChainLookup(multiProvider),
184-
signer,
185-
{
186-
chain,
187-
config: validatedConfig,
188-
addresses: deployedCoreAddresses,
188+
const chainLookup = altVmChainLookup(multiProvider);
189+
const metadata = chainLookup.getChainMetadata(chain);
190+
191+
const coreWriter = createCoreWriter(metadata, chainLookup, signer);
192+
const coreArtifact = coreConfigToArtifact(validatedConfig, chainLookup);
193+
const transactions = await coreWriter.update({
194+
artifactState: ArtifactState.DEPLOYED,
195+
config: coreArtifact.config,
196+
deployed: {
197+
address: deployedCoreAddresses.mailbox,
189198
},
190-
);
191-
192-
const transactions = await coreModule.update(validatedConfig);
199+
});
193200

194201
if (transactions.length) {
195202
logGray('Updating deployed core contracts');

typescript/cli/src/read/core.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
import { AltVMCoreReader } from '@hyperlane-xyz/deploy-sdk';
1+
import { createCoreReader } from '@hyperlane-xyz/deploy-sdk';
22
import {
33
type ChainName,
44
type CoreConfig,
55
EvmCoreReader,
66
altVmChainLookup,
77
} from '@hyperlane-xyz/sdk';
8-
import {
9-
type Address,
10-
ProtocolType,
11-
assert,
12-
mustGet,
13-
} from '@hyperlane-xyz/utils';
8+
import { type Address, ProtocolType, assert } from '@hyperlane-xyz/utils';
149

1510
import { type CommandContext } from '../context/types.js';
1611
import { errorRed } from '../logger.js';
@@ -55,11 +50,10 @@ export async function executeCoreRead({
5550
break;
5651
}
5752
default: {
58-
const provider = mustGet(context.altVmProviders, chain);
59-
const chainLookup = altVmChainLookup(context.multiProvider);
60-
const metadata = chainLookup.getChainMetadata(chain);
61-
const coreReader = new AltVMCoreReader(metadata, chainLookup, provider);
6253
try {
54+
const chainLookup = altVmChainLookup(context.multiProvider);
55+
const metadata = chainLookup.getChainMetadata(chain);
56+
const coreReader = createCoreReader(metadata, chainLookup);
6357
return await coreReader.deriveCoreConfig(mailbox);
6458
} catch (e: any) {
6559
errorRed(

0 commit comments

Comments
 (0)