@typesol/cli 0.45.0 → 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 +227 -0
- package/README.md +64 -17
- package/SECURITY.md +9 -7
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +9 -0
- package/dist/cli.js +33 -15
- 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 +5 -0
- package/dist/compiler/index.js +10 -1
- package/dist/compiler/model.js +3 -2
- package/dist/compiler/toolchain.d.ts +50 -2
- package/dist/compiler/toolchain.js +96 -11
- package/dist/node-version.d.ts +4 -0
- package/dist/node-version.js +12 -0
- package/dist/tools/doctor.d.ts +41 -0
- package/dist/tools/doctor.js +96 -14
- package/dist/workspace.d.ts +9 -2
- package/dist/workspace.js +13 -3
- package/docker/deps/0.46.0.lock.json +1206 -0
- package/docs/ai.md +2 -1
- package/docs/architecture.md +7 -3
- package/docs/audit.md +6 -6
- 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 +42 -4
- 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 +18 -3
- package/docs/migrate-from-anchor.md +7 -6
- package/docs/security-model.md +3 -3
- package/docs/stability.md +3 -1
- package/docs/test-your-program.md +52 -15
- package/docs/troubleshooting.md +222 -100
- package/lib/typesol.d.ts +67 -22
- package/llms-full.txt +4915 -634
- package/llms.txt +12 -1
- package/package.json +2 -2
- package/releases/0.45.0.json +732 -0
- package/ts-plugin/index.js +16 -5
package/docs/mainnet.md
CHANGED
|
@@ -2,10 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
From an empty directory to a program on Solana mainnet-beta: create, test, deploy, publish the IDL, then check that
|
|
4
4
|
the deployed binary is the one your source builds. The program here is the counter that `typesol init` creates
|
|
5
|
-
(11,400 bytes, 11.1 KiB, built with TypeSOL 0.
|
|
5
|
+
(11,400 bytes, 11.1 KiB, built with TypeSOL 0.45.0 and platform-tools clang 20.1.7 for SBPF v0; other versions differ
|
|
6
6
|
slightly); any TypeSOL project works the same way.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
**Before you deploy anything that holds value.** TypeSOL has had internal security reviews by its maintainers, not an
|
|
9
|
+
independent audit ([status](security-model.md#status)). Do not put significant value behind a program built with it
|
|
10
|
+
until an external audit of the compiler and runtime is published, and audit your own program as you would any Solana
|
|
11
|
+
program.
|
|
12
|
+
|
|
13
|
+
You need Node.js 22.12 or later and the Agave CLI with platform-tools (see the README's [Quick start](../README.md#quick-start)).
|
|
9
14
|
|
|
10
15
|
**The toolchain you deploy with.** The binary is what the platform-tools' clang makes of the generated C, so the
|
|
11
16
|
toolchain is part of what you trust. Deploy with the one TypeSOL is tested with (Agave 3.1.10, platform-tools v1.52;
|
|
@@ -147,9 +152,13 @@ npx --no-install typesol verify my_app
|
|
|
147
152
|
|
|
148
153
|
`verify` rebuilds the program from `programs/my_app.ts`, reads the deployed one at the address in `typesol.json` from
|
|
149
154
|
the cluster in your Solana CLI config, and compares the bytes. `match` means anyone with your source and the same
|
|
150
|
-
TypeSOL version and toolchain gets exactly the program on chain (from 0.45.0 on, on any of the hosts measured: macOS arm64, Linux arm64, Linux x86_64; with 0.44.1 or earlier, a
|
|
155
|
+
TypeSOL version and toolchain gets exactly the program on chain (from 0.45.0 on, on any of the hosts measured: macOS arm64, Linux arm64 with the platform-tools `linux-aarch64` package as in [troubleshooting.md](troubleshooting.md#linux-arm64-the-agave-installer-fails-with-a-404), Linux x86_64; with 0.44.1 or earlier, a
|
|
151
156
|
program with 128-bit or signed division also needs the same kind of host). It also prints the upgrade authority and checks the IDL you published in step 5.
|
|
152
157
|
|
|
158
|
+
A match says only that the deployed bytes are what this source and this compiler build. It does not say that the
|
|
159
|
+
program, or the compiler, is correct, and it does not hold after the next upgrade: whoever holds the upgrade authority
|
|
160
|
+
it prints can replace the program at any time.
|
|
161
|
+
|
|
153
162
|
### Verifying someone else's program
|
|
154
163
|
|
|
155
164
|
With the source at the deployed commit, the program id and, ideally, the deployer's `<name>.build.json`:
|
|
@@ -182,6 +191,12 @@ registry: the evidence is the command and its output, which anyone can rerun.
|
|
|
182
191
|
|
|
183
192
|
## Later
|
|
184
193
|
|
|
194
|
+
- **Upgrade it.** `typesol deploy` again replaces the code at the same address; the accounts keep their bytes. If an
|
|
195
|
+
account struct changed, existing accounts do not match it. Only the size is checked (at least the struct's): a field
|
|
196
|
+
added fails with 3003 on an account exactly the old size. On one created with spare space or grown since, it passes
|
|
197
|
+
with no error: an appended field reads the spare bytes (zero unless written), and an inserted one makes the fields
|
|
198
|
+
after it read other fields' bytes. A field removed from the middle, or moved, also reads other fields' bytes without
|
|
199
|
+
an error. Migrate the accounts ([migrating an account](language-accounts.md#migrating-an-account)).
|
|
185
200
|
- **Freeze it.** `solana program set-upgrade-authority <program id> --final` makes the program immutable. It cannot
|
|
186
201
|
be undone.
|
|
187
202
|
- **Close it.** `solana program close <program id> --bypass-warning` returns the rent to the authority. The program
|
|
@@ -24,7 +24,9 @@ and error codes. Its notes (on stderr) list what an existing Anchor client would
|
|
|
24
24
|
token types for token accounts (the table below).
|
|
25
25
|
2. Move the constraints from `#[account(...)]` into the parameter types or the body.
|
|
26
26
|
3. Port the body. Integers are `bigint`s with `n` literals, and every `+ - * / %` is checked.
|
|
27
|
-
4. Test with `typesol/testing` ([test your program](test-your-program.md)), then compare the IDLs
|
|
27
|
+
4. Test with `typesol/testing` ([test your program](test-your-program.md)), then compare the IDLs, section by section
|
|
28
|
+
(with `jq`): `diff <(jq -S .instructions ../anchor/target/idl/my_program.json) <(jq -S .instructions
|
|
29
|
+
target/my_program/my_program.json)`, then the same for `.accounts`, `.types`, `.events` and `.errors`.
|
|
28
30
|
|
|
29
31
|
## Accounts and constraints
|
|
30
32
|
|
|
@@ -46,7 +48,7 @@ and error codes. Its notes (on stderr) list what an existing Anchor client would
|
|
|
46
48
|
| `owner = program`, `executable` | `Owner<A, "…">`, `Executable<A>` |
|
|
47
49
|
| `constraint = expr @ MyError::X` (or without an error: 2003) | `constraint(acct, expr, MyError.X)` (or `constraint(acct, expr)`) at the start of the body: it runs with `acct`'s checks, where Anchor runs it |
|
|
48
50
|
| `realloc = n, realloc::payer = p` | `realloc(acct, n, p)` |
|
|
49
|
-
| `Option<Account<'info, T>>` | `Mut<T> \| null` (the client passes the program id to leave it out) |
|
|
51
|
+
| `Option<Account<'info, T>>` | `Account<T> \| null`, or `Mut<T> \| null` with `#[account(mut)]` (the client passes the program id to leave it out) |
|
|
50
52
|
| `UncheckedAccount` / `AccountInfo` | `AccountInfo` / `Mut<AccountInfo>`: check what you rely on yourself |
|
|
51
53
|
| `SystemAccount<'info>` | `SystemAccount` / `Mut<SystemAccount>` |
|
|
52
54
|
| `Migration<'info, From, To>` | `Migrate<From, To>`, then `acct.migrate(payer, value)`; the old struct keeps its on-chain discriminator with `/** @discriminator account:<OldName> */` |
|
|
@@ -76,7 +78,7 @@ and error codes. Its notes (on stderr) list what an existing Anchor client would
|
|
|
76
78
|
| `#[account] pub struct T { … }` | `export interface T { … }` |
|
|
77
79
|
| `u8` … `u128`, `i8` … `i128`, `bool`, `Pubkey` | `u8` … `u128`, `i8` … `i128`, `boolean`, `Pubkey` |
|
|
78
80
|
| `[T; N]` | `FixedArray<T, N>` |
|
|
79
|
-
| `String` with `#[max_len(n)]` | `FixedString<N>`: a u32 length and N bytes, always N bytes long |
|
|
81
|
+
| `String` with `#[max_len(n)]` | `FixedString<N>`: a u32 length and room for N bytes, always 4 + N bytes long |
|
|
80
82
|
| `Vec<T>` with `#[max_len(n)]` | `Vec<T>` (any number, declared anywhere, stored after the fixed-size fields; it grows with `push(v, payer)`), or `FixedVec<T, n>`: a u32 length and room for n, always 4 + n × size bytes; in a `@layout borsh` struct, `Vec<T>` is Anchor's own, bounded only by the account |
|
|
81
83
|
| `Option<T>` | `Option<T>`: fixed size (1 + size of T) |
|
|
82
84
|
| `#[derive(AnchorSerialize…)] enum` | `export enum` (unit variants) or a data enum `type A = { kind: "X"; … } \| …` |
|
|
@@ -90,8 +92,7 @@ fields after them).
|
|
|
90
92
|
To keep an Anchor program's existing accounts, mark the struct `/** @layout borsh */`: it is then stored exactly as
|
|
91
93
|
Anchor stores it (`FixedString<N>` / `FixedVec<T, N>` / `Option<T>` become Borsh String / Vec / Option, N being the
|
|
92
94
|
`#[max_len]`), its IDL type is Anchor's, and the upgraded program reads and writes the accounts in place. `typesol port`
|
|
93
|
-
adds it for you. It costs some compute
|
|
94
|
-
several times cheaper than Anchor. Without it, accounts that use these types need a migration (or a new program) rather
|
|
95
|
+
adds it for you. It costs some compute: the account is unpacked and packed in every instruction that uses it. Without it, accounts that use these types need a migration (or a new program) rather
|
|
95
96
|
than an in-place upgrade. Everything else, including instruction arguments (`String`, `Option`, `Vec` are Borsh there),
|
|
96
97
|
matches byte for byte. A `@layout borsh` struct passed as a whole argument, returned or emitted is Borsh too, so an
|
|
97
98
|
Anchor instruction that takes or returns a struct with `String` / `Vec` / `Option` fields keeps its client bytes.
|
|
@@ -105,7 +106,7 @@ Anchor instruction that takes or returns a struct with `String` / `Vec` / `Optio
|
|
|
105
106
|
| `#[error_code] enum MyError { #[msg("…")] X }` | `export enum MyError { X = "…" }` (codes from 6000, in order; `X = ""` for a variant without `#[msg]`; `/** @code 6200 */` before a member for Anchor's `Y = 200`) |
|
|
106
107
|
| `f64` fields (events) | `f64`, made from the bits the program computed (`f64FromBits`) |
|
|
107
108
|
| `Option<[T; N]>`, structs of Options inside Options (`BankConfigOpt`) | `Option<FixedArray<T, N>>`; a struct argument holding Options is Borsh as Anchor sends it; an event holding one is `/** @layout borsh */` (`typesol port` writes it so) |
|
|
108
|
-
| `#[account(zero_copy)]`, `#[repr(C)]` types with `_pad` fields and `WrappedI80F48` | a fixed-layout struct with `/** @serialization bytemuck */` and `/** @repr c */`, `/** @idlName _pad0 */` on the padding, `/** @bytes */ value: i128` for the wrapped number ([
|
|
109
|
+
| `#[account(zero_copy)]`, `#[repr(C)]` types with `_pad` fields and `WrappedI80F48` | a fixed-layout struct with `/** @serialization bytemuck */` and `/** @repr c */`, `/** @idlName _pad0 */` on the padding, `/** @bytes */ value: i128` for the wrapped number ([zero-copy types](language-accounts.md#zero-copy-types-as-anchors-idl-describes-them)) |
|
|
109
110
|
| `require!(c, MyError::X)`, `err!(MyError::X)` | `require(c, MyError.X)`, `require(false, MyError.X)` |
|
|
110
111
|
| `require_keys_eq!(a, b)`, `err!(ErrorCode::AccountDidNotDeserialize)` (Anchor's own codes) | `require(a === b, AnchorError.RequireKeysEqViolated)` (or your own error), `require(false, AnchorError.AccountDidNotDeserialize)` |
|
|
111
112
|
| `init_if_needed` + `extensions::…` on a mint | `mint.createIfNeeded(…, { metadataPointer: {…}, … })`: an existing mint is checked as Anchor checks it (2024–2039) |
|
package/docs/security-model.md
CHANGED
|
@@ -26,9 +26,9 @@ Each holds for every instruction of every program the compiler accepts. A break
|
|
|
26
26
|
|
|
27
27
|
1. **Account count.** Fewer accounts than parameters fail (3005); more than the program takes (32, or its `MAX_ACCOUNTS`) fail before parsing (5113).
|
|
28
28
|
2. **Account types.** Each parameter is checked for what its type says: `Signer` signed (3010); `Mut<…>` writable
|
|
29
|
-
(2000); a program account (`Account<T>`, `Mut<T>`) owned by this program (3007),
|
|
30
|
-
|
|
31
|
-
initialized account of that kind (3007
|
|
29
|
+
(2000); a program account (`Account<T>`, `Mut<T>`) initialized (3012), owned by this program (3007), at least
|
|
30
|
+
`T`'s size (3003) and with `T`'s discriminator (3002), checked in that order; a `TokenAccount` / `Mint` an
|
|
31
|
+
initialized account of that kind of SPL Token or Token-2022 (3012 for an empty system account (never created, or closed), 3007 for an account of another program, 3003 for a token program's account that is not an initialized token account (or mint) of its length); program parameters at their fixed address and executable
|
|
32
32
|
(3008 / 3009); `SystemAccount` owned by the System Program (3011); `Zeroed<T>` owned, all-zero discriminator and
|
|
33
33
|
rent-exempt.
|
|
34
34
|
3. **No aliasing.** Two writable parameters are never the same account (2040), whatever slots the transaction uses,
|
package/docs/stability.md
CHANGED
|
@@ -63,7 +63,9 @@ Meant to stay as they are; a change before 1.0 would be a breaking change listed
|
|
|
63
63
|
|
|
64
64
|
From 0.45.0 on, the programs measured build to the same bytes on each host measured. Measured with this release's
|
|
65
65
|
compiler and platform-tools v1.52 on macOS arm64 (the platform-tools `osx-aarch64` package, native), Linux arm64 and
|
|
66
|
-
Linux x86_64 (the `linux-aarch64` and `linux-x86_64` packages, in containers; x86_64 is the `--docker` image
|
|
66
|
+
Linux x86_64 (the `linux-aarch64` and `linux-x86_64` packages, in containers; x86_64 is the `--docker` image; Linux
|
|
67
|
+
arm64 has no Agave CLI, so there the package is set up by hand with `TYPESOL_SBF_SDK`, as in
|
|
68
|
+
[troubleshooting.md](troubleshooting.md#linux-arm64-the-agave-installer-fails-with-a-404)): for
|
|
67
69
|
SBPF v0 (the default), the 76 programs of the sources (`scripts/release-manifest.ts`, every program under `examples/`
|
|
68
70
|
and `showcase/`); for SBPF v1 and v2, the 14 programs of `test/golden/binaries.json` (counter, vault, escrow, multisig
|
|
69
71
|
and the 10 below).
|
|
@@ -24,7 +24,8 @@ it("counts", async () => {
|
|
|
24
24
|
## Instructions
|
|
25
25
|
|
|
26
26
|
`t.pda(...seeds)` derives this program's PDA for the seeds; `t.pdaWithBump(...seeds)` gives `[address, bump]`, for an
|
|
27
|
-
instruction that takes the bump as an argument
|
|
27
|
+
instruction that takes the bump as an argument (prefer a stored bump:
|
|
28
|
+
[PDAs](language-pdas.md#checking-a-pda-in-the-body)).
|
|
28
29
|
|
|
29
30
|
`t.ix(name, args, accounts, remaining?)` builds one instruction.
|
|
30
31
|
|
|
@@ -39,6 +40,26 @@ instruction that takes the bump as an argument.
|
|
|
39
40
|
|
|
40
41
|
`t.send(payer, ...ixs)` sends them in one transaction; keypairs given as accounts sign too.
|
|
41
42
|
|
|
43
|
+
### Seeds of other widths
|
|
44
|
+
|
|
45
|
+
`t.pda` takes text, addresses or keypairs, raw bytes, and bigints, which it encodes as 8-byte little-endian u64s, as
|
|
46
|
+
the program encodes a `u64` seed. A seed of another width is passed as its bytes: for a program that derives
|
|
47
|
+
`["vault", owner.key, index]` with `index: u16`,
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
const u16 = (n: number) => {
|
|
51
|
+
const b = new Uint8Array(2);
|
|
52
|
+
new DataView(b.buffer).setUint16(0, n, true); // little-endian, as the program reads a u16 seed
|
|
53
|
+
return b;
|
|
54
|
+
};
|
|
55
|
+
const vault = await t.pda("vault", alice, u16(3));
|
|
56
|
+
t.ok(await t.send(alice, t.ix("open", { index: 3 }, { owner: alice, vault })));
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`t.pda("vault", alice, 3n)` would be another address (8 bytes for the index). `setUint32` gives a `u32` seed the same
|
|
60
|
+
way. A string that is a valid address is taken as an address; pass `new TextEncoder().encode(s)` for text that only
|
|
61
|
+
looks like one.
|
|
62
|
+
|
|
42
63
|
## Results
|
|
43
64
|
|
|
44
65
|
| Helper | Gives |
|
|
@@ -51,6 +72,22 @@ instruction that takes the bump as an argument.
|
|
|
51
72
|
| `t.errorName(code)` | the name of an error code: your program's, TypeSOL's or Anchor's |
|
|
52
73
|
| `t.connection` | `{ rpc, rpcSubscriptions }` answered by this LiteSVM, for the generated client: `counter.sendInstructions(t.connection, alice, [ix])`, `counter.accounts.Counter.fetch(t.connection.rpc, address)`, views, `resolve`, `watch` and `watchEvents` (as on a cluster: `watch` yields when a later transaction changes the account, not at once; `watchEvents` gets transactions sent after it subscribed, failed ones included in the stream and skipped by the client) |
|
|
53
74
|
|
|
75
|
+
### Expecting an error
|
|
76
|
+
|
|
77
|
+
A test that a check holds sends the transaction that breaks it and compares the code. The program here is the vault
|
|
78
|
+
of [seeds of other widths](#seeds-of-other-widths), whose `spend` requires `amount <= 10n` and whose only error enum is
|
|
79
|
+
`export enum VaultError { TooMuch = "Amount above the limit" }`, so `TooMuch` is 6000 (in the guide's
|
|
80
|
+
[`spend`](language-accounts.md#constraints), `NotOwner` comes first and `TooMuch` is 6001):
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
const res = await t.send(alice, t.ix("spend", { amount: 50n }, { owner: alice, vault }));
|
|
84
|
+
expect(t.errorCode(res)).toBe(6000);
|
|
85
|
+
expect(t.errorName(t.errorCode(res))).toBe("TooMuch");
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`t.errorCode` throws when the transaction succeeded or failed without a custom code (a runtime error such as missing
|
|
89
|
+
signatures), so the test fails then too.
|
|
90
|
+
|
|
54
91
|
## Tokens and time
|
|
55
92
|
|
|
56
93
|
| Helper | Does |
|
|
@@ -60,6 +97,20 @@ instruction that takes the bump as an argument.
|
|
|
60
97
|
| `t.tokenBalance(address)` | the amount a token account holds, or `null` when it does not exist |
|
|
61
98
|
| `t.warp({ unixTimestamp?, slot?, seconds? })` | moves the Clock: to a timestamp or slot, or forward by `seconds` |
|
|
62
99
|
|
|
100
|
+
## Accounts from a cluster
|
|
101
|
+
|
|
102
|
+
To test against accounts that exist on mainnet (a mint, an oracle, another program), list them in `typesol.json` as
|
|
103
|
+
`"clone": ["<address>", …]` and run `typesol clone --url mainnet-beta` once (or `typesol clone <address>…`). They are
|
|
104
|
+
written to `tests/accounts/`, which `testProgram` loads into its LiteSVM before your first test; commit the directory so
|
|
105
|
+
the tests run offline. `loadClonedAccounts(svm, dir)` does the same for a LiteSVM of your own.
|
|
106
|
+
|
|
107
|
+
`t.svm`, `t.programId`, `t.idl` and `t.coder` are there for anything else. `programHarness(svm, programId, idl)` gives the same helpers for a
|
|
108
|
+
program you loaded yourself, and `svmConnection(svm)` the RPC pair alone (for any LiteSVM, e.g. one with an Anchor
|
|
109
|
+
program loaded). Transactions sent through it run at once; `getProgramAccounts` (`fetchAll`) sees the accounts those
|
|
110
|
+
transactions named, plus any you `track(...)`.
|
|
111
|
+
|
|
112
|
+
The module needs `litesvm` and `@anchor-lang/core`, which `typesol init` adds to `devDependencies`.
|
|
113
|
+
|
|
63
114
|
## Epochs and staking
|
|
64
115
|
|
|
65
116
|
LiteSVM's `warpToSlot` leaves `Clock.epoch` where it was, and its StakeHistory stays empty, so the Stake program takes
|
|
@@ -106,17 +157,3 @@ expect(cluster.activation(stake).effective).toBe(90n * SOL);
|
|
|
106
157
|
(`newRateActivationEpoch` 0, as the Stake program has it); `null` gives the original 25%.
|
|
107
158
|
- **Rent.** In LiteSVM 1.6.1 the Stake program holds back the Rent sysvar's minimum for 200 bytes
|
|
108
159
|
(`svm.minimumBalanceForRentExemption(200n)`), which is less than the `rentExemptReserve` its Initialize stores.
|
|
109
|
-
|
|
110
|
-
## Accounts from a cluster
|
|
111
|
-
|
|
112
|
-
To test against accounts that exist on mainnet (a mint, an oracle, another program), list them in `typesol.json` as
|
|
113
|
-
`"clone": ["<address>", …]` and run `typesol clone --url mainnet-beta` once (or `typesol clone <address>…`). They are
|
|
114
|
-
written to `tests/accounts/`, which `testProgram` loads into its LiteSVM before your first test; commit the directory so
|
|
115
|
-
the tests run offline. `loadClonedAccounts(svm, dir)` does the same for a LiteSVM of your own.
|
|
116
|
-
|
|
117
|
-
`t.svm`, `t.programId`, `t.idl` and `t.coder` are there for anything else. `programHarness(svm, programId, idl)` gives the same helpers for a
|
|
118
|
-
program you loaded yourself, and `svmConnection(svm)` the RPC pair alone (for any LiteSVM, e.g. one with an Anchor
|
|
119
|
-
program loaded). Transactions sent through it run at once; `getProgramAccounts` (`fetchAll`) sees the accounts those
|
|
120
|
-
transactions named, plus any you `track(...)`.
|
|
121
|
-
|
|
122
|
-
The module needs `litesvm` and `@anchor-lang/core`, which `typesol init` adds to `devDependencies`.
|
package/docs/troubleshooting.md
CHANGED
|
@@ -1,103 +1,225 @@
|
|
|
1
1
|
# Troubleshooting
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
`cargo-build-sbf --version` once. TypeSOL looks in `~/.local/share/solana/install/active_release/bin/platform-tools-sdk/sbf`
|
|
5
|
-
and next to `cargo-build-sbf` on PATH; set `TYPESOL_SBF_SDK` to a `platform-tools-sdk/sbf` directory otherwise.
|
|
6
|
-
|
|
7
|
-
**"platform-tools missing" / "no SBPF v2 libraries"** — `cargo-build-sbf --force-tools-install`.
|
|
8
|
-
|
|
9
|
-
**"warning: this build uses clang … TypeSOL is tested with clang 20.1.7-rust-dev …"** — the active platform-tools are
|
|
10
|
-
not the ones the release is tested with (platform-tools v1.52, from Agave 3.1.10). The build goes on, but the C TypeSOL
|
|
11
|
-
generates is only checked against that clang: another one can compile it to other bytes, and what the C relies on
|
|
12
|
-
includes backend details (how the SBF backend passes struct arguments was behind a defect fixed after 0.43.0). Install the tested ones with
|
|
13
|
-
`cargo-build-sbf --install-only --force-tools-install --tools-version v1.52`; `typesol doctor` shows which are active.
|
|
14
|
-
In CI, `--toolchain-strict` (or `TYPESOL_TOOLCHAIN=strict`) turns the warning into an error.
|
|
15
|
-
|
|
16
|
-
**`typesol verify` says MISMATCH** — first make sure the same sources (imports included), TypeSOL version and SBPF
|
|
17
|
-
version are used. Then the toolchain: verify prints the rebuild's clang and platform-tools, and the deployed build's
|
|
18
|
-
when a `<name>.build.json` describes the deployed bytes (`--manifest <file>`, one next to a given `.so`, or the local
|
|
19
|
-
build's). A program on chain carries no such record, so keep the build manifest of every deployment.
|
|
20
|
-
|
|
21
|
-
**`--docker needs Docker: docker is not installed` / `the Docker daemon is not running`** — `build --docker` and
|
|
22
|
-
`verify --docker` run in a container: install Docker, or start Docker Desktop (or `sudo systemctl start docker`).
|
|
23
|
-
`typesol doctor` has a `docker` row. Nothing is built without it; drop `--docker` to build with your own platform-tools.
|
|
24
|
-
|
|
25
|
-
**`docker build of typesol-build:… failed`** — the first `--docker` build makes the image, which needs the network:
|
|
26
|
-
the base images from Docker Hub, the Agave and platform-tools release files from GitHub, the TypeSOL tarball from npm.
|
|
27
|
-
A `checksum` error means a downloaded file is not the one the Dockerfile pins (retry; if it persists, report it).
|
|
28
|
-
`typesol tarball check: integrity …` means the tarball npm served is not the one `releases/<version>.json` records:
|
|
29
|
-
do not use that version until it is explained. `typesol dependency lock: …` means the lock does not describe the
|
|
30
|
-
package's dependencies or names a package without a registry integrity; an `EINTEGRITY` error from `npm ci` means a
|
|
31
|
-
downloaded dependency is not the one the lock records: the same.
|
|
32
|
-
|
|
33
|
-
**`the local image typesol-build:… was not built from this release record and dependency lock`** — an image of that
|
|
34
|
-
tag exists, made from a record or lock with other values (it names them). Two records of one version disagree, so
|
|
35
|
-
find out which is right before going on; to build from the one given now, `docker image rm` the tag and run again.
|
|
36
|
-
|
|
37
|
-
**`no dependency lock for TypeSOL <version>`** — neither this package nor that version's tarball has
|
|
38
|
-
`docker/deps/<version>.lock.json`: use a later `@typesol/cli`, which ships the locks of the versions before it. On arm64 machines the image is linux/amd64 and runs emulated: Docker
|
|
39
|
-
Desktop provides the x86_64 emulation (QEMU or Rosetta); other Docker installs may need `binfmt` for amd64.
|
|
40
|
-
|
|
41
|
-
**`no release record for TypeSOL <version>`** / **`could not fetch the release record`** — the container installs only
|
|
42
|
-
versions whose tarball has a record: the package's own, or `releases/<version>.json` on the repository's main branch,
|
|
43
|
-
which `--docker` fetches for a release newer than the package. Offline (or behind a proxy that blocks
|
|
44
|
-
raw.githubusercontent.com), pass the record yourself with `--release-record releases/<version>.json` from a checkout,
|
|
45
|
-
or choose a version the package records with `--typesol-version`. HTTP 404 means the repository has no record for that
|
|
46
|
-
version: check that it is a released version. 0.42.0 and earlier have no record.
|
|
47
|
-
|
|
48
|
-
**`this project installs typesol X …, but this is typesol Y`** — a `typesol` other than the project's ran `--docker`.
|
|
49
|
-
Run the project's own (`npx --no-install typesol …`), or say which version to use with `--typesol-version`.
|
|
50
|
-
|
|
51
|
-
**`the container build failed … the container sees only <dir>`** — the compiler's error is printed above it. The
|
|
52
|
-
container mounts only the project root (or a single file's directory): an import from outside it is missing there.
|
|
53
|
-
|
|
54
|
-
**`verify` says `differs host`** — the same TypeSOL (0.44.1 or earlier) and toolchain built the two sides on
|
|
55
|
-
different hosts. That may be the cause if the program has 128-bit or signed division: those versions linked
|
|
56
|
-
platform-tools' compiler-builtins, which each host package lays out differently. Rebuild on the deployed side's kind
|
|
57
|
-
of host (or with `--docker`, if the deployed build was one). From 0.45.0 on the host is not a difference between
|
|
58
|
-
macOS arm64, Linux arm64 and Linux x86_64 (the hosts measured); `differs host (not measured)` means one side was
|
|
59
|
-
built on another host.
|
|
60
|
-
|
|
61
|
-
**A 0.44.x program with division, deployed from macOS or Linux arm64, does not match `verify --docker`** — 0.44.0 and
|
|
62
|
-
0.44.1 linked platform-tools' compiler-builtins, so a program that calls 128-bit or signed division built to other
|
|
63
|
-
bytes on each host package; the container is linux/amd64 and gives the Linux x86_64 bytes. What verifies it is a
|
|
64
|
-
0.44.x install (the version in its `.build.json`) on the same kind of host as the one that built it, without
|
|
65
|
-
`--docker`: `npx @typesol/cli@0.44.1 verify …` on macOS arm64 for a build made there.
|
|
66
|
-
|
|
67
|
-
**Windows** — not tested; use WSL2 with the Linux Agave CLI.
|
|
68
|
-
|
|
69
|
-
**Node errors such as `ERR_UNKNOWN_FILE_EXTENSION` or `ERR_REQUIRE_ESM`** — use Node.js 22.12 or newer.
|
|
70
|
-
|
|
71
|
-
**"`solana` was not found on PATH"** (deploy) — install the Agave CLI, or use `typesol deploy --dry-run` and run the
|
|
72
|
-
printed commands yourself.
|
|
73
|
-
|
|
74
|
-
**"… is missing, but typesol.json records …"** — the program keypair under `target/deploy/` was deleted or replaced.
|
|
75
|
-
Restore it from your backup. Without it you cannot upgrade the deployed program; removing `"address"` from
|
|
76
|
-
`typesol.json` gives the program a new address.
|
|
77
|
-
|
|
78
|
-
**A build error you don't recognize** — the compiler adds a `hint:` line under TypeScript's message where TypeScript's
|
|
79
|
-
own advice points the wrong way for a program. The usual ones: integers are `bigint` (`1n`, `u64` parameters, not
|
|
80
|
-
`number`); `require`, `log`, `min`, `max` and `fixedArray` are imported from `"typesol"`; arrays are read with `.get(i)`
|
|
81
|
-
and written with `.set(i, v)`; an account you change is a `Mut<T>` parameter; there is no `async`, `try`, `throw` or
|
|
82
|
-
`class`. The full list of what the subset covers is in [language.md](language.md).
|
|
83
|
-
|
|
84
|
-
**A transaction fails with a custom error** — see [errors.md](errors.md). Failures raised by the
|
|
85
|
-
compiler's checks log their TypeScript location, e.g. `TypeSOL: arithmetic overflow (vault.ts:42)`.
|
|
86
|
-
|
|
87
|
-
**Heap errors (5110) building strings** — strings are allocated on a 32 KiB heap and never freed. Build less text,
|
|
88
|
-
or declare `const HEAP_SIZE_KIB = 64n` and add a ComputeBudget `requestHeapFrame` instruction to the transaction.
|
|
89
|
-
|
|
90
|
-
**`typesol idl publish` fails on a local validator with "invalid instruction data"** — the System Program of
|
|
91
|
-
`solana-test-validator` (Agave 3.1 included) rejects a System instruction that the current Program Metadata program
|
|
92
|
-
uses. Publishing works on mainnet-beta. The error shows the failing transaction's last log lines.
|
|
93
|
-
|
|
94
|
-
**"instruction X (with the helpers inlined into it) needs N bytes of stack; SBPF v0 gives each function 4096"** — under
|
|
95
|
-
SBPF v0 (the default) every function gets a fixed 4 KiB stack frame, and going past it corrupts memory, so the build
|
|
96
|
-
refuses it. SBPF v1 and v2 (`--sbpf v1` / `v2`) grow frames dynamically, so this limit does not apply there. Large structs and arrays copied into typed
|
|
97
|
-
locals (`const q: Big = acct.big`) are the usual cause: bind them without a type (`const q = acct.big`, a reference
|
|
98
|
-
into the account data). The message lists the biggest locals (clang's frame layout: a local's name and the source
|
|
99
|
-
line near it; the locals of an inlined helper show as unnamed, with the helpers' locals that may be them). Helpers are
|
|
100
|
-
often inlined into their instruction, so their locals count toward its frame: mark one `/** @noinline */` to give it a
|
|
101
|
-
4 KiB frame of its own (a few compute units per call), or declare a large local list or struct of an instruction
|
|
102
|
-
`/** @heap */` to keep it on the heap (about 18 CU for the allocation).
|
|
3
|
+
Grouped by when they happen; within each group, the problems a first run meets come first.
|
|
103
4
|
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
### `TypeSOL needs Node.js 22.12 or later`
|
|
8
|
+
|
|
9
|
+
The CLI checks the Node.js version before anything else. On an older one, `npm install` can fail inside npm and the
|
|
10
|
+
tests with `Map.groupBy is not a function`; install a current Node.js (https://nodejs.org, or `nvm install 22`).
|
|
11
|
+
|
|
12
|
+
### `npm error 404 … typesol - Not found`
|
|
13
|
+
|
|
14
|
+
`npx --no-install typesol` ran outside a project, or before `npm install` in it: `typesol` is the name projects install
|
|
15
|
+
the package under, not a package on npm. Run `npx @typesol/cli …` there, or `npm install` in the project first.
|
|
16
|
+
|
|
17
|
+
### "the Agave CLI is not installed" (formerly "Solana SBF SDK not found")
|
|
18
|
+
|
|
19
|
+
Install it and its platform-tools as in the README's [Quick start](../README.md#quick-start):
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
sh -c "$(curl -sSfL https://release.anza.xyz/v3.1.10/install)"
|
|
23
|
+
# The installer adds this line to ~/.profile for new shells, and this shell needs it now:
|
|
24
|
+
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
|
|
25
|
+
# 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:
|
|
26
|
+
cargo-build-sbf --install-only --force-tools-install --tools-version v1.52
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
TypeSOL looks in `~/.local/share/solana/install/active_release/bin/platform-tools-sdk/sbf` and next to
|
|
30
|
+
`cargo-build-sbf` on PATH; set `TYPESOL_SBF_SDK` to a `platform-tools-sdk/sbf` directory otherwise. On Linux arm64 see
|
|
31
|
+
[Linux arm64: the Agave installer fails with a 404](#linux-arm64-the-agave-installer-fails-with-a-404).
|
|
32
|
+
|
|
33
|
+
### `cargo-build-sbf: command not found` right after installing
|
|
34
|
+
|
|
35
|
+
The Agave installer adds its `bin` directory to `PATH` in `~/.profile`, which only new login shells read. In the same
|
|
36
|
+
shell, run `export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"`.
|
|
37
|
+
|
|
38
|
+
### "the Agave CLI is installed, but not its platform-tools" (formerly "platform-tools missing") / "no SBPF v2 libraries"
|
|
39
|
+
|
|
40
|
+
`cargo-build-sbf --install-only --force-tools-install --tools-version v1.52`. Neither `cargo-build-sbf --version` (it
|
|
41
|
+
downloads nothing) nor `cargo-build-sbf --force-tools-install` alone (it needs Cargo and a Cargo project) installs them.
|
|
42
|
+
|
|
43
|
+
### Linux arm64: the Agave installer fails with a 404
|
|
44
|
+
|
|
45
|
+
Anza publishes no Agave CLI for Linux arm64 (`agave-install-init-aarch64-unknown-linux-gnu` is not there), but
|
|
46
|
+
platform-tools has a `linux-aarch64` package. With it and the SDK's C files from the x86_64 release (headers and
|
|
47
|
+
linker script, as the `--docker` image takes them), `typesol build` and LiteSVM tests work; `typesol doctor` prints
|
|
48
|
+
these commands there (they need `curl` and `bzip2`):
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
mkdir -p "$HOME/.local/share/typesol-sdk/sbf/dependencies/platform-tools"
|
|
52
|
+
# About 215 MB, for the C headers and linker script of the SDK only:
|
|
53
|
+
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
|
|
54
|
+
# About 515 MB, 1.6 GB unpacked, and quiet for a minute or two:
|
|
55
|
+
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"
|
|
56
|
+
touch "$HOME/.local/share/typesol-sdk/sbf/dependencies/platform-tools-v1.52.md"
|
|
57
|
+
# Add this line to ~/.profile too, for new shells:
|
|
58
|
+
export TYPESOL_SBF_SDK="$HOME/.local/share/typesol-sdk/sbf"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Deploying needs the Solana CLI: deploy from macOS or Linux x86_64, or build the Agave CLI from source
|
|
62
|
+
(https://docs.anza.xyz/cli/install). `build --docker` (linux/amd64, emulated) works on any host with Docker.
|
|
63
|
+
|
|
64
|
+
### Windows
|
|
65
|
+
|
|
66
|
+
Not tested; use WSL2 with the Linux Agave CLI.
|
|
67
|
+
|
|
68
|
+
### Node errors such as `ERR_UNKNOWN_FILE_EXTENSION` or `ERR_REQUIRE_ESM`
|
|
69
|
+
|
|
70
|
+
Use Node.js 22.12 or newer.
|
|
71
|
+
|
|
72
|
+
### "warning: this build uses clang … TypeSOL is tested with clang 20.1.7-rust-dev …"
|
|
73
|
+
|
|
74
|
+
The active platform-tools are not the ones the release is tested with (platform-tools v1.52, from Agave 3.1.10). The
|
|
75
|
+
build goes on, but the C TypeSOL generates is only checked against that clang: another one can compile it to other
|
|
76
|
+
bytes, and what the C relies on includes backend details (how the SBF backend passes struct arguments was behind a
|
|
77
|
+
defect fixed after 0.43.0). Install the tested ones with `cargo-build-sbf --install-only --force-tools-install
|
|
78
|
+
--tools-version v1.52`; `typesol doctor` shows which are active. In CI, `--toolchain-strict` (or
|
|
79
|
+
`TYPESOL_TOOLCHAIN=strict`) turns the warning into an error.
|
|
80
|
+
|
|
81
|
+
## Writing and running a program
|
|
82
|
+
|
|
83
|
+
### A build error you don't recognize
|
|
84
|
+
|
|
85
|
+
The compiler adds a `hint:` line under TypeScript's message where TypeScript's own advice points the wrong way for a
|
|
86
|
+
program (and for a global a program does not have, such as `console` or `process`, says so in place of TypeScript's
|
|
87
|
+
advice to add a library). The usual ones: integers are `bigint` (`1n`, `u64` parameters, not `number`); `require`,
|
|
88
|
+
`log`, `min`, `max`, `fixedArray`, the types (`Signer`, `Mut`, …) and the integer casts are imported from `"typesol"` (a
|
|
89
|
+
cast such as `u64(x)` without `type`: `import { u64 }`); arrays are read with `.get(i)` and written with `.set(i, v)`;
|
|
90
|
+
an account you change is a `Mut<T>` parameter; the time is `now()`, not `Date.now()`; there is no `async`, `try`,
|
|
91
|
+
`throw` or `class`. The full list of what the subset covers is in [language.md](language.md).
|
|
92
|
+
|
|
93
|
+
### A transaction fails with a custom error
|
|
94
|
+
|
|
95
|
+
See [errors.md](errors.md). Failures raised by the compiler's checks log their TypeScript location, e.g. `TypeSOL:
|
|
96
|
+
arithmetic overflow (vault.ts:42)`.
|
|
97
|
+
|
|
98
|
+
### "exceeded CUs meter" / "Computational budget exceeded"
|
|
99
|
+
|
|
100
|
+
The transaction ran out of compute units: by default each instruction gets 200,000, and the logs end with `Program
|
|
101
|
+
<id> consumed 200000 of 200000 compute units` and `… failed: exceeded CUs meter at BPF instruction …`. Ask for more,
|
|
102
|
+
up to 1,400,000 per transaction, with a ComputeBudget `SetComputeUnitLimit` instruction placed before the others
|
|
103
|
+
(`getSetComputeUnitLimitInstruction({ units })` from `@solana-program/compute-budget`, or the bytes `[2, units as a
|
|
104
|
+
u32 little-endian]` to `ComputeBudget111111111111111111111111111111`). The generated client's `sendInstructions` and
|
|
105
|
+
the testing library's `t.send(payer, ...ixs)` send the instructions they are given, so pass it first:
|
|
106
|
+
`t.send(alice, setLimit, t.ix(…))`. To spend less, find the costly lines with `typesol build --profile` and `typesol
|
|
107
|
+
profile` ([limits and costs](language-basics.md#limits-and-costs)).
|
|
108
|
+
|
|
109
|
+
### `Transaction size … exceeds limit of 1232 bytes` / "transaction too large"
|
|
110
|
+
|
|
111
|
+
A transaction is at most 1,232 bytes, signatures, account addresses and instruction data included. Kit refuses to send
|
|
112
|
+
a larger one (the first message), and an RPC node refuses it too. Split the work into several transactions, pass
|
|
113
|
+
fewer accounts, or send large data in chunks into an account the program reads; with many accounts, a version 0
|
|
114
|
+
transaction with an address lookup table costs one byte per account instead of 32 (kit's
|
|
115
|
+
`compressTransactionMessageUsingAddressLookupTables`) ([limits and costs](language-basics.md#limits-and-costs)).
|
|
116
|
+
|
|
117
|
+
### Heap errors (5110) building strings
|
|
118
|
+
|
|
119
|
+
Strings are allocated on a 32 KiB heap and never freed. Build less text, or declare `const HEAP_SIZE_KIB = 64n` and add
|
|
120
|
+
a ComputeBudget `requestHeapFrame` instruction to the transaction.
|
|
121
|
+
|
|
122
|
+
### "instruction X (with the helpers inlined into it) needs N bytes of stack; SBPF v0 gives each function 4096"
|
|
123
|
+
|
|
124
|
+
Under SBPF v0 (the default) every function gets a fixed 4 KiB stack frame, and going past it corrupts memory, so the
|
|
125
|
+
build refuses it. SBPF v1 and v2 (`--sbpf v1` / `v2`) grow frames dynamically, so this limit does not apply there. Large
|
|
126
|
+
structs and arrays copied into typed locals (`const q: Big = acct.big`) are the usual cause: bind them without a type
|
|
127
|
+
(`const q = acct.big`, a reference into the account data). The message lists the biggest locals (clang's frame layout: a
|
|
128
|
+
local's name and the source line near it; the locals of an inlined helper show as unnamed, with the helpers' locals that
|
|
129
|
+
may be them). Helpers are often inlined into their instruction, so their locals count toward its frame: mark one `/**
|
|
130
|
+
@noinline */` to give it a 4 KiB frame of its own (a few compute units per call), or declare a large local list or
|
|
131
|
+
struct of an instruction `/** @heap */` to keep it on the heap (about 18 CU for the allocation).
|
|
132
|
+
|
|
133
|
+
### "… is missing, but typesol.json records …"
|
|
134
|
+
|
|
135
|
+
The program keypair under `target/deploy/` was deleted or replaced. Restore it from your backup. Without it you cannot
|
|
136
|
+
upgrade the deployed program; removing `"address"` from `typesol.json` gives the program a new address.
|
|
137
|
+
|
|
138
|
+
## Deploy
|
|
139
|
+
|
|
140
|
+
### `no payer keypair at ~/.config/solana/id.json` (deploy)
|
|
141
|
+
|
|
142
|
+
`solana-keygen new` creates it (or pass `--keypair <file>`); fund it on devnet with `solana airdrop 2 --url devnet`.
|
|
143
|
+
Nothing is sent before it exists.
|
|
144
|
+
|
|
145
|
+
### "`solana` was not found on PATH" (deploy)
|
|
146
|
+
|
|
147
|
+
Install the Agave CLI, or use `typesol deploy --dry-run` and run the printed commands yourself.
|
|
148
|
+
|
|
149
|
+
### `typesol idl publish` fails on a local validator with "invalid instruction data"
|
|
150
|
+
|
|
151
|
+
The System Program of `solana-test-validator` (Agave 3.1 included) rejects a System instruction that the current Program
|
|
152
|
+
Metadata program uses. The error shows the failing transaction's last log lines. No option fixes it locally: the System
|
|
153
|
+
Program is part of the validator. Publish where the Program Metadata program is deployed, mainnet-beta or devnet
|
|
154
|
+
(`npx --no-install typesol idl publish --url devnet`; [publish the IDL](mainnet.md#5-publish-the-idl)); against a local
|
|
155
|
+
validator, clients read the IDL file the build writes (`target/<name>/<name>.json`, [client.md](client.md)).
|
|
156
|
+
|
|
157
|
+
## Verify and `--docker`
|
|
158
|
+
|
|
159
|
+
### `typesol verify` says MISMATCH
|
|
160
|
+
|
|
161
|
+
First make sure the same sources (imports included), TypeSOL version and SBPF version are used. Then the toolchain:
|
|
162
|
+
verify prints the rebuild's clang and platform-tools, and the deployed build's when a `<name>.build.json` describes the
|
|
163
|
+
deployed bytes (`--manifest <file>`, one next to a given `.so`, or the local build's). A program on chain carries no
|
|
164
|
+
such record, so keep the build manifest of every deployment.
|
|
165
|
+
|
|
166
|
+
### `--docker needs Docker: docker is not installed` / `the Docker daemon is not running`
|
|
167
|
+
|
|
168
|
+
`build --docker` and `verify --docker` run in a container: install Docker, or start Docker Desktop (or `sudo systemctl
|
|
169
|
+
start docker`). `typesol doctor` has a `docker` row. Nothing is built without it; drop `--docker` to build with your own
|
|
170
|
+
platform-tools.
|
|
171
|
+
|
|
172
|
+
### `docker build of typesol-build:… failed`
|
|
173
|
+
|
|
174
|
+
The first `--docker` build makes the image, which needs the network: the base images from Docker Hub, the Agave and
|
|
175
|
+
platform-tools release files from GitHub, the TypeSOL tarball from npm. A `checksum` error means a downloaded file is
|
|
176
|
+
not the one the Dockerfile pins (retry; if it persists, report it). `typesol tarball check: integrity …` means the
|
|
177
|
+
tarball npm served is not the one `releases/<version>.json` records: do not use that version until it is explained.
|
|
178
|
+
`typesol dependency lock: …` means the lock does not describe the package's dependencies or names a package without a
|
|
179
|
+
registry integrity; an `EINTEGRITY` error from `npm ci` means a downloaded dependency is not the one the lock records:
|
|
180
|
+
the same.
|
|
181
|
+
|
|
182
|
+
### `the local image typesol-build:… was not built from this release record and dependency lock`
|
|
183
|
+
|
|
184
|
+
An image of that tag exists, made from a record or lock with other values (it names them). Two records of one version
|
|
185
|
+
disagree, so find out which is right before going on; to build from the one given now, `docker image rm` the tag and run
|
|
186
|
+
again.
|
|
187
|
+
|
|
188
|
+
### `no dependency lock for TypeSOL <version>`
|
|
189
|
+
|
|
190
|
+
Neither this package nor that version's tarball has `docker/deps/<version>.lock.json`: use a later `@typesol/cli`, which
|
|
191
|
+
ships the locks of the versions before it. On arm64 machines the image is linux/amd64 and runs emulated: Docker Desktop
|
|
192
|
+
provides the x86_64 emulation (QEMU or Rosetta); other Docker installs may need `binfmt` for amd64.
|
|
193
|
+
|
|
194
|
+
### `no release record for TypeSOL <version>` / `could not fetch the release record`
|
|
195
|
+
|
|
196
|
+
The container installs only versions whose tarball has a record: the package's own, or `releases/<version>.json` on the
|
|
197
|
+
repository's main branch, which `--docker` fetches for a release newer than the package. Offline (or behind a proxy that
|
|
198
|
+
blocks raw.githubusercontent.com), pass the record yourself with `--release-record releases/<version>.json` from a
|
|
199
|
+
checkout, or choose a version the package records with `--typesol-version`. HTTP 404 means the repository has no record
|
|
200
|
+
for that version: check that it is a released version. 0.42.0 and earlier have no record.
|
|
201
|
+
|
|
202
|
+
### `this project installs typesol X …, but this is typesol Y`
|
|
203
|
+
|
|
204
|
+
A `typesol` other than the project's ran `--docker`. Run the project's own (`npx --no-install typesol …`), or say which
|
|
205
|
+
version to use with `--typesol-version`.
|
|
206
|
+
|
|
207
|
+
### `the container build failed … the container sees only <dir>`
|
|
208
|
+
|
|
209
|
+
The compiler's error is printed above it. The container mounts only the project root (or a single file's directory): an
|
|
210
|
+
import from outside it is missing there.
|
|
211
|
+
|
|
212
|
+
### `verify` says `differs host`
|
|
213
|
+
|
|
214
|
+
The same TypeSOL (0.44.1 or earlier) and toolchain built the two sides on different hosts. That may be the cause if the
|
|
215
|
+
program has 128-bit or signed division: those versions linked platform-tools' compiler-builtins, which each host package
|
|
216
|
+
lays out differently. Rebuild on the deployed side's kind of host (or with `--docker`, if the deployed build was one).
|
|
217
|
+
From 0.45.0 on the host is not a difference between macOS arm64, Linux arm64 and Linux x86_64 (the hosts measured);
|
|
218
|
+
`differs host (not measured)` means one side was built on another host.
|
|
219
|
+
|
|
220
|
+
### A 0.44.x program with division, deployed from macOS or Linux arm64, does not match `verify --docker`
|
|
221
|
+
|
|
222
|
+
0.44.0 and 0.44.1 linked platform-tools' compiler-builtins, so a program that calls 128-bit or signed division built to
|
|
223
|
+
other bytes on each host package; the container is linux/amd64 and gives the Linux x86_64 bytes. What verifies it is a
|
|
224
|
+
0.44.x install (the version in its `.build.json`) on the same kind of host as the one that built it, without `--docker`:
|
|
225
|
+
`npx @typesol/cli@0.44.1 verify …` on macOS arm64 for a build made there.
|