@typesol/cli 0.44.1 → 0.46.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +343 -0
  2. package/NOTICE +14 -1
  3. package/README.md +115 -26
  4. package/SECURITY.md +10 -8
  5. package/dist/bin.d.ts +2 -0
  6. package/dist/bin.js +9 -0
  7. package/dist/cli.js +226 -62
  8. package/dist/compiler/analyze.js +57 -6
  9. package/dist/compiler/diagnostics.d.ts +4 -3
  10. package/dist/compiler/diagnostics.js +10 -6
  11. package/dist/compiler/emit/base.d.ts +1 -1
  12. package/dist/compiler/emit/calls.js +18 -5
  13. package/dist/compiler/emit/cpi-core.d.ts +3 -1
  14. package/dist/compiler/emit/cpi-core.js +8 -4
  15. package/dist/compiler/emit/expressions.d.ts +14 -0
  16. package/dist/compiler/emit/expressions.js +52 -4
  17. package/dist/compiler/emit/shared.d.ts +8 -1
  18. package/dist/compiler/emit/shared.js +8 -1
  19. package/dist/compiler/emit/statements.d.ts +8 -3
  20. package/dist/compiler/emit/statements.js +68 -3
  21. package/dist/compiler/emit/storage.js +5 -1
  22. package/dist/compiler/hints.d.ts +7 -0
  23. package/dist/compiler/hints.js +58 -9
  24. package/dist/compiler/index.d.ts +56 -1
  25. package/dist/compiler/index.js +27 -3
  26. package/dist/compiler/model.js +3 -2
  27. package/dist/compiler/toolchain.d.ts +73 -2
  28. package/dist/compiler/toolchain.js +222 -17
  29. package/dist/node-version.d.ts +4 -0
  30. package/dist/node-version.js +12 -0
  31. package/dist/tools/docker.d.ts +183 -0
  32. package/dist/tools/docker.js +442 -0
  33. package/dist/tools/doctor.d.ts +44 -0
  34. package/dist/tools/doctor.js +108 -14
  35. package/dist/workspace.d.ts +11 -3
  36. package/dist/workspace.js +46 -9
  37. package/docker/Dockerfile +163 -0
  38. package/docker/deps/0.43.0.lock.json +1206 -0
  39. package/docker/deps/0.44.0.lock.json +1206 -0
  40. package/docker/deps/0.44.1.lock.json +1206 -0
  41. package/docker/deps/0.45.0.lock.json +1206 -0
  42. package/docker/deps/0.46.0.lock.json +1206 -0
  43. package/docs/ai.md +2 -1
  44. package/docs/architecture.md +18 -6
  45. package/docs/audit.md +15 -7
  46. package/docs/case-study-phoenix.md +1 -1
  47. package/docs/case-study-raydium-amm.md +1 -1
  48. package/docs/case-study-spl-stake-pool.md +1 -1
  49. package/docs/cli.md +71 -6
  50. package/docs/errors.md +22 -8
  51. package/docs/glossary.md +210 -0
  52. package/docs/language-accounts.md +499 -0
  53. package/docs/language-basics.md +389 -0
  54. package/docs/language-builtins.md +411 -0
  55. package/docs/language-chain.md +198 -0
  56. package/docs/language-cpi.md +470 -0
  57. package/docs/language-errors-events.md +184 -0
  58. package/docs/language-native.md +493 -0
  59. package/docs/language-pdas.md +198 -0
  60. package/docs/language-statements.md +620 -0
  61. package/docs/language-types.md +601 -0
  62. package/docs/language.md +190 -467
  63. package/docs/mainnet.md +103 -8
  64. package/docs/migrate-from-anchor.md +7 -6
  65. package/docs/security-model.md +4 -4
  66. package/docs/stability.md +64 -3
  67. package/docs/test-your-program.md +52 -15
  68. package/docs/testing.md +49 -2
  69. package/docs/troubleshooting.md +210 -42
  70. package/lib/typesol.d.ts +67 -22
  71. package/llms-full.txt +5084 -591
  72. package/llms.txt +12 -1
  73. package/package.json +4 -2
  74. package/releases/0.43.0.json +669 -0
  75. package/releases/0.44.0.json +672 -0
  76. package/releases/0.44.1.json +672 -0
  77. package/releases/0.45.0.json +732 -0
  78. package/runtime/LICENSE-compiler-builtins.txt +275 -0
  79. package/runtime/typesol_builtins.c +484 -0
  80. package/ts-plugin/index.js +16 -5
