@typesol/cli 0.41.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +319 -0
  2. package/README.md +11 -7
  3. package/dist/compiler/analyze.js +484 -13
  4. package/dist/compiler/diagnostics.d.ts +1 -0
  5. package/dist/compiler/diagnostics.js +13 -0
  6. package/dist/compiler/emit/alias.d.ts +44 -0
  7. package/dist/compiler/emit/alias.js +135 -4
  8. package/dist/compiler/emit/base.d.ts +65 -7
  9. package/dist/compiler/emit/base.js +91 -7
  10. package/dist/compiler/emit/borsh.d.ts +7 -0
  11. package/dist/compiler/emit/borsh.js +86 -1
  12. package/dist/compiler/emit/calls.d.ts +169 -2
  13. package/dist/compiler/emit/calls.js +1170 -81
  14. package/dist/compiler/emit/cpi-core.d.ts +28 -5
  15. package/dist/compiler/emit/cpi-core.js +238 -12
  16. package/dist/compiler/emit/cpi.js +16 -16
  17. package/dist/compiler/emit/create.d.ts +3 -3
  18. package/dist/compiler/emit/create.js +33 -25
  19. package/dist/compiler/emit/expressions.js +89 -9
  20. package/dist/compiler/emit/function.js +2 -2
  21. package/dist/compiler/emit/outline.d.ts +24 -0
  22. package/dist/compiler/emit/outline.js +100 -0
  23. package/dist/compiler/emit/program.js +37 -3
  24. package/dist/compiler/emit/rbtree.d.ts +7 -0
  25. package/dist/compiler/emit/rbtree.js +142 -0
  26. package/dist/compiler/emit/shared.d.ts +43 -1
  27. package/dist/compiler/emit/shared.js +18 -2
  28. package/dist/compiler/emit/statements.d.ts +58 -1
  29. package/dist/compiler/emit/statements.js +549 -22
  30. package/dist/compiler/emit/storage.d.ts +48 -1
  31. package/dist/compiler/emit/storage.js +220 -63
  32. package/dist/compiler/emit/token.d.ts +11 -8
  33. package/dist/compiler/emit/token.js +233 -104
  34. package/dist/compiler/emit/views.d.ts +60 -0
  35. package/dist/compiler/emit/views.js +523 -0
  36. package/dist/compiler/hints.js +6 -0
  37. package/dist/compiler/idl.js +2 -1
  38. package/dist/compiler/model.d.ts +84 -4
  39. package/dist/compiler/model.js +19 -0
  40. package/dist/compiler/toolchain.d.ts +15 -0
  41. package/dist/compiler/toolchain.js +146 -11
  42. package/dist/testing-stake.d.ts +216 -0
  43. package/dist/testing-stake.js +526 -0
  44. package/dist/testing.d.ts +1 -0
  45. package/dist/testing.js +1 -0
  46. package/docs/architecture.md +9 -2
  47. package/docs/case-study-phoenix.md +226 -0
  48. package/docs/case-study-spl-stake-pool.md +122 -0
  49. package/docs/errors.md +1 -1
  50. package/docs/language.md +244 -20
  51. package/docs/migrate-from-anchor.md +1 -0
  52. package/docs/runtime.md +1 -1
  53. package/docs/security-model.md +4 -0
  54. package/docs/stability.md +33 -1
  55. package/docs/test-your-program.md +47 -0
  56. package/docs/testing.md +19 -0
  57. package/docs/troubleshooting.md +5 -2
  58. package/lib/typesol.d.ts +462 -44
  59. package/llms-full.txt +338 -26
  60. package/llms.txt +1 -1
  61. package/package.json +2 -2
  62. package/runtime/typesol_rt.h +476 -0
package/docs/testing.md CHANGED
@@ -19,6 +19,25 @@ run prints its seed; reproduce with `FUZZ_SEED=<n>`, widen with `FUZZ_RUNS` / `F
19
19
  Compute-unit and binary-size comparisons with Anchor, native Rust and Pinocchio are in the README
20
20
  ([Numbers](../README.md#numbers)).
21
21
 
22
+ ## Epochs and staking
23
+
24
+ `typesol/testing`'s `warpToEpoch`, `StakeCluster` and `stakeActivation` ([test-your-program.md](test-your-program.md#epochs-and-staking))
25
+ are checked in `test/cli/testing-stake.test.ts` against the Stake program LiteSVM runs, the core BPF build bundled in
26
+ LiteSVM 1.6.1 (its program data holds a 202,280-byte ELF, sha256 `c9cba7f3…cd2352a8`). The oracle is a withdrawal: from a deactivated stake account the
27
+ program lets go of lamports − rent-exempt minimum − the stake it computes as still effective, so withdrawing exactly
28
+ the predicted amount must succeed and one lamport more must fail.
29
+
30
+ - Rate-limited warmup and cooldown over 13 epochs in two VMs: each epoch, the program's held-back stake equals
31
+ `cluster.activation`, merging two delegations fails while either is still activating and succeeds the epoch both are
32
+ fully active, and both VMs' Clock and StakeHistory bytes are equal.
33
+ - Warmup read back at the deactivation epoch, after three rate-limited epochs, then its cooldown.
34
+ - 25 mainnet-sized cases (stakes up to 30M SOL against 300–500M SOL effective, over two cooldown epochs): the program
35
+ matches the f64 algorithm to the lamport, where the integer one is a few lamports off; the case of
36
+ solana-stake-interface's `high_ulp_case` test is among them.
37
+ - `stakeActivation`'s integer algorithm against hand-worked values and the Rust crate's own test cases (bootstrap
38
+ stake, activation and deactivation in one epoch, missing history, the rate change, u128 saturation, the one-lamport
39
+ minimum step).
40
+
22
41
  ## Reproducing a release
23
42
 
24
43
  From 0.39.0 on, each release's GitHub Release carries its manifest, `typesol-<version>-manifest.json`, attached by
@@ -37,6 +37,9 @@ uses. Publishing works on mainnet-beta. The error shows the failing transaction'
37
37
  SBPF v0 (the default) every function gets a fixed 4 KiB stack frame, and going past it corrupts memory, so the build
38
38
  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
39
39
  locals (`const q: Big = acct.big`) are the usual cause: bind them without a type (`const q = acct.big`, a reference
40
- into the account data) or move the work into helpers. Helpers are often inlined into their instruction, so their
41
- locals count toward its frame.
40
+ into the account data). The message lists the biggest locals (clang's frame layout: a local's name and the source
41
+ line near it; the locals of an inlined helper show as unnamed, with the helpers' locals that may be them). Helpers are
42
+ often inlined into their instruction, so their locals count toward its frame: mark one `/** @noinline */` to give it a
43
+ 4 KiB frame of its own (a few compute units per call), or declare a large local list or struct of an instruction
44
+ `/** @heap */` to keep it on the heap (about 18 CU for the allocation).
42
45