@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.
- package/CHANGELOG.md +343 -0
- package/NOTICE +14 -1
- package/README.md +115 -26
- package/SECURITY.md +10 -8
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +9 -0
- package/dist/cli.js +226 -62
- package/dist/compiler/analyze.js +57 -6
- package/dist/compiler/diagnostics.d.ts +4 -3
- package/dist/compiler/diagnostics.js +10 -6
- package/dist/compiler/emit/base.d.ts +1 -1
- package/dist/compiler/emit/calls.js +18 -5
- package/dist/compiler/emit/cpi-core.d.ts +3 -1
- package/dist/compiler/emit/cpi-core.js +8 -4
- package/dist/compiler/emit/expressions.d.ts +14 -0
- package/dist/compiler/emit/expressions.js +52 -4
- package/dist/compiler/emit/shared.d.ts +8 -1
- package/dist/compiler/emit/shared.js +8 -1
- package/dist/compiler/emit/statements.d.ts +8 -3
- package/dist/compiler/emit/statements.js +68 -3
- package/dist/compiler/emit/storage.js +5 -1
- package/dist/compiler/hints.d.ts +7 -0
- package/dist/compiler/hints.js +58 -9
- package/dist/compiler/index.d.ts +56 -1
- package/dist/compiler/index.js +27 -3
- package/dist/compiler/model.js +3 -2
- package/dist/compiler/toolchain.d.ts +73 -2
- package/dist/compiler/toolchain.js +222 -17
- package/dist/node-version.d.ts +4 -0
- package/dist/node-version.js +12 -0
- package/dist/tools/docker.d.ts +183 -0
- package/dist/tools/docker.js +442 -0
- package/dist/tools/doctor.d.ts +44 -0
- package/dist/tools/doctor.js +108 -14
- package/dist/workspace.d.ts +11 -3
- package/dist/workspace.js +46 -9
- package/docker/Dockerfile +163 -0
- package/docker/deps/0.43.0.lock.json +1206 -0
- package/docker/deps/0.44.0.lock.json +1206 -0
- package/docker/deps/0.44.1.lock.json +1206 -0
- package/docker/deps/0.45.0.lock.json +1206 -0
- package/docker/deps/0.46.0.lock.json +1206 -0
- package/docs/ai.md +2 -1
- package/docs/architecture.md +18 -6
- package/docs/audit.md +15 -7
- package/docs/case-study-phoenix.md +1 -1
- package/docs/case-study-raydium-amm.md +1 -1
- package/docs/case-study-spl-stake-pool.md +1 -1
- package/docs/cli.md +71 -6
- package/docs/errors.md +22 -8
- package/docs/glossary.md +210 -0
- package/docs/language-accounts.md +499 -0
- package/docs/language-basics.md +389 -0
- package/docs/language-builtins.md +411 -0
- package/docs/language-chain.md +198 -0
- package/docs/language-cpi.md +470 -0
- package/docs/language-errors-events.md +184 -0
- package/docs/language-native.md +493 -0
- package/docs/language-pdas.md +198 -0
- package/docs/language-statements.md +620 -0
- package/docs/language-types.md +601 -0
- package/docs/language.md +190 -467
- package/docs/mainnet.md +103 -8
- package/docs/migrate-from-anchor.md +7 -6
- package/docs/security-model.md +4 -4
- package/docs/stability.md +64 -3
- package/docs/test-your-program.md +52 -15
- package/docs/testing.md +49 -2
- package/docs/troubleshooting.md +210 -42
- package/lib/typesol.d.ts +67 -22
- package/llms-full.txt +5084 -591
- package/llms.txt +12 -1
- package/package.json +4 -2
- package/releases/0.43.0.json +669 -0
- package/releases/0.44.0.json +672 -0
- package/releases/0.44.1.json +672 -0
- package/releases/0.45.0.json +732 -0
- package/runtime/LICENSE-compiler-builtins.txt +275 -0
- package/runtime/typesol_builtins.c +484 -0
- package/ts-plugin/index.js +16 -5
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
14
|
<p align="center">
|
|
15
|
+
<a href="#quick-start">Quick start</a> ·
|
|
15
16
|
<a href="https://typesol.com">Website</a> ·
|
|
16
17
|
<a href="https://typesol.com/docs/">Docs</a> ·
|
|
17
18
|
<a href="https://typesol.com/docs/changelog/">Changelog</a> ·
|
|
@@ -27,15 +28,30 @@ clients read TypeSOL programs unchanged.
|
|
|
27
28
|
|
|
28
29
|
- **One language, end to end.** You write the program and its tests in TypeScript, and every build writes a typed
|
|
29
30
|
client for it ([docs/client.md](docs/client.md)). Your editor gives you completion and type errors throughout.
|
|
30
|
-
- **
|
|
31
|
+
- **Checked by default.**
|
|
31
32
|
- Every arithmetic operation is checked.
|
|
32
33
|
- Account owner, discriminator, signer, writability and aliasing checks are generated from your parameter types.
|
|
33
34
|
- Constraints follow Anchor's rules and use Anchor's error codes.
|
|
34
35
|
- **Small and fast.** In the LiteSVM benchmarks below, TypeSOL uses 5–32% of Anchor's compute units, with binaries
|
|
35
36
|
about 10× smaller, and fewer compute units than native Rust and hand-tuned Pinocchio on every instruction. On
|
|
36
37
|
mainnet the results differ by instruction; see [the mainnet table](#on-mainnet).
|
|
37
|
-
- **
|
|
38
|
-
|
|
38
|
+
- **Checked against mainnet.** Eight deployed programs are ported in full, among them Marginfi v2, Phoenix v1 and
|
|
39
|
+
SPL Stake Pool, and run beside the original binaries: the same outcomes, log lines, events and account bytes on
|
|
40
|
+
thousands of transactions, for fewer compute units ([the ports](#ported-and-checked-against-mainnet-binaries)).
|
|
41
|
+
- **Verifiable.** `typesol verify` reads a deployed program from the cluster and checks it, and the IDL published on
|
|
42
|
+
chain, against its source. Every release records the hashes of its npm tarball and of every program it builds
|
|
43
|
+
([releases/](releases), [docs/testing.md](docs/testing.md#reproducing-a-release)).
|
|
44
|
+
The same source, TypeSOL version and toolchain build to the same bytes on macOS arm64, Linux arm64 and Linux x86_64
|
|
45
|
+
(measured: all 76 programs of the sources for SBPF v0, 14 of them for v1 and v2; Linux arm64 with the platform-tools
|
|
46
|
+
`linux-aarch64` package set up as in [Requirements](#requirements), since there is no Agave CLI for it;
|
|
47
|
+
[docs/stability.md](docs/stability.md#what-builds-the-same-bytes-where)).
|
|
48
|
+
`typesol build --docker` builds in a pinned linux/amd64 container that anyone can rebuild from the Dockerfile, and
|
|
49
|
+
`typesol verify --docker` checks a deployed program against its source in that same environment
|
|
50
|
+
([docs/mainnet.md](docs/mainnet.md#6-verify)).
|
|
51
|
+
|
|
52
|
+
**Try it** in the browser, with nothing to install: [typesol.com/play](https://typesol.com/play/). On your machine, once
|
|
53
|
+
Node.js and the Solana toolchain are in place ([Quick start](#quick-start), [Requirements](#requirements)):
|
|
54
|
+
`npx @typesol/cli init my-app`, then `cd my-app && npm install && npm test`.
|
|
39
55
|
|
|
40
56
|
<p align="center">
|
|
41
57
|
<a href="#numbers">
|
|
@@ -46,9 +62,32 @@ clients read TypeSOL programs unchanged.
|
|
|
46
62
|
</a>
|
|
47
63
|
</p>
|
|
48
64
|
|
|
65
|
+
## Ported and checked against mainnet binaries
|
|
66
|
+
|
|
67
|
+
Each port is the whole program, written in TypeSOL from the original's source. Its tests send every transaction to
|
|
68
|
+
the port and to the binary deployed on mainnet, both in LiteSVM, and require the same outcome, error, log lines,
|
|
69
|
+
events, return data and bytes in every account; the port must also use fewer compute units on every transaction that
|
|
70
|
+
succeeds. A case study for each says what was compared and what was not.
|
|
71
|
+
|
|
72
|
+
| Program | Kind | Instructions | Transactions compared |
|
|
73
|
+
| --- | --- | ---: | ---: |
|
|
74
|
+
| [Marginfi v2](docs/case-study-marginfi.md) | Anchor, lending | 124 | 2,081 |
|
|
75
|
+
| [Phoenix v1](docs/case-study-phoenix.md) | native, limit order book | 28 | 3,575 |
|
|
76
|
+
| [SPL Stake Pool](docs/case-study-spl-stake-pool.md) | native, liquid staking | 27 | 2,107 |
|
|
77
|
+
| [Raydium CLMM](docs/case-study-raydium-clmm.md) | Anchor, concentrated liquidity | 37 | 302 |
|
|
78
|
+
| [Raydium CP-Swap](docs/case-study-raydium-cp-swap.md) | Anchor, constant product | 21 | 136 |
|
|
79
|
+
| [Raydium AMM v4](docs/case-study-raydium-amm.md) | native, constant product | all | 484 |
|
|
80
|
+
| [Jito MEV](docs/case-study-jito-mev.md) | Anchor, three programs | 24 | 150 |
|
|
81
|
+
| [coral-xyz/multisig](docs/case-study-multisig.md) | Anchor | all | 52 |
|
|
82
|
+
|
|
83
|
+
Random walks with fixed or printed seeds run on top of these counts ([docs/testing.md](docs/testing.md)). The
|
|
84
|
+
sources are in [`showcase/mainnet`](showcase/mainnet), and where each original binary comes from is recorded in
|
|
85
|
+
[test/programs/SOURCES.md](test/programs/SOURCES.md).
|
|
86
|
+
|
|
49
87
|
## At a glance
|
|
50
88
|
|
|
51
|
-
**`counter.ts`**: a complete program, 23 lines.
|
|
89
|
+
**`counter.ts`**: a complete program, 23 lines. (`typesol init` writes it with one more instruction, a read-only
|
|
90
|
+
`assertAtLeast`.)
|
|
52
91
|
|
|
53
92
|
```ts
|
|
54
93
|
import { type Init, type Mut, type Pubkey, type Signer,
|
|
@@ -141,41 +180,61 @@ transactions to both and compares the results.
|
|
|
141
180
|
|
|
142
181
|
## Quick start
|
|
143
182
|
|
|
183
|
+
No install: try TypeSOL in the browser at [typesol.com/play](https://typesol.com/play/).
|
|
184
|
+
|
|
144
185
|
You need Node.js 22.12 or later and the Agave CLI with its platform-tools, which hold the clang TypeSOL compiles with.
|
|
145
186
|
Rust is not needed. TypeSOL is tested with **Agave 3.1.10 and platform-tools v1.52** (clang 20.1.7); to install exactly
|
|
146
|
-
those:
|
|
187
|
+
those on macOS or Linux x86_64 (Linux arm64: see
|
|
188
|
+
[Requirements](https://github.com/typesol-lang/typesol#requirements)):
|
|
147
189
|
|
|
148
190
|
```sh
|
|
149
191
|
sh -c "$(curl -sSfL https://release.anza.xyz/v3.1.10/install)"
|
|
192
|
+
# The installer adds this line to ~/.profile for new shells, and this shell needs it now:
|
|
193
|
+
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
|
|
194
|
+
# Once: this downloads the platform-tools, about 0.5 GB and up to 1.6 GB unpacked, and prints nothing for a minute or two:
|
|
150
195
|
cargo-build-sbf --install-only --force-tools-install --tools-version v1.52
|
|
151
196
|
```
|
|
152
197
|
|
|
153
|
-
Other versions work, but their binaries are not covered by the project's tests: `typesol build` warns once when the
|
|
154
|
-
clang is another one (`--toolchain-strict` or `TYPESOL_TOOLCHAIN=strict` makes that an error), and every build records
|
|
155
|
-
its clang, platform-tools and host in `<name>.build.json`.
|
|
156
|
-
|
|
157
198
|
```sh
|
|
158
|
-
npx @typesol/cli init my-app --name counter
|
|
199
|
+
npx @typesol/cli init my-app --name counter
|
|
159
200
|
cd my-app && npm install
|
|
160
|
-
npm test
|
|
161
|
-
npx --no-install typesol build
|
|
201
|
+
npm test
|
|
202
|
+
npx --no-install typesol build
|
|
162
203
|
```
|
|
163
204
|
|
|
205
|
+
`init` writes `typesol.json`, `programs/counter.ts`, `tests/counter.test.ts` and a tsconfig. `npm test` builds the program
|
|
206
|
+
and runs it in LiteSVM, an in-process Solana runtime. `build` writes `target/counter/`: `counter.so`, `counter.json` (the
|
|
207
|
+
IDL), `counter.client.ts` and `counter.build.json`.
|
|
208
|
+
|
|
209
|
+
`init` also writes rules and an MCP server config for AI coding agents (AGENTS.md, CLAUDE.md, `.cursor/`, `.mcp.json`)
|
|
210
|
+
and lists them; `--no-agent-files` leaves them out. `npm install` reports advisories (moderate and high) and packages
|
|
211
|
+
with install scripts: they come from `@anchor-lang/core` and the Solana web3.js it depends on, which `typesol/testing`
|
|
212
|
+
uses to encode instructions and decode accounts, so the tests need it; none of it is in the program you deploy.
|
|
213
|
+
|
|
214
|
+
Other versions work, but their binaries are not covered by the project's tests: `typesol build` warns once when the
|
|
215
|
+
clang is another one (`--toolchain-strict` or `TYPESOL_TOOLCHAIN=strict` makes that an error), and every build records
|
|
216
|
+
its clang, platform-tools and host in `<name>.build.json`.
|
|
217
|
+
|
|
164
218
|
`npx --no-install typesol doctor` checks all of this (Node.js, platform-tools and whether they are the tested ones, Solana CLI, keypair, RPC) and prints the command
|
|
165
219
|
that fixes anything missing. Inside a project, `npx --no-install typesol …` (or `npm run build`, `npm run deploy`) runs the
|
|
166
220
|
project's own copy; outside one, use `npx @typesol/cli …`. Plain `npx typesol` is not TypeSOL: `typesol` is not the npm
|
|
167
|
-
package's name, so where the project's copy is not installed npx would fetch whatever package has that name.
|
|
221
|
+
package's name, so where the project's copy is not installed npx would fetch whatever package has that name. Outside a
|
|
222
|
+
project (or before `npm install`), `npx --no-install typesol …` therefore fails with npm's `E404 … typesol - Not
|
|
223
|
+
found`, which does not mention `@typesol/cli`: run `npx @typesol/cli …` there, or `npm install` in the project first.
|
|
168
224
|
|
|
169
225
|
To deploy, on devnet:
|
|
170
226
|
|
|
171
227
|
```sh
|
|
172
|
-
|
|
173
|
-
solana
|
|
228
|
+
# Once, if you have no keypair at ~/.config/solana/id.json:
|
|
229
|
+
solana-keygen new
|
|
230
|
+
# Test SOL for the rent. The airdrop is rate-limited, and https://faucet.solana.com also works:
|
|
231
|
+
solana airdrop 2 --url devnet
|
|
174
232
|
npx --no-install typesol deploy --url devnet
|
|
175
233
|
```
|
|
176
234
|
|
|
177
235
|
or on a local validator: `solana-test-validator` in another terminal, `solana airdrop 5 --url localhost`, then
|
|
178
|
-
`npx --no-install typesol deploy --url localhost`. `deploy` checks the RPC and the payer's balance
|
|
236
|
+
`npx --no-install typesol deploy --url localhost`. `deploy` checks the payer's keypair, the RPC and the payer's balance
|
|
237
|
+
before sending anything, and stops with the command to run when one is missing.
|
|
179
238
|
|
|
180
239
|
`--template vault` or `--template escrow` starts from a SOL vault or an SPL token escrow instead of the counter, each
|
|
181
240
|
with a passing LiteSVM test.
|
|
@@ -190,7 +249,8 @@ program's address.
|
|
|
190
249
|
**Your first change.** Open `programs/counter.ts`, add an instruction (say `decrement`, with
|
|
191
250
|
`require(counter.count >= 1n, …)` before `counter.count -= 1n`), call it from `tests/counter.test.ts` and run `npm test`.
|
|
192
251
|
If the build refuses something, the error points at the line and, for the usual first mistakes (`1` instead of `1n`,
|
|
193
|
-
`console.log`, a missing import, `async`), adds a `hint:` with what to write instead; your editor shows
|
|
252
|
+
`console.log`, `Date.now()`, a missing import, `async`), adds a `hint:` with what to write instead; your editor shows
|
|
253
|
+
the same.
|
|
194
254
|
|
|
195
255
|
**Where next**
|
|
196
256
|
- The language, every type and built-in: [docs/language.md](docs/language.md).
|
|
@@ -198,7 +258,7 @@ If the build refuses something, the error points at the line and, for the usual
|
|
|
198
258
|
- Coming from Anchor: [docs/migrate-from-anchor.md](docs/migrate-from-anchor.md) maps every construct, and
|
|
199
259
|
`typesol port` starts from your program's IDL; [docs/case-study-escrow.md](docs/case-study-escrow.md) follows one
|
|
200
260
|
program through the port.
|
|
201
|
-
- Real programs checked against their mainnet binaries: [Showcase](#showcase-ports-checked-against-mainnet), with a
|
|
261
|
+
- Real programs checked against their mainnet binaries: [Showcase](https://github.com/typesol-lang/typesol#showcase-ports-checked-against-mainnet), with a
|
|
202
262
|
case study each (Marginfi v2 in full: all 124 instructions, the same on 2,081 transactions; Phoenix v1, a native
|
|
203
263
|
order book, the same on 3,575 transactions down to its event bytes; Raydium AMM v4, a native program, down to its log
|
|
204
264
|
lines).
|
|
@@ -238,7 +298,8 @@ Runtime failures point back to your source: `Error 6000 Unauthorized (counter.ts
|
|
|
238
298
|
| **Native programs** | a `@fallback` entry over the raw instruction data and accounts by position, Borsh accounts (`loadBorsh`), views of account bytes in place (also at offsets known only at run time) and lib-sokoban's red-black tree over them, byte builders (`pushLE`, `pushBorsh`, …), return data, `closeRaw`, and Rust's panics and overflow messages at the original's source locations |
|
|
239
299
|
| **Interfaces** | custom discriminators (`@discriminator`), so a TypeSOL program can be a Token-2022 transfer hook, with extra accounts (ExtraAccountMetaList) |
|
|
240
300
|
|
|
241
|
-
The
|
|
301
|
+
The [language guide](docs/language.md) explains each construct with a compiled example, and lists every type, check
|
|
302
|
+
and built-in.
|
|
242
303
|
|
|
243
304
|
## Tooling
|
|
244
305
|
|
|
@@ -256,7 +317,7 @@ The full reference, with every type, check and built-in, is in [docs/language.md
|
|
|
256
317
|
| `typesol client <idl.json>` | generate a typed TypeScript client from an Anchor IDL (`typesol build` writes one per program) |
|
|
257
318
|
| `typesol port` | a TypeSOL skeleton of an Anchor program from its IDL, keeping discriminators and error codes |
|
|
258
319
|
| `typesol/ts-plugin` | the compiler's errors in the editor as you type, in every file of a program ([docs/cli.md](docs/cli.md#editor)) |
|
|
259
|
-
| `typesol verify` | rebuild from source and compare with the program and IDL on chain (or a dumped `.so`) |
|
|
320
|
+
| `typesol verify` | rebuild from source and compare with the program and IDL on chain (or a dumped `.so`); `--docker` rebuilds in the pinned container |
|
|
260
321
|
| `typesol profile` | compute units per TypeScript line, from a `--profile` build's logs |
|
|
261
322
|
| `typesol emit-c` | print the generated C |
|
|
262
323
|
|
|
@@ -337,7 +398,10 @@ upgrade, is in [typesol-lang/benchmarks](https://github.com/typesol-lang/benchma
|
|
|
337
398
|
- Stateful vault, escrow and ledger runs are checked against a TypeScript model.
|
|
338
399
|
- Differential runs send the same transactions to TypeSOL and to the Anchor twins and compare outcomes, account
|
|
339
400
|
contents and balances.
|
|
340
|
-
- **
|
|
401
|
+
- **Ports against mainnet binaries.** The eight ports above run beside the deployed originals, transaction by
|
|
402
|
+
transaction, and random walks over them compare every step.
|
|
403
|
+
- **Localnet smoke test.** A script deploys every example to a local validator and drives it end to end; it is run
|
|
404
|
+
by hand, not in CI.
|
|
341
405
|
|
|
342
406
|
Details are in [docs/testing.md](docs/testing.md).
|
|
343
407
|
|
|
@@ -381,6 +445,12 @@ Case studies: [Marginfi v2](docs/case-study-marginfi.md), [Phoenix v1](docs/case
|
|
|
381
445
|
[versioning policy](https://github.com/typesol-lang/.github/blob/main/VERSIONING.md); [CHANGELOG.md](CHANGELOG.md) lists every
|
|
382
446
|
change.
|
|
383
447
|
- The compiler, runtime and tooling have been through internal security reviews and are covered by the tests above.
|
|
448
|
+
The two latest, of 0.43.0 and 0.44.0 in November 2026, found defects that made a program that compiled behave
|
|
449
|
+
differently from its source; each is fixed with a test, and [docs/audit.md](docs/audit.md) lists them, what the
|
|
450
|
+
reviews covered and what they did not. Programs built before 0.44.1 should be rebuilt.
|
|
451
|
+
- From 0.44.0 on, a release that only fixes defects is a patch with no new language surface and a binary diff in its
|
|
452
|
+
notes ([SECURITY.md](SECURITY.md#fix-releases)), and the npm tarball is the one packed from the tag and recorded
|
|
453
|
+
in [releases/](releases).
|
|
384
454
|
- They have **not been audited by an independent firm**. Do not put significant value behind programs built with
|
|
385
455
|
TypeSOL until such an audit is published.
|
|
386
456
|
- Audit your own programs as you would any Solana program. What a compiled program can rely on, and what is left to
|
|
@@ -393,9 +463,27 @@ stable already and what is still experimental: [docs/stability.md](docs/stabilit
|
|
|
393
463
|
|
|
394
464
|
## Requirements
|
|
395
465
|
|
|
396
|
-
- Node.js 22.12 or later.
|
|
397
|
-
- The Agave CLI with platform-tools.
|
|
398
|
-
- macOS or Linux
|
|
466
|
+
- Node.js 22.12 or later (the CLI stops with the version it needs on an older one).
|
|
467
|
+
- The Agave CLI with platform-tools (see [Quick start](#quick-start)).
|
|
468
|
+
- macOS or Linux x86_64 for everything; Linux arm64 to build and test, set up as below (deploying from it needs the
|
|
469
|
+
Solana CLI built from source); on Windows, WSL2.
|
|
470
|
+
- Linux arm64: Anza publishes no Agave CLI for it (the installer fails with a 404), but platform-tools has a
|
|
471
|
+
`linux-aarch64` package. With it and the SDK's C files from the x86_64 release (headers and linker script, as the
|
|
472
|
+
`--docker` image takes them), `typesol build` and LiteSVM tests work (needs `curl` and `bzip2`):
|
|
473
|
+
|
|
474
|
+
```sh
|
|
475
|
+
mkdir -p "$HOME/.local/share/typesol-sdk/sbf/dependencies/platform-tools"
|
|
476
|
+
# About 215 MB, for the C headers and linker script of the SDK only:
|
|
477
|
+
curl -sSfL https://github.com/anza-xyz/agave/releases/download/v3.1.10/solana-release-x86_64-unknown-linux-gnu.tar.bz2 | tar -xj -C "$HOME/.local/share/typesol-sdk" --strip-components=3 solana-release/bin/platform-tools-sdk/sbf/c
|
|
478
|
+
# About 515 MB, 1.6 GB unpacked, and quiet for a minute or two:
|
|
479
|
+
curl -sSfL https://github.com/anza-xyz/platform-tools/releases/download/v1.52/platform-tools-linux-aarch64.tar.bz2 | tar -xj -C "$HOME/.local/share/typesol-sdk/sbf/dependencies/platform-tools"
|
|
480
|
+
touch "$HOME/.local/share/typesol-sdk/sbf/dependencies/platform-tools-v1.52.md"
|
|
481
|
+
# Add this line to ~/.profile too, for new shells:
|
|
482
|
+
export TYPESOL_SBF_SDK="$HOME/.local/share/typesol-sdk/sbf"
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
`typesol doctor` prints these commands there. Deploying needs the Solana CLI: deploy from macOS or Linux x86_64,
|
|
486
|
+
or build the Agave CLI from source. `build --docker` (linux/amd64, emulated) works on any host with Docker.
|
|
399
487
|
|
|
400
488
|
TypeSOL finds the SDK under `~/.local/share/solana/install/active_release` or next to `cargo-build-sbf` on `PATH`. Set
|
|
401
489
|
`TYPESOL_SBF_SDK` to override the location. See [docs/troubleshooting.md](docs/troubleshooting.md).
|
|
@@ -408,5 +496,6 @@ built-in, a constraint or an error code. Then read [CONTRIBUTING.md](CONTRIBUTIN
|
|
|
408
496
|
|
|
409
497
|
## License
|
|
410
498
|
|
|
411
|
-
[MIT](LICENSE). The
|
|
412
|
-
[NOTICE](NOTICE) and
|
|
499
|
+
[MIT](LICENSE). The runtime and `typesol/testing` include code ported from MIT and Apache-2.0 projects, and the tests
|
|
500
|
+
use third-party program binaries and data that are not in the npm package: see [NOTICE](NOTICE) and
|
|
501
|
+
[test/programs/SOURCES.md](test/programs/SOURCES.md).
|
package/SECURITY.md
CHANGED
|
@@ -5,11 +5,13 @@ TypeSOL generates programs that hold funds. Treat it accordingly.
|
|
|
5
5
|
## Status
|
|
6
6
|
|
|
7
7
|
- The compiler, runtime and tooling have been through internal security reviews by the maintainers. The latest, of
|
|
8
|
-
0.
|
|
9
|
-
in the
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
0.44.0 on 2026-11-11, found defects in the compiler (wrong token-wrapper instruction data, and a reference that could
|
|
9
|
+
outlive a resize and reach another record) and a latent one in the runtime; they are fixed in 0.44.1. The one
|
|
10
|
+
before it, of 0.43.0, found defects fixed in 0.44.0 (one of them could break an authorization check in a helper).
|
|
11
|
+
**Rebuild and redeploy programs built before 0.44.1**;
|
|
12
|
+
[docs/security-model.md](docs/security-model.md#status) gives the status, its sections on each review say how to
|
|
13
|
+
tell whether a program was exposed, and [docs/audit.md](docs/audit.md#earlier-reviews) what each review did and did
|
|
14
|
+
not cover. Every release is covered by execution tests, differential tests against Anchor, and randomized tests.
|
|
13
15
|
**TypeSOL has not been audited by an independent firm.** Do not put significant value behind programs built with it
|
|
14
16
|
until an external audit of the compiler and runtime is published, and audit your own programs as you would any
|
|
15
17
|
Solana program.
|
|
@@ -20,6 +22,8 @@ TypeSOL generates programs that hold funds. Treat it accordingly.
|
|
|
20
22
|
sha256), packed from a clean export of the release tag; `node scripts/release-check.ts <version> --verify --registry`
|
|
21
23
|
compares it with the registry.
|
|
22
24
|
- Only the latest 0.x release receives security fixes, as fix releases (below).
|
|
25
|
+
- What a compiled program can rely on is specified in [docs/security-model.md](docs/security-model.md); the package
|
|
26
|
+
for an external audit is [docs/audit.md](docs/audit.md).
|
|
23
27
|
|
|
24
28
|
## Fix releases
|
|
25
29
|
|
|
@@ -30,14 +34,12 @@ release (0.44.0 → 0.44.1), so a team can take the fix without taking new featu
|
|
|
30
34
|
no account layout, IDL or error code beyond what the fix itself needs;
|
|
31
35
|
- a program it refuses or builds to another binary is one the defect touches, and the CHANGELOG says which;
|
|
32
36
|
- its release notes carry the binary diff against the previous release (the previous release's sources built by both
|
|
33
|
-
packages, `binary-diff.txt`; see [docs/testing.md](docs/testing.md#reproducing-a-release)), so a team can see whether
|
|
37
|
+
packages, `typesol-<version>-binary-diff.txt`; see [docs/testing.md](docs/testing.md#reproducing-a-release)), so a team can see whether
|
|
34
38
|
their program's binary changes.
|
|
35
39
|
|
|
36
40
|
Fixes go to the latest minor only; older minors are not maintained. A fix that needs a language or layout change
|
|
37
41
|
comes in the next minor. 0.44.0 itself is a minor release: besides the fixes from the 0.43.0 review it has behaviour
|
|
38
42
|
changes (new compile errors, `deploy` refusing to run without a cluster).
|
|
39
|
-
- What a compiled program can rely on is specified in [docs/security-model.md](docs/security-model.md); the package
|
|
40
|
-
for an external audit is [docs/audit.md](docs/audit.md).
|
|
41
43
|
|
|
42
44
|
## Reporting a vulnerability
|
|
43
45
|
|
package/dist/bin.d.ts
ADDED
package/dist/bin.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The `typesol` command: the Node.js version first, then the CLI (src/cli.ts), loaded only once the check passed.
|
|
3
|
+
import { nodeVersionProblem } from "./node-version.js";
|
|
4
|
+
const problem = nodeVersionProblem(process.versions.node);
|
|
5
|
+
if (problem) {
|
|
6
|
+
console.error(problem);
|
|
7
|
+
process.exit(1);
|
|
8
|
+
}
|
|
9
|
+
await import("./cli.js");
|