package/CHANGELOG.md CHANGED
@@ -6,6 +6,349 @@ codes, and says so here.
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 0.46.0 — 2026-11-13
10
+
11
+ A minor release: it adds a flag (`init --no-agent-files`) and an export of `typesol/compiler` (`typescriptMessage`),
12
+ accepts what 0.45.0 refused (16 signer seeds, the bump included), and refuses programs 0.45.0 compiled to wrong code
13
+ (an `f64` used with an operator, as an integer or as text; a proof or signature check whose result decides nothing; a
14
+ `@code` tag that is not read; a `Seeds<…>` list over Solana's limit). The package's `bin` entry is now `dist/bin.js`,
15
+ which checks the Node.js version first, and `deploy` stops before building when the payer keypair file is missing (a
16
+ signer URI passes through to the Solana CLI). Programs that use none of these build to the same bytes: the repository's 76 programs build to the same binaries and
17
+ IDLs with 0.45.0 and with this release, and the release manifest's check of test/golden/binaries.json passes.
18
+
19
+ - Fixed: the README's toolchain block failed when pasted. The Agave installer adds its `bin` directory to `PATH` in
20
+ `~/.profile` only, so the next line gave `cargo-build-sbf: command not found`. The block now has the
21
+ `export PATH=…` line between the two commands, and says that the platform-tools install downloads about 0.5 GB and
22
+ prints nothing for a minute or two; docs/troubleshooting.md, CONTRIBUTING.md, `init` and `doctor` print the same
23
+ commands (test/cli/doctor.test.ts compares the README's block with them).
24
+ - Fixed: the commands `init`, `doctor` and the build printed for a missing toolchain did not install it.
25
+ `cargo-build-sbf --version` downloads nothing, and `cargo-build-sbf --force-tools-install` alone needs Cargo and a
26
+ Cargo project. Every message now gives `cargo-build-sbf --install-only --force-tools-install --tools-version v1.52`
27
+ (from `TESTED_TOOLCHAIN`), and says which is missing: "the Agave CLI is not installed" (then the installer, the
28
+ `PATH` line and that command) or "the Agave CLI is installed, but not its platform-tools" (that command only). The
29
+ build's errors were "Solana SBF SDK not found …" and "platform-tools missing under … Run
30
+ `cargo-build-sbf --force-tools-install` once." Each command is printed on a line of its own, with nothing after
31
+ it: what a command does is a `#` line above it, written without a character a shell acts on (the commands had a
32
+ trailing `# …` comment, which an interactive zsh, which reads no comments by default as on macOS, passed on as
33
+ arguments: `zsh: number expected`, `export: not valid in this context`), and no sentence's period follows a command.
34
+ `TYPESOL_SBF_SDK` set to a directory that is not an SDK makes `init` say so, where it printed "Install once:" and
35
+ nothing after it (test/cli/doctor.test.ts, both cases; it pastes the printed blocks into an interactive zsh and bash,
36
+ and fish where installed, with the commands stubbed).
37
+ - Fixed: on Linux arm64 the Agave installer fails with a 404 (Anza publishes no Agave CLI for it) and nothing said so;
38
+ `doctor` and `init` printed that installer. Building and LiteSVM tests work there with the platform-tools'
39
+ `linux-aarch64` package and the SDK's C files from the x86_64 release, pointed at with `TYPESOL_SBF_SDK` (checked
40
+ in a `linux/arm64` container: the three templates build and pass their tests). The README's Requirements give those
41
+ five commands (`$HOME` quoted in each), `doctor`, `init` and the build print them on Linux arm64 (an SDK there
42
+ without its platform-tools is "the SBF SDK at … has no platform-tools", not an installed Agave CLI), and the Solana
43
+ CLI row there says that deploying needs another host. The sentences that say builds are the same on Linux arm64 now say how that host was
44
+ set up (test/cli/doctor.test.ts).
45
+ - Fixed: on Node.js older than 22.12 the CLI ran or crashed without saying why (on 20, `npm install` failed inside
46
+ npm or the tests with `Map.groupBy is not a function`; on 22.11, `init`, `check` and `build` ran although `doctor`
47
+ said 22.12 was needed). The `typesol` command is now `dist/bin.js`, which checks the version before it loads
48
+ anything else and exits 1 with one line naming the version needed, the one running and where to get one
49
+ (test/cli/node-version.test.ts; checked in `node:20-bookworm` and `node:22.11-bookworm` containers).
50
+ - Fixed: `deploy` without a payer keypair printed that the Solana CLI would refuse, built, and went on until
51
+ `solana program deploy` failed. It now stops before building, exit 1: "no payer keypair at
52
+ ~/.config/solana/id.json: create one with `solana-keygen new` (or pass --keypair <file>), then fund it with
53
+ `solana airdrop 2 --url devnet`. Nothing was sent." A `--keypair` file that is not there gets "no keypair file at
54
+ ./payer.json (given with --keypair): check the path. Nothing was sent.", an empty one "--keypair is empty: give the
55
+ path of the payer's keypair file. Nothing was sent.", and a missing `keypair_path` of a Solana CLI config names that
56
+ config. Only a file is checked: a signer the Solana CLI resolves itself (`ASK`, `-`, and the schemes `usb:`,
57
+ `prompt:` and `stdin:`, as in `usb://ledger?key=0`, `prompt://`, `stdin://`) goes to `solana program deploy` as
58
+ before, without the balance check; a `file:` URI (`file:id.json`, `file:///abs/id.json`) is checked as the path it
59
+ names, and anything else is a path. `solana` missing from `PATH` is now said
60
+ first, also before building (it was said after the build) (test/cli/doctor.test.ts, with a fake `solana`).
61
+ - Fixed: `doctor` ended with its rows only, so three `!` rows after a passing test looked like a problem. It now ends
62
+ with one line: "Ready to build and test. The ! rows: deploying still needs: keypair, RPC; …", "Ready to build, test
63
+ and deploy." or "Not ready to build or test: fix the ERR rows (…) first." (test/cli/doctor.test.ts).
64
+ - New flag, `init --no-agent-files`: leaves out the files for AI coding agents (AGENTS.md, CLAUDE.md,
65
+ `.cursor/rules/typesol.mdc`, `.mcp.json`, `.cursor/mcp.json`), which `init` wrote with no way to opt out; without
66
+ it, `init` now names them after the files it created, and where one of them is already there (a repository with
67
+ its own AGENTS.md), its refusal says so: "refusing to overwrite: AGENTS.md (--no-agent-files leaves out the files
68
+ for AI coding agents)" (test/cli/ai.test.ts). `.vscode/settings.json` is written
69
+ either way: it makes the editor show TypeSOL's errors.
70
+ - Hints, text only (test/language/diagnostics.test.ts):
71
+ - an `async` instruction returning `Promise<void>` got "instructions cannot be async or generators" with no hint,
72
+ though the README promised one; it now has one (helper functions too);
73
+ - `console` and other globals a program does not have (`process`, `Buffer`, `setTimeout`, `setInterval`, `fetch`,
74
+ `window`, `document`) led with TypeScript's "Cannot find name 'console'. Do you need to change your target
75
+ library? …"; the message is now "'console' does not exist in a Solana program", with the hint under it where
76
+ there is one (`window` and `document` have none). The editor shows the same message, hint or not, through
77
+ `typesol/ts-plugin` (the new export below);
78
+ - `Date.now()` where an integer is expected now points to `now()`, the cluster's clock, and
79
+ `Math.floor(Date.now() / 1000)` (which was "unsupported call: Math.floor") says to use `now()`;
80
+ `Math.floor`, `trunc`, `ceil` and `round` on their own point to integer division;
81
+ - calling a cast imported with `type` (`import { type u64 }`, as the templates import it, then `u64(x)`) got
82
+ TypeScript's "'u64' cannot be used as a value because it was imported using 'import type'" alone; the hint says
83
+ to import it without `type`. The templates keep `type`: the hint is where the error is;
84
+ - the missing-import hint covered the functions and constants `typesol` exports (`u64`, `require`, …); it now
85
+ covers its types and interfaces too (`import { type Signer } from "typesol"`, `Mut`, `SystemProgram`, …);
86
+ - a `number` field in account data got the list of allowed field types alone; it now has a hint naming the integer
87
+ types (and a `Date` field, one about Unix seconds and `now()`).
88
+ - New export of `typesol/compiler`: `typescriptMessage(diagnostic)`, the message the CLI shows in place of a
89
+ TypeScript error's, or undefined to keep TypeScript's; `typesol/ts-plugin` uses it, so the editor shows what the CLI
90
+ shows (test/cli/ts-plugin.test.ts).
91
+ - Fixed: operators on an `f64` compiled to integer operators on its IEEE 754 bits, a silently wrong result:
92
+ `a.x + a.x` was a checked u64 add of the bits, `a.x < a.y` compared them as integers. Every operator with an `f64`
93
+ operand is now refused (arithmetic, bitwise, shifts, unary `-` and `~`, ordering, compound assignments, `++` / `--`,
94
+ and `min`, `max`, `isqrt`, `mulDiv`): "+ on an f64 is not supported: an f64 is held as its IEEE 754 bits and there
95
+ is no float arithmetic (this would compute on the bits); compute in integers and make the result with
96
+ f64FromBits(bits), or take an f64's bits with f64Bits(x)". Equality (`===`, `!==`, `==`, `!=`, `switch`) is
97
+ refused too, since equal bits are not equal numbers (NaN, 0 and -0): "… to compare the bits, write f64Bits(a) ===
98
+ f64Bits(b)". `??` over an `Option<f64>` now gives an `f64` whatever the other side expects, so `(a.o ?? a.x) * 2n`,
99
+ `a.n < (a.o ?? a.x)`, `min(a.n, a.o ?? a.x)` and `a.n += a.o ?? a.x` are refused too (they computed on the bits).
100
+ - Changed: an `f64` no longer converts to an integer, nor an integer to an `f64`. `a.n = a.x`, `const z: u64 = a.x`,
101
+ an `f64` passed to a helper's `u64` parameter or returned as a `u64`, `xs.get(a.x)`, `u64(a.x)`, `u8(a.x)`,
102
+ `u128(a.x)` and `a.x as u64` compiled and used the bits as the integer; `a.n as f64` made an integer's value the
103
+ bits. They are refused: "an f64 is not an integer, so it is not converted to u64: it is held as its IEEE 754 bits,
104
+ and the integer would be those bits; to use the bits, write f64Bits(x)" (and "a u64 is not an f64, so it is not
105
+ converted: an f64 is made from its IEEE 754 bits with f64FromBits(bits)"). An `f64` in a template string or `log`
106
+ printed its bits as a decimal integer; it is refused: "an f64 cannot be written as text: there is no float
107
+ formatting, and the digits would be its IEEE 754 bits read as an integer; to show the bits, write f64Bits(x)".
108
+ Copying an `f64` to an `f64` (fields, locals, structs, events, `Option<f64>`, ternaries, `??`, helper arguments and
109
+ returns typed `f64`) compiles as before, and so does an `f64` seed (its 8 bytes, as Rust's `to_le_bytes`). No
110
+ program of the repository used a conversion (test/language/f64-operators.test.ts; docs/language-types.md and the
111
+ refused-constructs table of docs/language-statements.md).
112
+ - Changed, now accepted: signer seeds were limited to 14 seeds and the bump, one fewer than Solana allows: the limit of 15 entries,
113
+ meant for lists the derivation adds the bump to, was applied to signer seeds and `createProgramAddress` lists too,
114
+ which end with their bump. They now take 16 entries, 15 seeds and the bump (Solana's `MAX_SEEDS`, checked by
115
+ `invoke_signed` and `create_program_address`); a 17th is refused with "at most 16 seeds, the bump included
116
+ (Solana's limit)", and a 16th seed before a derived bump with "at most 15 seeds: the bump the derivation adds makes
117
+ 16, Solana's limit" (was "at most 15 seeds" for both). test/language/signer-seed-limit.test.ts signs a CPI with
118
+ 16 entries in LiteSVM (a seed list and a bound `signer([...])`) and derives with `createProgramAddress`.
119
+ - Changed, now refused: a `Seeds<…>` constraint had no seed limit, so 16 or more names compiled and failed every call. It now
120
+ has the same limits and messages: with a bump field, "at most 16 seeds, the bump included (Solana's limit)"; with the
121
+ canonical bump, "at most 15 seeds: the bump the derivation adds makes 16, Solana's limit"
122
+ (test/language/signer-seed-limit.test.ts).
123
+ - Fixed, messages only (test/language/diagnostics.test.ts):
124
+ - a `u256` shift amount got "shift by a u64 (or smaller) amount", while a `u128` amount compiles (its range check
125
+ runs on all 128 bits); the message is now "a shift amount is a u128 or smaller integer: convert it (u64(n))";
126
+ - a function in parentheses (`const g = (function (): u64 { … })`) got "function expressions are not supported:
127
+ declare a function at the top level", though function expressions compile; an arrow there got "this syntax
128
+ (ArrowFunction) is not supported". Both now get "a function cannot be used here: bind it with const …". The hint
129
+ for template strings ("template strings are not supported …") was never shown and is gone;
130
+ - the test of `FixedString<0>` matched "capacity 1..1024" as a prefix of the message; it now matches the whole
131
+ "FixedString<N> needs a literal capacity 1..10240", and covers 10241 (refused) and 10240 (accepted).
132
+ - Fixed: a call to `merkleVerify`, `verifyEd25519` or `verifySecp256k1` used as a statement compiled and checked
133
+ nothing. The three return whether the proof or signature holds and fail nothing by themselves, so
134
+ `merkleVerify(leaf, proof, root);` emitted the hash computation and dropped its result. Such a call is now refused:
135
+ "the result of merkleVerify is discarded, so nothing is checked: it returns whether the proof holds; write
136
+ require(merkleVerify(…), error)". Refused as well: such a call as the condition of an `if` with an empty body and no
137
+ `else` or an empty one ("the result of merkleVerify is not acted on: the if around it has an empty body, so nothing
138
+ is checked: …"), and its result (in parentheses or under `as` too) kept in a `const` or `let` (declared or assigned,
139
+ in a closure too) that the function declaring it never reads, a closure inside it included ("the result of
140
+ merkleVerify is never read (ok is not used), so nothing is checked: …"). What is caught is these three forms, not
141
+ every unused result: a helper that returns the result, called as a statement, still compiles. No program of the
142
+ repository called one these ways (test/language/diagnostics.test.ts; rows in the refused-constructs table of
143
+ docs/language-statements.md).
144
+ - Fixed: a `@code` tag that TypeScript attaches to no member was ignored without a word, and the member took the next
145
+ code instead. Written after other code on its line (`A = "a", /** @code 6100 */ B = "b"`), it is now refused,
146
+ naming the member that follows: "this @code tag is not read: other code comes before it on its line; put /** @code …
147
+ */ on its own line above B" (after the last member: "it follows the last member"). Above the enum itself
148
+ (`/** @code 0 */` before `export enum PoolError {`), it is refused too: "this @code tag is not read: a tag above the
149
+ enum numbers no member; put /** @code … */ above its first member, AlreadyInUse". A tag on its own line, or first on
150
+ its member's line, is read as before; no program of the repository changes (test/language/zero-copy-shapes.test.ts).
151
+ The same goes for a tag in a `/* … */` or `//` comment ("this @code tag is not read: only a doc comment (/** … */)
152
+ is, not a // comment; write /** @code … */ above B") and in a doc comment that another one follows before the
153
+ member, of which only the last is read ("… another doc comment follows it, and only the last one above B is read;
154
+ put the tag in that one"). In a doc comment, a tag is any `@code` after the start, whitespace or `*`, as TypeScript
155
+ reads it, so one inside a sentence (`/** The second. @code 6200 */`) is a tag and is refused where it is not read; in
156
+ a `//` or `/* … */` comment only an `@code` first on a line of the comment is reported, so prose there
157
+ (`// see the @code docs`) is not.
158
+ - Docs: README links Quick start from the top, has three lines under the introduction with the two commands and the
159
+ playground, opens Quick start with the playground, says that `npm install`'s advisories come from
160
+ `@anchor-lang/core` (which `typesol/testing` uses to encode instructions and decode accounts, so the tests need it;
161
+ nothing of it is in a deployed program), says what npm's `E404 … typesol` outside a project means and what to run,
162
+ and that the scaffolded counter has one more instruction than the 23-line one shown. docs/troubleshooting.md has a
163
+ heading per symptom.
164
+ - Docs: the language reference is a guide. docs/language.md is an overview: the guide's pages, then an index of where
165
+ each construct is described, then the former reference's sections (their headings kept, so links to them still
166
+ land there). The pages, read in order:
167
+ - docs/language-basics.md: "Solana in a dozen lines", what a program is, one program explained line by line, and
168
+ "Limits and costs" (rent, compute budget, transaction size with its header and a recent blockhash, an address
169
+ lookup table entry at one byte, account growth, with their sources' values at the time of writing; at most 32
170
+ accounts per instruction is TypeSOL's default, not the cluster's);
171
+ - language-types.md: each type with its bytes, limits and error codes, and when to choose `FixedArray`, `FixedVec`
172
+ or `Vec`; `Struct arguments`, `f64` and heap values come last;
173
+ - language-statements.md: exactly which TypeScript is TypeSOL, and a table of what is refused with each message;
174
+ - language-accounts.md, with what happens to existing accounts when an account struct changes (also in
175
+ docs/mainnet.md: a field added fails with 3003 only on an account of exactly the old size; one created with spare
176
+ space or grown since passes and reads the spare bytes, or other fields' bytes when the field was inserted), and
177
+ `Two parameters, one account` (the `Inout` overlap rule for accounts) and `How many accounts` after the
178
+ constraints;
179
+ - language-pdas.md, language-errors-events.md, language-cpi.md, language-chain.md (sysvars, hashes, signatures,
180
+ oracles) and language-native.md (porting native programs, marked advanced);
181
+ - docs/language-builtins.md lists every name `"typesol"` exports, generated from lib/typesol.d.ts by
182
+ `scripts/language-builtins.ts` (`--check` in the tests and in CI).
183
+
184
+ Each page ends with a "Next" line and links a term's first use to the new docs/glossary.md (the three meanings of
185
+ owner, Anchor, associated token account, keypair account, authority, payer, remaining accounts, return data, slot
186
+ and epoch, cluster, syscall, precompile, ProgramData and upgrade authority, zero-copy, and more).
187
+
188
+ What the examples guarantee: every example is a complete program, or a block marked as a fragment whose every line is
189
+ a line of the compiled file it is taken from. test/language/docs-examples.test.ts compiles each program, checks that
190
+ every refused construct of the table is refused with the message it quotes, that links into the docs land on a
191
+ heading (a repeated heading's anchor with GitHub's `-1`, `-2` suffix), that every page but the overview and the
192
+ built-ins list has a compiled program, and that no TypeScript block is fenced so that it would be skipped (`~~~`,
193
+ `typescript`); a claim compiling does not prove is checked against the compiled program (the error codes from 0 of
194
+ docs/language-native.md). An example shows the construct its section is about, and docs/language.md says that,
195
+ unless the text says who may call an instruction, it does not check its caller as a real program must. The examples
196
+ that move value or sign as a PDA do check it: the PDA page's `payOut` takes its config at the singleton PDA
197
+ `["config"]` with `HasOne` and says to gate the config's creation, docs/language-cpi.md's `payOut` has the signer in
198
+ the vault's seeds (and `makeVault` creates the vault at those seeds), `remove` has `HasOne` before `close`, the native
199
+ `bump` checks that `admin` signed and the native Borsh `deposit` checks the pool's owner; the PDA page's first
200
+ example derives its second bump, and `invoke`'s `payOut` and `t.pdaWithBump` point to a stored bump. Those that show
201
+ one mechanism only say so, with the check a real instruction needs, on the first line after the example
202
+ (`invokeInstruction`'s `execute`, `Migrate`'s `upgrade`, a first-caller `InitIfNeeded` setup, FixedVec's
203
+ `setOwners` / `addOwner`, the fallback's `record`, BigVec's `add`, the run-time views' `fill`, the Borsh `deposit`,
204
+ the red-black tree's `place` / `cancel`, the enum's `approve`, the data enum's `apply`; the native `programAt`
205
+ entry and the randomness example's `settle` in their text), and `grow`'s open access is explained as moving no
206
+ value. docs/test-your-program.md has seeds of other widths and asserting an error code, naming the program that
207
+ snippet runs against (test/cli/testing.test.ts runs both). docs/troubleshooting.md is grouped (install, writing and
208
+ running a program, deploy, verify and `--docker`), with entries for running out of compute units, for a
209
+ transaction over 1,232 bytes and for `idl publish` failing on a local validator; the longest table cells (Token-2022
210
+ methods, `init` and `verify` in docs/cli.md) are lists.
211
+
212
+ lib/typesol.d.ts gains doc comments only: the 34 exports that had none have one, the built-ins page's one-liners
213
+ (`currentSlot`, `slotsPerEpoch`, `HasOne`, `Ata`, `transferFee`, `TOKEN_ACCOUNT_SIZE`, `readonly`, `rawArrayAt`,
214
+ `Mut`, `Init`, `Account`, `log`, `invoke`, `Vec`) describe the name itself, the comment of `findProgramAddress` sat
215
+ above `bigEndian` and moves to it, and `isqrt`'s says it takes integers up to `u256` (as the compiler does), not up
216
+ to `u128`.
217
+ - Docs, corrected (statements of the former reference and of other published pages, found while checking them
218
+ against the compiler; no program compiles differently): top-level constants are not listed in the IDL (a constant
219
+ used as a seed is recorded there as a `const` seed); closure parameters need their types where the closure is
220
+ declared (an arrow written at a call takes them from the parameter); a `@layout borsh` struct's `Vec` may be any
221
+ field, not only the last; `signer([…])` is written in a declaration or as a helper's argument, not inside a CPI's
222
+ arguments; `merkleVerify`, `verifyEd25519` and `verifySecp256k1` return whether the proof or signature holds and fail
223
+ nothing by themselves (docs/language-chain.md, with an example, and their doc comments); a program account is
224
+ checked for initialization (3012), owner (3007), size (3003), then discriminator (3002), and the two cases where
225
+ Anchor's order gives another code (another discriminator with fewer bytes than the struct: 3003 here, 3002 under
226
+ Anchor; under 8 bytes: 3003 here, 3001 under Anchor) are listed in docs/errors.md (test/security/anchor-order.test.ts
227
+ pins them); docs/errors.md said accounts are created after every other check, while the creates a body starts with
228
+ run before the constraints (not with an account group, whose arguments are decoded first); a failed instruction
229
+ fails the whole transaction; `>>` fails (5100) like `<<` when the amount is not below the width; `FixedString<N>`
230
+ takes 4 + N bytes; token account and mint codes are stated one way everywhere (3012 / 3007 / 3003); SECURITY.md
231
+ names the review of 0.44.0 and 0.44.1 as the README and docs/security-model.md do (test/cli/repository.test.ts
232
+ checks the three against docs/audit.md); the README's "Safe by default." is "Checked by default."; docs/mainnet.md
233
+ carries the status warning, its counter is built with 0.45.0, and it says what a `verify` match does not prove;
234
+ docs/migrate-from-anchor.md no longer claims `@layout borsh` is "several times cheaper than Anchor".
235
+
236
+ ## 0.45.0 — 2026-11-12
237
+
238
+ - New: a program builds to the same bytes on macOS arm64, Linux arm64 and Linux x86_64 (the programs and SBPF versions
239
+ measured are below). Up to 0.44.1 the 10 programs of the sources that call 128-bit or signed 64-bit division linked
240
+ platform-tools' compiler-builtins Rust library and built to a different binary on each host: its functions have the
241
+ same instructions in the three host packages, but each package splits them into differently numbered archive
242
+ members, so the linker placed them in another order and the calls into them had other offsets. Programs now link
243
+ none of it. `runtime/typesol_builtins.c` defines every builtin the tested clang calls for C integer code on SBF
244
+ (`__multi3`, `__udivti3`, `__umodti3`, `__divti3`, `__modti3`, `__ashlti3`, `__lshrti3`, `__ashrti3`, `__divdi3`,
245
+ `__moddi3`: the set it references for SBPF v0, v1 and v2 for every arithmetic, shift, overflow and bit operation on
246
+ every integer width, which test/language/builtins.test.ts compiles; the bit operations, counts of zeros and ones,
247
+ byte swaps, ffs and parity, are inline), compiled with each program by its clang and linked after it. Division is new
248
+ C that takes the shortest route for the operands' sizes; multiplication and shifts are, per SBPF version, the
249
+ instructions compiler-builtins has for them, in assembly, so programs that use only those keep their bytes on SBPF
250
+ v0. The exception is `__multi3` on v1 and v2, which is C (cheaper there: 175 compute units a call against 177.5 on
251
+ average). A link that would leave the loader an undefined symbol other than the syscalls the SDK's headers
252
+ (`@SYSCALL`) and the runtime header declare, and `abort`, is now an error (`SYSCALLS` in src/compiler/toolchain.ts,
253
+ checked against both headers by test/cli/toolchain.test.ts, which also checks that the link fails and leaves no
254
+ `.so`). With another clang than the tested one, which may call a builtin the tested one never does (0.44.1 linked it
255
+ from compiler-builtins), the error first says that the toolchain is not the tested one and names
256
+ `TESTED_TOOLCHAIN`. `<name>.build.json` lists `<runtime>/typesol_builtins.c` among the sources, and release manifests
257
+ record its sha256 (`toolchain.builtins`); compiler-builtins' LICENSE.txt ships as
258
+ `runtime/LICENSE-compiler-builtins.txt`, and NOTICE and the file's header give its licence expression
259
+ (test/cli/repository.test.ts).
260
+ Programs whose binary changes. For SBPF v0, the 10 that call division (each now the same on the three hosts): the
261
+ Phoenix, Marginfi, Raydium AMM, Raydium CLMM, Raydium CP-Swap, Jito priority-fee distribution and SPL Stake Pool
262
+ ports, transfer-fee, token-fundraiser and token-swap; the other 66 programs build to 0.44.1's bytes on each of the
263
+ three hosts, and the generated C and IDL of all 76 are unchanged. For SBPF v1 and v2, programs that call division
264
+ change too, and on v1 so do programs that multiply 128-bit or checked 64-bit values (`__multi3`): of the 14 programs
265
+ of test/golden/binaries.json built on macOS arm64, all 14 have other v1 bytes than with 0.44.1, and 9 other v2 bytes
266
+ (the 10 above but token-fundraiser, whose signed 64-bit division is an instruction on v2; counter, vault, escrow,
267
+ multisig and token-fundraiser keep their v2 bytes); their C and IDL are unchanged. Division by zero is unchanged:
268
+ TypeSOL checks every divisor before dividing and fails with 5101 (test/verification/fuzz-arith.test.ts); the
269
+ builtins are never called with zero, and if one were it would stop with the VM's division-by-zero error
270
+ (compiler-builtins leaves that case undefined: some of its calls returned a value). Compute units: in the showcase
271
+ suites, each of the 18,085 transactions sent to a program whose binary changes (the ports above and two test
272
+ programs) was also run against 0.44.1's binary on the same state; none costs more and 2,659 cost less (in total:
273
+ Marginfi −5.1%, Raydium AMM −7.9%, CLMM −5.0%, CP-Swap −2.3%, Jito priority-fee −1.0%, Stake Pool −0.2%, Phoenix
274
+ −0.004%, token-swap −0.5%, transfer-fee −0.4%, token-fundraiser −0.1%). `test/language/builtins.test.ts` runs
275
+ every builtin as SBF in LiteSVM for SBPF v0, v1 and v2, against a BigInt reference and against compiler-builtins on the edge cases (0, 1, maxima, the signed minimum,
276
+ powers of two and their neighbours, values with one half zero, divisors above the dividend) and a seeded random set
277
+ (with the default seed, on v0, 84,741 to 91,289 calls per multiplication or division function and 59,506 per shift;
278
+ on v1 and v2, 41,506 to 73,289), and requires every call to cost no more compute units than compiler-builtins'.
279
+ - Measured: what builds the same bytes where. With this release's compiler and platform-tools v1.52 on macOS arm64
280
+ (native), Linux arm64 and Linux x86_64 (in containers; x86_64 is the `--docker` image): for SBPF v0, all 76 programs
281
+ of the sources give the same C, IDL and binary on the three hosts; for SBPF v1 and v2, the 14 programs of
282
+ test/golden/binaries.json do (v1 and v2 were not measured over all 76). With 0.44.1 (the npm tarball) on the same
283
+ three, for v0, 66 gave the same binary and the 10 above three different ones (token-fundraiser: the two Linux ones
284
+ agreed), which is what 0.44.0 gave too. README, docs/stability.md, docs/security-model.md, docs/audit.md,
285
+ docs/mainnet.md, docs/testing.md, docs/cli.md and docs/troubleshooting.md say so. A program built with 0.44.0 or
286
+ 0.44.1 on macOS or Linux arm64 that calls 128-bit or signed division cannot be verified with `--docker` (the
287
+ container gives the Linux x86_64 bytes of those versions); a 0.44.x install on the same kind of host verifies it
288
+ (docs/troubleshooting.md).
289
+ - New: `typesol build --docker` and `typesol verify --docker` build in a pinned container, so that a third party can
290
+ rebuild a deployed program from its source in the same environment. The container is made locally from
291
+ `docker/Dockerfile`, which ships in the package with `releases/` and `docker/deps/`: linux/amd64 on every machine,
292
+ the Node 24 and busybox base images by digest, the Agave 3.1.10 and platform-tools v1.52 release files by sha256,
293
+ the TypeSOL version from npm with its tarball checked against `releases/<version>.json` (integrity, shasum, every
294
+ file) before it is installed, and that version's npm dependencies (TypeScript, the compiler's front end, and
295
+ `@solana/kit` with its tree) installed with `npm ci --ignore-scripts` from its lock, `docker/deps/<version>.lock.json`
296
+ (npm checks every package against the lock's integrity; the lock must be for exactly the dependencies the checked
297
+ tarball's package.json declares, every package from the npm registry with a sha512 integrity), and then the checked
298
+ tarball's files placed as `node_modules/@typesol/cli` with no second resolution. The lock of version N ships in
299
+ package N (`node scripts/release-check.ts <version> --lock`, a step of the release; the check of the tag refuses a
300
+ release without it and installs it with `npm ci`); for a version newer than the package the image takes the one in
301
+ that version's own tarball. The locks of 0.43.0, 0.44.0 and 0.44.1 were resolved from the registry on 2026-11-12,
302
+ after those releases, so their integrity values are what npm served that day. Builds run without network or
303
+ capabilities, with the sources read-only, as the caller's uid and gid (root for a root caller, whose output
304
+ directories the container could not write otherwise). `<name>.build.json` records the container (platform,
305
+ Dockerfile sha256, base images, downloads, tarball hashes, the commit the release record names, where the record came
306
+ from and the sha256 of its bytes, the dependency lock and its sha256, local image id). An image is labelled with
307
+ everything its build checked (the tarball's integrity and shasum, the record's commit, a hash of its file list, the
308
+ lock's sha256), and a cached image whose labels differ from the record and lock given now is an error that names
309
+ them, not a build reported with values that were never checked. The TypeSOL version is `--typesol-version`, else
310
+ (verify) the deployed build's manifest's, else the CLI's; a project that installs another typesol than the one
311
+ running is an error. The release record is the package's; for a release newer than the package (a release's own
312
+ record is committed after it is published, so the package of version N never holds `releases/N.json`) it is fetched
313
+ from the repository's main branch over HTTPS
314
+ (`raw.githubusercontent.com/typesol-lang/typesol/main/releases/<version>.json`; HTTP 404 between the npm publish
315
+ and the record's commit), said on stderr and recorded, so that the npm tarball is checked against a second, independent source (as with `--release-record <file>`, which passes one by hand; a record
316
+ the package ships came from npm too). Offline or for a version without a record it is an error naming that option.
317
+ A record needs its version, commit, tarball hashes and files. Versions before 0.43.0 have no record and are refused.
318
+ On a match, `verify --docker` prints what was verified (source and git commit, TypeSOL tarball, the commit its record
319
+ names and the record's origin, the dependency lock, toolchain, container inputs) and the command that repeats it,
320
+ with every option given that changes the result (`--address`, `--url`, `--config`, `--sbpf`, `--manifest`,
321
+ `--release-record`). Without Docker, with its daemon stopped or when the image build fails, it is an error: never a
322
+ local build instead. No image is published, and nothing is registered with an external verified-build registry
323
+ (docs/mainnet.md; test/cli/docker.test.ts: the record lookup with an injected fetch, the image cache with a fake
324
+ docker, the Dockerfile's tarball and lock checks on crafted inputs, the uid mapping, and with `TYPESOL_DOCKER_TESTS=1`
325
+ real container builds; running as root was not tested).
326
+ - A `--docker` build is up to date for `typesol test` (`npm test`) on any host while the program's sources, SBPF
327
+ version and address are the ones its `<name>.build.json` records and its `.so` is the one recorded: the test runs the
328
+ container's binary instead of rebuilding it locally because the manifest says linux/x64 (another TypeSOL version's
329
+ runtime files are not compared). When the sources changed, the test rebuilds locally and says on stderr that it
330
+ replaced a container build. `typesol build` without `--docker` and `typesol deploy` build locally, as before
331
+ (docs/mainnet.md; test/cli/toolchain.test.ts).
332
+ - `toolchainDifferences` (and so `verify`'s mismatch hint) counts the host as a difference between builds of 0.44.1
333
+ or earlier (whose manifests do not list the runtime's builtins), and `verify` says it may be the cause if the program
334
+ uses 128-bit or signed division; between builds that link the runtime's builtins the host is not a difference when
335
+ both are among the hosts measured (`MEASURED_HOSTS`: darwin-arm64, linux-arm64, linux-x64), and `host (not
336
+ measured)` otherwise (test/cli/toolchain.test.ts).
337
+ - CI: the programs of `test/golden/binaries.json` (for SBPF v0, counter, vault, escrow, multisig and the 10 that call
338
+ division; for v1 and v2, counter, escrow, Phoenix and Marginfi) must build to the C, IDL and bytes the build
339
+ container gave, on every runner of the test job with Node 24: Linux x86_64 on pushes and pull requests (the
340
+ container's host package, installed separately) and macOS arm64 when the macOS workflow runs
341
+ (`scripts/release-manifest.ts --check`, which now fails on another binary on any host, and on a reference that lists
342
+ no program, has an entry that did not build, or was made from uncommitted changes; `--docker` regenerates the file
343
+ and refuses a tree with uncommitted changes, `--programs` limits a manifest to a set and `<path>:v1` or `--sbpf`
344
+ builds for another SBPF version; test/cli/release-manifest.test.ts).
345
+ - `typesol doctor` has an optional `docker` row.
346
+ - Docs: the release assets are named with their version, `typesol-<version>-manifest.json` and
347
+ `typesol-<version>-binary-diff.txt` (SECURITY.md, CONTRIBUTING.md, docs/testing.md, docs/stability.md). The
348
+ README's first page names the eight ports checked against mainnet binaries, with instruction and transaction
349
+ counts, before the examples; the quick start gives its commands before the toolchain notes; Status says what the
350
+ November 2026 reviews found and how fix releases and release records work; the licence line matches NOTICE.
351
+
9
352
  ## 0.44.1 — 2026-11-11
10
353
 
11
354
  Fixes from a second internal review, of 0.44.0 (docs/audit.md). Of the 76 programs of the 0.44.0 sources, 74 compile
package/NOTICE CHANGED
@@ -4,7 +4,8 @@ Copyright (c) 2026 TypeSOL contributors. Licensed under the MIT License (LICENSE
4
4
  Third-party code in the published @typesol/cli package
5
5
  --------------------------------------------------------
6
6
 
7
- The package ships this NOTICE and the Apache License 2.0 text (test/programs/LICENSE-Apache-2.0.txt).
7
+ The package ships this NOTICE, the Apache License 2.0 text (test/programs/LICENSE-Apache-2.0.txt) and
8
+ compiler-builtins' licence file (runtime/LICENSE-compiler-builtins.txt).
8
9
 
9
10
  - runtime/typesol_rt.h, the RedBlackTree section (ts_rbt_*): a statement-for-statement port of the red-black tree and
10
11
  node allocator of lib-sokoban 0.3.0 (https://github.com/jarry-xiao/sokoban, src/red_black_tree.rs and
@@ -37,6 +38,18 @@ The package ships this NOTICE and the Apache License 2.0 text (test/programs/LIC
37
38
  solana-labs/solana-program-library), licensed under the Apache License, Version 2.0. Changes: rewritten in C and
38
39
  TypeScript.
39
40
 
41
+ - runtime/typesol_builtins.c, the assembly (__multi3 for SBPF v0; __ashlti3, __lshrti3 and __ashrti3): the
42
+ instructions that the compiler-builtins crate (https://github.com/rust-lang/compiler-builtins), as built in
43
+ platform-tools v1.52, has for these functions, written out as assembly so that a program links them from the
44
+ runtime's source. compiler-builtins is licensed "MIT AND Apache-2.0 WITH LLVM-exception AND (MIT OR Apache-2.0)"
45
+ (its Cargo.toml); its LICENSE.txt, which says the crate is available under both the MIT licence and the
46
+ Apache-2.0 licence with the LLVM exception and holds both texts, ships verbatim as
47
+ runtime/LICENSE-compiler-builtins.txt (taken from https://github.com/rust-lang/compiler-builtins at commit
48
+ 8fe310e552c1a24df0bd977e87756168fe396037 of its main branch, on 2026-11-12). Changes: disassembled, labels
49
+ renamed. The division functions in the same
50
+ file are TypeSOL's own C, after the algorithms of Knuth (The Art of Computer Programming, vol. 2, algorithm D) and
51
+ Warren (Hacker's Delight, divlu).
52
+
40
53
  - dist/testing-stake.js (src/testing-stake.ts), stakeActivation: a port of Delegation::stake_activating_and_deactivating_v2
41
54
  of solana-stake-interface 4.3.0 (https://github.com/solana-program/stake, interface crate), Copyright Anza
42
55
  Maintainers. Licence: Apache-2.0 (the crate's Cargo metadata for 4.3.0; text in test/programs/LICENSE-Apache-2.0.txt). Changes: rewritten in TypeScript (BigInt arithmetic with the original's u128 saturation).