@typesol/cli 0.44.1 → 0.45.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.
@@ -27,14 +27,16 @@ program.so + program.build.json (manifest: versions, sha256 of sources and binar
27
27
  | Path | Contents |
28
28
  | --- | --- |
29
29
  | `src/` | The compiler (`src/compiler/`); the CLI, projects, init templates and `typesol/testing` at the top; generators and chain tooling in `src/tools/` (client, CPI and port generators, IDL publishing, on-chain reads, profiling, the LiteSVM RPC). Source map below |
30
- | `runtime/` | `typesol_rt.h`, the C runtime every program includes ([runtime.md](runtime.md)) |
30
+ | `runtime/` | `typesol_rt.h`, the C runtime every program includes ([runtime.md](runtime.md)), and `typesol_builtins.c`, the compiler builtins every program links |
31
31
  | `lib/` | `typesol.d.ts`, the language surface programs typecheck against |
32
32
  | `ts-plugin/` | The editor plugin (`typesol/ts-plugin`) |
33
33
  | `examples/` | Example programs; the `typesol init` templates are copies of three of them |
34
- | `test/` | The compiler's test suite (`pnpm test:core`), by subject: `language/`, `security/`, `examples/`, `integrations/` (token, Metaplex, oracle and other CPIs), `client/`, `cli/`, `verification/` (differential and fuzz tests). Shared: `harness.ts` and the `*-helpers.ts`, `fixtures/` (programs the tests compile), `golden/` (pinned generated C and clients), `programs/` (third-party program binaries, see its SOURCES.md), `anchor-twins/` (below) |
34
+ | `test/` | The compiler's test suite (`pnpm test:core`), by subject: `language/`, `security/`, `examples/`, `integrations/` (token, Metaplex, oracle and other CPIs), `client/`, `cli/`, `verification/` (differential and fuzz tests). Shared: `harness.ts` and the `*-helpers.ts`, `fixtures/` (programs the tests compile), `golden/` (pinned generated C and clients, and what 14 programs build to in the build container: SBPF v0, and v1 and v2 for four of them), `programs/` (third-party program binaries, see its SOURCES.md), `anchor-twins/` (below) |
35
35
  | `showcase/` | Ports, apart from the compiler's own tests (`pnpm test:showcase`, its own CI job): `mainnet/` (Phoenix v1, SPL Stake Pool, Raydium AMM v4, CP-Swap and CLMM, Jito's MEV programs, Marginfi, coral-xyz/multisig, each checked against the binary on mainnet), `program-examples/` (TypeSOL rewrites of solana-developers/program-examples), `test/` (their differential tests, fuzzers, helpers and fixtures; `porting/` for the program-examples) |
