@midnightntwrk/testkit-js 5.0.4-0-pre.095fdb60 → 5.0.4-0-pre.f34e601e
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.
|
@@ -73,7 +73,7 @@ Two things to know about what ships:
|
|
|
73
73
|
`compact-runtime-ledger8`, an alias that exists in THIS workspace and not in
|
|
74
74
|
an installed consumer's, so they will not resolve for you — the same caveat as
|
|
75
75
|
the `index.js` above, one level up. `packages/contracts` imports them
|
|
76
|
-
type-only to type its
|
|
76
|
+
type-only to type its ledger 8 fixtures; see [`counter-016/`](#counter-016).
|
|
77
77
|
|
|
78
78
|
## Fixtures
|
|
79
79
|
|
|
@@ -87,7 +87,7 @@ Two things to know about what ships:
|
|
|
87
87
|
| `state-tampered-keyset-v9to8.hex` | 1000000 (claimed) / 2000000 (actual payload) | derive | `state-migrated-v9.hex` with only the tag's version digit flipped `'8'→'6'`. |
|
|
88
88
|
| `state-tampered-bytes.hex` | 2000000 | derive | `state-migrated-v9.hex` with one payload byte bit-flipped past the header. |
|
|
89
89
|
| `state-both-keys.hex` | null (ambiguous by design) | derive | `state-v8-v6-envelope.hex` ++ `state-migrated-v9.hex` concatenated — both envelope tags in one blob. |
|
|
90
|
-
| `state-co-v2-only-foreign.hex` | 2000000 | mint (npm, cheap) | Mis-dispatch negative: a full, well-formed `ContractState` (deserializes cleanly on `ledger-v9`) whose `increment` operation slot carries a FOREIGN verifier key — borrowed from the golden `state-migrated-v9.hex`'s real `post` operation (a different, real migrated circuit, not built from the
|
|
90
|
+
| `state-co-v2-only-foreign.hex` | 2000000 | mint (npm, cheap) | Mis-dispatch negative: a full, well-formed `ContractState` (deserializes cleanly on `ledger-v9`) whose `increment` operation slot carries a FOREIGN verifier key — borrowed from the golden `state-migrated-v9.hex`'s real `post` operation (a different, real migrated circuit, not built from the ledger 8 counter artifacts). Fails later, at execution, not at decode. |
|
|
91
91
|
|
|
92
92
|
`fixtures.json` repeats this table machine-readably, plus the exact envelope
|
|
93
93
|
tag / claimed-vs-actual era for each, plus `status` (`ok` / `synthetic` /
|
|
@@ -266,7 +266,7 @@ opposed to `twin-contract/compiled/`, which is the SAME source recompiled with
|
|
|
266
266
|
a v9-era toolchain (`compactc 0.33.0-rc.2`, `runtime-version:
|
|
267
267
|
0.18.0-rc.1`). The two are not interchangeable: `twin-contract/compiled/` emits
|
|
268
268
|
0.18-era (async) codegen and cannot run against a `compact-runtime@0.16`
|
|
269
|
-
instance; `counter-016/` emits the sync codegen the
|
|
269
|
+
instance; `counter-016/` emits the sync codegen the ledger 8 pre-fork engine
|
|
270
270
|
(`packages/protocol/src/lib/v8/executable.ts`) actually exercises, and is the
|
|
271
271
|
fixture `v8-executable.test.ts` runs `increment` against.
|
|
272
272
|
|
|
@@ -286,7 +286,7 @@ end-to-end positive and the AC0 scenario gated at unit tier.
|
|
|
286
286
|
|
|
287
287
|
**The declaration file IS committed, with one line changed.** `compactc 0.31.1`
|
|
288
288
|
emits `contract/index.d.ts` beside the module; it was left uncommitted until
|
|
289
|
-
#1312, which is the defect that decided the question. `contracts`'s
|
|
289
|
+
#1312, which is the defect that decided the question. `contracts`'s ledger 8
|
|
290
290
|
type family is hand-written, and its compile-time tests used a hand-written
|
|
291
291
|
stand-in for this artifact -- a stand-in written in terms of the family, so it
|
|
292
292
|
agreed with the family whatever the family said and could not fail when the two
|
|
@@ -305,7 +305,7 @@ That is loud rather than silent -- the conformance assertions in
|
|
|
305
305
|
`packages/contracts/src/test/typecheck/overloads.test-d.ts` go red -- but it
|
|
306
306
|
fails somewhere that says nothing about a specifier, which is why the rewrite is
|
|
307
307
|
pinned directly. The alias is this
|
|
308
|
-
repo's own install of the same
|
|
308
|
+
repo's own install of the same ledger 8 `@midnight-ntwrk/compact-runtime@0.16.0`
|
|
309
309
|
(see `packages/protocol/package.json`), which is the only way to name 0.16 here.
|
|
310
310
|
`ledger8-contract.test.ts` asserts both halves of that rewrite on the committed
|
|
311
311
|
bytes.
|
|
@@ -348,7 +348,7 @@ toolchain ever starts emitting V3 by default.
|
|
|
348
348
|
None of the generated files are read at import time; the module's only own-time dependency is a bare
|
|
349
349
|
`@midnight-ntwrk/compact-runtime` import, satisfied in tests by redirecting
|
|
350
350
|
that specifier (module-registry-scoped to the one test file that imports this
|
|
351
|
-
fixture) to this repo's own `compact-runtime-ledger8` — the same
|
|
351
|
+
fixture) to this repo's own `compact-runtime-ledger8` — the same ledger 8
|
|
352
352
|
`@midnight-ntwrk/compact-runtime@0.16.0`, installed under an alias so it can
|
|
353
353
|
coexist with the root's `0.20.0` pin (see
|
|
354
354
|
`packages/protocol/package.json`).
|
|
@@ -401,7 +401,7 @@ export circuit increment(): [] {
|
|
|
401
401
|
`localIncrement()` reads the step out of the dApp's own private state, so
|
|
402
402
|
executing `increment()` calls the witness, threads the private state through the
|
|
403
403
|
runtime, and lets the witness hand a **new** private state back — which is what
|
|
404
|
-
makes the state a test persists something the
|
|
404
|
+
makes the state a test persists something the ledger 8 toolchain really
|
|
405
405
|
produced, rather than the caller's own object passed through by reference (which
|
|
406
406
|
is all `counter-016` can offer, since nothing there ever touches private state).
|
|
407
407
|
|
|
@@ -411,7 +411,7 @@ see below):
|
|
|
411
411
|
|
|
412
412
|
| Directory | Compiler | Language | Runtime | Codegen |
|
|
413
413
|
|---|---|---|---|---|
|
|
414
|
-
| `private-counter-016/compiled/` | 0.31.1 | 0.23.0 | **0.16.0** | sync (
|
|
414
|
+
| `private-counter-016/compiled/` | 0.31.1 | 0.23.0 | **0.16.0** | sync (ledger 8, pre-fork) |
|
|
415
415
|
| `private-counter-twin/compiled/` | 0.36.1 | 0.28.0 | **0.21.0** | async (current) |
|
|
416
416
|
|
|
417
417
|
The two `contract-info.json` files are **identical apart from those three
|
|
@@ -420,7 +420,7 @@ witness — which is the machine-checkable form of the "PS-schema-identical twin
|
|
|
420
420
|
claim, and is asserted rather than assumed (see below).
|
|
421
421
|
|
|
422
422
|
**Both builds EXECUTE**, and that is the difference from `twin-contract/`. The
|
|
423
|
-
|
|
423
|
+
ledger 8 build runs against the ledger 8 engine
|
|
424
424
|
(`packages/protocol/src/lib/v8/executable.ts`, reached through `loadLedger8Engine()`),
|
|
425
425
|
exactly as `counter-016` does. The twin's declared runtime is **the one this
|
|
426
426
|
repo resolves** (root `resolutions` pins `@midnight-ntwrk/compact-runtime` to
|
|
@@ -434,7 +434,7 @@ That coupling is committed **as a gate, not as decoration**: the consuming test
|
|
|
434
434
|
asserts `private-counter-twin`'s declared `runtime-version` equals the runtime
|
|
435
435
|
the repo actually resolves, so bumping `compact-runtime` without recompiling
|
|
436
436
|
this fixture fails with a named assertion instead of a version-mismatch throw
|
|
437
|
-
from deep inside the twin's own module body. The
|
|
437
|
+
from deep inside the twin's own module body. The ledger 8 side is pinned to the
|
|
438
438
|
literal `0.16.0` for the same reason.
|
|
439
439
|
|
|
440
440
|
Consumed by `testkit-js/testkit-js/test/cross-window.ut.test.ts`, which drives
|
|
@@ -455,8 +455,8 @@ left exactly as it is.
|
|
|
455
455
|
|
|
456
456
|
**What is committed, and what is not.** `contract/index.js` and
|
|
457
457
|
`compiler/contract-info.json` on both sides, plus `contract/index.d.ts` on the
|
|
458
|
-
|
|
459
|
-
and for the same reason: `packages/contracts` types its
|
|
458
|
+
LEDGER 8 side only — the same set `counter-016/` and `coin-receiver-016/` carry,
|
|
459
|
+
and for the same reason: `packages/contracts` types its ledger 8 fixtures
|
|
460
460
|
from it, and this is the only fixture that declares a WITNESS. It carries the
|
|
461
461
|
same one-line specifier rewrite as the other two. The current-toolchain side
|
|
462
462
|
needs none, since nothing types a fixture from it. No `keys/`, no `zkir/`, no
|
|
@@ -483,7 +483,7 @@ devDependency of that package, not a dependency — so importing either
|
|
|
483
483
|
`@midnight-ntwrk/compact-runtime` import unless the consumer has one in their own
|
|
484
484
|
tree. That is true of every compiled contract here; it matters for this pair
|
|
485
485
|
first, because it is the only one a consumer would plausibly want to execute
|
|
486
|
-
rather than read. The
|
|
486
|
+
rather than read. The ledger 8 side additionally needs a real 0.16 instance,
|
|
487
487
|
which no consumer resolves from that specifier by default — see the redirect the
|
|
488
488
|
consuming test uses.
|
|
489
489
|
|
|
@@ -623,7 +623,7 @@ from the Apache-2.0 header check, which generated code must not carry.
|
|
|
623
623
|
### The three recorded `coin-receiver-016` fixtures
|
|
624
624
|
|
|
625
625
|
Three fixtures were added beside the compiled artifact so that a **coin-moving
|
|
626
|
-
call can be driven without a
|
|
626
|
+
call can be driven without a ledger 8 runtime**. They are minted, and on every
|
|
627
627
|
run re-verified against a live execution, by
|
|
628
628
|
`packages/protocol/src/test/era-record-coin-receiver.test.ts` — the same
|
|
629
629
|
provenance pattern as `counter-016/increment-transcript.golden.json`, which was
|
|
@@ -632,7 +632,7 @@ itself minted from the retired `v8-execute.test.ts`'s own real execution.
|
|
|
632
632
|
| File | What it is |
|
|
633
633
|
|---|---|
|
|
634
634
|
| `coin-receiver-016/receive-coin-transcript.recording.json` | The `TranscriptPojo` the real `compact-runtime@0.16` runtime produces for `receive_coin`, with the state it ran against. Values are TAGGED — `{"__bigint"}`, `{"__bytes"}` (lower-case hex), `{"__map"}` — because unlike the counter golden this recording is *decoded* and fed back to a real ledger, and `partitionContext.block.parentBlockHash` is a genuine hex string sitting beside genuine byte arrays. |
|
|
635
|
-
| `coin-receiver-016/state-v6-envelope.hex` | A real
|
|
635
|
+
| `coin-receiver-016/state-v6-envelope.hex` | A real ledger 8 `ContractState` (`contract-state[v6]`) whose `.data` is the state that same constructor built, with `receive_coin` registered. The state a pre-fork call is dispatched against. |
|
|
636
636
|
| `coin-receiver-016/state-v9.hex` | The same primary state as a current-era `ContractState` (`contract-state[v8]`), with `receive_coin` registered. The state a post-fork keep-state call is dispatched against. |
|
|
637
637
|
|
|
638
638
|
Neither `.hex` is reachable through `readHfFixture` — that accessor covers the
|
|
@@ -683,7 +683,7 @@ them, re-copy from a newer spike checkout and re-run
|
|
|
683
683
|
`generate-all.mjs` (the tamper/derive scripts read the goldens back in, so
|
|
684
684
|
they stay consistent automatically).
|
|
685
685
|
|
|
686
|
-
To recompile `coin-receiver-016/` (needs the
|
|
686
|
+
To recompile `coin-receiver-016/` (needs the ledger 8 compiler — see its
|
|
687
687
|
section above for why the version is not negotiable):
|
|
688
688
|
|
|
689
689
|
```
|
|
@@ -705,8 +705,8 @@ To recompile the `private-counter` pair — **both sides, from the one source,
|
|
|
705
705
|
always together**, or the pair stops being a pair:
|
|
706
706
|
|
|
707
707
|
```
|
|
708
|
-
compact list # 0.31.1 must be installed, for the
|
|
709
|
-
# The
|
|
708
|
+
compact list # 0.31.1 must be installed, for the ledger 8 side
|
|
709
|
+
# The ledger 8 side comes from a `compact`-installed toolchain; the current side
|
|
710
710
|
# comes from the one THIS REPO pins (`.envrc`'s COMPACTC_VERSION), because that
|
|
711
711
|
# is the version whose `runtime-version` the consuming test gates on. Fetch it
|
|
712
712
|
# once, from packages/contracts/, if packages/compact/managed/ has no such
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"documentation": "Recording of the transcript the real
|
|
2
|
+
"documentation": "Recording of the transcript the real ledger 8 (compact-runtime@0.16) runtime produces for coin-receiver-016's receive_coin circuit, minted by real execution from packages/protocol/src/test/era-record-coin-receiver.test.ts. Values are tagged: {\"__bigint\"}, {\"__bytes\"} (lower-case hex) and {\"__map\"}. NO member is substituted: the execution clock is an input, pinned to partitionContext.block.secondsSinceEpoch, so every value here is the runtime's own output. Regenerate with MINT_HF_FIXTURES=1.",
|
|
3
3
|
"circuitId": "receive_coin",
|
|
4
4
|
"coinPublicKey": "cacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacaca",
|
|
5
5
|
"contractAddress": "0000000000000000000000000000000000000000000000000000000000000000",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Generated code only. **The source lives one directory over**, at
|
|
4
4
|
[`../private-counter-twin/private-counter.compact`](../private-counter-twin/private-counter.compact),
|
|
5
5
|
because both builds are compiled from that one file: this directory is the
|
|
6
|
-
|
|
6
|
+
ledger 8 toolchain build of it (compiler 0.31.1, language 0.23.0, runtime
|
|
7
7
|
0.16.0), and `../private-counter-twin/compiled/` is the current-toolchain build
|
|
8
8
|
of the same source (compiler 0.36.0, runtime 0.21.0).
|
|
9
9
|
|
package/dist/index.d.ts
CHANGED
|
@@ -246,7 +246,7 @@ interface ContractConfiguration {
|
|
|
246
246
|
* Integrity-verification options for the ZK artifacts, passed straight to the
|
|
247
247
|
* config provider. Omitted means the provider's own default, `require`.
|
|
248
248
|
*
|
|
249
|
-
* Needed because
|
|
249
|
+
* Needed because ledger 8 artifacts cannot satisfy `require`: `compactc`
|
|
250
250
|
* 0.31.1 emits `compiler/contract-info.json` and no
|
|
251
251
|
* `compiler/contract-manifest.json`, and the manifest is what verification
|
|
252
252
|
* reads. A pre-fork contract therefore has nothing to verify against, however
|
package/dist/index.js
CHANGED
|
@@ -1977,7 +1977,7 @@ let walletLedger8Module;
|
|
|
1977
1977
|
* Lazy, and a failed load is not memoised: the next call retries rather than
|
|
1978
1978
|
* serving the first rejection forever.
|
|
1979
1979
|
*
|
|
1980
|
-
* @see docs/architecture/
|
|
1980
|
+
* @see docs/architecture/ledger8-coverage.md
|
|
1981
1981
|
*/
|
|
1982
1982
|
const loadWalletLedger8 = () => (walletLedger8Module ??= import('@midnightntwrk/wallet-sdk/ledger/v8').catch((error) => {
|
|
1983
1983
|
walletLedger8Module = undefined;
|
|
@@ -2004,7 +2004,7 @@ const activeProtocolVersion = async (wallet) => (await Rx.firstValueFrom(wallet.
|
|
|
2004
2004
|
* unwrap into.
|
|
2005
2005
|
*
|
|
2006
2006
|
* Derived from the wallet's own `activeProtocolVersion` rather than pinned to a
|
|
2007
|
-
* single era: below the fork version that is the
|
|
2007
|
+
* single era: below the fork version that is the ledger 8 epoch, from it the
|
|
2008
2008
|
* current one, and a caller that hardcodes either is wrong on one side of the
|
|
2009
2009
|
* boundary.
|
|
2010
2010
|
*/
|