@typesol/cli 0.44.0 → 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.
- package/CHANGELOG.md +166 -0
- package/NOTICE +14 -1
- package/README.md +52 -10
- package/SECURITY.md +1 -1
- package/dist/cli.js +194 -48
- package/dist/compiler/emit/alias.d.ts +16 -2
- package/dist/compiler/emit/alias.js +62 -4
- package/dist/compiler/emit/calls.js +15 -7
- package/dist/compiler/emit/cpi-core.d.ts +6 -0
- package/dist/compiler/emit/cpi-core.js +18 -5
- package/dist/compiler/emit/create.js +19 -11
- package/dist/compiler/emit/function.js +5 -5
- package/dist/compiler/emit/metaplex.js +17 -4
- package/dist/compiler/emit/token.js +64 -39
- package/dist/compiler/index.d.ts +51 -1
- package/dist/compiler/index.js +17 -2
- package/dist/compiler/toolchain.d.ts +23 -0
- package/dist/compiler/toolchain.js +128 -8
- package/dist/tools/docker.d.ts +183 -0
- package/dist/tools/docker.js +442 -0
- package/dist/tools/doctor.d.ts +3 -0
- package/dist/tools/doctor.js +12 -0
- package/dist/workspace.d.ts +2 -1
- package/dist/workspace.js +33 -6
- 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/docs/architecture.md +13 -5
- package/docs/audit.md +54 -7
- package/docs/cli.md +31 -4
- package/docs/errors.md +1 -1
- package/docs/language.md +6 -4
- package/docs/mainnet.md +86 -6
- package/docs/security-model.md +47 -12
- package/docs/stability.md +62 -3
- package/docs/testing.md +49 -2
- package/docs/troubleshooting.md +46 -0
- package/llms-full.txt +283 -34
- package/package.json +3 -1
- 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/runtime/LICENSE-compiler-builtins.txt +275 -0
- package/runtime/typesol_builtins.c +484 -0
- package/runtime/typesol_rt.h +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,172 @@ codes, and says so here.
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## 0.45.0 — 2026-11-12
|
|
10
|
+
|
|
11
|
+
- New: a program builds to the same bytes on macOS arm64, Linux arm64 and Linux x86_64 (the programs and SBPF versions
|
|
12
|
+
measured are below). Up to 0.44.1 the 10 programs of the sources that call 128-bit or signed 64-bit division linked
|
|
13
|
+
platform-tools' compiler-builtins Rust library and built to a different binary on each host: its functions have the
|
|
14
|
+
same instructions in the three host packages, but each package splits them into differently numbered archive
|
|
15
|
+
members, so the linker placed them in another order and the calls into them had other offsets. Programs now link
|
|
16
|
+
none of it. `runtime/typesol_builtins.c` defines every builtin the tested clang calls for C integer code on SBF
|
|
17
|
+
(`__multi3`, `__udivti3`, `__umodti3`, `__divti3`, `__modti3`, `__ashlti3`, `__lshrti3`, `__ashrti3`, `__divdi3`,
|
|
18
|
+
`__moddi3`: the set it references for SBPF v0, v1 and v2 for every arithmetic, shift, overflow and bit operation on
|
|
19
|
+
every integer width, which test/language/builtins.test.ts compiles; the bit operations, counts of zeros and ones,
|
|
20
|
+
byte swaps, ffs and parity, are inline), compiled with each program by its clang and linked after it. Division is new
|
|
21
|
+
C that takes the shortest route for the operands' sizes; multiplication and shifts are, per SBPF version, the
|
|
22
|
+
instructions compiler-builtins has for them, in assembly, so programs that use only those keep their bytes on SBPF
|
|
23
|
+
v0. The exception is `__multi3` on v1 and v2, which is C (cheaper there: 175 compute units a call against 177.5 on
|
|
24
|
+
average). A link that would leave the loader an undefined symbol other than the syscalls the SDK's headers
|
|
25
|
+
(`@SYSCALL`) and the runtime header declare, and `abort`, is now an error (`SYSCALLS` in src/compiler/toolchain.ts,
|
|
26
|
+
checked against both headers by test/cli/toolchain.test.ts, which also checks that the link fails and leaves no
|
|
27
|
+
`.so`). With another clang than the tested one, which may call a builtin the tested one never does (0.44.1 linked it
|
|
28
|
+
from compiler-builtins), the error first says that the toolchain is not the tested one and names
|
|
29
|
+
`TESTED_TOOLCHAIN`. `<name>.build.json` lists `<runtime>/typesol_builtins.c` among the sources, and release manifests
|
|
30
|
+
record its sha256 (`toolchain.builtins`); compiler-builtins' LICENSE.txt ships as
|
|
31
|
+
`runtime/LICENSE-compiler-builtins.txt`, and NOTICE and the file's header give its licence expression
|
|
32
|
+
(test/cli/repository.test.ts).
|
|
33
|
+
Programs whose binary changes. For SBPF v0, the 10 that call division (each now the same on the three hosts): the
|
|
34
|
+
Phoenix, Marginfi, Raydium AMM, Raydium CLMM, Raydium CP-Swap, Jito priority-fee distribution and SPL Stake Pool
|
|
35
|
+
ports, transfer-fee, token-fundraiser and token-swap; the other 66 programs build to 0.44.1's bytes on each of the
|
|
36
|
+
three hosts, and the generated C and IDL of all 76 are unchanged. For SBPF v1 and v2, programs that call division
|
|
37
|
+
change too, and on v1 so do programs that multiply 128-bit or checked 64-bit values (`__multi3`): of the 14 programs
|
|
38
|
+
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
|
|
39
|
+
(the 10 above but token-fundraiser, whose signed 64-bit division is an instruction on v2; counter, vault, escrow,
|
|
40
|
+
multisig and token-fundraiser keep their v2 bytes); their C and IDL are unchanged. Division by zero is unchanged:
|
|
41
|
+
TypeSOL checks every divisor before dividing and fails with 5101 (test/verification/fuzz-arith.test.ts); the
|
|
42
|
+
builtins are never called with zero, and if one were it would stop with the VM's division-by-zero error
|
|
43
|
+
(compiler-builtins leaves that case undefined: some of its calls returned a value). Compute units: in the showcase
|
|
44
|
+
suites, each of the 18,085 transactions sent to a program whose binary changes (the ports above and two test
|
|
45
|
+
programs) was also run against 0.44.1's binary on the same state; none costs more and 2,659 cost less (in total:
|
|
46
|
+
Marginfi −5.1%, Raydium AMM −7.9%, CLMM −5.0%, CP-Swap −2.3%, Jito priority-fee −1.0%, Stake Pool −0.2%, Phoenix
|
|
47
|
+
−0.004%, token-swap −0.5%, transfer-fee −0.4%, token-fundraiser −0.1%). `test/language/builtins.test.ts` runs
|
|
48
|
+
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,
|
|
49
|
+
powers of two and their neighbours, values with one half zero, divisors above the dividend) and a seeded random set
|
|
50
|
+
(with the default seed, on v0, 84,741 to 91,289 calls per multiplication or division function and 59,506 per shift;
|
|
51
|
+
on v1 and v2, 41,506 to 73,289), and requires every call to cost no more compute units than compiler-builtins'.
|
|
52
|
+
- Measured: what builds the same bytes where. With this release's compiler and platform-tools v1.52 on macOS arm64
|
|
53
|
+
(native), Linux arm64 and Linux x86_64 (in containers; x86_64 is the `--docker` image): for SBPF v0, all 76 programs
|
|
54
|
+
of the sources give the same C, IDL and binary on the three hosts; for SBPF v1 and v2, the 14 programs of
|
|
55
|
+
test/golden/binaries.json do (v1 and v2 were not measured over all 76). With 0.44.1 (the npm tarball) on the same
|
|
56
|
+
three, for v0, 66 gave the same binary and the 10 above three different ones (token-fundraiser: the two Linux ones
|
|
57
|
+
agreed), which is what 0.44.0 gave too. README, docs/stability.md, docs/security-model.md, docs/audit.md,
|
|
58
|
+
docs/mainnet.md, docs/testing.md, docs/cli.md and docs/troubleshooting.md say so. A program built with 0.44.0 or
|
|
59
|
+
0.44.1 on macOS or Linux arm64 that calls 128-bit or signed division cannot be verified with `--docker` (the
|
|
60
|
+
container gives the Linux x86_64 bytes of those versions); a 0.44.x install on the same kind of host verifies it
|
|
61
|
+
(docs/troubleshooting.md).
|
|
62
|
+
- New: `typesol build --docker` and `typesol verify --docker` build in a pinned container, so that a third party can
|
|
63
|
+
rebuild a deployed program from its source in the same environment. The container is made locally from
|
|
64
|
+
`docker/Dockerfile`, which ships in the package with `releases/` and `docker/deps/`: linux/amd64 on every machine,
|
|
65
|
+
the Node 24 and busybox base images by digest, the Agave 3.1.10 and platform-tools v1.52 release files by sha256,
|
|
66
|
+
the TypeSOL version from npm with its tarball checked against `releases/<version>.json` (integrity, shasum, every
|
|
67
|
+
file) before it is installed, and that version's npm dependencies (TypeScript, the compiler's front end, and
|
|
68
|
+
`@solana/kit` with its tree) installed with `npm ci --ignore-scripts` from its lock, `docker/deps/<version>.lock.json`
|
|
69
|
+
(npm checks every package against the lock's integrity; the lock must be for exactly the dependencies the checked
|
|
70
|
+
tarball's package.json declares, every package from the npm registry with a sha512 integrity), and then the checked
|
|
71
|
+
tarball's files placed as `node_modules/@typesol/cli` with no second resolution. The lock of version N ships in
|
|
72
|
+
package N (`node scripts/release-check.ts <version> --lock`, a step of the release; the check of the tag refuses a
|
|
73
|
+
release without it and installs it with `npm ci`); for a version newer than the package the image takes the one in
|
|
74
|
+
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,
|
|
75
|
+
after those releases, so their integrity values are what npm served that day. Builds run without network or
|
|
76
|
+
capabilities, with the sources read-only, as the caller's uid and gid (root for a root caller, whose output
|
|
77
|
+
directories the container could not write otherwise). `<name>.build.json` records the container (platform,
|
|
78
|
+
Dockerfile sha256, base images, downloads, tarball hashes, the commit the release record names, where the record came
|
|
79
|
+
from and the sha256 of its bytes, the dependency lock and its sha256, local image id). An image is labelled with
|
|
80
|
+
everything its build checked (the tarball's integrity and shasum, the record's commit, a hash of its file list, the
|
|
81
|
+
lock's sha256), and a cached image whose labels differ from the record and lock given now is an error that names
|
|
82
|
+
them, not a build reported with values that were never checked. The TypeSOL version is `--typesol-version`, else
|
|
83
|
+
(verify) the deployed build's manifest's, else the CLI's; a project that installs another typesol than the one
|
|
84
|
+
running is an error. The release record is the package's; for a release newer than the package (a release's own
|
|
85
|
+
record is committed after it is published, so the package of version N never holds `releases/N.json`) it is fetched
|
|
86
|
+
from the repository's main branch over HTTPS
|
|
87
|
+
(`raw.githubusercontent.com/typesol-lang/typesol/main/releases/<version>.json`; HTTP 404 between the npm publish
|
|
88
|
+
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
|
|
89
|
+
the package ships came from npm too). Offline or for a version without a record it is an error naming that option.
|
|
90
|
+
A record needs its version, commit, tarball hashes and files. Versions before 0.43.0 have no record and are refused.
|
|
91
|
+
On a match, `verify --docker` prints what was verified (source and git commit, TypeSOL tarball, the commit its record
|
|
92
|
+
names and the record's origin, the dependency lock, toolchain, container inputs) and the command that repeats it,
|
|
93
|
+
with every option given that changes the result (`--address`, `--url`, `--config`, `--sbpf`, `--manifest`,
|
|
94
|
+
`--release-record`). Without Docker, with its daemon stopped or when the image build fails, it is an error: never a
|
|
95
|
+
local build instead. No image is published, and nothing is registered with an external verified-build registry
|
|
96
|
+
(docs/mainnet.md; test/cli/docker.test.ts: the record lookup with an injected fetch, the image cache with a fake
|
|
97
|
+
docker, the Dockerfile's tarball and lock checks on crafted inputs, the uid mapping, and with `TYPESOL_DOCKER_TESTS=1`
|
|
98
|
+
real container builds; running as root was not tested).
|
|
99
|
+
- A `--docker` build is up to date for `typesol test` (`npm test`) on any host while the program's sources, SBPF
|
|
100
|
+
version and address are the ones its `<name>.build.json` records and its `.so` is the one recorded: the test runs the
|
|
101
|
+
container's binary instead of rebuilding it locally because the manifest says linux/x64 (another TypeSOL version's
|
|
102
|
+
runtime files are not compared). When the sources changed, the test rebuilds locally and says on stderr that it
|
|
103
|
+
replaced a container build. `typesol build` without `--docker` and `typesol deploy` build locally, as before
|
|
104
|
+
(docs/mainnet.md; test/cli/toolchain.test.ts).
|
|
105
|
+
- `toolchainDifferences` (and so `verify`'s mismatch hint) counts the host as a difference between builds of 0.44.1
|
|
106
|
+
or earlier (whose manifests do not list the runtime's builtins), and `verify` says it may be the cause if the program
|
|
107
|
+
uses 128-bit or signed division; between builds that link the runtime's builtins the host is not a difference when
|
|
108
|
+
both are among the hosts measured (`MEASURED_HOSTS`: darwin-arm64, linux-arm64, linux-x64), and `host (not
|
|
109
|
+
measured)` otherwise (test/cli/toolchain.test.ts).
|
|
110
|
+
- CI: the programs of `test/golden/binaries.json` (for SBPF v0, counter, vault, escrow, multisig and the 10 that call
|
|
111
|
+
division; for v1 and v2, counter, escrow, Phoenix and Marginfi) must build to the C, IDL and bytes the build
|
|
112
|
+
container gave, on every runner of the test job with Node 24: Linux x86_64 on pushes and pull requests (the
|
|
113
|
+
container's host package, installed separately) and macOS arm64 when the macOS workflow runs
|
|
114
|
+
(`scripts/release-manifest.ts --check`, which now fails on another binary on any host, and on a reference that lists
|
|
115
|
+
no program, has an entry that did not build, or was made from uncommitted changes; `--docker` regenerates the file
|
|
116
|
+
and refuses a tree with uncommitted changes, `--programs` limits a manifest to a set and `<path>:v1` or `--sbpf`
|
|
117
|
+
builds for another SBPF version; test/cli/release-manifest.test.ts).
|
|
118
|
+
- `typesol doctor` has an optional `docker` row.
|
|
119
|
+
- Docs: the release assets are named with their version, `typesol-<version>-manifest.json` and
|
|
120
|
+
`typesol-<version>-binary-diff.txt` (SECURITY.md, CONTRIBUTING.md, docs/testing.md, docs/stability.md). The
|
|
121
|
+
README's first page names the eight ports checked against mainnet binaries, with instruction and transaction
|
|
122
|
+
counts, before the examples; the quick start gives its commands before the toolchain notes; Status says what the
|
|
123
|
+
November 2026 reviews found and how fix releases and release records work; the licence line matches NOTICE.
|
|
124
|
+
|
|
125
|
+
## 0.44.1 — 2026-11-11
|
|
126
|
+
|
|
127
|
+
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
|
|
128
|
+
to the same binary as in 0.44.0 and 2 to a different one (mint-close-authority and allow-block-list-token, below); no
|
|
129
|
+
program of those sources is refused.
|
|
130
|
+
|
|
131
|
+
- Fixed: `mint.create(…, { transferFee })` with a `null` (or run-time None) config or withdraw authority made a mint
|
|
132
|
+
with fee 0 and no withdraw authority. Token-2022 reads a None COption as one byte and the compiler sent 33, so the
|
|
133
|
+
32 zero bytes were read as the next fields. A None authority is now one byte, for `transferFee`'s two and
|
|
134
|
+
`closeAuthority` (where Token-2022 ignored the extra bytes, now exact too); `initializeTransferFeeConfig` and the
|
|
135
|
+
other wrappers already encoded it right. Programs using `transferFee` or `closeAuthority` in `mint.create` /
|
|
136
|
+
`createIfNeeded` compile differently (transfer-fee to the same binary, mint-close-authority to another)
|
|
137
|
+
(test/integrations/token-init.test.ts, decoded by the Token-2022 decoder for each authority null, constant and
|
|
138
|
+
run-time).
|
|
139
|
+
- Fixed: a reference into account data held across a resize made through another parameter that may be the same
|
|
140
|
+
account was not refused: with `a: Dup<Mut<Bag>>` and `b: Mut<Bag>` (or a read-only `a: Account<Bag>`, or a struct
|
|
141
|
+
loaded with `loadAccount` / `loadAccountMut`) one account in both slots, `const e = a.entries.get(1n); b.tags.pop();
|
|
142
|
+
e.score = v` wrote another record, and a `for (const x of a.entries)` loop read shifted fields. The reference rule
|
|
143
|
+
now treats parameters that may be one account (a Dup pair, a read-only and a writable account of one type, a loaded
|
|
144
|
+
struct) as one name for push, pop, clear and a helper given the account: such a program is a compile error, as with
|
|
145
|
+
one name. Programs that hold no reference across the resize compile as before; none of the examples and ports is
|
|
146
|
+
refused (test/security/dup.test.ts).
|
|
147
|
+
- Fixed: twelve token wrappers (approve, approveChecked, mintToChecked, burnChecked, setAuthority,
|
|
148
|
+
updateTransferHook, updateInterestRate, transferCheckedWithFee, setTransferFee, initializeTokenGroup,
|
|
149
|
+
updateGroupMaxSize, updateGroupAuthority) and the Stake program's split, authorize and withdraw read
|
|
150
|
+
their signer seeds before an earlier argument ran: `approve(src, d, owner, next(st), ["vault", st.count, bump])`
|
|
151
|
+
signed for the count before `next(st)` changed it. The seeds are now lowered after the other arguments when an
|
|
152
|
+
argument runs code; calls whose arguments run none compile as before (test/integrations/tokenops.test.ts).
|
|
153
|
+
- Fixed: arguments read after later ones ran. The amount of `transfer`, `transferChecked`, `mintTo`, `burn` and
|
|
154
|
+
`systemProgram.transfer` was read at the CPI, after a seed list that runs code (`["vault", next(st), bump]`); account
|
|
155
|
+
text passed to `initializeMetadata`, `removeMetadataKey` and Metaplex `updateMetadataAccountsV2` (and that
|
|
156
|
+
call's `primarySaleHappened` / `isMutable`) changed when a later argument rewrote it. Each is now read first, only
|
|
157
|
+
where a later argument runs code, so other calls compile as before (test/integrations/tokenops.test.ts).
|
|
158
|
+
- Fixed: `mint.create` with extensions adding up to exactly 355 bytes (a Multisig's length) always failed: Token-2022
|
|
159
|
+
sizes such a mint 357 bytes and refuses any other size. The mint is now made 357 bytes; `createIfNeeded` accepts
|
|
160
|
+
that size already, and cannot reach 355 with the extensions it checks (test/integrations/token-init.test.ts).
|
|
161
|
+
- Fixed: `updateExtraAccountMetas` limited growth to 10 KiB past the account's current length instead of its length
|
|
162
|
+
when the instruction started, so after `resizeAccount(metas, metas.dataLen + 10240n)` it could write past the room
|
|
163
|
+
the runtime leaves, into the next account's record. It now counts from the length at entry (3016), in an
|
|
164
|
+
instruction and in a helper. Programs that call it compile differently (allow-block-list-token, to another binary)
|
|
165
|
+
(test/integrations/hook.test.ts).
|
|
166
|
+
- Fixed: the runtime grew a heap Vec (`ts_hvec_reserve`) through its own struct type while the program reads it
|
|
167
|
+
through the generated one, which the C aliasing rules let the optimizer treat as unrelated (no miscompile was
|
|
168
|
+
observed). The runtime's type is `may_alias`; no build flag changed, and no program of the 0.44.0 sources (heap Vecs
|
|
169
|
+
included) builds to another binary (test/language/borsh-vec.test.ts).
|
|
170
|
+
- Docs: docs/security-model.md and docs/language.md say what `pythPrice` and `switchboardValue` leave to the author
|
|
171
|
+
(the price's sign and zero, the confidence, a publish time or result slot in the future, rounding toward zero when
|
|
172
|
+
scaling) and that Switchboard staleness counts from `result.slot`; the review of 0.44.0 is recorded in
|
|
173
|
+
docs/audit.md and docs/security-model.md.
|
|
174
|
+
|
|
9
175
|
## 0.44.0 — 2026-11-11
|
|
10
176
|
|
|
11
177
|
Fixes from an internal review of 0.43.0, and the means to check a release. A helper's Pubkey, Option, string or u256
|
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
|
|
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).
|
package/README.md
CHANGED
|
@@ -34,8 +34,18 @@ clients read TypeSOL programs unchanged.
|
|
|
34
34
|
- **Small and fast.** In the LiteSVM benchmarks below, TypeSOL uses 5–32% of Anchor's compute units, with binaries
|
|
35
35
|
about 10× smaller, and fewer compute units than native Rust and hand-tuned Pinocchio on every instruction. On
|
|
36
36
|
mainnet the results differ by instruction; see [the mainnet table](#on-mainnet).
|
|
37
|
-
- **
|
|
38
|
-
|
|
37
|
+
- **Checked against mainnet.** Eight deployed programs are ported in full, among them Marginfi v2, Phoenix v1 and
|
|
38
|
+
SPL Stake Pool, and run beside the original binaries: the same outcomes, log lines, events and account bytes on
|
|
39
|
+
thousands of transactions, for fewer compute units ([the ports](#ported-and-checked-against-mainnet-binaries)).
|
|
40
|
+
- **Verifiable.** `typesol verify` reads a deployed program from the cluster and checks it, and the IDL published on
|
|
41
|
+
chain, against its source. Every release records the hashes of its npm tarball and of every program it builds
|
|
42
|
+
([releases/](releases), [docs/testing.md](docs/testing.md#reproducing-a-release)).
|
|
43
|
+
The same source, TypeSOL version and toolchain build to the same bytes on macOS arm64, Linux arm64 and Linux x86_64
|
|
44
|
+
(measured: all 76 programs of the sources for SBPF v0, 14 of them for v1 and v2;
|
|
45
|
+
[docs/stability.md](docs/stability.md#what-builds-the-same-bytes-where)).
|
|
46
|
+
`typesol build --docker` builds in a pinned linux/amd64 container that anyone can rebuild from the Dockerfile, and
|
|
47
|
+
`typesol verify --docker` checks a deployed program against its source in that same environment
|
|
48
|
+
([docs/mainnet.md](docs/mainnet.md#6-verify)).
|
|
39
49
|
|
|
40
50
|
<p align="center">
|
|
41
51
|
<a href="#numbers">
|
|
@@ -46,6 +56,28 @@ clients read TypeSOL programs unchanged.
|
|
|
46
56
|
</a>
|
|
47
57
|
</p>
|
|
48
58
|
|
|
59
|
+
## Ported and checked against mainnet binaries
|
|
60
|
+
|
|
61
|
+
Each port is the whole program, written in TypeSOL from the original's source. Its tests send every transaction to
|
|
62
|
+
the port and to the binary deployed on mainnet, both in LiteSVM, and require the same outcome, error, log lines,
|
|
63
|
+
events, return data and bytes in every account; the port must also use fewer compute units on every transaction that
|
|
64
|
+
succeeds. A case study for each says what was compared and what was not.
|
|
65
|
+
|
|
66
|
+
| Program | Kind | Instructions | Transactions compared |
|
|
67
|
+
| --- | --- | ---: | ---: |
|
|
68
|
+
| [Marginfi v2](docs/case-study-marginfi.md) | Anchor, lending | 124 | 2,081 |
|
|
69
|
+
| [Phoenix v1](docs/case-study-phoenix.md) | native, limit order book | 28 | 3,575 |
|
|
70
|
+
| [SPL Stake Pool](docs/case-study-spl-stake-pool.md) | native, liquid staking | 27 | 2,107 |
|
|
71
|
+
| [Raydium CLMM](docs/case-study-raydium-clmm.md) | Anchor, concentrated liquidity | 37 | 302 |
|
|
72
|
+
| [Raydium CP-Swap](docs/case-study-raydium-cp-swap.md) | Anchor, constant product | 21 | 136 |
|
|
73
|
+
| [Raydium AMM v4](docs/case-study-raydium-amm.md) | native, constant product | all | 484 |
|
|
74
|
+
| [Jito MEV](docs/case-study-jito-mev.md) | Anchor, three programs | 24 | 150 |
|
|
75
|
+
| [coral-xyz/multisig](docs/case-study-multisig.md) | Anchor | all | 52 |
|
|
76
|
+
|
|
77
|
+
Random walks with fixed or printed seeds run on top of these counts ([docs/testing.md](docs/testing.md)). The
|
|
78
|
+
sources are in [`showcase/mainnet`](showcase/mainnet), and where each original binary comes from is recorded in
|
|
79
|
+
[test/programs/SOURCES.md](test/programs/SOURCES.md).
|
|
80
|
+
|
|
49
81
|
## At a glance
|
|
50
82
|
|
|
51
83
|
**`counter.ts`**: a complete program, 23 lines.
|
|
@@ -150,10 +182,6 @@ sh -c "$(curl -sSfL https://release.anza.xyz/v3.1.10/install)"
|
|
|
150
182
|
cargo-build-sbf --install-only --force-tools-install --tools-version v1.52
|
|
151
183
|
```
|
|
152
184
|
|
|
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
185
|
```sh
|
|
158
186
|
npx @typesol/cli init my-app --name counter # typesol.json, programs/counter.ts, tests/counter.test.ts, tsconfig
|
|
159
187
|
cd my-app && npm install
|
|
@@ -161,6 +189,10 @@ npm test # builds the program and runs it i
|
|
|
161
189
|
npx --no-install typesol build # target/counter/{counter.so, counter.json (IDL), counter.client.ts, counter.build.json}
|
|
162
190
|
```
|
|
163
191
|
|
|
192
|
+
Other versions work, but their binaries are not covered by the project's tests: `typesol build` warns once when the
|
|
193
|
+
clang is another one (`--toolchain-strict` or `TYPESOL_TOOLCHAIN=strict` makes that an error), and every build records
|
|
194
|
+
its clang, platform-tools and host in `<name>.build.json`.
|
|
195
|
+
|
|
164
196
|
`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
197
|
that fixes anything missing. Inside a project, `npx --no-install typesol …` (or `npm run build`, `npm run deploy`) runs the
|
|
166
198
|
project's own copy; outside one, use `npx @typesol/cli …`. Plain `npx typesol` is not TypeSOL: `typesol` is not the npm
|
|
@@ -256,7 +288,7 @@ The full reference, with every type, check and built-in, is in [docs/language.md
|
|
|
256
288
|
| `typesol client <idl.json>` | generate a typed TypeScript client from an Anchor IDL (`typesol build` writes one per program) |
|
|
257
289
|
| `typesol port` | a TypeSOL skeleton of an Anchor program from its IDL, keeping discriminators and error codes |
|
|
258
290
|
| `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`) |
|
|
291
|
+
| `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
292
|
| `typesol profile` | compute units per TypeScript line, from a `--profile` build's logs |
|
|
261
293
|
| `typesol emit-c` | print the generated C |
|
|
262
294
|
|
|
@@ -337,7 +369,10 @@ upgrade, is in [typesol-lang/benchmarks](https://github.com/typesol-lang/benchma
|
|
|
337
369
|
- Stateful vault, escrow and ledger runs are checked against a TypeScript model.
|
|
338
370
|
- Differential runs send the same transactions to TypeSOL and to the Anchor twins and compare outcomes, account
|
|
339
371
|
contents and balances.
|
|
340
|
-
- **
|
|
372
|
+
- **Ports against mainnet binaries.** The eight ports above run beside the deployed originals, transaction by
|
|
373
|
+
transaction, and random walks over them compare every step.
|
|
374
|
+
- **Localnet smoke test.** A script deploys every example to a local validator and drives it end to end; it is run
|
|
375
|
+
by hand, not in CI.
|
|
341
376
|
|
|
342
377
|
Details are in [docs/testing.md](docs/testing.md).
|
|
343
378
|
|
|
@@ -381,6 +416,12 @@ Case studies: [Marginfi v2](docs/case-study-marginfi.md), [Phoenix v1](docs/case
|
|
|
381
416
|
[versioning policy](https://github.com/typesol-lang/.github/blob/main/VERSIONING.md); [CHANGELOG.md](CHANGELOG.md) lists every
|
|
382
417
|
change.
|
|
383
418
|
- The compiler, runtime and tooling have been through internal security reviews and are covered by the tests above.
|
|
419
|
+
The two latest, of 0.43.0 and 0.44.0 in November 2026, found defects that made a program that compiled behave
|
|
420
|
+
differently from its source; each is fixed with a test, and [docs/audit.md](docs/audit.md) lists them, what the
|
|
421
|
+
reviews covered and what they did not. Programs built before 0.44.1 should be rebuilt.
|
|
422
|
+
- 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
|
|
423
|
+
notes ([SECURITY.md](SECURITY.md#fix-releases)), and the npm tarball is the one packed from the tag and recorded
|
|
424
|
+
in [releases/](releases).
|
|
384
425
|
- They have **not been audited by an independent firm**. Do not put significant value behind programs built with
|
|
385
426
|
TypeSOL until such an audit is published.
|
|
386
427
|
- Audit your own programs as you would any Solana program. What a compiled program can rely on, and what is left to
|
|
@@ -408,5 +449,6 @@ built-in, a constraint or an error code. Then read [CONTRIBUTING.md](CONTRIBUTIN
|
|
|
408
449
|
|
|
409
450
|
## License
|
|
410
451
|
|
|
411
|
-
[MIT](LICENSE). The
|
|
412
|
-
[NOTICE](NOTICE) and
|
|
452
|
+
[MIT](LICENSE). The runtime and `typesol/testing` include code ported from MIT and Apache-2.0 projects, and the tests
|
|
453
|
+
use third-party program binaries and data that are not in the npm package: see [NOTICE](NOTICE) and
|
|
454
|
+
[test/programs/SOURCES.md](test/programs/SOURCES.md).
|
package/SECURITY.md
CHANGED
|
@@ -30,7 +30,7 @@ release (0.44.0 → 0.44.1), so a team can take the fix without taking new featu
|
|
|
30
30
|
no account layout, IDL or error code beyond what the fix itself needs;
|
|
31
31
|
- a program it refuses or builds to another binary is one the defect touches, and the CHANGELOG says which;
|
|
32
32
|
- 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
|
|
33
|
+
packages, `typesol-<version>-binary-diff.txt`; see [docs/testing.md](docs/testing.md#reproducing-a-release)), so a team can see whether
|
|
34
34
|
their program's binary changes.
|
|
35
35
|
|
|
36
36
|
Fixes go to the latest minor only; older minors are not maintained. A fix that needs a language or layout change
|