36
36
  | `test/anchor-twins/` | Anchor twins of the counter, vault and escrow examples, for the differential tests (`pnpm build:twins`) and the zero-copy client test; the benchmarks themselves are in [typesol-lang/benchmarks](https://github.com/typesol-lang/benchmarks) |
37
- | `scripts/` | `smoke.ts`, `localnet.sh` and `localnet-fixtures.ts` (a local validator run), `fetch-programs.sh` (third-party binaries), `readme-bench.ts` (the README numbers), `codegen-snapshot.ts` (the generated C and IDL of every program, to diff a refactor), `release-manifest.ts` (a release's binary, IDL and toolchain hashes) |
37
+ | `scripts/` | `smoke.ts`, `localnet.sh` and `localnet-fixtures.ts` (a local validator run), `fetch-programs.sh` (third-party binaries), `readme-bench.ts` (the README numbers), `codegen-snapshot.ts` (the generated C and IDL of every program, to diff a refactor), `release-manifest.ts` (a release's binary, IDL and toolchain hashes; the cross-host check against `test/golden/binaries.json`) |
38
+ | `docker/` | The Dockerfile of the `--docker` build container |
39
+ | `releases/` | Each release's npm tarball record (`scripts/release-check.ts`); shipped, so `--docker` can check the tarball it installs |
38
40
  | `docs/` | User and contributor documentation (also published on typesol.com) |
39
41
  | `assets/` | The CLI's logo and the README images (`readme/`, generated) |
40
42
 
@@ -48,11 +50,12 @@ program.so + program.build.json (manifest: versions, sha256 of sources and binar
48
50
  | `src/compiler/model.ts` | The data model shared by every stage (`ProgramModel`, `Instruction`, `ParamKind`, `FieldType`, `ValueType`) and small type utilities. |
49
51
  | `src/compiler/emit/` | Code generation (see below). |
50
52
  | `src/compiler/idl.ts` | Turns the model into an Anchor IDL: accounts with `pda`, `relations`, `address` and `optional`, plus types, events, errors and docs. |
51
- | `src/compiler/toolchain.ts` | Finds the Agave SDK and runs clang and lld with the SDK's flags, plus per-function sections, `--gc-sections` and `--strip-all` so unused code and symbol tables stay out of the binary. |
53
+ | `src/compiler/toolchain.ts` | Finds the Agave SDK and runs clang and lld with the SDK's flags, plus per-function sections, `--gc-sections` and `--strip-all` so unused code and symbol tables stay out of the binary. Links the program with the runtime's builtins and platform-tools' libc, nothing from its Rust libraries, and refuses a binary that would leave the loader a symbol that is not a syscall. |
52
54
  | `src/compiler/diagnostics.ts` | `Reporter` and `CompileError`: diagnostics with file, line and column. |
53
55
  | `src/compiler/anchor-errors.ts` | Anchor's own error codes (`AnchorError.X`), shared by `require` and the generated clients. |
54
56
  | `src/compiler/index.ts` | The compiler's API (`generate`, `build`, `verifyBinary`, the build manifest). |
55
57
  | `runtime/typesol_rt.h` | The C runtime: error codes, word-wise memory helpers, the entry point's input parser (`ts_deserialize`), account checks, checked math, Borsh helpers, CPIs (System, Token, Token-2022, ATA, Metaplex), oracles and the heap allocator. Header-only and `static inline`, so unused code is dropped. |
58
+ | `runtime/typesol_builtins.c` | The compiler builtins clang calls for 128-bit multiplication, division and shifts and signed 64-bit division, compiled with each program and linked in place of platform-tools' compiler-builtins library (whose build differs between its host packages); a program links the ones it calls. Division in C, multiplication and shifts as the instructions compiler-builtins has for each SBPF version. |
56
59
  | `src/workspace.ts` | `typesol.json` projects, program keypairs, `typesol init` templates and deploy arguments. |
57
60
  | `src/tools/cpigen.ts` | `typesol cpi`: reads an Anchor IDL and writes typed TypeSOL CPI helpers. |
58
61
  | `src/tools/clientgen.ts` | The TypeScript client (`<name>.client.ts`, [client.md](client.md)): reads an IDL, validates it (it may come from anywhere), and writes one `@solana/kit` file. Not part of the compiler core: `workspace.ts` and the CLI write it after `build()`, and `typesol client` writes it for any IDL. |
@@ -65,6 +68,8 @@ program.so + program.build.json (manifest: versions, sha256 of sources and binar
65
68
  | `src/testing.ts` | `typesol/testing`: LiteSVM test helpers for projects (accounts by name from the IDL, plain values). |
66
69
  | `src/tools/onchain.ts` | `typesol verify --address`: a deployed program's ELF, authority and deploy slot under loader v2, v3 or v4. |
67
70
  | `src/tools/profile.ts` | Turns `--profile` logs into compute units per source line. |
71
+ | `src/tools/docker.ts` | `build --docker` / `verify --docker`: the TypeSOL version and its release record (the package's, a file, or fetched from the repository), the image from `docker/Dockerfile` (built when missing), the locked-down container run, the container's identity in the manifest. |
72
+ | `docker/Dockerfile` | The pinned build environment (linux/amd64, platform-tools v1.52, a recorded TypeSOL tarball); shipped in the package with `releases/`. |
68
73
  | `src/cli.ts` | Command parsing. Every command has strict options, `--help`, and exit codes 0 (success), 1 (failure), 2 (usage error) and 3 (verify mismatch). |
69
74
 
70
75
  ## The emitter
@@ -182,6 +187,9 @@ These invariants are easy to break. Each one has tests.
182
187
 
183
188
  `test/golden/counter.c` pins the output for the counter example. Run
184
189
  `UPDATE_GOLDEN=1 pnpm test test/language/diagnostics.test.ts`, review the diff, and commit it with the change.
190
+ `test/golden/binaries.json` pins what 14 programs build to in the `--docker` container (SBPF v0, and counter,
191
+ escrow, Phoenix and Marginfi for v1 and v2 too); when they change,
192
+ regenerate it as [testing.md](testing.md#across-hosts) says (CI's cross-host check fails with `STALE` until then).
185
193
 
186
194
  For refactors that should not change behaviour, compare binaries: build every example and fixture before and after
187
195
  the change. The sha256 values in the `*.build.json` manifests must not change.
package/docs/audit.md CHANGED
@@ -29,7 +29,15 @@ the code, [docs/runtime.md](runtime.md) the runtime's conventions.
29
29
  Out of scope: the Solana runtime, platform-tools (clang, lld), the TypeScript compiler, and programs written with
30
30
  TypeSOL. The platform-tools are part of what a binary trusts all the same: the tests cover the toolchain the release
31
31
  declares (`TESTED_TOOLCHAIN` in `src/compiler/toolchain.ts`: Agave 3.1.10, platform-tools v1.52), builds with another
32
- one warn, and the review of 0.43.0 traced one defect to how that backend passes struct arguments.
32
+ one warn, and the review of 0.43.0 traced one defect to how that backend passes struct arguments. The platform-tools
33
+ host package mattered too, up to 0.44.1: its compiler-builtins library, which each of the macOS, Linux arm64 and
34
+ Linux x86_64 packages lays out differently, made a program with 128-bit or signed division link to different bytes on
35
+ each. From 0.45.0 on the builtins are TypeSOL's own C, compiled with the program, and the programs measured build to
36
+ the same bytes on the three hosts (the 76 of the sources for SBPF v0, 14 for v1 and v2;
37
+ [stability.md](stability.md#what-builds-the-same-bytes-where)). The reference environment for binaries is the
38
+ `--docker` build container (`docker/Dockerfile`, linux/amd64; base images by digest, release files by sha256, the
39
+ TypeSOL tarball by its release record and its npm dependencies by a lock whose every integrity `npm ci` checks), which
40
+ `typesol verify --docker` rebuilds in.
33
41
 
34
42
  ## What to check
35
43
 
package/docs/cli.md CHANGED
@@ -8,9 +8,9 @@ error. Exit codes: **0** success, **1** failure (compile errors, failed deploy,
8
8
  | --- | --- |
9
9
  | `typesol init [<dir>] [--name <program>] [--template counter\|vault\|escrow]` | Create a project: `typesol.json`, `programs/<name>.ts`, `tests/<name>.test.ts` (LiteSVM), `package.json`, `tsconfig.json`, `programs/tsconfig.json` (with the editor plugin), `.vscode/settings.json` (the workspace TypeScript, so the plugin loads), `.gitignore`, the rules for AI coding agents (`AGENTS.md`, `CLAUDE.md` importing it, `.cursor/rules/typesol.mdc`) and the MCP server configuration (`.mcp.json`, `.cursor/mcp.json`; see [ai.md](ai.md)). `<name>` must be snake_case; by default it is derived from `<dir>` (`my-app` → `my_app`). The template picks the program and its test: `counter` (default, a PDA counter per user), `vault` (SOL at a PDA: deposit, withdraw above rent, close) or `escrow` (SPL tokens: make, take, refund, the offer PDA signing for its vault). Refuses to overwrite files. It warns, with the install commands, when the platform-tools that building needs are missing. |
10
10
  | `typesol new <program> [--template counter\|vault\|escrow]` | In a project: add a program, `programs/<program>.ts` and `tests/<program>.test.ts` from the template, and its entry in `typesol.json`. Refuses to overwrite files or reuse a name. |
11
- | `typesol doctor [--url <rpc>] [--config <cli config>]` | Check what building, testing and deploying need: Node.js, the platform-tools (and a `toolchain` row: the tested ones, or untested with both versions), the Solana CLI, its keypair, the RPC (`--url`, a cluster moniker, or the CLI config) and the keypair's balance there, and the project. Each problem is printed with the command that fixes it. Exit code 1 when building is impossible (Node.js or the platform-tools missing); deploy pieces are warnings. |
12
- | `typesol build [<program>…] [--sbpf v0\|v1\|v2] [--profile] [--toolchain-strict] [--quiet]` | In a project: build every program (or those named) into `<out>/<name>/`: `<name>.so`, `<name>.json` (Anchor IDL), `<name>.client.ts` (TypeScript client, see [client.md](client.md)), `<name>.c`, `<name>.build.json` (the TypeSOL, TypeScript, clang and platform-tools versions, the host, the SBPF version, each source's sha256 and the binary's). With platform-tools other than the tested ones it warns once; `--toolchain-strict` (or `TYPESOL_TOOLCHAIN=strict`) refuses them. The first build creates `<out>/deploy/<name>-keypair.json` and records the address in `typesol.json`; later builds refuse a different keypair. Without the keypair (a fresh clone, CI) it builds at the recorded address and says so; only `deploy` needs the keypair. |
13
- | `typesol build <file.ts> [--out <dir>] [--program-id <keypair.json>] [--sbpf …] [--profile] [--toolchain-strict] [--quiet]` | Outside a project (or a file that is not one of its programs): build that file. Its keypair is `--program-id`, which must exist, or `<out>/<name>-keypair.json`, created on the first build. A project program's `.ts` builds as that program. |
11
+ | `typesol doctor [--url <rpc>] [--config <cli config>]` | Check what building, testing and deploying need: Node.js, the platform-tools (and a `toolchain` row: the tested ones, or untested with both versions), the Solana CLI, Docker (optional: only `--docker` builds need it; it says when they run emulated), its keypair, the RPC (`--url`, a cluster moniker, or the CLI config) and the keypair's balance there, and the project. Each problem is printed with the command that fixes it. Exit code 1 when building is impossible (Node.js or the platform-tools missing); deploy pieces are warnings. |
12
+ | `typesol build [<program>…] [--sbpf v0\|v1\|v2] [--profile] [--toolchain-strict] [--docker [--typesol-version <v>] [--release-record <file>]] [--quiet]` | In a project: build every program (or those named) into `<out>/<name>/`: `<name>.so`, `<name>.json` (Anchor IDL), `<name>.client.ts` (TypeScript client, see [client.md](client.md)), `<name>.c`, `<name>.build.json` (the TypeSOL, TypeScript, clang and platform-tools versions, the host, the SBPF version, each source's sha256 and the binary's). With platform-tools other than the tested ones it warns once; `--toolchain-strict` (or `TYPESOL_TOOLCHAIN=strict`) refuses them. The first build creates `<out>/deploy/<name>-keypair.json` and records the address in `typesol.json`; later builds refuse a different keypair. Without the keypair (a fresh clone, CI) it builds at the recorded address and says so; only `deploy` needs the keypair. `--docker` builds in the pinned container instead ([below](#build---docker-and-verify---docker)). |
13
+ | `typesol build <file.ts> [--out <dir>] [--program-id <keypair.json>] [--sbpf …] [--profile] [--toolchain-strict] [--docker …] [--quiet]` | Outside a project (or a file that is not one of its programs): build that file. Its keypair is `--program-id`, which must exist, or `<out>/<name>-keypair.json`, created on the first build. A project program's `.ts` builds as that program. |
14
14
  | `typesol check [<program>… \| <file.ts>] [--json] [--stdin \| --files]` | Type-check and validate without building. In a project, no argument checks every program (or those named) and exits 1 if any has errors. `--json` prints `{ ok, diagnostics: [{ file, line, column, message }] }`, always (a missing file or unreadable `--files` input is a diagnostic too, exit 1 or 2); `--stdin` checks the text given on stdin as that file (its imports come from disk); `--files` reads `{ "files": { "<absolute path>": "<text>", … } }` from stdin and checks with those texts instead of the disk (an editor's unsaved buffers). |
15
15
  | `typesol clone [<address>…] [--url <rpc>] [--config <cli config>] [--out <dir>]` | Copy cluster accounts and programs for the tests (Anchor's `[test.validator.clone]`): each account to `<address>.json` (lamports, owner, data), each program to `<address>.so` (its ELF, from the ProgramData account for upgradeable programs), in `tests/accounts` (`"accounts"` in `typesol.json`) or `--out`. Without addresses it clones the project's `"clone"` list. `testProgram` loads that directory into its LiteSVM; commit it so the tests run offline. |
16
16
  | `typesol emit-c <file.ts> [--out <file.c>] [--profile]` | Print or write the generated C. |
@@ -20,7 +20,7 @@ error. Exit codes: **0** success, **1** failure (compile errors, failed deploy,
20
20
  | `typesol cpi <idl.json> [--out <file.ts>] [--prefix <name>] [--address <base58>]` | Generate TypeSOL helpers that call another program from its IDL. Unsupported instructions are listed on stderr. |
21
21
  | `typesol port <idl.json> [--out <file.ts>]` | A TypeSOL program skeleton from an Anchor IDL (0.30+/1.x), to port an Anchor program: account structs, enums, errors, events and one function per instruction with its accounts and arguments, each body `require(false, …NotPorted)` until written. Instruction discriminators (an explicit `@discriminator` when the name derives another), account names and error codes are kept, so existing clients keep working where the layouts match; notes on stderr list where they do not (Borsh `String`/`Option` in account data, a `Vec` that is not the last field). Error codes that skip ahead are kept with `@code`, and zero-copy types keep their IDL `repr`, `serialization` and field names (`@repr`, `@serialization`, `@idlName`). |
22
22
  | `typesol client <idl.json> [--out <file.ts>] [--address <base58>]`, `typesol client --address <program id> [--url <rpc>] [--config <cli config>] [--out <file.ts>]` | Generate a typed TypeScript client on `@solana/kit` from an Anchor IDL (0.30+/1.x or TypeSOL); the IDL is validated first, and what the client leaves out is printed as notes. Without a file, the IDL is read from the chain: the canonical Program Metadata IDL, else Anchor's IDL account. See [client.md](client.md). |
23
- | `typesol verify <program\|file.ts> [<deployed.so>] [--address <program id>] [--url <rpc>] [--config <cli config>] [--sbpf …] [--manifest <name.build.json>]` | Rebuild and compare with what is deployed. Without a `.so`, reads the program from the cluster (`--url`, cluster monikers such as `mainnet-beta` included, else the Solana CLI config) at `--address` or the address `typesol.json` records, under any loader (v2, upgradeable v3, v4); prints the upgrade authority (or that the program is immutable) and the last deploy slot, and compares the IDL published with `typesol idl publish` (a published IDL that differs is a mismatch). With a `.so` (e.g. `solana program dump`), compares with that file. Trailing zero padding is ignored; the SBPF version is read from the deployed ELF unless `--sbpf` is given. On a mismatch it prints the rebuild's toolchain (clang, platform-tools, host, TypeSOL) and the deployed build's when a build manifest's binary hash is the deployed bytes' (`--manifest`, `<deployed>.build.json` next to a given `.so`, or the local build's), and what differs; otherwise it says the deployed side's toolchain is unknown (a program on chain records none). |
23
+ | `typesol verify <program\|file.ts> [<deployed.so>] [--address <program id>] [--url <rpc>] [--config <cli config>] [--sbpf …] [--manifest <name.build.json>] [--docker …]` | Rebuild and compare with what is deployed. Without a `.so`, reads the program from the cluster (`--url`, cluster monikers such as `mainnet-beta` included, else the Solana CLI config) at `--address` or the address `typesol.json` records, under any loader (v2, upgradeable v3, v4); prints the upgrade authority (or that the program is immutable) and the last deploy slot, and compares the IDL published with `typesol idl publish` (a published IDL that differs is a mismatch). With a `.so` (e.g. `solana program dump`), compares with that file. Trailing zero padding is ignored; the SBPF version is read from the deployed ELF unless `--sbpf` is given. On a mismatch it prints the rebuild's toolchain (clang, platform-tools, host, TypeSOL) and the deployed build's when a build manifest's binary hash is the deployed bytes' (`--manifest`, `<deployed>.build.json` next to a given `.so`, or the local build's), and what differs; otherwise it says the deployed side's toolchain is unknown (a program on chain records none). A host difference alone is named as such; it counts only between builds of 0.44.1 or earlier, whose programs with 128-bit or signed division linked platform-tools' compiler-builtins (laid out differently by each host package). `--docker` rebuilds in the pinned container and, on a match, prints what was verified ([below](#build---docker-and-verify---docker)). |
24
24
  | `typesol profile <logs.txt\|-> [--program <id>]` | Compute units per TypeScript line from the logs of a `--profile` build's transaction (exit 1 when the logs have no markers). |
25
25
  | `typesol help <command>` | Same as `typesol <command> --help`. |
26
26
  | `typesol --version` | Print the version. |
@@ -33,6 +33,33 @@ Builds (`build`, `deploy`, `verify`, `typesol/testing`) compare the active clang
33
33
  with (`TESTED_TOOLCHAIN` in `typesol/compiler`: Agave 3.1.10, platform-tools v1.52): another one gets one warning per
34
34
  process on stderr. `TYPESOL_TOOLCHAIN=strict` makes it an error everywhere, `warn` is the default.
35
35
 
36
+ ## build --docker and verify --docker
37
+
38
+ `--docker` builds in a container made on your machine from `docker/Dockerfile` (shipped in the package): linux/amd64
39
+ on every machine (emulated on arm64), Node 24, the platform-tools v1.52 of Agave 3.1.10, and a TypeSOL version from
40
+ npm whose tarball is checked against `releases/<version>.json` (sha512 integrity, sha1 shasum, every file's sha256)
41
+ before it is installed, with its npm dependencies installed by `npm ci` from `docker/deps/<version>.lock.json` (every
42
+ package checked against the lock's integrity; the package's lock, or the version's own tarball's). Every input is
43
+ pinned by digest, checksum or integrity. The image is `typesol-build:<version>-<first 12
44
+ of the Dockerfile's sha256>`, built the first time it is needed (progress on stderr; about 750 MB of downloads) and
45
+ reused after. Builds run with `--network none`, the sources read-only (the project root, or a single file's
46
+ directory: imports from outside it are not there), the output directory writable, no capabilities, a read-only root
47
+ file system, as your uid and gid (root for a root caller, still without capabilities). The written files are the
48
+ ones `build` writes; `<name>.build.json` adds `container` (platform, Dockerfile sha256, base images, downloads, the
49
+ TypeSOL tarball's hashes and the commit its record names, where the release record came from and the record's sha256,
50
+ the dependency lock with its sha256, the local image id). An image is reused only when its labels carry this
51
+ record's integrity, shasum, commit and file list and this lock's sha256; an image of the same tag made from other
52
+ values is an error that names it (remove it to build from this record).
53
+
54
+ | Option | |
55
+ | --- | --- |
56
+ | `--typesol-version <v>` | The TypeSOL in the container. Default: this `typesol`'s version (in a project that installs another `typesol` than the one running, an error naming both); for `verify`, the version of the deployed build's manifest when one is known (`--manifest`, `<deployed>.build.json`, or the local build's whose binary hash is the deployed one's). |
57
+ | `--release-record <file>` | The record to check that version's tarball against. Default: the package's (a package ships the records of the releases before it: a record is written after its release is published), else `releases/<version>.json` fetched from the repository's main branch over HTTPS (said on stderr; where it came from and the sha256 of its bytes go into `container.typesol.record`), so that the npm tarball is checked against a second, independent source (as with a file given here; a record the package ships came from npm too). Offline, or for a version the repository has no record of, an error names this option. Versions before 0.43.0 have no record and are refused. |
58
+
59
+ Without Docker, with its daemon stopped or when the image build fails, `--docker` is an error and nothing is built;
60
+ it never falls back to the local toolchain. `TYPESOL_DOCKER_CPUS` and `TYPESOL_DOCKER_MEMORY` (e.g. `2`, `4g`) limit
61
+ the build container on a shared machine. Why one platform: [stability.md](stability.md#what-builds-the-same-bytes-where).
62
+
36
63
  ## typesol.json
37
64
 
38
65
  ```json
package/docs/mainnet.md CHANGED
@@ -9,11 +9,17 @@ You need Node.js 22.12 or later and the Agave CLI with platform-tools (see the R
9
9
 
10
10
  **The toolchain you deploy with.** The binary is what the platform-tools' clang makes of the generated C, so the
11
11
  toolchain is part of what you trust. Deploy with the one TypeSOL is tested with (Agave 3.1.10, platform-tools v1.52;
12
- `typesol doctor` says whether yours is, and `typesol deploy --toolchain-strict` refuses another). Keep
12
+ `typesol doctor` says whether yours is, and `typesol deploy --toolchain-strict` refuses another). The host does not
13
+ matter from 0.45.0 on: with the same TypeSOL and toolchain a program builds to the same bytes on macOS arm64, Linux
14
+ arm64 and Linux x86_64 (measured over 76 programs for SBPF v0 and 14 for v1 and v2; up to 0.44.1 a program with
15
+ 128-bit or signed division did not, [stability.md](stability.md#what-builds-the-same-bytes-where)). For a program others should be able to verify, build
16
+ it with `--docker` (step 2) all the same: a pinned linux/amd64 container that anyone can rebuild, so the whole
17
+ environment is one recipe. Keep
13
18
  `target/my_app/my_app.build.json` with each deployment, next to the commit you deployed: it records the TypeSOL,
14
- TypeScript, clang and platform-tools versions and the host, and the deployed bytes' sha256. Step 6's `verify` matches
15
- only when it rebuilds with the same TypeSOL version and toolchain, and on a mismatch `--manifest` with that file shows
16
- what differs.
19
+ TypeScript, clang and platform-tools versions, the host, the container when there was one, and the deployed bytes'
20
+ sha256. Step 6's `verify` matches only when it rebuilds with the same TypeSOL version and toolchain (and, for a program
21
+ with 128-bit or signed division built with 0.44.1 or earlier, the same kind of host), and on a mismatch `--manifest`
22
+ with that file shows what differs.
17
23
 
18
24
  ## 1. Create and test
19
25
 
@@ -40,6 +46,54 @@ program's address, and records the address in `typesol.json`.
40
46
  **Back up `target/deploy/my_app-keypair.json` now.** It is not committed (`.gitignore`), and without it you cannot
41
47
  redeploy to that address.
42
48
 
49
+ ### A build others can verify
50
+
51
+ ```sh
52
+ npx --no-install typesol build --docker
53
+ ```
54
+
55
+ The same files, built inside a container instead of with your platform-tools. The container is made on your machine
56
+ from `docker/Dockerfile`, which ships in the package; every input is pinned: the Node and busybox base images by their
57
+ linux/amd64 digests, the Agave 3.1.10 and platform-tools v1.52 release files by sha256, the TypeSOL package (the
58
+ version your project uses) by its release record, `releases/<version>.json`: the npm tarball's sha512 integrity and
59
+ sha1 shasum and every file's sha256, checked before it is installed, and its npm dependencies (TypeScript, the
60
+ compiler's front end, among them) by that version's lock, `docker/deps/<version>.lock.json`, which `npm ci` installs
61
+ checking every package's integrity, with no install scripts. The lock of a version ships in the package of that
62
+ version (and in later ones); the locks of 0.43.0, 0.44.0 and 0.44.1, released before locks existed, were resolved
63
+ from the npm registry on 2026-11-12, so their integrity values are what the registry served then, not what an image
64
+ built at their release installed. The first `--docker` build of a TypeSOL version
65
+ builds the image (about 750 MB of downloads, a few minutes; Docker must be running, `typesol doctor` shows it); later
66
+ ones take seconds. The build runs with no network, the project mounted read-only, the output directory writable,
67
+ with no capabilities, as your uid and gid (root for a root caller). `my_app.build.json` then records the container:
68
+ the platform, the Dockerfile's sha256, the pinned base images and downloads, the TypeSOL tarball's hashes, the commit
69
+ its release record names, where the record came from (with the record's sha256), the dependency lock and its sha256,
70
+ and the local image id.
71
+
72
+ Deploy that `my_app.so` with the Solana CLI, `solana program deploy target/my_app/my_app.so --program-id
73
+ target/deploy/my_app-keypair.json --use-rpc` (with your `--url`). What replaces the container build: `typesol deploy`
74
+ (`--dry-run` included) and `typesol build` without `--docker`, which build again with your local platform-tools and
75
+ overwrite it; and `npm test` once the program's sources, SBPF version or address changed, which rebuilds it locally
76
+ and says so (`note: … held a --docker build that is out of date`). What does not: `npm test` while the sources are
77
+ the ones `my_app.build.json` records and the `.so` is the one it records, on any host: the tests then run the
78
+ container's binary. After a local build, `typesol build --docker` again before deploying. Commit the source, keep
79
+ `my_app.build.json`, and publish the commit and that file with the program id.
80
+
81
+ The TypeSOL inside the container is the version this `typesol` is, the one your project installs (`npx --no-install
82
+ typesol`); a global `typesol` of another version than the project's `node_modules/typesol` refuses rather than
83
+ guess. `--typesol-version <v>` picks another. Only versions with a release record can be installed (0.43.0 and later).
84
+ A package carries the records of the releases before it, because a release's record is written after it is
85
+ published; for a release the package does not record (the newest one, or a later one asked for), `--docker` fetches
86
+ `releases/<version>.json` from the repository's main branch
87
+ (`https://raw.githubusercontent.com/typesol-lang/typesol/main/releases/<version>.json`, unauthenticated HTTPS), prints
88
+ where it came from and its sha256, and records both in `my_app.build.json` (`container.typesol.record`). The check is
89
+ then two independent sources agreeing: the tarball npm serves must be the one the repository's record describes, so a
90
+ tampered package would have to be matched by a tampered repository. That holds for a fetched record and for a
91
+ `--release-record` file; for a version whose record ships in the running package, the record came from npm too (in
92
+ an earlier package), so the check is then against what npm served before. Offline, or when the repository has no
93
+ record for that version, it is an error that names `--release-record <file>`, which passes the record yourself (from
94
+ a checkout, `releases/<version>.json`). Between `npm publish` and the commit of the release's record the repository
95
+ answers HTTP 404: `--release-record` is the way then.
96
+
43
97
  ## 3. A wallet with SOL
44
98
 
45
99
  ```sh
@@ -93,8 +147,34 @@ npx --no-install typesol verify my_app
93
147
 
94
148
  `verify` rebuilds the program from `programs/my_app.ts`, reads the deployed one at the address in `typesol.json` from
95
149
  the cluster in your Solana CLI config, and compares the bytes. `match` means anyone with your source and the same
96
- TypeSOL version and toolchain gets exactly the program on chain. It also prints the upgrade authority and checks the IDL you
97
- published in step 5. Anyone can run it against your program with `--address <program id> --url mainnet-beta`.
150
+ TypeSOL version and toolchain gets exactly the program on chain (from 0.45.0 on, on any of the hosts measured: macOS arm64, Linux arm64, Linux x86_64; with 0.44.1 or earlier, a
151
+ program with 128-bit or signed division also needs the same kind of host). It also prints the upgrade authority and checks the IDL you published in step 5.
152
+
153
+ ### Verifying someone else's program
154
+
155
+ With the source at the deployed commit, the program id and, ideally, the deployer's `<name>.build.json`:
156
+
157
+ ```sh
158
+ git clone <repository> && cd <repository> && git checkout <commit>
159
+ npx --no-install typesol verify my_app --address <program id> --url mainnet-beta --docker --manifest my_app.build.json
160
+ ```
161
+
162
+ `--docker` rebuilds in the same container recipe, built on your machine from the Dockerfile and checked inputs. The
163
+ TypeSOL version is the deployed build's (from the manifest whose binary hash is the deployed bytes'), or
164
+ `--typesol-version <v>`; months later, the current `@typesol/cli` installs the old version in the container, checked
165
+ against its release record. On a match it prints what was verified: the program, the source directory and its git
166
+ commit (and whether it has uncommitted changes), the TypeSOL version and tarball, the commit its record names and
167
+ where the record came from, the dependency lock and its sha256, the clang and platform-tools, the container's
168
+ Dockerfile sha256, base images and downloads, and the command that repeats it (with every option given that changes
169
+ the result: `--address`, `--url`, `--config`, `--sbpf`, `--manifest`, `--release-record`). A program built with
170
+ 0.44.x on macOS or Linux arm64 that calls 128-bit or signed division does not match a `--docker` rebuild (those
171
+ versions' binaries depended on the host package; [troubleshooting](troubleshooting.md)). On a mismatch it shows the
172
+ toolchain of each side that is known, as without `--docker`. Exit codes: 0 match, 3 mismatch.
173
+
174
+ What this is not: the container is built locally from pinned inputs, not pulled from a published image, so the first
175
+ verification downloads the inputs and builds it. Its local image id can differ between machines; the Dockerfile's
176
+ sha256 and the pinned inputs are what to compare. The result is not registered with an external verified-build
177
+ registry: the evidence is the command and its output, which anyone can rerun.
98
178
 
99
179
  ## 7. Call it
100
180
 
@@ -10,7 +10,7 @@ auditors, [SECURITY.md](../SECURITY.md) how to report a problem.
10
10
  | --- | --- |
11
11
  | The program's author | the program's logic: what it allows, to whom, for how much |
12
12
  | TypeSOL (this repository) | that the binary does what the source and these guarantees say, and nothing an attacker can steer beyond it |
13
- | The toolchain | the TypeScript compiler API (parsing, types), Agave platform-tools (clang, lld), Node.js. The guarantees are tested with one platform-tools release (v1.52, from Agave 3.1.10); a build with another warns, or fails with `--toolchain-strict`, and `<name>.build.json` records which one built a binary |
13
+ | The toolchain | the TypeScript compiler API (parsing, types), Agave platform-tools (clang, lld), Node.js. The guarantees are tested with one platform-tools release (v1.52, from Agave 3.1.10); a build with another warns, or fails with `--toolchain-strict`, and `<name>.build.json` records which one built a binary and on which host. The compiler builtins (128-bit multiplication, division and shifts, signed 64-bit division) are TypeSOL's own (`runtime/typesol_builtins.c`), compiled with the program; nothing is linked from platform-tools' Rust libraries, whose layout differed by host package, so from 0.45.0 on the programs measured build to the same bytes on macOS arm64, Linux arm64 and Linux x86_64 ([stability.md](stability.md#what-builds-the-same-bytes-where): 76 programs for SBPF v0, 14 for v1 and v2). `--docker` builds pin the whole environment in one linux/amd64 container whose inputs are checked by digest, checksum and integrity (base images, release files, the TypeSOL tarball and every npm dependency) |
14
14
  | The Solana runtime | account ownership and signer flags as passed, the loader's account serialization, CPI privilege rules, sysvars |
15
15
 
16
16
  Everything a transaction carries is attacker-controlled: the instruction data, which accounts are passed in which
package/docs/stability.md CHANGED
@@ -11,9 +11,12 @@ From 1.0 on, within a major version:
11
11
 
12
12
  - **Sources keep compiling.** A program that compiles with 1.x compiles with every later 1.y, to a program with the same
13
13
  account layouts, IDL, instruction and account discriminators and error codes. New releases add; they do not take away.
14
- - **Binaries are reproducible and only change for a reason.** With the same TypeSOL release and the toolchain it is
15
- tested with, a source builds to the same bytes. A release that changes the binary of a program that uses none of
16
- its new features says so, with the release manifest's diff (`binary-diff.txt`) as the evidence.
14
+ - **Binaries are reproducible and only change for a reason.** With the same TypeSOL release and the tested
15
+ toolchain, a source builds to the same bytes in the build container (`--docker`) as on the hosts measured: from
16
+ 0.45.0 on, macOS arm64, Linux arm64 and Linux x86_64, for the programs and SBPF versions listed
17
+ [below](#what-builds-the-same-bytes-where).
18
+ A release that changes the binary of a program that uses none of its new features says so, with the release
19
+ manifest's diff (`typesol-<version>-binary-diff.txt`) as the evidence.
17
20
  - **The checks stay.** No check a program gets from its parameter types (owner, discriminator, signer, writability,
18
21
  aliasing, checked arithmetic, constraints) is removed or weakened.
19
22
  - **The tools keep their interfaces**: `typesol build`, `test` (via `typesol/testing`), `check --json`, `deploy`,
@@ -46,10 +49,66 @@ Meant to stay as they are; a change before 1.0 would be a breaking change listed
46
49
  - **A build says what made it.** `<name>.build.json` records the TypeSOL, TypeScript, clang and platform-tools versions,
47
50
  the host, the SBPF version and the sha256 of every source and of the binary. `typesol verify` uses it to say, on a
48
51
  mismatch, whether the toolchains differ. A program on chain records none of this: keep the file with the deployment.
52
+ - **A deployed program anyone can rebuild.** `typesol build --docker` builds in a container made from
53
+ `docker/Dockerfile` (in the package), whose inputs are all pinned: base images by digest, the Agave and
54
+ platform-tools release files by sha256, the TypeSOL tarball by its `releases/<version>.json`. `typesol verify
55
+ --docker` rebuilds there and says what it verified. The image is built locally from those inputs; no image is
56
+ published, and the result is not registered with any external verified-build registry
57
+ ([docs/mainnet.md](mainnet.md#6-verify)).
49
58
  - **Fixes come as patches of the latest minor.** From 0.44.0 on, a release that only fixes soundness or security
50
59
  defects is a patch (0.44.1, …) with no new language surface, and its notes carry the binary diff against the
51
60
  previous release ([SECURITY.md](../SECURITY.md#fix-releases)). Older minors are not maintained.
52
61
 
62
+ ## What builds the same bytes where
63
+
64
+ From 0.45.0 on, the programs measured build to the same bytes on each host measured. Measured with this release's
65
+ compiler and platform-tools v1.52 on macOS arm64 (the platform-tools `osx-aarch64` package, native), Linux arm64 and
66
+ Linux x86_64 (the `linux-aarch64` and `linux-x86_64` packages, in containers; x86_64 is the `--docker` image): for
67
+ SBPF v0 (the default), the 76 programs of the sources (`scripts/release-manifest.ts`, every program under `examples/`
68
+ and `showcase/`); for SBPF v1 and v2, the 14 programs of `test/golden/binaries.json` (counter, vault, escrow, multisig
69
+ and the 10 below).
70
+
71
+ | What | Same on the three hosts? |
72
+ | --- | --- |
73
+ | The generated C and the IDL (all 76) | yes |
74
+ | The binary, SBPF v0 (all 76) | yes |
75
+ | The binary, SBPF v1 and v2 (the 14) | yes |
76
+ | The binary, SBPF v0, against 0.44.1 | 66 programs build to 0.44.1's bytes on each of the three; the 10 below build to new bytes, the same on the three |
77
+ | The binary, SBPF v1 and v2, against 0.44.1 (on macOS arm64) | v1: all 14 build to new bytes; v2: 9 (the 10 below but token-fundraiser) build to new bytes, the other 5 (counter, vault, escrow, multisig, token-fundraiser) to 0.44.1's |
78
+
79
+ The 10 are the programs that call 128-bit or signed 64-bit division (the Phoenix, Marginfi, Raydium AMM, CLMM and
80
+ CP-Swap, Jito priority-fee and Stake Pool ports, transfer-fee, token-fundraiser, token-swap). With 0.44.1 each of them
81
+ built to three different binaries on the three hosts (token-fundraiser: the two Linux ones agreed). The cause was one
82
+ library: platform-tools' SBF `compiler-builtins` Rust library (`libcompiler_builtins-<hash>.rlib`, a different file in
83
+ each host package). Its functions have the same instructions in the three packages (compared function by function for
84
+ SBPF v0, v1 and v2), but each package splits them into differently numbered archive members, so the linker placed the
85
+ ones a division pulls in (`__udivti3`, its shared `u128_div_rem`, `__ashlti3`, `__lshrti3`, …) in another order, and
86
+ the program's calls into them had other offsets. Programs that called at most `__multi3` linked one member and agreed.
87
+
88
+ TypeSOL now links none of that library: `runtime/typesol_builtins.c` defines every builtin the tested clang calls for
89
+ C integer code on SBF (`__multi3`, `__udivti3`, `__umodti3`, `__divti3`, `__modti3`, `__ashlti3`, `__lshrti3`, `__ashrti3`, `__divdi3`,
90
+ `__moddi3`) and is compiled with each program, by the same clang, and linked after it. Multiplication and shifts are
91
+ the instructions compiler-builtins has for them, so on SBPF v0 programs that use only those keep their bytes;
92
+ division is new C that costs no more compute units than compiler-builtins' on any input measured, and fewer on most
93
+ (`test/language/builtins.test.ts`). On SBPF v1, `__multi3` (128-bit multiplication, which checked 64-bit
94
+ multiplication uses too) is C as well, cheaper than compiler-builtins' there (175 against 177.5 compute units a call on average in that test),
95
+ so a v1 program that
96
+ multiplies that way builds to other bytes than with 0.44.1 (every one of the 14 measured does); SBPF v2 multiplies
97
+ with its own instructions and calls no `__multi3`, and its signed 64-bit division is an instruction too, which is
98
+ why token-fundraiser keeps its v2 bytes.
99
+ libc's `memcpy` and `memset` still come from platform-tools; the programs that link them build the same on the three
100
+ hosts. Nothing in the emitted C, the paths or the build directory reaches the binary.
101
+
102
+ The reference environment stays one platform, so that the whole environment is one recipe: the build container is
103
+ `linux/amd64` on every machine (emulated on arm64 hosts). CI checks on every change that a Linux x86_64 runner with
104
+ independently installed platform-tools builds the programs of `test/golden/binaries.json` (the 14 for SBPF v0, and
105
+ counter, escrow, Phoenix and Marginfi for v1 and v2) to the container's bytes; that is the same host package as the
106
+ container's, installed separately. The macOS workflow (on demand) runs the same check on macOS arm64, and anyone can
107
+ run it on another host, binary included. `<name>.build.json` records the host; `typesol verify` counts a host
108
+ difference between builds made before 0.45.0 (which linked compiler-builtins: a possible cause if the program uses
109
+ 128-bit or signed division), and between later builds only when one of the hosts is not among the three measured
110
+ (`host (not measured)`).
111
+
53
112
  ## Experimental
54
113
 
55
114
  Useful today, but may still change before 1.0 (each change listed in the CHANGELOG):
package/docs/testing.md CHANGED
@@ -47,12 +47,13 @@ From 0.39.0 on, each release's GitHub Release carries its manifest, `typesol-<ve
47
47
  hand after the npm publish (written by `scripts/release-manifest.ts` from the tag's sources; the scripts need Node 22.18
48
48
  or later):
49
49
 
50
- - the compiler and toolchain versions (clang, platform-tools, Node, TypeScript, the runtime header's sha256);
50
+ - the compiler and toolchain versions (clang, platform-tools, Node, TypeScript, the sha256 of the runtime header and,
51
+ from 0.45.0 on, of the runtime's compiler builtins);
51
52
  - the sha256 of the SBF binary, IDL and C that every program under `examples/` and `showcase/program-examples/` builds to;
52
53
  - the sha256 of the reference binaries the differential tests run against (`test/programs/`);
53
54
  - a hash of the test corpus.
54
55
 
55
- It also carries `binary-diff.txt`: the previous release's sources built by the previous package and by this one,
56
+ It also carries `typesol-<version>-binary-diff.txt` (older releases: `binary-diff.txt`): the previous release's sources built by the previous package and by this one,
56
57
  compared program by program. That is the check behind a changelog line such as "programs that use none of these compile to the
57
58
  same binaries". To redo it, or to compare other versions:
58
59
 
@@ -68,6 +69,41 @@ node scripts/release-manifest.ts --diff a.json b.json
68
69
  For 0.37.0 → 0.38.0 (run by hand before release manifests existed): all 67 programs of the 0.37.0 sources build to
69
70
  the same binary and IDL with both packages.
70
71
 
72
+ ### Across hosts
73
+
74
+ From 0.45.0 on the C, IDL and linked binary TypeSOL's builds produce are the same on the hosts measured
75
+ ([stability.md](stability.md#what-builds-the-same-bytes-where) has the measurement over 76 programs on macOS arm64,
76
+ Linux arm64 and Linux x86_64, and why 0.44.1 and earlier differed for programs with 128-bit or signed division). The
77
+ reference environment is the `--docker` build container (linux/amd64). `test/golden/binaries.json` holds what 14
78
+ programs build to there with the checkout's compiler: counter, vault, escrow, multisig, and the 10 that call 128-bit or
79
+ signed division (the Phoenix, Marginfi, Raydium AMM, CLMM and CP-Swap, Jito priority-fee and Stake Pool ports,
80
+ transfer-fee, token-fundraiser, token-swap), the ones whose binary used to depend on the host, for SBPF v0; and
81
+ counter, escrow, Phoenix and Marginfi for v1 and v2 (`<path>:v1`, `<path>:v2`). CI checks on every change that its
82
+ Linux x86_64 runner, with platform-tools installed by `cargo-build-sbf`, gives the same C, IDL and bytes (the same
83
+ host package as the container's, installed separately); the macOS workflow, run on demand, checks macOS arm64. On
84
+ another host the check is the same (binary included):
85
+
86
+ ```sh
87
+ node scripts/release-manifest.ts --check test/golden/binaries.json # what CI runs; the same result on macOS
88
+ node scripts/release-manifest.ts --docker --out test/golden/binaries.json --programs \
89
+ examples/counter.ts,examples/vault.ts,examples/escrow.ts,showcase/mainnet/multisig/multisig.ts,showcase/mainnet/phoenix/phoenix.ts,showcase/mainnet/marginfi/marginfi.ts,showcase/mainnet/raydium-amm/raydium_amm.ts,showcase/mainnet/raydium-clmm/raydium_clmm.ts,showcase/mainnet/raydium-cp-swap/raydium_cp_swap.ts,showcase/mainnet/jito-mev/priority_fee_distribution.ts,showcase/mainnet/spl-stake-pool/stake_pool.ts,showcase/program-examples/tokens/token-2022/transfer-fee.ts,showcase/program-examples/tokens/token-fundraiser.ts,showcase/program-examples/tokens/token-swap/lib.ts,examples/counter.ts:v1,examples/escrow.ts:v1,showcase/mainnet/phoenix/phoenix.ts:v1,showcase/mainnet/marginfi/marginfi.ts:v1,examples/counter.ts:v2,examples/escrow.ts:v2,showcase/mainnet/phoenix/phoenix.ts:v2,showcase/mainnet/marginfi/marginfi.ts:v2
90
+ ```
91
+
92
+ The second regenerates the file in the container (Docker, the checkout built with `pnpm build`, committed: `--docker`
93
+ refuses a tree with uncommitted changes, as the file records the commit; no network once the image exists), after a
94
+ change that alters what those programs compile to. `--check` says `STALE` when the C or IDL differ (regenerate) and
95
+ `DIFFERS` when the same C and IDL give other bytes (a toolchain problem); it fails on a reference that lists no
96
+ program, has an entry that did not build, or was made from uncommitted changes (`sources.dirty`).
97
+ `test/cli/release-manifest.test.ts` covers each outcome. The whole set, on more
98
+ hosts: build `scripts/release-manifest.ts` (every program) on each and compare with `--diff`, as for a release. The
99
+ compiler builtins themselves are tested by `test/language/builtins.test.ts`: each against a BigInt reference and
100
+ against platform-tools' compiler-builtins on edge cases and a seeded random set (`FUZZ_SEED`, `BUILTINS_RANDOM`), run as
101
+ SBF in LiteSVM for SBPF v0, v1 and v2, with each call's compute units compared to compiler-builtins' (never more).
102
+ With the default seed that is 84,741 to 91,289 calls per multiplication or division function and 59,506 per shift on
103
+ v0, and 41,506 to 73,289 on v1 and v2. The container itself is tested by `test/cli/docker.test.ts` with
104
+ `TYPESOL_DOCKER_TESTS=1` (off in CI: the first image build downloads about 750 MB); without Docker the same file
105
+ checks the Dockerfile's tarball and dependency-lock scripts on crafted inputs.
106
+
71
107
  ### The npm tarball
72
108
 
73
109
  From 0.43.0 on, `releases/<version>.json` in the repository describes the package on npm: the tag and its commit, the
@@ -90,3 +126,14 @@ or another Node (its zlib compresses the archive). The record also keeps the unc
90
126
  file's, which compare across those, and `--verify --tarball` says which files differ, if any. 0.42.0 and earlier
91
127
  were published from a maintainer's checkout without a record.
92
128
 
129
+ ### The build container's dependencies
130
+
131
+ The `--docker` image installs a TypeSOL version's npm dependencies with `npm ci` from `docker/deps/<version>.lock.json`
132
+ (an npm lockfile v3 of the package's runtime dependencies only), so every package is checked against the integrity
133
+ the lock records and nothing is resolved when the image is built. `node scripts/release-check.ts <version> --lock`
134
+ writes it from `package.json` (when it has that version) or from the published package's dependencies (`npm view`),
135
+ resolved from the registry at that moment; the release procedure runs it before the release commit, so the lock of
136
+ version N ships in package N, and the check of the tag refuses a release without it (or with one for other
137
+ dependencies) and installs it with `npm ci` in a temporary directory. The locks of 0.43.0, 0.44.0 and 0.44.1 were
138
+ made this way on 2026-11-12, after those releases: their integrity values are what the registry served that day.
139
+
@@ -18,6 +18,52 @@ version are used. Then the toolchain: verify prints the rebuild's clang and plat
18
18
  when a `<name>.build.json` describes the deployed bytes (`--manifest <file>`, one next to a given `.so`, or the local
19
19
  build's). A program on chain carries no such record, so keep the build manifest of every deployment.
20
20
 
21
+ **`--docker needs Docker: docker is not installed` / `the Docker daemon is not running`** — `build --docker` and
22
+ `verify --docker` run in a container: install Docker, or start Docker Desktop (or `sudo systemctl start docker`).
23
+ `typesol doctor` has a `docker` row. Nothing is built without it; drop `--docker` to build with your own platform-tools.
24
+
25
+ **`docker build of typesol-build:… failed`** — the first `--docker` build makes the image, which needs the network:
26
+ the base images from Docker Hub, the Agave and platform-tools release files from GitHub, the TypeSOL tarball from npm.
27
+ A `checksum` error means a downloaded file is not the one the Dockerfile pins (retry; if it persists, report it).
28
+ `typesol tarball check: integrity …` means the tarball npm served is not the one `releases/<version>.json` records:
29
+ do not use that version until it is explained. `typesol dependency lock: …` means the lock does not describe the
30
+ package's dependencies or names a package without a registry integrity; an `EINTEGRITY` error from `npm ci` means a
31
+ downloaded dependency is not the one the lock records: the same.
32
+
33
+ **`the local image typesol-build:… was not built from this release record and dependency lock`** — an image of that
34
+ tag exists, made from a record or lock with other values (it names them). Two records of one version disagree, so
35
+ find out which is right before going on; to build from the one given now, `docker image rm` the tag and run again.
36
+
37
+ **`no dependency lock for TypeSOL <version>`** — neither this package nor that version's tarball has
38
+ `docker/deps/<version>.lock.json`: use a later `@typesol/cli`, which ships the locks of the versions before it. On arm64 machines the image is linux/amd64 and runs emulated: Docker
39
+ Desktop provides the x86_64 emulation (QEMU or Rosetta); other Docker installs may need `binfmt` for amd64.
40
+
41
+ **`no release record for TypeSOL <version>`** / **`could not fetch the release record`** — the container installs only
42
+ versions whose tarball has a record: the package's own, or `releases/<version>.json` on the repository's main branch,
43
+ which `--docker` fetches for a release newer than the package. Offline (or behind a proxy that blocks
44
+ raw.githubusercontent.com), pass the record yourself with `--release-record releases/<version>.json` from a checkout,
45
+ or choose a version the package records with `--typesol-version`. HTTP 404 means the repository has no record for that
46
+ version: check that it is a released version. 0.42.0 and earlier have no record.
47
+
48
+ **`this project installs typesol X …, but this is typesol Y`** — a `typesol` other than the project's ran `--docker`.
49
+ Run the project's own (`npx --no-install typesol …`), or say which version to use with `--typesol-version`.
50
+
51
+ **`the container build failed … the container sees only <dir>`** — the compiler's error is printed above it. The
52
+ container mounts only the project root (or a single file's directory): an import from outside it is missing there.
53
+
54
+ **`verify` says `differs host`** — the same TypeSOL (0.44.1 or earlier) and toolchain built the two sides on
55
+ different hosts. That may be the cause if the program has 128-bit or signed division: those versions linked
56
+ platform-tools' compiler-builtins, which each host package lays out differently. Rebuild on the deployed side's kind
57
+ of host (or with `--docker`, if the deployed build was one). From 0.45.0 on the host is not a difference between
58
+ macOS arm64, Linux arm64 and Linux x86_64 (the hosts measured); `differs host (not measured)` means one side was
59
+ built on another host.
60
+
61
+ **A 0.44.x program with division, deployed from macOS or Linux arm64, does not match `verify --docker`** — 0.44.0 and
62
+ 0.44.1 linked platform-tools' compiler-builtins, so a program that calls 128-bit or signed division built to other
63
+ bytes on each host package; the container is linux/amd64 and gives the Linux x86_64 bytes. What verifies it is a
64
+ 0.44.x install (the version in its `.build.json`) on the same kind of host as the one that built it, without
65
+ `--docker`: `npx @typesol/cli@0.44.1 verify …` on macOS arm64 for a build made there.
66
+
21
67
  **Windows** — not tested; use WSL2 with the Linux Agave CLI.
22
68
 
23
69
  **Node errors such as `ERR_UNKNOWN_FILE_EXTENSION` or `ERR_REQUIRE_ESM`** — use Node.js 22.12 or newer.