@layerzerolabs/vm-tooling-stellar 0.2.122 → 0.2.124
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/{PT2VYI7I.js → AY7HGKNR.js} +3 -6
- package/dist/AY7HGKNR.js.map +1 -0
- package/dist/{6YPWRWU3.js → EP3GEVT6.js} +65 -13
- package/dist/EP3GEVT6.js.map +1 -0
- package/dist/LCHYL2IQ.js +115 -0
- package/dist/LCHYL2IQ.js.map +1 -0
- package/dist/{K7N3LKMZ.js → P6KJGYNA.js} +3 -5
- package/dist/P6KJGYNA.js.map +1 -0
- package/dist/VUOMXK5T.js +6 -0
- package/dist/VUOMXK5T.js.map +1 -0
- package/dist/commands/package-source.d.ts +55 -0
- package/dist/commands/package-source.d.ts.map +1 -0
- package/dist/commands/package-source.js +4 -0
- package/dist/commands/package-source.js.map +1 -0
- package/dist/commands/sync-toolchain.js +2 -2
- package/dist/commands/verifiable-build.d.ts +29 -2
- package/dist/commands/verifiable-build.d.ts.map +1 -1
- package/dist/commands/verifiable-build.js +2 -2
- package/dist/config.js +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/scripts/generate-github-matrix.js +3 -5
- package/dist/scripts/generate-github-matrix.js.map +1 -1
- package/package.json +7 -5
- package/dist/2VBLSQAK.js +0 -44
- package/dist/2VBLSQAK.js.map +0 -1
- package/dist/6YPWRWU3.js.map +0 -1
- package/dist/ITF544RZ.js +0 -18485
- package/dist/ITF544RZ.js.map +0 -1
- package/dist/K7N3LKMZ.js.map +0 -1
- package/dist/PT2VYI7I.js.map +0 -1
- package/dist/RR7PDZXI.js +0 -1341
- package/dist/RR7PDZXI.js.map +0 -1
- package/dist/commands/verifiable-build.test.js +0 -120
- package/dist/commands/verifiable-build.test.js.map +0 -1
- package/dist/index.test.js +0 -16
- package/dist/index.test.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["context","tools","images","versionCombinations","verifiableBuildWrapper","VerifiableBuildWrapper","main","runCli","program","parseGlobalOptions","command","description","action","syncToolchain","extra","stellar","requiredOption","argument","passThroughOptions","allowUnknownOption","args","stellarVersion","rustVersion","run"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["context","tools","images","versionCombinations","verifiableBuildWrapper","VerifiableBuildWrapper","main","runCli","program","parseGlobalOptions","command","description","action","syncToolchain","extra","stellar","requiredOption","option","argument","passThroughOptions","allowUnknownOption","args","stellarVersion","rustVersion","sourceDir","run","output","include","exclude","packageSource"],"mappings":";;;;;;;AAQA,IAAMA,OAAAA,GAAiC;AAAEC,EAAAA,KAAAA;AAAOC,EAAAA,MAAAA;AAAQC,EAAAA;AAAoB,CAAA;AAE5E,IAAMC,sBAAAA,GAAyB,IAAIC,sBAAAA,EAAAA;AAE5B,IAAMC,uBAAO,MAAA,CAAA,MAChBC,MAAAA,CAAOP,OAAAA,EAAS,CAACQ,SAASC,kBAAAA,KAAAA;AACtBD,EAAAA,OAAAA,CACKE,OAAAA,CAAQ,gBAAA,CAAA,CACRC,WAAAA,CACG,+EAAA,CAAA,CAEHC,MAAAA,CAAO,YAAYC,aAAAA,CAAcb,OAAAA,EAAS,MAAMS,kBAAAA,CAAmBD,OAAAA,CAAAA,CAAAA,CAAAA;AAIxE,EAAA,MAAMM,QAAQN,OAAAA,CAAQE,OAAAA,CAAQ,OAAA,CAAA,CAASC,YAAY,+BAAA,CAAA;AACnD,EAAA,MAAMI,OAAAA,GAAUD,KAAAA,CAAMJ,OAAAA,CAAQ,SAAA,CAAA;AAE9BK,EAAAA,OAAAA,CACKL,QAAQ,kBAAA,CAAA,CACRC,WAAAA,CACG,8RAGI,EAEPK,cAAAA,CACG,6BAAA,EACA,sEAAA,CAAA,CAEHA,eACG,0BAAA,EACA,+DAAA,CAAA,CAEHC,MAAAA,CACG,uBACA,gIACI,CAAA,CAEPC,QAAAA,CACG,WAAA,EACA,gFAAA,CAAA,CAEHC,kBAAAA,CAAmB,IAAA,CAAA,CACnBC,oBAAkB,CAClBR,MAAAA,CACG,OACIS,IAAAA,EACA,EACIC,cAAAA,EACAC,WAAAA,EACAC,WAAS,KAGbpB,sBAAAA,CAAuBqB,IACnBJ,IAAAA,EACA;AAAEC,IAAAA,cAAAA;AAAgBC,IAAAA;AAAY,GAAA,EAC9B,MAAMd,kBAAAA,CAAmBD,OAAAA,CAAAA,EACzBgB,SAAAA,CAAAA,CAAAA;AAIhBT,EAAAA,OAAAA,CACKL,OAAAA,CAAQ,gBAAA,CAAA,CACRC,WAAAA,CACG,gYAII,CAAA,CAEPM,MAAAA,CACG,iBAAA,EACA,oEAAA,CAAA,CAEHA,MAAAA,CACG,wBAAA,EACA,2EAAA,EACA,EAAE,CAAA,CAELA,MAAAA,CACG,wBAAA,EACA,sFAAA,EACA,EAAE,CAAA,CAELL,MAAAA,CACG,OAAO,EACHc,MAAAA,EACAC,OAAAA,EACAC,OAAAA,OAMAC,aAAAA,CAAc;AAAEH,IAAAA,MAAAA;AAAQC,IAAAA,OAAAA;AAASC,IAAAA;AAAQ,GAAA,EAAG,MAAMnB,kBAAAA,CAAmBD,OAAAA,CAAAA,CAAAA,CAAAA;AAErF,CAAA,CAAA,EA7FgB,MAAA","file":"index.js","sourcesContent":["import type { ChainContext } from '@layerzerolabs/vm-tooling';\nimport { runCli } from '@layerzerolabs/vm-tooling';\n\nimport { packageSource } from './commands/package-source';\nimport { syncToolchain } from './commands/sync-toolchain';\nimport { VerifiableBuildWrapper } from './commands/verifiable-build';\nimport { type ImageId, images, tools, versionCombinations } from './config';\n\nconst context: ChainContext<ImageId> = { tools, images, versionCombinations };\n\nconst verifiableBuildWrapper = new VerifiableBuildWrapper();\n\nexport const main = (): Promise<void> =>\n runCli(context, (program, parseGlobalOptions) => {\n program\n .command('sync-toolchain')\n .description(\n 'Pre-download the Rust toolchain specified in rust-toolchain.toml under a lock',\n )\n .action(async () => syncToolchain(context, await parseGlobalOptions(program)));\n\n // Extra (non-passthrough) commands, namespaced under `extra <tool>` like vm-tooling-sui:\n // lz-tool extra stellar verifiable-build [args...]\n const extra = program.command('extra').description('Extra commands for VM tooling');\n const stellar = extra.command('stellar');\n\n stellar\n .command('verifiable-build')\n .description(\n 'Reproducible `stellar contract build` of the self-contained source in the cwd by ' +\n 'default, inside the official stellar/stellar-cli:<stellar>-rust<rust>-slim-bookworm ' +\n 'image pinned by its linux/amd64 digest (run from the host, no Docker socket; embeds ' +\n 'the bldimg WASM meta automatically)',\n )\n .requiredOption(\n '--stellar-version <version>',\n 'Stellar CLI version of the official reproducible image (e.g. 25.1.0)',\n )\n .requiredOption(\n '--rust-version <version>',\n 'Rust version of the official reproducible image (e.g. 1.90.0)',\n )\n .option(\n '--source-dir <path>',\n 'Directory to build — the self-contained/decompressed source. Relative paths ' +\n 'resolve against the cwd; defaults to the cwd.',\n )\n .argument(\n '[args...]',\n 'Arguments for `stellar contract build`, after `--` (e.g. -- --package <crate>)',\n )\n .passThroughOptions(true)\n .allowUnknownOption()\n .action(\n async (\n args: string[],\n {\n stellarVersion,\n rustVersion,\n sourceDir,\n }: { stellarVersion: string; rustVersion: string; sourceDir?: string },\n ) =>\n verifiableBuildWrapper.run(\n args,\n { stellarVersion, rustVersion },\n await parseGlobalOptions(program),\n sourceDir,\n ),\n );\n\n stellar\n .command('package-source')\n .description(\n 'Package the self-contained crate in the cwd into a byte-deterministic source ' +\n '.zip under .artifacts/ (for the SEP-58 verifiable build) and print its ' +\n 'source_sha256. Include-only: packages source files (.rs/.lock, Cargo.toml, ' +\n 'rust-toolchain.toml, rustfmt.toml, clippy.toml) plus any --include entries; ' +\n '--exclude always wins. Skips non-source directories (target, node_modules, …).',\n )\n .option(\n '--output <path>',\n 'Output .zip path (default: <cwd>/.artifacts/<basename>-source.zip)',\n )\n .option(\n '--include <pattern...>',\n 'Native Node glob patterns to include beyond the default source extensions',\n [],\n )\n .option(\n '--exclude <pattern...>',\n 'Native Node glob patterns to exclude (always wins over the allow-list and --include)',\n [],\n )\n .action(\n async ({\n output,\n include,\n exclude,\n }: {\n output?: string;\n include?: string[];\n exclude?: string[];\n }) =>\n packageSource({ output, include, exclude }, await parseGlobalOptions(program)),\n );\n });\n"]}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { images, versionCombinations } from '../
|
|
2
|
-
import '../
|
|
3
|
-
import
|
|
1
|
+
import { images, versionCombinations } from '../AY7HGKNR.js';
|
|
2
|
+
import '../P6KJGYNA.js';
|
|
3
|
+
import '../VUOMXK5T.js';
|
|
4
4
|
import { runGithubMatrixGenerator } from '@layerzerolabs/vm-tooling';
|
|
5
5
|
|
|
6
|
-
// src/scripts/generate-github-matrix.ts
|
|
7
|
-
init_esm_shims();
|
|
8
6
|
runGithubMatrixGenerator(images, "tools/vm-tooling/vm-tooling-stellar", versionCombinations).catch((error) => {
|
|
9
7
|
console.error(error);
|
|
10
8
|
process.exit(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/scripts/generate-github-matrix.ts"],"names":["runGithubMatrixGenerator","images","versionCombinations","catch","error","console","process","exit"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/scripts/generate-github-matrix.ts"],"names":["runGithubMatrixGenerator","images","versionCombinations","catch","error","console","process","exit"],"mappings":";;;;;AAIAA,wBAAAA,CAAyBC,QAAQ,qCAAA,EAAuCC,mBAAAA,CAAAA,CAAqBC,KAAAA,CACzF,CAACC,KAAAA,KAAAA;AACGC,EAAAA,OAAAA,CAAQD,MAAMA,KAAAA,CAAAA;AACdE,EAAAA,OAAAA,CAAQC,KAAK,CAAA,CAAA;AACjB,CAAA,CAAA","file":"generate-github-matrix.js","sourcesContent":["import { runGithubMatrixGenerator } from '@layerzerolabs/vm-tooling';\n\nimport { images, versionCombinations } from '../config';\n\nrunGithubMatrixGenerator(images, 'tools/vm-tooling/vm-tooling-stellar', versionCombinations).catch(\n (error: unknown) => {\n console.error(error);\n process.exit(1);\n },\n);\n"]}
|
package/package.json
CHANGED
|
@@ -20,16 +20,18 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"toml": "^3.0.0",
|
|
23
|
-
"@layerzerolabs/
|
|
23
|
+
"@layerzerolabs/deterministic-zip": "0.2.124",
|
|
24
|
+
"@layerzerolabs/vm-tooling": "0.2.124"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
27
|
+
"fflate": "^0.8.3",
|
|
26
28
|
"tsup": "^8.4.0",
|
|
27
29
|
"tsx": "^4.21.0",
|
|
28
30
|
"typescript": "^5.8.2",
|
|
29
31
|
"vitest": "^3.2.6",
|
|
30
|
-
"@layerzerolabs/tsup-configuration": "0.2.
|
|
31
|
-
"@layerzerolabs/typescript-configuration": "0.2.
|
|
32
|
-
"@layerzerolabs/vitest-configuration": "0.2.
|
|
32
|
+
"@layerzerolabs/tsup-configuration": "0.2.124",
|
|
33
|
+
"@layerzerolabs/typescript-configuration": "0.2.124",
|
|
34
|
+
"@layerzerolabs/vitest-configuration": "0.2.124"
|
|
33
35
|
},
|
|
34
36
|
"publishConfig": {
|
|
35
37
|
"access": "public",
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
"onesig-client"
|
|
44
46
|
]
|
|
45
47
|
},
|
|
46
|
-
"version": "0.2.
|
|
48
|
+
"version": "0.2.124",
|
|
47
49
|
"scripts": {
|
|
48
50
|
"build": "tsup",
|
|
49
51
|
"generate-github-matrix": "tsx src/scripts/generate-github-matrix.ts",
|
package/dist/2VBLSQAK.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import 'path';
|
|
2
|
-
import 'url';
|
|
3
|
-
|
|
4
|
-
var __create = Object.create;
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
11
|
-
var __esm = (fn, res) => function __init() {
|
|
12
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
13
|
-
};
|
|
14
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
15
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
|
-
};
|
|
17
|
-
var __export = (target, all) => {
|
|
18
|
-
for (var name in all)
|
|
19
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (let key of __getOwnPropNames(from))
|
|
24
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
-
}
|
|
27
|
-
return to;
|
|
28
|
-
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
-
mod
|
|
36
|
-
));
|
|
37
|
-
var init_esm_shims = __esm({
|
|
38
|
-
"../../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.2_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.8.2_yaml@2.8.2/node_modules/tsup/assets/esm_shims.js"() {
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export { __commonJS, __export, __name, __toESM, init_esm_shims };
|
|
43
|
-
//# sourceMappingURL=2VBLSQAK.js.map
|
|
44
|
-
//# sourceMappingURL=2VBLSQAK.js.map
|
package/dist/2VBLSQAK.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.2_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.8.2_yaml@2.8.2/node_modules/tsup/assets/esm_shims.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,cAAA,GAAA,KAAA,CAAA","file":"2VBLSQAK.js","sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n"]}
|
package/dist/6YPWRWU3.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/verifiable-build.ts"],"names":["execFileAsync","promisify","execFile","SOURCE_MOUNT","VERIFIABLE_BUILD_PLATFORM","OFFICIAL_IMAGE_REPO","officialImageTagRef","stellarVersion","rustVersion","parseAmd64Digest","manifestInspectJson","manifests","JSON","parse","Array","isArray","Error","digest","find","platform","os","architecture","startsWith","resolveAmd64Digest","imageTagRef","stdout","maxBuffer","cause","buildVerifiableBuildDockerArgs","imageRef","sourceDir","buildArgs","bldimg","runDocker","dockerArgs","Promise","resolve","reject","child","spawn","stdio","on","error","code","signal","VerifiableBuildWrapper","run","args","options","tagRef","cwd","console","info","join"],"mappings":";;;;;AAAA,cAAA,EAAA;AAKA,I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pB,MAAAA,CAAAA,CAAQ,CAAA;AACnCmB,IAAAA,OAAAA,CAAQC,KAAK,CAAA,UAAA,EAAalB,UAAAA,CAAWmB,IAAAA,CAAK,GAAA,CAAA,CAAA,CAAM,CAAA;AAEhD,IAAA,MAAMpB,UAAUC,UAAAA,CAAAA;AACpB,EAAA;AACJ","file":"6YPWRWU3.js","sourcesContent":["import { execFile, spawn } from 'node:child_process';\nimport { promisify } from 'node:util';\n\nimport type { ToolCommandExecutionOptions } from '@layerzerolabs/vm-tooling';\n\nconst execFileAsync = promisify(execFile);\n\n// The self-contained source is mounted here and built in place. The official image's WORKDIR is\n// already /source; we set it explicitly for clarity.\nconst SOURCE_MOUNT = '/source';\n\n// Canonical reproducible platform. External verifiers reproduce the amd64 artifact, so we always\n// run the amd64 image regardless of the host arch (the daemon emulates it when needed).\nconst VERIFIABLE_BUILD_PLATFORM = 'linux/amd64';\n\nconst OFFICIAL_IMAGE_REPO = 'stellar/stellar-cli';\n\n/**\n * The official reproducible image reference for a (Stellar CLI, Rust) version pair, e.g.\n * `stellar/stellar-cli:25.1.0-rust1.90.0-slim-bookworm`. The caller pins both versions; this is the\n * only image the tool builds against.\n */\nexport const officialImageTagRef = (stellarVersion: string, rustVersion: string): string =>\n `${OFFICIAL_IMAGE_REPO}:${stellarVersion}-rust${rustVersion}-slim-bookworm`;\n\n/**\n * Pick the linux/amd64 manifest digest out of `docker manifest inspect` output. Pure/synchronous so\n * the selection (skip the arm64 and the unknown/unknown attestation entries) is unit-testable.\n */\n// The subset of `docker manifest inspect` output (an OCI image index) that we read.\ninterface ManifestDescriptor {\n digest?: string;\n platform?: { os?: string; architecture?: string };\n}\ninterface ManifestIndex {\n manifests?: ManifestDescriptor[];\n}\n\nexport const parseAmd64Digest = (manifestInspectJson: string): string => {\n const { manifests } = JSON.parse(manifestInspectJson) as ManifestIndex;\n\n if (!Array.isArray(manifests)) {\n throw new Error(\n '`docker manifest inspect` did not return a multi-arch index (no `manifests` array)',\n );\n }\n\n const digest = manifests.find(\n ({ platform }) => platform?.os === 'linux' && platform?.architecture === 'amd64',\n )?.digest;\n\n if (typeof digest !== 'string' || !digest.startsWith('sha256:')) {\n throw new Error('No linux/amd64 manifest digest found in `docker manifest inspect` output');\n }\n\n return digest;\n};\n\n/**\n * Resolve the immutable linux/amd64 digest of a `stellar/stellar-cli` tag via a daemon-less\n * registry query (`docker manifest inspect`). This is the reproducible reference an external\n * verifier pins to (SEP-58).\n */\nconst resolveAmd64Digest = async (imageTagRef: string): Promise<string> => {\n try {\n const { stdout } = await execFileAsync('docker', ['manifest', 'inspect', imageTagRef], {\n maxBuffer: 16 * 1024 * 1024,\n });\n return parseAmd64Digest(stdout);\n } catch (cause) {\n throw new Error(\n `Failed to resolve the linux/amd64 digest of ${imageTagRef} (\\`docker manifest inspect\\`)`,\n { cause },\n );\n }\n};\n\n/**\n * Assemble the `docker run` argv for a verifiable build. Kept pure and synchronous so the mount /\n * workdir layout and the tool-injected `--meta bldimg=…` are unit-testable without Docker.\n *\n * The official image's ENTRYPOINT is `stellar`, so the trailing `contract build …` runs under it.\n * The source directory is assumed self-contained, so it is mounted at /source and built in place —\n * no surrounding workspace is required.\n */\nexport const buildVerifiableBuildDockerArgs = ({\n imageRef,\n sourceDir,\n buildArgs,\n bldimg,\n}: {\n imageRef: string;\n sourceDir: string;\n buildArgs: string[];\n bldimg: string;\n}): string[] => [\n 'run',\n '--rm',\n '--platform',\n VERIFIABLE_BUILD_PLATFORM,\n '-v',\n `${sourceDir}:${SOURCE_MOUNT}`,\n '-w',\n SOURCE_MOUNT,\n imageRef,\n 'contract',\n 'build',\n ...buildArgs,\n // Embedded by us (not the user): the exact build image, so the WASM records what produced it.\n '--meta',\n `bldimg=${bldimg}`,\n];\n\nconst runDocker = (dockerArgs: string[]): Promise<void> =>\n new Promise((resolve, reject) => {\n const child = spawn('docker', dockerArgs, { stdio: 'inherit' });\n child.on('error', (error) =>\n reject(new Error('Failed to spawn docker for the verifiable build', { cause: error })),\n );\n child.on('close', (code, signal) => {\n if (code === 0) {\n resolve();\n } else {\n reject(\n new Error(\n `Verifiable build failed: docker exited with ${\n signal ? `signal ${signal}` : `code ${code}`\n }`,\n ),\n );\n }\n });\n });\n\nexport interface VerifiableBuildVersions {\n stellarVersion: string;\n rustVersion: string;\n}\n\n/**\n * Reproducible `stellar contract build` that runs inside the OFFICIAL `stellar/stellar-cli` image —\n * the exact package an external verifier uses — instead of our own dev image (whose sccache/mold\n * layers could change the WASM).\n *\n * The build runs the official image directly from the HOST: our TypeScript CLI already executes on\n * the host runner, so it can `docker run` the official image itself. This is what an external\n * verifier's plain `docker run` does, and it means we never bind-mount the host Docker socket into\n * a container — eliminating the container-escape / secret-leak surface that mounting the socket\n * would create.\n *\n * The image is `stellar/stellar-cli:<stellarVersion>-rust<rustVersion>-slim-bookworm`, pinned by the\n * caller. For a stable reference we resolve it to its linux/amd64 digest and both RUN that digest\n * and embed it as the `bldimg` WASM metadata (`docker.io/stellar/stellar-cli@sha256:…`) — the tool\n * does this automatically so callers never hand-inject `--meta bldimg=…`. The source directory (the\n * cwd, assumed self-contained) is mounted at /source and built in place, and the official image runs\n * as its own user/toolchain.\n */\nexport class VerifiableBuildWrapper {\n public async run(\n args: string[],\n { stellarVersion, rustVersion }: VerifiableBuildVersions,\n options: ToolCommandExecutionOptions,\n ): Promise<void> {\n const tagRef = officialImageTagRef(stellarVersion, rustVersion);\n const digest = await resolveAmd64Digest(tagRef);\n const imageRef = `${OFFICIAL_IMAGE_REPO}@${digest}`;\n const bldimg = `docker.io/${OFFICIAL_IMAGE_REPO}@${digest}`;\n\n const dockerArgs = buildVerifiableBuildDockerArgs({\n imageRef,\n sourceDir: options.cwd,\n buildArgs: args,\n bldimg,\n });\n\n console.info('🔒 Verifiable build (official stellar/stellar-cli image, run from host)');\n console.info(` image: ${imageRef} (${VERIFIABLE_BUILD_PLATFORM}, from tag ${tagRef})`);\n console.info(` bldimg: ${bldimg}`);\n console.info(` docker ${dockerArgs.join(' ')}`);\n\n await runDocker(dockerArgs);\n }\n}\n"]}
|