ckb-cycle-tools 1.1.0 → 1.3.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 CHANGED
@@ -1,180 +1,331 @@
1
- # Changelog
2
-
3
- This project follows [semantic versioning](https://semver.org/).
4
-
5
- ## 1.1.0 (2026-10-30)
6
-
7
- Cycle reports from ckb-testtool tests, and a check across ckb-debugger releases.
8
-
9
- ### Security
10
- - Every mock transaction is checked before it is written for ckb-debugger
11
- (native and WebAssembly; plain replay, `--file`, `report`, `flame`, `scan`
12
- scenarios, mocks built from a node): a string containing `{{` anywhere in it,
13
- or a field that should be hex and is not, is refused with an error that names
14
- the field. ckb-debugger expands `{{ data <path> }}`, `{{ hash <path> }}`,
15
- `{{ def_type … }}` and `{{ ref_type … }}` in a tx file, so a pull request's
16
- mock could embed any file on the runner, past `--root`.
17
- `checkMockTransaction` is exported from `.` and `./replay`.
18
- - `report --root` ignores the config's `"rpc"` and says so in a warning: a pull
19
- request's cycles.json no longer chooses the host the runner sends requests to.
20
- `--rpc` still applies; otherwise the public node is asked.
21
- - Names from a cycles.json, a build or a node (scenario, script, binary and
22
- function names, warnings) are printed to the terminal and the CI log on one
23
- line, without control or bidi characters, and never with `::` at the start
24
- of a line (errors keep their lines, each cleaned the same way), so a name
25
- cannot forge a GitHub Actions workflow command or drive the terminal:
26
- `report`, `diff`, `flame`, `scan` and plain replay.
27
- - GitHub Action: the PR's `build` runs in the same job as the sticky-comment
28
- step, which gets `github-token`, and could take that token by writing its own
29
- `gh` to `$GITHUB_PATH`, or BASH_ENV, PATH and the like to `$GITHUB_ENV`. `gh`
30
- is now located before the build runs; the comment step runs `/bin/bash -p`
31
- (not the `bash` on PATH; no BASH_ENV, ENV or exported functions), sets PATH
32
- itself, blanks LD_PRELOAD and the like, and runs `gh` with only the variables
33
- it needs (the proxies and CA settings as they were before the build) and an
34
- empty config directory. The comment file is read from the runner's temp
35
- directory, never from a step output, and must be a regular file. This does
36
- not stop a build that leaves a process running or replaces files on the
37
- runner; the Action's README says so and shows a two-job setup for PRs you do
38
- not trust with the token.
39
- - GitHub Action: `action/comment`, the sticky-comment step on its own, for that
40
- second job: it posts a markdown file downloaded from the first job, with a
41
- token the PR's build never shares a runner with. The first job runs the
42
- Action with `comment: false` and a read-only token.
43
- - GitHub Action: the comment's markdown is written only when the diff ran, so a
44
- second job never posts a failed diff's output; the base commit is fetched only
45
- when the checkout does not have it (a private repository checked out with
46
- `persist-credentials: false` and `fetch-depth: 0` then needs no credentials).
47
- - The README examples and this repository's cycle-report workflow check out
48
- with `persist-credentials: false`, so no token is left in `.git/config` for
49
- the PR's build, and the Action's README no longer says the build cannot get a
50
- write token. GitHub-owned actions in this repository's workflows and the
51
- README examples are pinned to commit SHAs, with the release as a comment.
52
- - Web inspector: every page is served with `Content-Security-Policy:
53
- frame-ancestors 'none'`, `X-Frame-Options: DENY`, `X-Content-Type-Options:
54
- nosniff` and `Referrer-Policy: strict-origin-when-cross-origin`, and without
55
- `X-Powered-By`, so no other site can frame it.
56
-
57
- ### Fixed (audit, 31 Oct)
58
- Each of these could give a gated check the wrong verdict.
59
- - A binary missing from `--binaries-from` (a contract the PR adds) made every
60
- scenario offered it a base error with no groups, so nothing in those
61
- scenarios was compared, the other binaries' groups included. The scenario now
62
- runs with the binaries that exist, the missing one left as the mock has it;
63
- only the groups whose code it is are not compared (`missingBinary` on the
64
- group, `missingBinaries` on the scenario), and a gated diff fails on them
65
- unless `--allow-removed`.
66
- - A binary offered to a scenario that matches none of its cell deps (a mock
67
- dumped from an older build) was measured as the mock's old code on both
68
- sides and shown unchanged, with nothing said. It is now a warning on that
69
- scenario, listed in the comment. A binary that matches no cell dep in any
70
- scenario was a report error that only reached the log: `report` now writes
71
- its errors into the JSON (`"errors"`), and a gated diff fails when either
72
- report has any, so the Action's `|| true` no longer hides them.
73
- - A group the VM stopped (past the cycle limit) was recorded with 0 cycles and
74
- read as a -100% saving, passing `--fail-above`. The cycles of a stopped run
75
- are never used now; with `--fail-above` such a group is over the threshold,
76
- and a result change for `--fail-on-result-change`. A result names the VM
77
- error's kind (`error: invalid instruction`, `error: cycles error: max cycles
78
- exceeded`), so one VM error turning into another is a result change.
79
- - GitHub Action: the base report ran the PR's cycles.json, so a scenario the PR
80
- deleted was never measured or listed. The base is now measured with the base
81
- commit's own cycles.json, mocks and binaries (an empty report when the base
82
- has none); the head still runs the PR's.
83
- - A base group with nothing in the head to compare against (a scenario or group
84
- removed, renamed, or moved to another selector) passed both gates. A gated
85
- diff now fails on it unless `--allow-removed` (Action input `allow-removed`,
86
- default false). The summary counts such groups and new groups.
87
- - Two reports from different ckb-debugger versions were compared without a
88
- word: the summary now names both versions.
89
-
90
- ### CLI: `ckb-cycles`
91
- - `scan <mocks-dir>`: writes a cycles.json from the mock transactions a test
92
- suite wrote, one scenario per file, with each freshly built binary in
93
- `--binaries` (default `build/release`) mapped by its data hash and
94
- `<name>.debug` as its symbols build; `--functions` records each group's
95
- costliest functions.
96
- - Functions the profiler could not name from line info (`func_0x<address>`:
97
- ckb-std's `_start`, rustc's allocator shims) are named from the symbols
98
- build's ELF symbol table, so they no longer show in a diff as one address
99
- removed and another added when code moves.
100
- - ELF names skip absolute symbols, labels outside executable sections and
101
- linker section markers (`__text_start`, `_etext`), so a marker at `_start`'s
102
- address no longer renames the root frame.
103
- - Legacy Rust symbol names are demangled in full (`$RF$`, `$LP$`, `$u7b$` and
104
- the other escapes), so they read as `rustc-demangle` prints them.
105
-
106
- ### ckb-testtool integration
107
- - `integrations/ckb-testtool`: a Rust crate whose `verify_tx` writes each
108
- ckb-testtool transaction as a mock when `CKB_CYCLES_MOCKS` is set, for
109
- ckb-script-templates projects; with `scan`, `make cycles` reports every
110
- test's script groups. Checked in CI on a project generated from
111
- ckb-script-templates, two contracts, a change, a diff.
112
- - README: the Makefile target uses `npx -p ckb-cycle-tools ckb-cycles` (a bare
113
- `npx ckb-cycles` names a package that does not exist) and `cargo test -p tests`.
114
- Every other `npx` line in the READMEs and the demo page now names the package
115
- the same way.
116
-
117
- ### Library
118
- - `scanTestMocks`, `configFromMocks` and `formatScan` (and their types) from `.`.
119
- - `flameTransaction` reads and parses each symbols build once, not once per
120
- script group that runs it.
121
- - `flameTransaction` takes `readBinary` beside `readFile`, so a caller whose
122
- debugger sees another file system gets frame names from the builds there
123
- too; it defaults to node:fs, as before.
124
-
125
- ### GitHub Action
126
- - When the sticky comment exists but updating it fails, the step retries the
127
- update (three tries) and then warns; it no longer posts a second report
128
- comment beside the first.
129
- - When the pull request's comments cannot be listed, the step warns and posts
130
- nothing (the report is in the job summary), since it cannot tell whether its
131
- comment already exists.
132
-
133
- ### Compatibility across ckb-debugger releases
134
- - `npm run compat` (repository only): replays 35 frozen scenarios under every
135
- ckb-debugger release from 0.121.0 to 1.1.1, native and WebAssembly, compares
136
- each script group with 1.1.1, and writes compat/RESULTS.md; a weekly Linux CI
137
- job runs it. A scenario the reference debugger could not run counts as a
138
- mismatch, and two scenario ids that slug alike no longer replay the same
139
- transaction.
140
-
141
- ## 1.0.0 (2026-10-27)
142
-
143
- First stable release.
144
-
145
- ### CLI: `ckb-cycles`
146
- - Replays a transaction per script group in ckb-debugger; the sum matches the node's
147
- total. Resolves the real ckb-debugger past the Windows `.cmd` shim.
148
- - Failure-path profiling: `--file` profiles a transaction that is not on chain.
149
- - Right VM version per script, from the node's hardfork epochs; input headers are
150
- replayed, so header-reading scripts (Nervos DAO) match.
151
- - Only complete ckb-debugger result lines are trusted, cross-checked with its exit code.
152
- - `report`, `diff` and `mock` subcommands; swap a cell dep's binary for a fresh build
153
- before replaying; name your own scripts with `--name`.
154
- - `flame`: per-group flamegraphs from ckb-debugger's profiler (SVG + folded
155
- stacks, costliest functions printed); `--bin` swaps in an unstripped build and
156
- checks its cycles against the deployed binary's.
157
- - Exit codes: 0 every script accepts and the sum matches the node; 1 a script
158
- rejects or the sum differs; 2 a usage or environment error.
159
-
160
- ### Library
161
- - `.` (analysis), `./analyze`, `./replay` and `./flame` (pure, work in the browser), `./wasm`
162
- (ckb-debugger's WebAssembly build, in memory, same numbers as native).
163
-
164
- ### GitHub Action
165
- - `action/`: posts one sticky cycle report on a pull request, group by group against
166
- the base branch; checksums the ckb-debugger it installs; fails on a broken base.
167
- - Function-level costs in the report: a binary's `symbols` build and `"functions": true`
168
- in cycles.json record each group's costliest functions (checked against the binary's
169
- cycles), and the comment folds in which functions changed.
170
- - Hardened for untrusted pull requests: `report --root` keeps the files a PR's
171
- cycles.json names inside the checkout; names in the comment cannot mention,
172
- link or break the table; the comment always fits GitHub's size limit.
173
-
174
- ### Web inspector
175
- - ckb-cycle-tools.vercel.app: paste a transaction hash, see its scripts and the
176
- per-group cycles computed in the page.
177
-
178
- ### Benchmark
179
- - The session lock in Rust vs ckb-js-vm, rebuilt and rerun in CI: the current lock
180
- (ckb-session-kit 49227cd, plain CKB and token sessions, codes 10-20), 58 scenarios.
1
+ # Changelog
2
+
3
+ This project follows [semantic versioning](https://semver.org/).
4
+
5
+ ## 1.3.0 (2026-11-07)
6
+
7
+ From the review on #46 (5 Nov): failed gates on a script that starts rejecting,
8
+ a reproducibility manifest, and what a rejected transaction's numbers mean.
9
+
10
+ ### Changed
11
+ - `diff --fail-above` (and the Action's `fail-above`) now also fails when a
12
+ group that accepted on the base rejects on the head (`ok` → `exit N` or a VM
13
+ error), whatever its cycles: a script that starts rejecting what it accepted
14
+ could pass before, by getting cheaper. This affects workflows that set only
15
+ `fail-above`: a pull request that turns an accepting scenario into a
16
+ rejection now fails the check (a warning with `informational: true`).
17
+ `--fail-on-result-change` is unchanged and still broader (reject → accept,
18
+ one exit code to another, a new group that does not accept); a diff with
19
+ neither set stays informational. The comment marks such a row "accepted on
20
+ the base, rejects now".
21
+ - A gated diff (`--fail-above` or `--fail-on-result-change`) now also fails
22
+ when a scenario's inputs changed between base and head (unless
23
+ `--allow-changed-inputs`), or when the two sides ran another ckb-debugger or
24
+ CKB-VM version. Before, an edited mock under the same scenario name was
25
+ compared silently. Ungated diffs only gain notes. See Added.
26
+ - A gated diff also fails when a head scenario's groups add up to more than
27
+ the node's per-transaction cycle limit and the base's did not: the node would
28
+ reject it, as if a group started rejecting (see Added). A new scenario over
29
+ the limit fails `--fail-on-result-change` only. The CLI exits 1 for such a
30
+ transaction.
31
+
32
+ ### Added
33
+ - `report` writes a `manifest` into its JSON: the ckb-cycle-tools version,
34
+ ckb-debugger's `--version` and the sha256 (and path) of the binary every
35
+ scenario ran (resolved once), or a WebAssembly build's id for a library
36
+ caller that runs one (`debuggerBuild`), the git commit of the config's
37
+ checkout and of `--binaries-from` (none, and no failure, outside git), an
38
+ optional `--toolchain <text>`, and per scenario the CKB-VM version, an
39
+ `inputs` sha256 (the mock or transaction file's bytes as read, and the
40
+ cycles.json entry canonicalised without its name, file path or `functions`)
41
+ and each swapped-in binary's path, sha256 and size. The terminal report
42
+ ends with a manifest line.
43
+ - `diff` reads both manifests. A scenario whose `inputs` differ is NOT
44
+ COMPARED (its groups count as neither new nor removed); a gated diff fails
45
+ on it unless `--allow-changed-inputs`. Another ckb-debugger (version, binary,
46
+ native against WebAssembly) or another CKB-VM version for a scenario fails a
47
+ gated diff, listed under the summary; ungated it is a bold note. Another
48
+ toolchain is a note. A report without a manifest on one side is a note,
49
+ never a failure; two such reports diff as before. The comment and the
50
+ terminal output show each side's manifest in one line. Manifest strings go
51
+ through the same cleaning as other report text.
52
+ - Action inputs `toolchain` (a command run after the build in each checkout;
53
+ its output goes to `--toolchain`) and `allow-changed-inputs`.
54
+ - A rejected transaction (some group exits non-zero, the VM stops it, or Type
55
+ ID refuses it) no longer shows "measured (sum of groups)". The CLI prints
56
+ "sum of groups, each run on its own", names the group the node would stop
57
+ at, says the node reports no cycles for a rejected transaction, and lists the
58
+ groups the node would never run. The order is ckb-script's, read from its
59
+ source (`TransactionScriptsVerifier::verify` and `TxData`/`TxInfo::groups`
60
+ at ckb a4aa128): lock groups, then type groups, each by script hash,
61
+ stopping at the first failure.
62
+ - JSON, added fields only: a profile (`--json`, `profileTransaction`) and a
63
+ report scenario get `nodeStopsAt` (that group's selector), and each group
64
+ `nodeReaches: true | false`. Both are only set when some group rejects, so
65
+ reports of accepted transactions are byte-for-byte as before. `report`'s text
66
+ output says the same under a rejected scenario. `diff` and its gates are
67
+ unchanged.
68
+ - The node's cycle limit is per transaction (`max_block_cycles`, 3,500,000,000
69
+ on mainnet and testnet: each group gets what the ones before it left), while
70
+ ckb-debugger gives each group 3,500,000,000 on its own. A transaction whose
71
+ groups each fit but together pass the limit was shown as accepted; it is now
72
+ flagged: "over the node's per-transaction limit of 3,500,000,000 cycles: the
73
+ node would reject this transaction (exceeded max cycles)", in the CLI table,
74
+ the `report` text and the `diff` summary and comment. The limit is the
75
+ node's `get_consensus` `max_block_cycles` when the replay asked the node,
76
+ else 3,500,000,000 (`txCycleLimit` in the options to override;
77
+ `DEFAULT_TX_CYCLE_LIMIT` exported). `nodeStopsAt` and `nodeReaches` then mark
78
+ the group at which the running sum, in the node's order, passes the limit,
79
+ unless a failing group comes first. JSON, added fields only, and only in
80
+ that case: `overTxLimit: { limit, sum }` on a profile (bigints as strings,
81
+ as `measuredCycles`) and on a report scenario (numbers), and in a diff, the
82
+ head scenarios newly over it. Transactions under the limit are unchanged.
83
+ - `nodeOrder`, `nodeStop` and `sumLines` exported from the package and from
84
+ `ckb-cycle-tools/replay` (no Node built-ins).
85
+
86
+ ### Docs
87
+ - compat/HARDFORK.md, from the review on #46 (point 1): 24 real mainnet and
88
+ testnet transactions next to Mirana (VM v1) and Meepo (VM v2), the nearest
89
+ of each kind (secp only; another `type` script; a data/data1/data2 script)
90
+ on each side of each fork, replayed as `ckb-cycles <hash>` replays them and
91
+ again with `--script-version` forced to the two other values. The 18 after
92
+ Mirana match the cycles a node recorded for their block exactly, at the
93
+ chosen version only, and data/data1/data2 groups keep their own version.
94
+ Before Mirana no public node has cycles (mainnet.ckb.dev reports `0x0`
95
+ everywhere here; mainnet/testnet.ckbapp.dev record from the Mirana block on),
96
+ and the explorer's number for those 6 equals the v1 sum, not the v0 sum the
97
+ consensus rules give: reported as unverified, with how to settle it. Also why
98
+ `estimate_cycles` is no oracle for a historical transaction (spent inputs do
99
+ not resolve; it would run today's VM).
100
+ - `npm run hardfork` (scripts/hardfork-check.ts, `--discover` to pick the
101
+ transactions again) writes compat/hardfork.json, the table and
102
+ test/fixtures/hardfork-mocks.json.br. test/hardfork.test.ts replays the
103
+ recorded mocks offline with the WebAssembly debugger at every version, and
104
+ with `CKB_HARDFORK_NETWORK=1` plans them again through the public nodes.
105
+ No change to the replay itself.
106
+ - README: "What a rejected transaction's numbers mean", and "What comes from
107
+ where when replaying": a table of every input to a replay (cells, cell deps
108
+ and dep groups, input headers, header deps, consensus epochs, CKB-VM version,
109
+ max cycles, group order, Type ID, since/capacity checks) and whether it comes
110
+ from the chain via RPC, the node's current state or ckb-debugger's defaults;
111
+ ckb-debugger's limit is per group, the node's per transaction.
112
+ - README: "Flamegraph fidelity": totals are exact, the split between functions
113
+ is attributed (frames open only at symbol-table function starts, so inlined
114
+ code is charged to its caller; cycles charged outside instructions are in no
115
+ frame). The flame example now says the 1,812-cycle gap is everything charged
116
+ outside instructions, not only loading the binary.
117
+ - benchmarks/session-lock/RESULTS.md (and compare.mjs, which writes it): the
118
+ comparison is of these two implementations only, and the Rust lock's build
119
+ profile at 49227cd (`opt-level = "s"`, LTO, one codegen unit, `panic = "abort"`,
120
+ overflow checks, stripped; `+zba,+zbb,+zbc,+zbs,-a`; ckb-std 1.1.0; no pinned
121
+ toolchain).
122
+
123
+ ## 1.2.0 (2026-11-05)
124
+
125
+ Scripts that spawn other scripts (CKB2023 `spawn`).
126
+
127
+ ### Added
128
+ - `flame`, and `report` with `functions`, say when a script spawned others:
129
+ ckb-debugger profiles only the spawning script, so the spawned scripts'
130
+ cycles are in the group's total but in none of its functions. The report
131
+ records `spawned` and `profiled` per group; `diff` notes it under the
132
+ group, and for a group whose cycles changed while none of its own
133
+ functions did, says that the change is in what it spawned.
134
+ - A warning when a swapped-in binary's old code hash is still in a cell's
135
+ data (a match cell naming the game it spawns by data hash): data is not
136
+ rewritten, so that script would not find the new build.
137
+ - `test/fixtures/spawn-project`: a parent lock that spawns a child found by
138
+ data2 hash, with mocks, and tests against ckb-debugger 1.1.1.
139
+ - Action: pull requests from forks, whose token cannot comment. `action/comment`
140
+ runs in a `workflow_run` workflow: it finds the pull request from the run's
141
+ head commit through the API (never from the artifact), posts only while the
142
+ PR is still at that commit, and checks the downloaded report first (at most
143
+ `max-bytes` (256 KiB), the marker on its first line, no NUL bytes; @mentions and #refs
144
+ broken). The two workflows are in `action/README.md`.
145
+ - Action input `informational`: a crossed threshold or a scenario that could
146
+ not run is a warning, not a failed job.
147
+ - Action input `base-config: head`: the base is measured with the PR's
148
+ cycles.json and the base checkout's binaries (`--binaries-from`), for a
149
+ cycles.json generated before the Action (`ckb-cycles scan`). With the
150
+ default, the base checkout has no such file and every group was new.
151
+
152
+ ### Fixed
153
+ - `profiledCycles` reads the last `All cycles:` line: for a spawning script,
154
+ flamegraph mode prints the whole group's total first.
155
+
156
+ ## 1.1.0 (2026-10-30)
157
+
158
+ Cycle reports from ckb-testtool tests, and a check across ckb-debugger releases.
159
+
160
+ ### Security
161
+ - Every mock transaction is checked before it is written for ckb-debugger
162
+ (native and WebAssembly; plain replay, `--file`, `report`, `flame`, `scan`
163
+ scenarios, mocks built from a node): a string containing `{{` anywhere in it,
164
+ or a field that should be hex and is not, is refused with an error that names
165
+ the field. ckb-debugger expands `{{ data <path> }}`, `{{ hash <path> }}`,
166
+ `{{ def_type … }}` and `{{ ref_type … }}` in a tx file, so a pull request's
167
+ mock could embed any file on the runner, past `--root`.
168
+ `checkMockTransaction` is exported from `.` and `./replay`.
169
+ - `report --root` ignores the config's `"rpc"` and says so in a warning: a pull
170
+ request's cycles.json no longer chooses the host the runner sends requests to.
171
+ `--rpc` still applies; otherwise the public node is asked.
172
+ - Names from a cycles.json, a build or a node (scenario, script, binary and
173
+ function names, warnings) are printed to the terminal and the CI log on one
174
+ line, without control or bidi characters, and never with `::` at the start
175
+ of a line (errors keep their lines, each cleaned the same way), so a name
176
+ cannot forge a GitHub Actions workflow command or drive the terminal:
177
+ `report`, `diff`, `flame`, `scan` and plain replay.
178
+ - GitHub Action: the PR's `build` runs in the same job as the sticky-comment
179
+ step, which gets `github-token`, and could take that token by writing its own
180
+ `gh` to `$GITHUB_PATH`, or BASH_ENV, PATH and the like to `$GITHUB_ENV`. `gh`
181
+ is now located before the build runs; the comment step runs `/bin/bash -p`
182
+ (not the `bash` on PATH; no BASH_ENV, ENV or exported functions), sets PATH
183
+ itself, blanks LD_PRELOAD and the like, and runs `gh` with only the variables
184
+ it needs (the proxies and CA settings as they were before the build) and an
185
+ empty config directory. The comment file is read from the runner's temp
186
+ directory, never from a step output, and must be a regular file. This does
187
+ not stop a build that leaves a process running or replaces files on the
188
+ runner; the Action's README says so and shows a two-job setup for PRs you do
189
+ not trust with the token.
190
+ - GitHub Action: `action/comment`, the sticky-comment step on its own, for that
191
+ second job: it posts a markdown file downloaded from the first job, with a
192
+ token the PR's build never shares a runner with. The first job runs the
193
+ Action with `comment: false` and a read-only token.
194
+ - GitHub Action: the comment's markdown is written only when the diff ran, so a
195
+ second job never posts a failed diff's output; the base commit is fetched only
196
+ when the checkout does not have it (a private repository checked out with
197
+ `persist-credentials: false` and `fetch-depth: 0` then needs no credentials).
198
+ - The README examples and this repository's cycle-report workflow check out
199
+ with `persist-credentials: false`, so no token is left in `.git/config` for
200
+ the PR's build, and the Action's README no longer says the build cannot get a
201
+ write token. GitHub-owned actions in this repository's workflows and the
202
+ README examples are pinned to commit SHAs, with the release as a comment.
203
+ - Web inspector: every page is served with `Content-Security-Policy:
204
+ frame-ancestors 'none'`, `X-Frame-Options: DENY`, `X-Content-Type-Options:
205
+ nosniff` and `Referrer-Policy: strict-origin-when-cross-origin`, and without
206
+ `X-Powered-By`, so no other site can frame it.
207
+
208
+ ### Fixed (audit, 31 Oct)
209
+ Each of these could give a gated check the wrong verdict.
210
+ - A binary missing from `--binaries-from` (a contract the PR adds) made every
211
+ scenario offered it a base error with no groups, so nothing in those
212
+ scenarios was compared, the other binaries' groups included. The scenario now
213
+ runs with the binaries that exist, the missing one left as the mock has it;
214
+ only the groups whose code it is are not compared (`missingBinary` on the
215
+ group, `missingBinaries` on the scenario), and a gated diff fails on them
216
+ unless `--allow-removed`.
217
+ - A binary offered to a scenario that matches none of its cell deps (a mock
218
+ dumped from an older build) was measured as the mock's old code on both
219
+ sides and shown unchanged, with nothing said. It is now a warning on that
220
+ scenario, listed in the comment. A binary that matches no cell dep in any
221
+ scenario was a report error that only reached the log: `report` now writes
222
+ its errors into the JSON (`"errors"`), and a gated diff fails when either
223
+ report has any, so the Action's `|| true` no longer hides them.
224
+ - A group the VM stopped (past the cycle limit) was recorded with 0 cycles and
225
+ read as a -100% saving, passing `--fail-above`. The cycles of a stopped run
226
+ are never used now; with `--fail-above` such a group is over the threshold,
227
+ and a result change for `--fail-on-result-change`. A result names the VM
228
+ error's kind (`error: invalid instruction`, `error: cycles error: max cycles
229
+ exceeded`), so one VM error turning into another is a result change.
230
+ - GitHub Action: the base report ran the PR's cycles.json, so a scenario the PR
231
+ deleted was never measured or listed. The base is now measured with the base
232
+ commit's own cycles.json, mocks and binaries (an empty report when the base
233
+ has none); the head still runs the PR's.
234
+ - A base group with nothing in the head to compare against (a scenario or group
235
+ removed, renamed, or moved to another selector) passed both gates. A gated
236
+ diff now fails on it unless `--allow-removed` (Action input `allow-removed`,
237
+ default false). The summary counts such groups and new groups.
238
+ - Two reports from different ckb-debugger versions were compared without a
239
+ word: the summary now names both versions.
240
+
241
+ ### CLI: `ckb-cycles`
242
+ - `scan <mocks-dir>`: writes a cycles.json from the mock transactions a test
243
+ suite wrote, one scenario per file, with each freshly built binary in
244
+ `--binaries` (default `build/release`) mapped by its data hash and
245
+ `<name>.debug` as its symbols build; `--functions` records each group's
246
+ costliest functions.
247
+ - Functions the profiler could not name from line info (`func_0x<address>`:
248
+ ckb-std's `_start`, rustc's allocator shims) are named from the symbols
249
+ build's ELF symbol table, so they no longer show in a diff as one address
250
+ removed and another added when code moves.
251
+ - ELF names skip absolute symbols, labels outside executable sections and
252
+ linker section markers (`__text_start`, `_etext`), so a marker at `_start`'s
253
+ address no longer renames the root frame.
254
+ - Legacy Rust symbol names are demangled in full (`$RF$`, `$LP$`, `$u7b$` and
255
+ the other escapes), so they read as `rustc-demangle` prints them.
256
+
257
+ ### ckb-testtool integration
258
+ - `integrations/ckb-testtool`: a Rust crate whose `verify_tx` writes each
259
+ ckb-testtool transaction as a mock when `CKB_CYCLES_MOCKS` is set, for
260
+ ckb-script-templates projects; with `scan`, `make cycles` reports every
261
+ test's script groups. Checked in CI on a project generated from
262
+ ckb-script-templates, two contracts, a change, a diff.
263
+ - README: the Makefile target uses `npx -p ckb-cycle-tools ckb-cycles` (a bare
264
+ `npx ckb-cycles` names a package that does not exist) and `cargo test -p tests`.
265
+ Every other `npx` line in the READMEs and the demo page now names the package
266
+ the same way.
267
+
268
+ ### Library
269
+ - `scanTestMocks`, `configFromMocks` and `formatScan` (and their types) from `.`.
270
+ - `flameTransaction` reads and parses each symbols build once, not once per
271
+ script group that runs it.
272
+ - `flameTransaction` takes `readBinary` beside `readFile`, so a caller whose
273
+ debugger sees another file system gets frame names from the builds there
274
+ too; it defaults to node:fs, as before.
275
+
276
+ ### GitHub Action
277
+ - When the sticky comment exists but updating it fails, the step retries the
278
+ update (three tries) and then warns; it no longer posts a second report
279
+ comment beside the first.
280
+ - When the pull request's comments cannot be listed, the step warns and posts
281
+ nothing (the report is in the job summary), since it cannot tell whether its
282
+ comment already exists.
283
+
284
+ ### Compatibility across ckb-debugger releases
285
+ - `npm run compat` (repository only): replays 35 frozen scenarios under every
286
+ ckb-debugger release from 0.121.0 to 1.1.1, native and WebAssembly, compares
287
+ each script group with 1.1.1, and writes compat/RESULTS.md; a weekly Linux CI
288
+ job runs it. A scenario the reference debugger could not run counts as a
289
+ mismatch, and two scenario ids that slug alike no longer replay the same
290
+ transaction.
291
+
292
+ ## 1.0.0 (2026-10-27)
293
+
294
+ First stable release.
295
+
296
+ ### CLI: `ckb-cycles`
297
+ - Replays a transaction per script group in ckb-debugger; the sum matches the node's
298
+ total. Resolves the real ckb-debugger past the Windows `.cmd` shim.
299
+ - Failure-path profiling: `--file` profiles a transaction that is not on chain.
300
+ - Right VM version per script, from the node's hardfork epochs; input headers are
301
+ replayed, so header-reading scripts (Nervos DAO) match.
302
+ - Only complete ckb-debugger result lines are trusted, cross-checked with its exit code.
303
+ - `report`, `diff` and `mock` subcommands; swap a cell dep's binary for a fresh build
304
+ before replaying; name your own scripts with `--name`.
305
+ - `flame`: per-group flamegraphs from ckb-debugger's profiler (SVG + folded
306
+ stacks, costliest functions printed); `--bin` swaps in an unstripped build and
307
+ checks its cycles against the deployed binary's.
308
+ - Exit codes: 0 every script accepts and the sum matches the node; 1 a script
309
+ rejects or the sum differs; 2 a usage or environment error.
310
+
311
+ ### Library
312
+ - `.` (analysis), `./analyze`, `./replay` and `./flame` (pure, work in the browser), `./wasm`
313
+ (ckb-debugger's WebAssembly build, in memory, same numbers as native).
314
+
315
+ ### GitHub Action
316
+ - `action/`: posts one sticky cycle report on a pull request, group by group against
317
+ the base branch; checksums the ckb-debugger it installs; fails on a broken base.
318
+ - Function-level costs in the report: a binary's `symbols` build and `"functions": true`
319
+ in cycles.json record each group's costliest functions (checked against the binary's
320
+ cycles), and the comment folds in which functions changed.
321
+ - Hardened for untrusted pull requests: `report --root` keeps the files a PR's
322
+ cycles.json names inside the checkout; names in the comment cannot mention,
323
+ link or break the table; the comment always fits GitHub's size limit.
324
+
325
+ ### Web inspector
326
+ - ckb-cycle-tools.vercel.app: paste a transaction hash, see its scripts and the
327
+ per-group cycles computed in the page.
328
+
329
+ ### Benchmark
330
+ - The session lock in Rust vs ckb-js-vm, rebuilt and rerun in CI: the current lock
331
+ (ckb-session-kit 49227cd, plain CKB and token sessions, codes 10-20), 58 scenarios.