Commit 9226f19
authored
* fix(simulator): pin simulated block time to zero
compact-runtime 0.18 defaults `createCircuitContext`'s `time` to
wall-clock, where the hand-rolled 0.16 `QueryContext` left it at 0. Any
suite reading `kernel.blockTime()` silently became non-reproducible.
Threads an explicit `time` from `BaseSimulatorOptions` through to the
runtime factory, defaulting to 0 to restore the previous behaviour.
* refactor(simulator): drop the dead circuit-context helpers
`useCircuitContext` and `useCircuitContextSender` had no callers and were
never exported from the barrel, so they were unreachable before this
migration and got hand-ported to the 0.18 call-tree shape untested.
* fix(simulator): guard context reads before init()
0.18 split construction from state building, so a caller that skipped
`init()` got `Cannot read properties of undefined (reading
'callContext')`. Both `CircuitContextManager.context` and the simulator's
`contractAddress` now throw a named error instead.
* fix(simulator): declare initialState async on IMinimalContract
The canonical interface still promised the sync-only 0.16 return type, so
anything typed against it got the wrong shape and
`CircuitContextManager` carried a private redeclaration to compensate.
* fix(simulator): typecheck the test tree
`tsconfig.types.json` compiled `src/**` only, and its `exclude` named a
`tests` directory that does not exist, so nothing verified the test tree.
Adding a project that covers it surfaced 74 errors, of which the
load-bearing one is in `src/`: 0.18 circuits return
`Promise<CircuitResults>`, which the `ContextlessCircuits` /
`AsyncCircuits` conditionals did not match, collapsing every entry on
`circuits.pure` and `circuits.impure` to `never`.
* src: match the promised circuit shape; keep the anonymous class's
address field underscore-public for declaration emit
* test: give relative imports the `.js` extension nodenext requires
* wiring: run both projects under `yarn types`, and let turbo see the
test tree so a regression is not cached away
* fix(simulator): build the setContext fixture as a real 0.18 context
The replacement context was a hand-rolled literal in the pre-0.18 flat
shape, so `setContext`'s only test asserted against a context the runtime
would reject. `toEqual` compared two plain objects and passed anyway.
Rebuilds it through `createCircuitContext` and asserts identity plus the
two fields the test is about. Exporting `BackendDeps` is required for the
same reason: it appears in `create`/`_create`, so an exported binding
assigned from `createSimulator(...)` could not name it (TS4023).
* fix(ci): make the prerelease compiler input functional and verified
* `COMPACTC_VERSION` is now exported to `$GITHUB_ENV`. `VER` was
step-scoped, so `test/setup.ts` never saw it: overriding the input
installed one toolchain while the fixtures compiled with the hardcoded
default.
* The archive is checked against a pinned SHA-256 before it is unpacked
and executed. The release publishes no checksum file, so the digests
are pinned per platform here; overriding the version requires passing
its digest.
* fix(simulator): key the fixture cache on the compiler
The staleness check compared artifact mtime against source mtime only,
so an existing clone kept its 0.31-compiled artifacts and hit a load-time
rejection against the 0.18 runtime. CI never saw it: the `test` turbo
task is uncached and the checkout is clean.
Artifacts now carry a stamp of the compiler version and the zkir flag,
and recompile when it does not match. The flag also moves onto the
fixture list, replacing a `secp256k1` regex over the source that a
mention in a comment was enough to trip.
* test(simulator): collapse the field-to-bytes helpers
Two near-identical copies existed in the test tree. The one in
`SampleZOwnable.test.ts` silently truncated where the runtime helper it
replaced threw, so a wrong value would read as a passing assertion.
Keeps one in the shared test utils, with the range check restored, and
derives `zeroUint8Array` from it. `Signers.ts` keeps its own copy: `src`
cannot import from `test`.
* test(simulator): consume the generated secp256k1 types
The `Ecdsa.compact` re-export is live: the artifact's `index.d.ts`
declares both `Secp256k1EcdsaSignature` and `Secp256k1Point`. The
simulator hand-rolled the signature struct and took the point from the
runtime instead, so a change to the generated shape would not surface
here.
* docs(simulator): correct the sync-era comments
The async migration left the docs describing a synchronous engine: the
dry primitive called "synchronous", `DryBackend` said it wraps a
synchronous result in a resolved promise and preserves dry behaviour
"byte-for-byte", and the `SyncSimulator` name now describes nothing.
Renaming the exported type is a breaking change, so it keeps the name
with a `@remarks` note. Also records that `copyCircuitContext` is
`@internal` upstream.
* ci(turbo): declare COMPACTC_VERSION on the test task
The setup action exports it and `test/setup.ts` reads it, but the task
never declared it. Pass-through happens to work on turbo 2.9, so this
only pins the behaviour against a stricter env mode.
* fix(ci): compile fixtures before the type check
`yarn types` now covers `test/**`, which imports the generated artifacts,
but `checks.yml` runs it before `yarn test` — the only thing that
compiled them. It passed locally only because the artifacts were already
on disk.
Lifts fixture compilation into its own turbo task that `types` depends
on. `test/setup.ts` gains a direct entry point so the task does not have
to go through vitest; vitest's `globalSetup` still calls the same
function.
1 parent 6d0703f commit 9226f19
32 files changed
Lines changed: 346 additions & 235 deletions
File tree
- .github/actions/setup
- packages/simulator
- src
- backend
- core
- factory
- signers
- types
- utils
- test
- fixtures/utils
- integration
- unit/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| |||
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
68 | 96 | | |
69 | 97 | | |
70 | 98 | | |
71 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
72 | 106 | | |
73 | 107 | | |
74 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| |||
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
33 | | - | |
34 | | - | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
| |||
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
52 | | - | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | | - | |
10 | 8 | | |
| 9 | + | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | 17 | | |
26 | | - | |
27 | | - | |
28 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| |||
62 | 67 | | |
63 | 68 | | |
64 | 69 | | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
69 | 75 | | |
70 | 76 | | |
| 77 | + | |
71 | 78 | | |
72 | 79 | | |
73 | 80 | | |
| |||
94 | 101 | | |
95 | 102 | | |
96 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
97 | 108 | | |
98 | 109 | | |
99 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
9 | 7 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 8 | + | |
| 9 | + | |
17 | 10 | | |
18 | 11 | | |
19 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
42 | 53 | | |
43 | 54 | | |
44 | 55 | | |
| |||
53 | 64 | | |
54 | 65 | | |
55 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
56 | 70 | | |
57 | 71 | | |
58 | 72 | | |
| |||
65 | 79 | | |
66 | 80 | | |
67 | 81 | | |
| 82 | + | |
68 | 83 | | |
69 | 84 | | |
70 | 85 | | |
| |||
76 | 91 | | |
77 | 92 | | |
78 | 93 | | |
79 | | - | |
| 94 | + | |
80 | 95 | | |
81 | 96 | | |
82 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
19 | 24 | | |
20 | 25 | | |
21 | 26 | | |
| |||
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
57 | | - | |
| 62 | + | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| |||
81 | 86 | | |
82 | 87 | | |
83 | 88 | | |
84 | | - | |
| 89 | + | |
85 | 90 | | |
86 | 91 | | |
87 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
0 commit comments