@midnight-ntwrk/midnight-js-protocol 5.0.0-beta.7 → 5.0.0-beta.8
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/README.md +201 -2
- package/dist/engine.d.ts +367 -0
- package/dist/engine.js +519 -0
- package/dist/engine.js.map +1 -0
- package/dist/errors.d.ts +467 -0
- package/dist/errors.js +595 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +1278 -2
- package/dist/index.js +787 -2
- package/dist/index.js.map +1 -1
- package/dist/prove.d.ts +38 -0
- package/dist/prove.js +81 -0
- package/dist/prove.js.map +1 -0
- package/dist/shared/deploy-D6yyn9P7.js +428 -0
- package/dist/shared/deploy-D6yyn9P7.js.map +1 -0
- package/dist/shared/load-C0TZnEd2.js +39 -0
- package/dist/shared/load-C0TZnEd2.js.map +1 -0
- package/dist/v8.d.ts +1 -0
- package/dist/v8.js +3 -0
- package/dist/v8.js.map +1 -0
- package/dist/version.d.ts +121 -0
- package/dist/version.js +132 -0
- package/dist/version.js.map +1 -0
- package/package.json +28 -4
package/dist/engine.js
ADDED
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
import * as ledgerV9 from '@midnightntwrk/ledger-v9';
|
|
2
|
+
import { ComposeOptionError, Ledger8RuntimeInvalidError, DownConvertFailedError, MerkleNotRehashedError, UnknownLedger8AxisError, Ledger8InstanceMismatchError } from './errors.js';
|
|
3
|
+
import { a as assembleCallPrototype, e as executeConstructor } from './shared/deploy-D6yyn9P7.js';
|
|
4
|
+
import '@midnight-ntwrk/compact-js';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* This file is part of midnight-js.
|
|
8
|
+
* Copyright (C) Midnight Foundation
|
|
9
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
* You may not use this file except in compliance with the License.
|
|
12
|
+
* You may obtain a copy of the License at
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Re-expresses a retained-era contract's entry points as a CURRENT-era contract state.
|
|
22
|
+
*
|
|
23
|
+
* WHY THIS EXISTS. The fork does not rewrite a contract's stored state: a contract deployed before
|
|
24
|
+
* it and dormant across it is served, indefinitely, carrying its retained-era envelope. The current
|
|
25
|
+
* ledger's composer cannot deserialize those bytes — it accepts only its own envelope — so a
|
|
26
|
+
* keep-state call had nothing to hand it and could not be composed at all.
|
|
27
|
+
*
|
|
28
|
+
* WHAT THE COMPOSER ACTUALLY WANTS. The `contractState` a composition takes is NOT the state being
|
|
29
|
+
* proven. `assembleCallPrototype` uses it for exactly one thing: looking up the `ContractOperation`
|
|
30
|
+
* for the circuit, to read its verifier key. The state the call is bound to travels separately, as
|
|
31
|
+
* the transcript's `preState`. So what has to cross the era boundary here is the OPERATION
|
|
32
|
+
* REGISTRY, not the state.
|
|
33
|
+
*
|
|
34
|
+
* WHY THIS IS FAITHFUL, NOT A SUBSTITUTION. The verifier keys come from the chain's own state, read
|
|
35
|
+
* through the retained decoder, and the caller has already checked its local artifact against them.
|
|
36
|
+
* The current ledger models retained-era operations natively — `ContractOperationVersion` carries a
|
|
37
|
+
* `'v3'` arm precisely for them — so a key preserved across the fork is a value this ledger is built
|
|
38
|
+
* to hold. Nothing is minted here: every key written out is one the chain already holds.
|
|
39
|
+
*
|
|
40
|
+
* The primary state is deliberately left at its default. A caller that needed the state itself would
|
|
41
|
+
* be reading it from {@link ContractStatePojo.state}, not from this registry.
|
|
42
|
+
*
|
|
43
|
+
* @param entryPoints The entry points a retained-era contract state declared, as the retained
|
|
44
|
+
* decoder read them.
|
|
45
|
+
* @returns The serialized current-era contract state, carrying those entry points and their keys.
|
|
46
|
+
* @throws ComposeOptionError if no entry point carries a key, since the registry would then answer
|
|
47
|
+
* for nothing and the composer's own refusal would name a circuit rather than the empty state.
|
|
48
|
+
*/
|
|
49
|
+
const reexpressOperationsForCurrentEra = (entryPoints) => {
|
|
50
|
+
const state = new ledgerV9.ContractState();
|
|
51
|
+
let registered = 0;
|
|
52
|
+
for (const entryPoint of entryPoints) {
|
|
53
|
+
// A blank slot is carried as `undefined` rather than as empty bytes -- see the fail-closed
|
|
54
|
+
// decoding note on ContractEntryPointPojo. Skipped rather than refused one by one: if the
|
|
55
|
+
// circuit being called is the one missing a key, the composer names it precisely, and a
|
|
56
|
+
// contract may legitimately declare an entry point this call does not touch.
|
|
57
|
+
if (entryPoint.verifierKey === undefined) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const operation = new ledgerV9.ContractOperation();
|
|
61
|
+
operation.verifierKey = entryPoint.verifierKey;
|
|
62
|
+
state.setOperation(entryPoint.circuitId, operation);
|
|
63
|
+
registered += 1;
|
|
64
|
+
}
|
|
65
|
+
if (registered === 0) {
|
|
66
|
+
throw new ComposeOptionError('v9', 'contractState');
|
|
67
|
+
}
|
|
68
|
+
return state.serialize();
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/*
|
|
72
|
+
* This file is part of midnight-js.
|
|
73
|
+
* Copyright (C) Midnight Foundation
|
|
74
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
75
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
76
|
+
* You may not use this file except in compliance with the License.
|
|
77
|
+
* You may obtain a copy of the License at
|
|
78
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
79
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
80
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
81
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
82
|
+
* See the License for the specific language governing permissions and
|
|
83
|
+
* limitations under the License.
|
|
84
|
+
*/
|
|
85
|
+
/**
|
|
86
|
+
* Wraps a {@link TranscriptPojo} — the output of {@link executeCircuit}
|
|
87
|
+
* (`./execute.ts`) — into a v9-native `ContractCallPrototype`, ready for
|
|
88
|
+
* `Intent.new(ttl).addCall(...)`, via {@link assembleCallPrototype}
|
|
89
|
+
* (`./assemble-call.ts`) against the ledger-v9 module.
|
|
90
|
+
*
|
|
91
|
+
* `options.contractState` is the migrated, post-fork v9 `ContractState` —
|
|
92
|
+
* read from chain, or otherwise carrying the contract's real registered
|
|
93
|
+
* operations. It must already carry the operation for the circuit: a
|
|
94
|
+
* keep-state call registers no new verifier key.
|
|
95
|
+
*
|
|
96
|
+
* @param options The transcript to wrap, the contract's address, and the
|
|
97
|
+
* migrated post-fork state to resolve the circuit's operation against.
|
|
98
|
+
* @returns The v9-native call prototype.
|
|
99
|
+
* @throws ComposeFailedError at stage `'wrap-call'` if `contractState`
|
|
100
|
+
* registers no operation for the circuit, and at `'call-verifier-key'` if the
|
|
101
|
+
* registered operation carries no verifier key — rather than falling back to a
|
|
102
|
+
* blank, unverifiable operation.
|
|
103
|
+
* @see {@link RetainedEraExecution}
|
|
104
|
+
*/
|
|
105
|
+
const wrapKeepStateCall = (options) => {
|
|
106
|
+
const { transcript, contractAddress, contractState, ledgerParameters } = options;
|
|
107
|
+
return assembleCallPrototype(ledgerV9, {
|
|
108
|
+
circuitId: transcript.circuitId,
|
|
109
|
+
contractAddress,
|
|
110
|
+
// The retained execution leg partitions nothing: it always submits the raw
|
|
111
|
+
// op sequence as `'unpartitioned'` -- see RetainedEraExecution.
|
|
112
|
+
transcript: {
|
|
113
|
+
kind: 'unpartitioned',
|
|
114
|
+
preState: transcript.preContractState.data.state.encode(),
|
|
115
|
+
publicTranscript: transcript.publicTranscript,
|
|
116
|
+
partitionContext: transcript.partitionContext
|
|
117
|
+
},
|
|
118
|
+
privateTranscriptOutputs: transcript.privateTranscriptOutputs,
|
|
119
|
+
input: transcript.input,
|
|
120
|
+
output: transcript.output,
|
|
121
|
+
operations: contractState,
|
|
122
|
+
ledgerParameters,
|
|
123
|
+
stage: 'wrap-call',
|
|
124
|
+
version: 'v9'
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/*
|
|
129
|
+
* This file is part of midnight-js.
|
|
130
|
+
* Copyright (C) Midnight Foundation
|
|
131
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
132
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
133
|
+
* You may not use this file except in compliance with the License.
|
|
134
|
+
* You may obtain a copy of the License at
|
|
135
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
136
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
137
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
138
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
139
|
+
* See the License for the specific language governing permissions and
|
|
140
|
+
* limitations under the License.
|
|
141
|
+
*/
|
|
142
|
+
/**
|
|
143
|
+
* Structural equality over the `EncodedStateValue` algebra — plain objects,
|
|
144
|
+
* arrays, `Map`s, `Uint8Array`s and primitives.
|
|
145
|
+
*
|
|
146
|
+
* `Map`s are compared pairwise in iteration order, deliberately, and that order
|
|
147
|
+
* is not ascending by key — do not reason about it as sorted.
|
|
148
|
+
*
|
|
149
|
+
* @param a One value in the algebra.
|
|
150
|
+
* @param b The value to compare it against.
|
|
151
|
+
* @returns `true` when the two are structurally equal.
|
|
152
|
+
* @see {@link RetainedEraExecution}
|
|
153
|
+
*/
|
|
154
|
+
const structurallyEqual = (a, b) => {
|
|
155
|
+
if (a === b) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
if (a instanceof Uint8Array || b instanceof Uint8Array) {
|
|
162
|
+
return (a instanceof Uint8Array && b instanceof Uint8Array && a.length === b.length && a.every((byte, i) => byte === b[i]));
|
|
163
|
+
}
|
|
164
|
+
if (a instanceof Map || b instanceof Map) {
|
|
165
|
+
if (!(a instanceof Map) || !(b instanceof Map) || a.size !== b.size) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
const bEntries = Array.from(b);
|
|
169
|
+
return Array.from(a).every(([key, value], i) => {
|
|
170
|
+
const bEntry = bEntries[i];
|
|
171
|
+
return bEntry !== undefined && structurallyEqual(key, bEntry[0]) && structurallyEqual(value, bEntry[1]);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
175
|
+
return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((item, i) => structurallyEqual(item, b[i]));
|
|
176
|
+
}
|
|
177
|
+
const aRecord = { ...a };
|
|
178
|
+
const bRecord = { ...b };
|
|
179
|
+
const aKeys = Object.keys(aRecord);
|
|
180
|
+
// `key in bRecord`, not just a matching key count, and a partial guard only --
|
|
181
|
+
// see RetainedEraExecution and SharedTableDiscipline.
|
|
182
|
+
return (aKeys.length === Object.keys(bRecord).length &&
|
|
183
|
+
aKeys.every((key) => key in bRecord && structurallyEqual(aRecord[key], bRecord[key])));
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Reads a bounded Merkle tree's root, failing with
|
|
187
|
+
* {@link MerkleNotRehashedError} when the tree has not been rehashed.
|
|
188
|
+
*
|
|
189
|
+
* Three shapes of "no root" are treated alike: `undefined`, `null`, and a
|
|
190
|
+
* throw out of the wasm-bindgen shim for `root()`.
|
|
191
|
+
*
|
|
192
|
+
* @param tree The bounded Merkle tree to read.
|
|
193
|
+
* @returns The tree's root.
|
|
194
|
+
* @throws MerkleNotRehashedError If the tree has no readable root, in any of
|
|
195
|
+
* those three shapes.
|
|
196
|
+
* @see {@link RetainedEraExecution}
|
|
197
|
+
*/
|
|
198
|
+
const checkRoot = (tree) => {
|
|
199
|
+
let root;
|
|
200
|
+
try {
|
|
201
|
+
root = tree.root();
|
|
202
|
+
}
|
|
203
|
+
catch (cause) {
|
|
204
|
+
throw new MerkleNotRehashedError(cause);
|
|
205
|
+
}
|
|
206
|
+
if (root == null) {
|
|
207
|
+
throw new MerkleNotRehashedError();
|
|
208
|
+
}
|
|
209
|
+
return root;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Asserts that every bounded Merkle tree in a `StateValue` tree already has
|
|
213
|
+
* its node hashes computed, recursing through the only two container variants
|
|
214
|
+
* in the algebra (`array` and `map`) and ignoring the leaf variants (`cell`,
|
|
215
|
+
* `null`, and `boundedMerkleTree`'s own contents).
|
|
216
|
+
*
|
|
217
|
+
* Does not mutate or rebuild the state: a rootless tree is refused, never
|
|
218
|
+
* repaired.
|
|
219
|
+
*
|
|
220
|
+
* @param sv The `StateValue` tree to walk.
|
|
221
|
+
* @throws MerkleNotRehashedError On the first tree without a readable root,
|
|
222
|
+
* via {@link checkRoot}.
|
|
223
|
+
* @throws DownConvertFailedError If the walk meets a `StateValue` variant the
|
|
224
|
+
* pinned typings do not declare.
|
|
225
|
+
* @see {@link RetainedEraExecution}
|
|
226
|
+
*/
|
|
227
|
+
const assertMerkleTreesRehashed = (sv) => {
|
|
228
|
+
const variant = sv.type();
|
|
229
|
+
switch (variant) {
|
|
230
|
+
case 'boundedMerkleTree':
|
|
231
|
+
checkRoot(sv.asBoundedMerkleTree());
|
|
232
|
+
return;
|
|
233
|
+
case 'array':
|
|
234
|
+
sv.asArray().forEach((element) => assertMerkleTreesRehashed(element));
|
|
235
|
+
return;
|
|
236
|
+
case 'map': {
|
|
237
|
+
const map = sv.asMap();
|
|
238
|
+
map.keys().forEach((key) => assertMerkleTreesRehashed(map.get(key)));
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
case 'cell':
|
|
242
|
+
case 'null':
|
|
243
|
+
return;
|
|
244
|
+
default: {
|
|
245
|
+
// Compile-time exhaustiveness plus a runtime throw; neither is redundant
|
|
246
|
+
// with the other -- see SharedTableDiscipline.
|
|
247
|
+
const unhandled = variant;
|
|
248
|
+
throw new DownConvertFailedError('state down-convert', new Error(`unhandled StateValue variant '${String(unhandled)}' in the Merkle rehash walk`));
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Down-converts an already-extracted (post-fork) {@link EncodedStateValue}
|
|
254
|
+
* into the pre-fork {@link DownConvertedState} a v8-era circuit executes
|
|
255
|
+
* against, decoding it through `ledger8Runtime` and asserting (via
|
|
256
|
+
* {@link assertMerkleTreesRehashed}) that every bounded Merkle tree it
|
|
257
|
+
* contains already has its hashes computed.
|
|
258
|
+
*
|
|
259
|
+
* Never returns a silently empty or partial state: every failure leaves as a
|
|
260
|
+
* coded error. Structural integrity is checked by re-encoding the decoded value
|
|
261
|
+
* and comparing it to the input, which costs one extra encode plus a deep
|
|
262
|
+
* comparison per call.
|
|
263
|
+
*
|
|
264
|
+
* `ledger8Runtime` is checked before anything is decoded. Only the two members
|
|
265
|
+
* this function actually calls are checked; `ContractState` is on
|
|
266
|
+
* {@link Ledger8CompactRuntime} to pin the era, and is never dereferenced here.
|
|
267
|
+
*
|
|
268
|
+
* @param state The already-extracted post-fork encoded state value.
|
|
269
|
+
* @param ledger8Runtime The injected pre-fork runtime slice.
|
|
270
|
+
* @returns The pre-fork state a v8-era circuit executes against.
|
|
271
|
+
* @throws Ledger8RuntimeInvalidError If `ledger8Runtime` is missing
|
|
272
|
+
* `StateValue.decode` or `ChargedState`.
|
|
273
|
+
* @throws DownConvertFailedError If the state cannot be decoded, does not
|
|
274
|
+
* re-encode to its source, or the Merkle walk meets an undeclared variant —
|
|
275
|
+
* carrying the underlying failure on `cause`.
|
|
276
|
+
* @throws MerkleNotRehashedError If any bounded Merkle tree in the state has no
|
|
277
|
+
* readable root.
|
|
278
|
+
* @see {@link RetainedEraExecution}
|
|
279
|
+
* @see {@link FailClosedDecoding}
|
|
280
|
+
*/
|
|
281
|
+
const downConvertForExecution = (state, ledger8Runtime) => {
|
|
282
|
+
if (typeof ledger8Runtime?.StateValue?.decode !== 'function') {
|
|
283
|
+
throw new Ledger8RuntimeInvalidError('StateValue.decode');
|
|
284
|
+
}
|
|
285
|
+
if (typeof ledger8Runtime.ChargedState !== 'function') {
|
|
286
|
+
throw new Ledger8RuntimeInvalidError('ChargedState');
|
|
287
|
+
}
|
|
288
|
+
try {
|
|
289
|
+
const decoded = ledger8Runtime.StateValue.decode(state);
|
|
290
|
+
if (!structurallyEqual(decoded.encode(), state)) {
|
|
291
|
+
throw new DownConvertFailedError('state down-convert', new Error(`decoded StateValue did not re-encode to its source (source tag '${state.tag}')`));
|
|
292
|
+
}
|
|
293
|
+
assertMerkleTreesRehashed(decoded);
|
|
294
|
+
return { data: new ledger8Runtime.ChargedState(decoded) };
|
|
295
|
+
}
|
|
296
|
+
catch (cause) {
|
|
297
|
+
if (cause instanceof DownConvertFailedError || cause instanceof MerkleNotRehashedError) {
|
|
298
|
+
throw cause;
|
|
299
|
+
}
|
|
300
|
+
throw new DownConvertFailedError('state down-convert', cause);
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
/*
|
|
305
|
+
* This file is part of midnight-js.
|
|
306
|
+
* Copyright (C) Midnight Foundation
|
|
307
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
308
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
309
|
+
* You may not use this file except in compliance with the License.
|
|
310
|
+
* You may obtain a copy of the License at
|
|
311
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
312
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
313
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
314
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
315
|
+
* See the License for the specific language governing permissions and
|
|
316
|
+
* limitations under the License.
|
|
317
|
+
*/
|
|
318
|
+
/**
|
|
319
|
+
* Runs one impure circuit on a pre-fork (`compact-runtime@0.16`) contract
|
|
320
|
+
* instance and packages every artifact {@link wrapKeepStateCall} needs into a
|
|
321
|
+
* {@link TranscriptPojo}.
|
|
322
|
+
*
|
|
323
|
+
* A circuit that moved coins runs like any other: its post-call Zswap local
|
|
324
|
+
* state leaves on {@link TranscriptPojo}, decoded through the injected runtime,
|
|
325
|
+
* for the caller to turn into the transaction's Zswap offer.
|
|
326
|
+
*
|
|
327
|
+
* @param options The contract module, circuit id, arguments, down-converted
|
|
328
|
+
* state, contract address, coin public key and private state.
|
|
329
|
+
* @param ledger8Runtime The injected pre-fork glue slice.
|
|
330
|
+
* @returns Every artifact a v9-native call prototype needs.
|
|
331
|
+
* @throws Error A plain `Error` — not a {@link PROTOCOL_ERROR_CODES}-carrying
|
|
332
|
+
* class — when `circuitId` names no entry point on
|
|
333
|
+
* `contract.impureCircuits`.
|
|
334
|
+
* @see {@link RetainedEraExecution}
|
|
335
|
+
*/
|
|
336
|
+
const executeCircuit = (options, ledger8Runtime) => {
|
|
337
|
+
const { contract, circuitId, args, state, address, coinPk, privateState } = options;
|
|
338
|
+
const circuit = Object.hasOwn(contract.impureCircuits, circuitId) ? contract.impureCircuits[circuitId] : undefined;
|
|
339
|
+
if (typeof circuit !== 'function') {
|
|
340
|
+
throw new Error(`No impure circuit named '${circuitId}' on this pre-fork contract instance. ` +
|
|
341
|
+
`Available circuits: ${Object.keys(contract.impureCircuits).join(', ') || '(none)'}.`);
|
|
342
|
+
}
|
|
343
|
+
const ctx = ledger8Runtime.createCircuitContext(address, coinPk, state.data, privateState, undefined, ledger8Runtime.CostModel.initialCostModel());
|
|
344
|
+
// Read BEFORE the circuit runs. The glue swaps `currentQueryContext` for a
|
|
345
|
+
// new context on every coin it registers, so after the call this object no
|
|
346
|
+
// longer answers for the context the call started from.
|
|
347
|
+
const preCallBlock = ctx.currentQueryContext.block;
|
|
348
|
+
const preCallEffects = ctx.currentQueryContext.effects;
|
|
349
|
+
const res = circuit(ctx, ...args);
|
|
350
|
+
return {
|
|
351
|
+
circuitId,
|
|
352
|
+
result: res.result,
|
|
353
|
+
input: res.proofData.input,
|
|
354
|
+
output: res.proofData.output,
|
|
355
|
+
publicTranscript: res.proofData.publicTranscript,
|
|
356
|
+
privateTranscriptOutputs: res.proofData.privateTranscriptOutputs,
|
|
357
|
+
preContractState: state,
|
|
358
|
+
postContractState: { data: res.context.currentQueryContext.state },
|
|
359
|
+
// Encoded HERE, where the retained runtime is in scope, rather than by the
|
|
360
|
+
// caller: `.encode()` is on the pre-fork `StateValue` this module already
|
|
361
|
+
// holds, and a caller reaching for it would be reaching through a handle
|
|
362
|
+
// whose type it cannot name.
|
|
363
|
+
postContractStateEncoded: res.context.currentQueryContext.state.state.encode(),
|
|
364
|
+
privateStateAfter: res.context.currentPrivateState,
|
|
365
|
+
partitionContext: {
|
|
366
|
+
block: preCallBlock,
|
|
367
|
+
effects: preCallEffects,
|
|
368
|
+
comIndices: res.context.currentQueryContext.comIndices
|
|
369
|
+
},
|
|
370
|
+
zswapLocalState: ledger8Runtime.decodeZswapLocalState(res.context.currentZswapLocalState)
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
/*
|
|
375
|
+
* This file is part of midnight-js.
|
|
376
|
+
* Copyright (C) Midnight Foundation
|
|
377
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
378
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
379
|
+
* You may not use this file except in compliance with the License.
|
|
380
|
+
* You may obtain a copy of the License at
|
|
381
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
382
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
383
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
384
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
385
|
+
* See the License for the specific language governing permissions and
|
|
386
|
+
* limitations under the License.
|
|
387
|
+
*/
|
|
388
|
+
/**
|
|
389
|
+
* The closed set of axes this guard will run on, as a lookup rather than a
|
|
390
|
+
* comparison chain.
|
|
391
|
+
*
|
|
392
|
+
* Kept here rather than exported from `errors.ts`, which is a build entry:
|
|
393
|
+
* nothing outside this module needs to test an axis, and the engine's whole
|
|
394
|
+
* design is to stay off the public surface.
|
|
395
|
+
*
|
|
396
|
+
* @see {@link SharedTableDiscipline}
|
|
397
|
+
*/
|
|
398
|
+
const KNOWN_AXES = Object.freeze(Object.assign(Object.create(null), {
|
|
399
|
+
'onchain-runtime-v3': true
|
|
400
|
+
}));
|
|
401
|
+
const isKnownAxis = (axis) => KNOWN_AXES[axis] === true;
|
|
402
|
+
/**
|
|
403
|
+
* Fails fast on a dual-instantiation of a WASM package the down-convert
|
|
404
|
+
* engine depends on, along one named `axis`.
|
|
405
|
+
*
|
|
406
|
+
* Pass a **shared binding** — a class the package exports, such as
|
|
407
|
+
* `ChargedState` or `StateValue` — never a module namespace object.
|
|
408
|
+
*
|
|
409
|
+
* The two probes are compared symmetrically, so they are interchangeable, but
|
|
410
|
+
* they must be obtained from **two different acquisition paths** (two distinct
|
|
411
|
+
* import specifiers, or an import versus a caller-supplied module). Passing the
|
|
412
|
+
* same binding twice satisfies the check trivially and proves nothing; the
|
|
413
|
+
* caller owns that, because nothing in the signature can enforce it.
|
|
414
|
+
*
|
|
415
|
+
* @param axis The physical-copy axis to check, validated against
|
|
416
|
+
* {@link Ledger8InstanceAxis} before either probe is looked at.
|
|
417
|
+
* @param probeA A shared binding, obtained through one acquisition path.
|
|
418
|
+
* @param probeB The same binding, obtained through a different acquisition
|
|
419
|
+
* path.
|
|
420
|
+
* @throws UnknownLedger8AxisError If `axis` is not a member of
|
|
421
|
+
* {@link Ledger8InstanceAxis}.
|
|
422
|
+
* @throws Ledger8RuntimeInvalidError If either probe is `null` or `undefined`.
|
|
423
|
+
* A missing probe is a binding the caller did not hand over, so it is not
|
|
424
|
+
* reported as a mismatch.
|
|
425
|
+
* @throws Ledger8InstanceMismatchError If the two probes are not
|
|
426
|
+
* reference-equal, i.e. the package resolved to two physically distinct
|
|
427
|
+
* copies in this process.
|
|
428
|
+
* @example
|
|
429
|
+
* ```typescript
|
|
430
|
+
* const [glue, ocrt3] = await Promise.all([
|
|
431
|
+
* import('compact-runtime-ledger8'),
|
|
432
|
+
* import('@midnight-ntwrk/onchain-runtime-v3')
|
|
433
|
+
* ]);
|
|
434
|
+
* // Two acquisition paths to the same binding, never a namespace object.
|
|
435
|
+
* assertSharedLedger8Instance('onchain-runtime-v3', ocrt3.ChargedState, glue.ChargedState);
|
|
436
|
+
* ```
|
|
437
|
+
* @see {@link DualInstantiationGuard}
|
|
438
|
+
*/
|
|
439
|
+
const assertSharedLedger8Instance = (axis, probeA, probeB) => {
|
|
440
|
+
if (!isKnownAxis(axis)) {
|
|
441
|
+
throw new UnknownLedger8AxisError(String(axis));
|
|
442
|
+
}
|
|
443
|
+
if (probeA == null || probeB == null) {
|
|
444
|
+
throw new Ledger8RuntimeInvalidError(`${axis} instance probe`);
|
|
445
|
+
}
|
|
446
|
+
if (probeA !== probeB) {
|
|
447
|
+
throw new Ledger8InstanceMismatchError(axis);
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
/*
|
|
452
|
+
* This file is part of midnight-js.
|
|
453
|
+
* Copyright (C) Midnight Foundation
|
|
454
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
455
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
456
|
+
* You may not use this file except in compliance with the License.
|
|
457
|
+
* You may obtain a copy of the License at
|
|
458
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
459
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
460
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
461
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
462
|
+
* See the License for the specific language governing permissions and
|
|
463
|
+
* limitations under the License.
|
|
464
|
+
*/
|
|
465
|
+
/**
|
|
466
|
+
* Acquires the retained pre-fork toolchain — the `compact-runtime@0.16` glue
|
|
467
|
+
* and `@midnight-ntwrk/onchain-runtime-v3` — and builds a {@link Ledger8Engine}
|
|
468
|
+
* bound to it.
|
|
469
|
+
*
|
|
470
|
+
* Runs {@link assertSharedLedger8Instance} exactly once, on the
|
|
471
|
+
* `onchain-runtime-v3` axis. Any acquisition failure surfaces through the
|
|
472
|
+
* facade (`lib/v8/load-engine.ts`) as `Ledger8RuntimeMissingError`
|
|
473
|
+
* (`../../errors.ts`).
|
|
474
|
+
*
|
|
475
|
+
* Does NOT acquire the v8 ledger module: a consumer that only executes
|
|
476
|
+
* circuits and binds them onto v9 never instantiates the multi-megabyte v8
|
|
477
|
+
* WASM, and never hard-depends on ledger-v8 resolving.
|
|
478
|
+
*
|
|
479
|
+
* @returns The engine surface, with the acquired runtime captured in closure.
|
|
480
|
+
* @throws Ledger8InstanceMismatchError If `onchain-runtime-v3` resolved to two
|
|
481
|
+
* physically distinct copies in this process.
|
|
482
|
+
* @see {@link EraSeam}
|
|
483
|
+
* @see {@link DualInstantiationGuard}
|
|
484
|
+
* @see {@link ModuleGraphAndLazyLoading}
|
|
485
|
+
*/
|
|
486
|
+
const createLedger8Engine = async () => {
|
|
487
|
+
const [glue, ocrt3] = await Promise.all([
|
|
488
|
+
import('compact-runtime-ledger8'),
|
|
489
|
+
import('@midnight-ntwrk/onchain-runtime-v3')
|
|
490
|
+
]);
|
|
491
|
+
assertSharedLedger8Instance('onchain-runtime-v3', ocrt3.ChargedState, glue.ChargedState);
|
|
492
|
+
// `ContractState` from ocrt3, the other two from the glue: sound only because
|
|
493
|
+
// of the assertion above -- see DualInstantiationGuard. The member is what
|
|
494
|
+
// pins this object to the pre-fork era -- see `Ledger8CompactRuntime`.
|
|
495
|
+
const ledger8CompactRuntime = {
|
|
496
|
+
ContractState: ocrt3.ContractState,
|
|
497
|
+
StateValue: glue.StateValue,
|
|
498
|
+
ChargedState: glue.ChargedState
|
|
499
|
+
};
|
|
500
|
+
const ledger8ExecutionRuntime = {
|
|
501
|
+
decodeZswapLocalState: glue.decodeZswapLocalState,
|
|
502
|
+
createCircuitContext: glue.createCircuitContext,
|
|
503
|
+
CostModel: glue.CostModel
|
|
504
|
+
};
|
|
505
|
+
const ledger8ConstructorRuntime = {
|
|
506
|
+
createConstructorContext: glue.createConstructorContext,
|
|
507
|
+
decodeZswapLocalState: glue.decodeZswapLocalState
|
|
508
|
+
};
|
|
509
|
+
return {
|
|
510
|
+
downConvertForExecution: (state) => downConvertForExecution(state, ledger8CompactRuntime),
|
|
511
|
+
executeCircuit: (options) => executeCircuit(options, ledger8ExecutionRuntime),
|
|
512
|
+
wrapKeepStateCall,
|
|
513
|
+
reexpressOperationsForCurrentEra,
|
|
514
|
+
executeConstructor: (options) => executeConstructor(options, ledger8ConstructorRuntime)
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
export { createLedger8Engine };
|
|
519
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sources":["../src/lib/v9/operations.ts","../src/lib/v9/wrap.ts","../src/lib/v8/down-convert.ts","../src/lib/v8/execute.ts","../src/lib/v8/instance-guard.ts","../src/lib/v8/engine.ts"],"sourcesContent":[null,null,null,null,null,null],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;AAaG;AAOH;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACI,MAAM,gCAAgC,GAAG,CAAC,WAA8C,KAAgB;AAC7G,IAAA,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,aAAa,EAAE;IAC1C,IAAI,UAAU,GAAG,CAAC;AAElB,IAAA,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;;;;;AAKpC,QAAA,IAAI,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE;YACxC;QACF;AACA,QAAA,MAAM,SAAS,GAAG,IAAI,QAAQ,CAAC,iBAAiB,EAAE;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