@lionden/plugin-deploy 0.1.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/LICENSE +201 -0
- package/README.md +23 -0
- package/dist/deploy-task.d.ts +83 -0
- package/dist/deploy-task.d.ts.map +1 -0
- package/dist/deploy-task.js +599 -0
- package/dist/deploy-task.js.map +1 -0
- package/dist/deployment-manager.d.ts +80 -0
- package/dist/deployment-manager.d.ts.map +1 -0
- package/dist/deployment-manager.js +521 -0
- package/dist/deployment-manager.js.map +1 -0
- package/dist/deployment-state.d.ts +40 -0
- package/dist/deployment-state.d.ts.map +1 -0
- package/dist/deployment-state.js +204 -0
- package/dist/deployment-state.js.map +1 -0
- package/dist/deployment-types.d.ts +112 -0
- package/dist/deployment-types.d.ts.map +1 -0
- package/dist/deployment-types.js +9 -0
- package/dist/deployment-types.js.map +1 -0
- package/dist/errors.d.ts +7 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +10 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +184 -0
- package/dist/index.js.map +1 -0
- package/dist/leo-sources.d.ts +11 -0
- package/dist/leo-sources.d.ts.map +1 -0
- package/dist/leo-sources.js +31 -0
- package/dist/leo-sources.js.map +1 -0
- package/dist/leo-version.d.ts +2 -0
- package/dist/leo-version.d.ts.map +1 -0
- package/dist/leo-version.js +10 -0
- package/dist/leo-version.js.map +1 -0
- package/dist/on-chain-check.d.ts +34 -0
- package/dist/on-chain-check.d.ts.map +1 -0
- package/dist/on-chain-check.js +84 -0
- package/dist/on-chain-check.js.map +1 -0
- package/dist/preflight.d.ts +94 -0
- package/dist/preflight.d.ts.map +1 -0
- package/dist/preflight.js +288 -0
- package/dist/preflight.js.map +1 -0
- package/dist/prove.d.ts +11 -0
- package/dist/prove.d.ts.map +1 -0
- package/dist/prove.js +19 -0
- package/dist/prove.js.map +1 -0
- package/dist/recipe-task.d.ts +18 -0
- package/dist/recipe-task.d.ts.map +1 -0
- package/dist/recipe-task.js +201 -0
- package/dist/recipe-task.js.map +1 -0
- package/dist/recipe-types.d.ts +95 -0
- package/dist/recipe-types.d.ts.map +1 -0
- package/dist/recipe-types.js +10 -0
- package/dist/recipe-types.js.map +1 -0
- package/dist/upgrade-task.d.ts +30 -0
- package/dist/upgrade-task.d.ts.map +1 -0
- package/dist/upgrade-task.js +315 -0
- package/dist/upgrade-task.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
import { isSignable, normalizeProgramId } from "@lionden/config";
|
|
2
|
+
import { KeyArtifactsMetadataError, logAction, logMetadata, logSuccess, logWarning, readProgramArtifactProvenance, } from "@lionden/core";
|
|
3
|
+
import { discoverUnits, resolveDependencies, } from "@lionden/leo-compiler";
|
|
4
|
+
import { DeployError } from "./errors.js";
|
|
5
|
+
import { supportsLeoProgramRename } from "./leo-version.js";
|
|
6
|
+
import { checkProgramOnChain, createDegradedRecord, getRequiredProgramEdition, } from "./on-chain-check.js";
|
|
7
|
+
import { runDeployPreflight } from "./preflight.js";
|
|
8
|
+
import { resolveProveOption } from "./prove.js";
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Deploy action
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
export async function deployAction(args, lre) {
|
|
13
|
+
const options = {
|
|
14
|
+
program: args["program"],
|
|
15
|
+
priorityFee: args["priorityFee"],
|
|
16
|
+
skipConfirm: args["skipConfirm"],
|
|
17
|
+
network: args["network"],
|
|
18
|
+
noCompile: args["noCompile"],
|
|
19
|
+
preflight: args["preflight"],
|
|
20
|
+
dryRun: args["dryRun"],
|
|
21
|
+
noSkipDeployed: args["noSkipDeployed"],
|
|
22
|
+
export: args["export"],
|
|
23
|
+
prove: resolveProveOption(args, lre),
|
|
24
|
+
rename: args["rename"],
|
|
25
|
+
};
|
|
26
|
+
const config = lre.config;
|
|
27
|
+
const networkName = options.network ?? config.defaultNetwork;
|
|
28
|
+
const shouldConfirm = !options.skipConfirm && config.deploy.confirmTransactions;
|
|
29
|
+
if (options.export && !shouldConfirm) {
|
|
30
|
+
throw new DeployError("Export is not available when deploy confirmation is skipped because deployed state may not yet be visible on-chain.");
|
|
31
|
+
}
|
|
32
|
+
const programsDir = config.paths.programs;
|
|
33
|
+
const manager = lre.deployments;
|
|
34
|
+
// 1. Compile first (unless --noCompile or --preflight). Forward the effective
|
|
35
|
+
// deployment network (when explicitly supplied) so the implicit compile
|
|
36
|
+
// resolves imported on-chain sources + `.env` from the deploying network.
|
|
37
|
+
// Omit it on a default run so compile falls back to `config.defaultNetwork`
|
|
38
|
+
// (byte-for-byte unchanged).
|
|
39
|
+
if (!options.noCompile && !options.preflight) {
|
|
40
|
+
const compileArgs = {};
|
|
41
|
+
if (options.program)
|
|
42
|
+
compileArgs["program"] = options.program;
|
|
43
|
+
if (options.rename)
|
|
44
|
+
compileArgs["rename"] = options.rename;
|
|
45
|
+
if (options.network)
|
|
46
|
+
compileArgs["network"] = networkName;
|
|
47
|
+
if (Object.keys(compileArgs).length > 0) {
|
|
48
|
+
await lre.tasks.run("compile", compileArgs);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
await lre.tasks.run("compile");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// 2. Discover all units for source-dir mapping and dependency ordering
|
|
55
|
+
const discovered = discoverUnits(programsDir);
|
|
56
|
+
const programs = discovered.filter((u) => u.kind === "program");
|
|
57
|
+
const programMap = new Map(programs.map((p) => [p.programId, p]));
|
|
58
|
+
const graph = resolveDependencies(discovered);
|
|
59
|
+
const renamePlan = validateDeployRename(options, config, graph);
|
|
60
|
+
// 3. Determine candidate program IDs for target resolution.
|
|
61
|
+
// In --preflight mode compilation is skipped, so artifacts may be absent.
|
|
62
|
+
// Use discovered program IDs so runDeployPreflight() can emit MISSING_ARTIFACTS
|
|
63
|
+
// per program rather than throwing here before any structured result is produced.
|
|
64
|
+
// In normal (deploy/dry-run) mode, only compiled IDs are valid targets.
|
|
65
|
+
const compiledIds = lre.artifacts.getProgramIds();
|
|
66
|
+
const candidateIds = options.preflight
|
|
67
|
+
? programs.map((p) => p.programId)
|
|
68
|
+
: renamePlan
|
|
69
|
+
? programs.map((p) => p.programId)
|
|
70
|
+
: compiledIds.filter((id) => programMap.has(id));
|
|
71
|
+
if (!options.preflight && candidateIds.length === 0) {
|
|
72
|
+
throw new DeployError("No compiled programs found. Run `lionden compile` first.");
|
|
73
|
+
}
|
|
74
|
+
// 4. Resolve deploy targets in topological order (deps first)
|
|
75
|
+
const targetIds = resolveDeployTargets(candidateIds, programMap, graph, options.program).map((id) => (id === renamePlan?.sourceProgramId ? renamePlan?.targetProgramId : id));
|
|
76
|
+
const preflightGraph = renamePlan ? graphWithRenamedPrimary(graph, renamePlan) : graph;
|
|
77
|
+
if (renamePlan && options.noCompile) {
|
|
78
|
+
validateRenamedNoCompileArtifactProvenance(config, renamePlan);
|
|
79
|
+
}
|
|
80
|
+
// 5. Connect to network
|
|
81
|
+
const networkConfig = config.networks[networkName];
|
|
82
|
+
if (!networkConfig) {
|
|
83
|
+
throw new DeployError(`Network "${networkName}" not found in config. ` +
|
|
84
|
+
`Available: ${Object.keys(config.networks).join(", ") || "none"}`);
|
|
85
|
+
}
|
|
86
|
+
const networkManager = lre.network;
|
|
87
|
+
const connection = await networkManager.connect(networkName);
|
|
88
|
+
// 5b. Resolve deployer signer from namedAccounts (if configured)
|
|
89
|
+
let deployerSignerKey;
|
|
90
|
+
const namedDeployer = lre.namedAccounts["deployer"];
|
|
91
|
+
if (namedDeployer !== undefined) {
|
|
92
|
+
if (!isSignable(namedDeployer)) {
|
|
93
|
+
throw new DeployError(`Named account "deployer" is configured as address-only for network "${networkName}". ` +
|
|
94
|
+
`The deployer role requires a signable account (private key or devnode account index). ` +
|
|
95
|
+
`Provide a private key or devnode index in your namedAccounts config.`);
|
|
96
|
+
}
|
|
97
|
+
deployerSignerKey = namedDeployer.privateKey;
|
|
98
|
+
}
|
|
99
|
+
// 6. Recover pending deployments from previous runs
|
|
100
|
+
if (manager) {
|
|
101
|
+
await manager.recoverPendingDeployments(networkName, connection);
|
|
102
|
+
}
|
|
103
|
+
// 7. Build local sources map (compiled Aleo sources for all targets)
|
|
104
|
+
const localSources = new Map();
|
|
105
|
+
for (const programId of targetIds) {
|
|
106
|
+
const source = lre.artifacts.getAleoSource(programId);
|
|
107
|
+
if (source)
|
|
108
|
+
localSources.set(programId, source);
|
|
109
|
+
}
|
|
110
|
+
// 8. Build preflight program entries
|
|
111
|
+
// Use getDeployment() (async, validates disk/on-chain) instead of getCached() so that HTTP
|
|
112
|
+
// disk state is loaded into the preflight even on a cold-cache (fresh CLI process).
|
|
113
|
+
const preflightPrograms = [];
|
|
114
|
+
for (const programId of targetIds) {
|
|
115
|
+
const aleoSourceRaw = lre.artifacts.getAleoSource(programId);
|
|
116
|
+
const aleoSource = typeof aleoSourceRaw === "string" ? aleoSourceRaw : undefined;
|
|
117
|
+
// Devnode: use sync cache — it's populated as programs are deployed in this session
|
|
118
|
+
// and avoids unnecessary getProgramSource() calls before the program exists.
|
|
119
|
+
// HTTP: use async getDeployment() to load validated disk state on a cold-cache process.
|
|
120
|
+
const existingRecord = manager
|
|
121
|
+
? connection.type === "devnode" && (!renamePlan || manager.isEphemeral(networkName))
|
|
122
|
+
? (manager.getCached(programId, networkName) ?? null)
|
|
123
|
+
: await manager.getDeployment(programId, networkName)
|
|
124
|
+
: null;
|
|
125
|
+
preflightPrograms.push({ programId, aleoSource, existingRecord });
|
|
126
|
+
}
|
|
127
|
+
// 9. Run pre-flight validation
|
|
128
|
+
const skipDeployed = !options.noSkipDeployed && config.deploy.skipDeployed;
|
|
129
|
+
const deployTargets = new Set(targetIds);
|
|
130
|
+
const preflightResult = await runDeployPreflight({
|
|
131
|
+
programs: preflightPrograms,
|
|
132
|
+
connection,
|
|
133
|
+
networkConfig,
|
|
134
|
+
config,
|
|
135
|
+
skipDeployed,
|
|
136
|
+
deployTargets,
|
|
137
|
+
localSources,
|
|
138
|
+
graph: preflightGraph,
|
|
139
|
+
signerPrivateKey: deployerSignerKey,
|
|
140
|
+
});
|
|
141
|
+
if (renamePlan) {
|
|
142
|
+
validateRenamedPreflightReuse(preflightResult, renamePlan);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
validatePlainPreflightReuse(preflightResult, programMap);
|
|
146
|
+
}
|
|
147
|
+
// 10. If --preflight, return pure check result (no state mutations)
|
|
148
|
+
if (options.preflight) {
|
|
149
|
+
return { mode: "preflight", result: preflightResult };
|
|
150
|
+
}
|
|
151
|
+
// 11. Fail if preflight has errors (not just warnings)
|
|
152
|
+
if (!preflightResult.passed) {
|
|
153
|
+
const errorMessages = preflightResult.errors
|
|
154
|
+
.map((e) => ` [${e.code}] ${e.message}`)
|
|
155
|
+
.join("\n");
|
|
156
|
+
throw new DeployError(`Pre-flight validation failed:\n${errorMessages}`);
|
|
157
|
+
}
|
|
158
|
+
// Log any warnings after validation passes. --preflight returns the structured
|
|
159
|
+
// result without side effects so callers can decide how to display it.
|
|
160
|
+
for (const w of preflightResult.warnings) {
|
|
161
|
+
console.warn(`Warning [${w.code}]: ${w.message}`);
|
|
162
|
+
}
|
|
163
|
+
// 12. Filter to programs that need deploying from preflight outcomes
|
|
164
|
+
const toDeployIds = preflightResult.programs
|
|
165
|
+
.filter((p) => p.action === "deploy")
|
|
166
|
+
.map((p) => p.programId);
|
|
167
|
+
for (const outcome of preflightResult.programs) {
|
|
168
|
+
if (outcome.action === "skip" && outcome.reason === "already-deployed") {
|
|
169
|
+
console.log(`${logWarning("Skipping")} ${outcome.programId}: already deployed`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// 13. If --dry-run, build transactions without broadcasting (devnode only).
|
|
173
|
+
// This must happen BEFORE reconciliation so dry-run never mutates deployment state.
|
|
174
|
+
if (options.dryRun) {
|
|
175
|
+
if (connection.type !== "devnode") {
|
|
176
|
+
throw new DeployError(`Dry-run is not supported for HTTP networks in v1. ` +
|
|
177
|
+
`Use --preflight for validation without deployment.`);
|
|
178
|
+
}
|
|
179
|
+
const dryRunResults = [];
|
|
180
|
+
for (const programId of toDeployIds) {
|
|
181
|
+
const aleoSource = lre.artifacts.getAleoSource(programId);
|
|
182
|
+
if (!aleoSource)
|
|
183
|
+
continue;
|
|
184
|
+
const tx = await buildDeployTransaction({
|
|
185
|
+
programId,
|
|
186
|
+
aleoSource,
|
|
187
|
+
connection,
|
|
188
|
+
fee: options.priorityFee ?? config.deploy.defaultPriorityFee,
|
|
189
|
+
privateFee: config.deploy.privateFee,
|
|
190
|
+
signerPrivateKey: deployerSignerKey,
|
|
191
|
+
prove: options.prove,
|
|
192
|
+
keyCache: config.sdk.keyCache,
|
|
193
|
+
logLevel: config.sdk.logLevel,
|
|
194
|
+
egressPolicy: connection.egressPolicy,
|
|
195
|
+
});
|
|
196
|
+
dryRunResults.push({
|
|
197
|
+
programId,
|
|
198
|
+
transaction: tx,
|
|
199
|
+
estimatedFee: 0n,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
return { mode: "dry-run", results: dryRunResults };
|
|
203
|
+
}
|
|
204
|
+
// 14. Reconcile: create degraded records for skipped+already-deployed programs with no state.
|
|
205
|
+
// Runs AFTER dry-run check so dry-run never writes deployment state.
|
|
206
|
+
if (manager) {
|
|
207
|
+
for (const outcome of preflightResult.programs) {
|
|
208
|
+
if (outcome.action === "skip" && outcome.reason === "already-deployed" && !outcome.record) {
|
|
209
|
+
const onChain = await checkProgramOnChain(connection, outcome.programId);
|
|
210
|
+
if (onChain.exists) {
|
|
211
|
+
const observedEdition = typeof onChain.edition === "number"
|
|
212
|
+
? onChain.edition
|
|
213
|
+
: await getRequiredProgramEdition(connection, outcome.programId, "create degraded deployment record");
|
|
214
|
+
const degraded = createDegradedRecord(outcome.programId, networkName, connection.endpoint, onChain.source, observedEdition);
|
|
215
|
+
await manager.record(degraded, "deploy");
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// 15. Deploy each program in order
|
|
221
|
+
const results = [];
|
|
222
|
+
const fee = options.priorityFee ?? config.deploy.defaultPriorityFee;
|
|
223
|
+
const privateFee = config.deploy.privateFee;
|
|
224
|
+
const confirmTimeout = config.deploy.confirmationTimeout;
|
|
225
|
+
// Inter-deployment delay for HTTP
|
|
226
|
+
const isHttp = networkConfig.type === "http";
|
|
227
|
+
const interDelay = config.deploy.interDeploymentDelay ?? (isHttp ? 12_000 : 0);
|
|
228
|
+
for (let i = 0; i < toDeployIds.length; i++) {
|
|
229
|
+
const programId = toDeployIds[i];
|
|
230
|
+
console.log(`${logAction("Deploying")} ${programId} on network "${networkName}"`);
|
|
231
|
+
const aleoSource = lre.artifacts.getAleoSource(programId);
|
|
232
|
+
if (!aleoSource) {
|
|
233
|
+
throw new DeployError(`No compiled .aleo source found for "${programId}". Run \`lionden compile\` first.`);
|
|
234
|
+
}
|
|
235
|
+
// ABI is recorded for export consumers (manager.record requires it for complete records).
|
|
236
|
+
const abi = lre.artifacts.getAbi(programId);
|
|
237
|
+
if (!abi) {
|
|
238
|
+
throw new DeployError(`No compiled ABI found for "${programId}". ` +
|
|
239
|
+
`Run \`lionden compile\` first, or pass --noCompile only when artifacts already exist.`);
|
|
240
|
+
}
|
|
241
|
+
// Derive deployer address from connection (prefer namedAccounts.deployer key)
|
|
242
|
+
const deployerAddress = await resolveDeployerAddress(connection, networkConfig, deployerSignerKey);
|
|
243
|
+
// Before broadcast: write pending marker
|
|
244
|
+
if (manager) {
|
|
245
|
+
const pending = {
|
|
246
|
+
programId,
|
|
247
|
+
...(renamePlan && programId === renamePlan.targetProgramId
|
|
248
|
+
? { sourceProgramId: renamePlan.sourceProgramId }
|
|
249
|
+
: {}),
|
|
250
|
+
action: "deploy",
|
|
251
|
+
startedAt: new Date().toISOString(),
|
|
252
|
+
deployerAddress: deployerAddress ?? "unknown",
|
|
253
|
+
priorityFee: fee,
|
|
254
|
+
privateFee,
|
|
255
|
+
network: networkName,
|
|
256
|
+
endpoint: connection.endpoint,
|
|
257
|
+
};
|
|
258
|
+
await manager.setPending(pending);
|
|
259
|
+
}
|
|
260
|
+
// Build and broadcast
|
|
261
|
+
const txId = await deployToNetwork({
|
|
262
|
+
programId,
|
|
263
|
+
aleoSource,
|
|
264
|
+
connection,
|
|
265
|
+
fee,
|
|
266
|
+
privateFee,
|
|
267
|
+
signerPrivateKey: deployerSignerKey,
|
|
268
|
+
prove: options.prove,
|
|
269
|
+
keyCache: config.sdk.keyCache,
|
|
270
|
+
logLevel: config.sdk.logLevel,
|
|
271
|
+
egressPolicy: connection.egressPolicy,
|
|
272
|
+
});
|
|
273
|
+
// Wait for confirmation
|
|
274
|
+
let blockHeight = 0;
|
|
275
|
+
if (shouldConfirm) {
|
|
276
|
+
console.log(`${logAction("Waiting for confirmation")} of ${programId} ${logMetadata(`(tx: ${txId})`)}`);
|
|
277
|
+
const confirmed = await connection.waitForConfirmation(txId, confirmTimeout);
|
|
278
|
+
if (confirmed.status === "rejected") {
|
|
279
|
+
throw new DeployError(`Deploy transaction ${txId} was rejected on-chain.`);
|
|
280
|
+
}
|
|
281
|
+
blockHeight = confirmed.blockHeight;
|
|
282
|
+
}
|
|
283
|
+
// Record in deployment state. The compiled ABI is passed through so export
|
|
284
|
+
// consumers (and the in-memory ABI cache) have it; the record itself carries
|
|
285
|
+
// no upgrade-bookkeeping metadata.
|
|
286
|
+
if (manager) {
|
|
287
|
+
const record = {
|
|
288
|
+
status: "complete",
|
|
289
|
+
programId,
|
|
290
|
+
...(renamePlan && programId === renamePlan.targetProgramId
|
|
291
|
+
? { sourceProgramId: renamePlan.sourceProgramId }
|
|
292
|
+
: {}),
|
|
293
|
+
network: networkName,
|
|
294
|
+
endpoint: connection.endpoint,
|
|
295
|
+
updatedAt: new Date().toISOString(),
|
|
296
|
+
edition: 0,
|
|
297
|
+
historyCount: 1,
|
|
298
|
+
txId,
|
|
299
|
+
blockHeight,
|
|
300
|
+
deployerAddress: deployerAddress ?? "unknown",
|
|
301
|
+
deployedAt: new Date().toISOString(),
|
|
302
|
+
feePaid: fee,
|
|
303
|
+
};
|
|
304
|
+
await manager.record(record, "deploy", { abi });
|
|
305
|
+
}
|
|
306
|
+
const result = {
|
|
307
|
+
programId,
|
|
308
|
+
txId,
|
|
309
|
+
blockHeight,
|
|
310
|
+
};
|
|
311
|
+
results.push(result);
|
|
312
|
+
console.log(`${logSuccess("Deployed")} ${programId} ${logMetadata(`(tx: ${txId}, block: ${blockHeight})`)}`);
|
|
313
|
+
// Fire deployment hook
|
|
314
|
+
await lre.hooks.serial("deployment", "programDeployed", {
|
|
315
|
+
programId,
|
|
316
|
+
txId,
|
|
317
|
+
blockHeight,
|
|
318
|
+
network: networkName,
|
|
319
|
+
});
|
|
320
|
+
// Inter-deployment delay (HTTP only, between dependent programs only).
|
|
321
|
+
// The next program may only need the propagation time if it imports from
|
|
322
|
+
// a program just deployed. Unrelated programs in the same batch skip the wait.
|
|
323
|
+
if (isHttp && interDelay > 0 && i < toDeployIds.length - 1) {
|
|
324
|
+
const nextProgramId = toDeployIds[i + 1];
|
|
325
|
+
const nextImports = preflightGraph.imports.get(nextProgramId) ?? [];
|
|
326
|
+
const deployedSoFar = toDeployIds.slice(0, i + 1);
|
|
327
|
+
const nextDependsOnDeployed = nextImports.some((dep) => deployedSoFar.includes(dep));
|
|
328
|
+
if (nextDependsOnDeployed) {
|
|
329
|
+
await sleep(interDelay);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
// 16. Export if requested. Non-confirming deploys are fire-and-forget: the
|
|
334
|
+
// program may not be visible on-chain yet, and export performs validated reads.
|
|
335
|
+
if (manager && (options.export || config.deploy.autoExport)) {
|
|
336
|
+
if (shouldConfirm) {
|
|
337
|
+
await manager.export(networkName);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return { mode: "deploy", results };
|
|
341
|
+
}
|
|
342
|
+
function validateRenamedPreflightReuse(preflightResult, rename) {
|
|
343
|
+
const outcome = preflightResult.programs.find((program) => program.programId === rename.targetProgramId);
|
|
344
|
+
if (!outcome || outcome.action !== "skip")
|
|
345
|
+
return;
|
|
346
|
+
if (outcome.record?.sourceProgramId === rename.sourceProgramId)
|
|
347
|
+
return;
|
|
348
|
+
if (outcome.record?.sourceProgramId) {
|
|
349
|
+
throw new DeployError(`Renamed deploy target "${rename.targetProgramId}" is already associated with source ` +
|
|
350
|
+
`"${outcome.record.sourceProgramId}", not "${rename.sourceProgramId}".`);
|
|
351
|
+
}
|
|
352
|
+
throw new DeployError(`Renamed deploy target "${rename.targetProgramId}" already exists but has no matching local ` +
|
|
353
|
+
`provenance for source "${rename.sourceProgramId}".`);
|
|
354
|
+
}
|
|
355
|
+
function validatePlainPreflightReuse(preflightResult, programMap) {
|
|
356
|
+
for (const outcome of preflightResult.programs) {
|
|
357
|
+
if (outcome.action !== "skip" || !programMap.has(outcome.programId))
|
|
358
|
+
continue;
|
|
359
|
+
const sourceProgramId = outcome.record?.sourceProgramId;
|
|
360
|
+
if (sourceProgramId && sourceProgramId !== outcome.programId) {
|
|
361
|
+
throw new DeployError(`Deploy target "${outcome.programId}" is already associated with source ` +
|
|
362
|
+
`"${sourceProgramId}", not "${outcome.programId}".`);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
// ---------------------------------------------------------------------------
|
|
367
|
+
// Deploy target resolution
|
|
368
|
+
// ---------------------------------------------------------------------------
|
|
369
|
+
/**
|
|
370
|
+
* Resolve which programs to deploy and in what order.
|
|
371
|
+
*
|
|
372
|
+
* Uses the dependency graph (from `resolveDependencies`) for topological
|
|
373
|
+
* ordering. When a specific program is requested, traverses the graph
|
|
374
|
+
* to include its transitive local program dependencies.
|
|
375
|
+
*/
|
|
376
|
+
export function resolveDeployTargets(compiledIds, programMap, graph, targetProgram) {
|
|
377
|
+
if (!targetProgram) {
|
|
378
|
+
// Deploy all compiled programs in dependency order from the graph.
|
|
379
|
+
const ordered = [];
|
|
380
|
+
for (const unit of graph.order) {
|
|
381
|
+
if (unit.kind === "program" && compiledIds.includes(unit.programId)) {
|
|
382
|
+
ordered.push(unit.programId);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
// Add any compiled programs not in the graph (safety fallback)
|
|
386
|
+
for (const id of compiledIds) {
|
|
387
|
+
if (!ordered.includes(id))
|
|
388
|
+
ordered.push(id);
|
|
389
|
+
}
|
|
390
|
+
return ordered;
|
|
391
|
+
}
|
|
392
|
+
// Normalize: add .aleo suffix if missing
|
|
393
|
+
const normalized = targetProgram.endsWith(".aleo") ? targetProgram : `${targetProgram}.aleo`;
|
|
394
|
+
if (!compiledIds.includes(normalized)) {
|
|
395
|
+
throw new DeployError(`Program "${targetProgram}" not found. ` + `Available: ${compiledIds.join(", ") || "none"}`);
|
|
396
|
+
}
|
|
397
|
+
// Collect transitive local program dependencies via graph traversal
|
|
398
|
+
const needed = new Set();
|
|
399
|
+
collectTransitiveProgramDeps(normalized, graph, programMap, needed);
|
|
400
|
+
// Return in topological order from the graph
|
|
401
|
+
const ordered = [];
|
|
402
|
+
for (const unit of graph.order) {
|
|
403
|
+
if (unit.kind === "program" && needed.has(unit.programId)) {
|
|
404
|
+
ordered.push(unit.programId);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
// Ensure target is included even if not in graph
|
|
408
|
+
if (!ordered.includes(normalized))
|
|
409
|
+
ordered.push(normalized);
|
|
410
|
+
return ordered;
|
|
411
|
+
}
|
|
412
|
+
function validateDeployRename(options, config, graph) {
|
|
413
|
+
const rawRename = options.rename?.trim();
|
|
414
|
+
if (!rawRename)
|
|
415
|
+
return null;
|
|
416
|
+
if (!supportsLeoProgramRename(config.leoVersion)) {
|
|
417
|
+
throw new DeployError(`deploy --rename requires Leo 4.3.0 or newer. Configured leoVersion is "${config.leoVersion}".`);
|
|
418
|
+
}
|
|
419
|
+
if (config.compiler.buildTests) {
|
|
420
|
+
throw new DeployError("deploy --rename is not supported when compiler.buildTests is enabled.");
|
|
421
|
+
}
|
|
422
|
+
if (!options.program) {
|
|
423
|
+
throw new DeployError("deploy --rename requires --program so exactly one primary target is selected.");
|
|
424
|
+
}
|
|
425
|
+
const sourceProgramId = normalizeProgramId(options.program);
|
|
426
|
+
const targetProgramId = normalizeProgramId(rawRename);
|
|
427
|
+
const targetBareName = bareProgramName(targetProgramId);
|
|
428
|
+
const localUnitKeys = new Set(graph.order
|
|
429
|
+
.filter((unit) => unit.kind !== "program" || unit.programId !== sourceProgramId)
|
|
430
|
+
.flatMap((unit) => localLookupKeys(unit)));
|
|
431
|
+
if (localUnitKeys.has(targetProgramId) || localUnitKeys.has(targetBareName)) {
|
|
432
|
+
throw new DeployError(`Invalid deploy rename: "${targetProgramId}" conflicts with another local unit.`);
|
|
433
|
+
}
|
|
434
|
+
return { sourceProgramId, targetProgramId };
|
|
435
|
+
}
|
|
436
|
+
function validateRenamedNoCompileArtifactProvenance(config, rename) {
|
|
437
|
+
let provenance;
|
|
438
|
+
try {
|
|
439
|
+
provenance = readProgramArtifactProvenance(config.paths.artifacts, rename.targetProgramId);
|
|
440
|
+
}
|
|
441
|
+
catch (err) {
|
|
442
|
+
if (err instanceof KeyArtifactsMetadataError) {
|
|
443
|
+
throw new DeployError(`Renamed --noCompile deploy for "${rename.targetProgramId}" requires artifact provenance ` +
|
|
444
|
+
`compiled from source "${rename.sourceProgramId}", but the artifact metadata is invalid. ` +
|
|
445
|
+
`Run deploy again without --noCompile to recompile the renamed program. Cause: ${err.message}`);
|
|
446
|
+
}
|
|
447
|
+
throw err;
|
|
448
|
+
}
|
|
449
|
+
const provenanceRequirement = `Renamed --noCompile deploy for "${rename.targetProgramId}" requires artifacts ` +
|
|
450
|
+
`compiled from source "${rename.sourceProgramId}".`;
|
|
451
|
+
const recompileInstruction = "Run deploy again without --noCompile to recompile the renamed program.";
|
|
452
|
+
if (!provenance?.sourceProgramId) {
|
|
453
|
+
throw new DeployError(`${provenanceRequirement} Missing artifact provenance metadata. ${recompileInstruction}`);
|
|
454
|
+
}
|
|
455
|
+
if (provenance.programId !== rename.targetProgramId ||
|
|
456
|
+
provenance.sourceProgramId !== rename.sourceProgramId) {
|
|
457
|
+
throw new DeployError(`${provenanceRequirement} Found artifact provenance programId="${provenance.programId}", ` +
|
|
458
|
+
`sourceProgramId="${provenance.sourceProgramId}". ${recompileInstruction}`);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function localLookupKeys(unit) {
|
|
462
|
+
return unit.kind === "library" ? [unit.name, `${unit.name}.aleo`] : [unit.programId];
|
|
463
|
+
}
|
|
464
|
+
function bareProgramName(programId) {
|
|
465
|
+
return programId.endsWith(".aleo") ? programId.slice(0, -".aleo".length) : programId;
|
|
466
|
+
}
|
|
467
|
+
function graphWithRenamedPrimary(graph, rename) {
|
|
468
|
+
const imports = new Map(graph.imports);
|
|
469
|
+
imports.set(rename.targetProgramId, imports.get(rename.sourceProgramId) ?? []);
|
|
470
|
+
return { ...graph, imports };
|
|
471
|
+
}
|
|
472
|
+
function collectTransitiveProgramDeps(unitId, graph, programMap, collected, visited = new Set()) {
|
|
473
|
+
if (visited.has(unitId))
|
|
474
|
+
return;
|
|
475
|
+
visited.add(unitId);
|
|
476
|
+
if (programMap.has(unitId)) {
|
|
477
|
+
collected.add(unitId);
|
|
478
|
+
}
|
|
479
|
+
const deps = graph.imports.get(unitId) ?? [];
|
|
480
|
+
for (const dep of deps) {
|
|
481
|
+
if (graph.networkDeps.has(dep))
|
|
482
|
+
continue;
|
|
483
|
+
collectTransitiveProgramDeps(dep, graph, programMap, collected, visited);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Build a deployment transaction without broadcasting.
|
|
488
|
+
* Only supported on devnode (HTTP deploy() is atomic).
|
|
489
|
+
*/
|
|
490
|
+
export async function buildDeployTransaction(opts) {
|
|
491
|
+
if (opts.connection.type !== "devnode") {
|
|
492
|
+
throw new DeployError(`Dry-run is not supported for HTTP networks in v1. ` +
|
|
493
|
+
`Use --preflight for validation without deployment.`);
|
|
494
|
+
}
|
|
495
|
+
const { createSdkObjects, captureSdkCall, checkDevnodeSdkSupport, initConsensusHeights } = await import("@lionden/network");
|
|
496
|
+
await initConsensusHeights();
|
|
497
|
+
if (!opts.prove) {
|
|
498
|
+
await checkDevnodeSdkSupport();
|
|
499
|
+
}
|
|
500
|
+
const sdk = await createSdkObjects({
|
|
501
|
+
network: opts.connection.networkId,
|
|
502
|
+
endpoint: opts.connection.endpoint,
|
|
503
|
+
privateKey: opts.signerPrivateKey ?? opts.connection.privateKey,
|
|
504
|
+
apiKey: opts.connection.apiKey,
|
|
505
|
+
keyCache: opts.keyCache,
|
|
506
|
+
logLevel: opts.logLevel,
|
|
507
|
+
egressPolicy: opts.egressPolicy,
|
|
508
|
+
});
|
|
509
|
+
return captureSdkCall(sdk.diagnostics, { operation: "deploy", programId: opts.programId }, () => buildDevnodeDeploymentTransactionForMode(sdk.programManager, opts));
|
|
510
|
+
}
|
|
511
|
+
async function buildDevnodeDeploymentTransactionForMode(programManager, opts) {
|
|
512
|
+
if (opts.prove === true) {
|
|
513
|
+
if (typeof programManager.buildDeploymentTransaction !== "function") {
|
|
514
|
+
throw new DeployError(`Unable to deploy "${opts.programId}" with the standard deployment builder: ` +
|
|
515
|
+
`the installed @provablehq/sdk does not expose buildDeploymentTransaction().`);
|
|
516
|
+
}
|
|
517
|
+
return programManager.buildDeploymentTransaction(opts.aleoSource, opts.fee, opts.privateFee);
|
|
518
|
+
}
|
|
519
|
+
return programManager.buildDevnodeDeploymentTransaction({
|
|
520
|
+
program: opts.aleoSource,
|
|
521
|
+
priorityFee: opts.fee,
|
|
522
|
+
privateFee: opts.privateFee,
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Full deploy: build and broadcast. Returns transaction ID.
|
|
527
|
+
*/
|
|
528
|
+
async function deployToNetwork(opts) {
|
|
529
|
+
const { aleoSource, connection, fee, privateFee } = opts;
|
|
530
|
+
const { createSdkObjects, captureSdkCall, checkDevnodeSdkSupport, initConsensusHeights } = await import("@lionden/network");
|
|
531
|
+
const signerKey = opts.signerPrivateKey ?? connection.privateKey;
|
|
532
|
+
if (connection.type === "devnode") {
|
|
533
|
+
await initConsensusHeights();
|
|
534
|
+
if (!opts.prove) {
|
|
535
|
+
await checkDevnodeSdkSupport();
|
|
536
|
+
}
|
|
537
|
+
const sdk = await createSdkObjects({
|
|
538
|
+
network: connection.networkId,
|
|
539
|
+
endpoint: connection.endpoint,
|
|
540
|
+
privateKey: signerKey,
|
|
541
|
+
apiKey: connection.apiKey,
|
|
542
|
+
keyCache: opts.keyCache,
|
|
543
|
+
logLevel: opts.logLevel,
|
|
544
|
+
egressPolicy: opts.egressPolicy,
|
|
545
|
+
});
|
|
546
|
+
// Only the build is wrapped; broadcast surfaces its own HTTP error.
|
|
547
|
+
const tx = await captureSdkCall(sdk.diagnostics, { operation: "deploy", programId: opts.programId }, () => buildDevnodeDeploymentTransactionForMode(sdk.programManager, opts));
|
|
548
|
+
return connection.broadcastTransaction(tx);
|
|
549
|
+
}
|
|
550
|
+
// HTTP: atomic build+broadcast
|
|
551
|
+
const sdk = await createSdkObjects({
|
|
552
|
+
network: connection.networkId,
|
|
553
|
+
endpoint: connection.endpoint,
|
|
554
|
+
privateKey: signerKey,
|
|
555
|
+
apiKey: connection.apiKey,
|
|
556
|
+
keyCache: opts.keyCache,
|
|
557
|
+
logLevel: opts.logLevel,
|
|
558
|
+
egressPolicy: opts.egressPolicy,
|
|
559
|
+
});
|
|
560
|
+
return captureSdkCall(sdk.diagnostics, { operation: "deploy", programId: opts.programId }, () => sdk.programManager.deploy(aleoSource, fee, privateFee));
|
|
561
|
+
}
|
|
562
|
+
// ---------------------------------------------------------------------------
|
|
563
|
+
// Helpers
|
|
564
|
+
// ---------------------------------------------------------------------------
|
|
565
|
+
export { DeployError } from "./errors.js";
|
|
566
|
+
export { readLeoSourcesFromDir } from "./leo-sources.js";
|
|
567
|
+
function sleep(ms) {
|
|
568
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Resolve the deployer's address from the network config or connection.
|
|
572
|
+
* Best-effort — returns undefined if derivation fails.
|
|
573
|
+
*/
|
|
574
|
+
async function resolveDeployerAddress(connection, networkConfig, signerPrivateKey) {
|
|
575
|
+
const privateKey = signerPrivateKey ??
|
|
576
|
+
connection.privateKey ??
|
|
577
|
+
(networkConfig.type === "devnode" && networkConfig.accounts.length > 0
|
|
578
|
+
? networkConfig.accounts[0].privateKey
|
|
579
|
+
: undefined);
|
|
580
|
+
if (!privateKey)
|
|
581
|
+
return undefined;
|
|
582
|
+
try {
|
|
583
|
+
const { createSdkObjects } = await import("@lionden/network");
|
|
584
|
+
const sdk = await createSdkObjects({
|
|
585
|
+
network: connection.networkId,
|
|
586
|
+
endpoint: connection.endpoint,
|
|
587
|
+
privateKey,
|
|
588
|
+
egressPolicy: connection.egressPolicy,
|
|
589
|
+
});
|
|
590
|
+
const account = sdk.account;
|
|
591
|
+
return typeof account.address === "function"
|
|
592
|
+
? account.address().to_string()
|
|
593
|
+
: String(account.address ?? account);
|
|
594
|
+
}
|
|
595
|
+
catch {
|
|
596
|
+
return undefined;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
//# sourceMappingURL=deploy-task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy-task.js","sourceRoot":"","sources":["../src/deploy-task.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EACL,yBAAyB,EAEzB,SAAS,EACT,WAAW,EACX,UAAU,EACV,UAAU,EAEV,6BAA6B,GAC9B,MAAM,eAAe,CAAC;AACvB,OAAO,EAIL,aAAa,EAGb,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAQ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