@midnight-ntwrk/midnight-js-types 5.0.0-beta.3 → 5.0.0-beta.4
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/dist/index.cjs +79 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -5
- package/dist/index.d.mts +40 -5
- package/dist/index.d.ts +40 -5
- package/dist/index.mjs +79 -17
- package/dist/index.mjs.map +1 -1
- package/dist/proof-provider.d.ts +4 -1
- package/dist/proof-provider.d.ts.map +1 -1
- package/dist/zk-config-registry.d.ts +36 -4
- package/dist/zk-config-registry.d.ts.map +1 -1
- package/package.json +6 -3
package/dist/index.cjs
CHANGED
|
@@ -435,11 +435,24 @@ class ZKConfigProvider {
|
|
|
435
435
|
*/
|
|
436
436
|
class ZKArtifactNotFoundError extends Error {
|
|
437
437
|
keyLocation;
|
|
438
|
-
|
|
438
|
+
suppressedErrors;
|
|
439
|
+
/**
|
|
440
|
+
* @param keyLocation The location that could not be resolved.
|
|
441
|
+
* @param suppressedErrors Errors raised by individual sources while probing their verifier key
|
|
442
|
+
* (integrity violations, permission/IO failures, or a genuine absence of the circuit). They are
|
|
443
|
+
* attached as this error's `cause` so a real failure — for example a `ZkArtifactIntegrityError` —
|
|
444
|
+
* is not hidden behind the "missing or stale" message.
|
|
445
|
+
*/
|
|
446
|
+
constructor(keyLocation, suppressedErrors = []) {
|
|
439
447
|
super(`No ZK artifact bundle matches the deployed verifier key for contract ` +
|
|
440
448
|
`'${keyLocation.contractAddress}', circuit '${keyLocation.circuitId}'. The local compiled ` +
|
|
441
|
-
`artifacts are missing or stale with respect to the deployed contract
|
|
449
|
+
`artifacts are missing or stale with respect to the deployed contract.`, suppressedErrors.length > 0
|
|
450
|
+
? {
|
|
451
|
+
cause: new AggregateError(suppressedErrors, 'One or more artifact sources errored while resolving the verifier key.')
|
|
452
|
+
}
|
|
453
|
+
: undefined);
|
|
442
454
|
this.keyLocation = keyLocation;
|
|
455
|
+
this.suppressedErrors = suppressedErrors;
|
|
443
456
|
this.name = 'ZKArtifactNotFoundError';
|
|
444
457
|
}
|
|
445
458
|
}
|
|
@@ -457,12 +470,23 @@ class ZKArtifactNotFoundError extends Error {
|
|
|
457
470
|
* resolution immune to redeploys, multiple deployments of one contract, and circuit-name
|
|
458
471
|
* collisions across contracts.
|
|
459
472
|
*
|
|
460
|
-
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs
|
|
461
|
-
*
|
|
473
|
+
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs. The
|
|
474
|
+
* location→source binding and each source's verifier-key hashes are memoized; the (potentially
|
|
475
|
+
* multi-MB) artifacts themselves are re-fetched from the bound source rather than retained, so the
|
|
476
|
+
* registry's memory does not grow with the number of distinct locations resolved.
|
|
462
477
|
*/
|
|
463
478
|
class ZKConfigRegistry {
|
|
464
479
|
sources;
|
|
465
|
-
|
|
480
|
+
/**
|
|
481
|
+
* Binds a resolved key location to the source that serves it — a single source reference per
|
|
482
|
+
* location, so it can be held for the registry's lifetime without retaining artifact bytes.
|
|
483
|
+
*/
|
|
484
|
+
boundSource = new Map();
|
|
485
|
+
/**
|
|
486
|
+
* Memoizes each source's verifier-key hash per circuit, so source selection reuses computed
|
|
487
|
+
* hashes instead of re-fetching and re-hashing keys on every new location.
|
|
488
|
+
*/
|
|
489
|
+
vkHashByCircuit = new Map();
|
|
466
490
|
/**
|
|
467
491
|
* @param sources The compiled-contract artifact sources to resolve against — one per compiled
|
|
468
492
|
* contract the application can call (its own contracts and any cross-contract call targets).
|
|
@@ -514,27 +538,65 @@ class ZKConfigRegistry {
|
|
|
514
538
|
};
|
|
515
539
|
}
|
|
516
540
|
async resolve(keyLocation, parsed) {
|
|
517
|
-
const
|
|
518
|
-
if (
|
|
519
|
-
return
|
|
541
|
+
const bound = this.boundSource.get(keyLocation);
|
|
542
|
+
if (bound !== undefined) {
|
|
543
|
+
return this.buildConfig(bound, parsed.circuitId);
|
|
520
544
|
}
|
|
545
|
+
const suppressedErrors = [];
|
|
521
546
|
for (const source of this.sources) {
|
|
522
|
-
let
|
|
547
|
+
let probe;
|
|
523
548
|
try {
|
|
524
|
-
|
|
549
|
+
probe = await this.probeVerifierKeyHash(source, parsed.circuitId);
|
|
525
550
|
}
|
|
526
|
-
catch {
|
|
527
|
-
//
|
|
551
|
+
catch (error) {
|
|
552
|
+
// A source may simply not have this circuit, or the read may have failed for a real reason
|
|
553
|
+
// (integrity violation, permissions, IO). The provider interface can't tell them apart, so
|
|
554
|
+
// keep probing other sources but retain the error to surface as the cause if none matches —
|
|
555
|
+
// never silently discard it.
|
|
556
|
+
suppressedErrors.push(error);
|
|
528
557
|
continue;
|
|
529
558
|
}
|
|
530
|
-
if (
|
|
559
|
+
if (probe.hash !== parsed.verifierKeyHash) {
|
|
531
560
|
continue;
|
|
532
561
|
}
|
|
533
|
-
|
|
534
|
-
this.
|
|
535
|
-
return config;
|
|
562
|
+
this.boundSource.set(keyLocation, source);
|
|
563
|
+
return this.buildConfig(source, parsed.circuitId, probe.verifierKey);
|
|
536
564
|
}
|
|
537
|
-
throw new ZKArtifactNotFoundError(parsed);
|
|
565
|
+
throw new ZKArtifactNotFoundError(parsed, suppressedErrors);
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Returns a source's verifier-key hash for a circuit, memoized per source and circuit. The
|
|
569
|
+
* verifier key bytes are included only when freshly fetched (a memo miss), so a caller that
|
|
570
|
+
* matches on the hash can reuse them and avoid a second fetch (and re-integrity-verification).
|
|
571
|
+
*/
|
|
572
|
+
async probeVerifierKeyHash(source, circuitId) {
|
|
573
|
+
const cached = this.vkHashByCircuit.get(source)?.get(circuitId);
|
|
574
|
+
if (cached !== undefined) {
|
|
575
|
+
return { hash: cached };
|
|
576
|
+
}
|
|
577
|
+
const verifierKey = await source.getVerifierKey(circuitId);
|
|
578
|
+
const hash = compactJs.hashVerifierKey(verifierKey);
|
|
579
|
+
let byCircuit = this.vkHashByCircuit.get(source);
|
|
580
|
+
if (byCircuit === undefined) {
|
|
581
|
+
byCircuit = new Map();
|
|
582
|
+
this.vkHashByCircuit.set(source, byCircuit);
|
|
583
|
+
}
|
|
584
|
+
byCircuit.set(circuitId, hash);
|
|
585
|
+
return { hash, verifierKey };
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Assembles the {@link ZKConfig} for a circuit from a source. Reuses an already-fetched verifier
|
|
589
|
+
* key when the caller has one, so it is not fetched (and re-integrity-verified) a second time;
|
|
590
|
+
* otherwise fetches all three artifacts from the source. Unlike {@link ZKConfigProvider.get}, the
|
|
591
|
+
* three fetches run concurrently.
|
|
592
|
+
*/
|
|
593
|
+
async buildConfig(source, circuitId, verifierKey) {
|
|
594
|
+
const [proverKey, resolvedVerifierKey, zkir] = await Promise.all([
|
|
595
|
+
source.getProverKey(circuitId),
|
|
596
|
+
verifierKey !== undefined ? Promise.resolve(verifierKey) : source.getVerifierKey(circuitId),
|
|
597
|
+
source.getZKIR(circuitId)
|
|
598
|
+
]);
|
|
599
|
+
return { circuitId, proverKey, verifierKey: resolvedVerifierKey, zkir };
|
|
538
600
|
}
|
|
539
601
|
}
|
|
540
602
|
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/contract.ts","../src/errors.ts","../src/logger-provider.ts","../src/midnight-types.ts","../src/private-state-provider.ts","../src/proof-provider.ts","../src/zk-config-provider.ts","../src/zk-config-registry.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":["Effect","Option","Contract","ZKConfigurationReadError","Layer","ZKConfiguration","Configuration","ConfigProvider","ContractExecutableRuntime","Exit","Cause","ContractAddress","LogLevel","CostModel","encodeContractKeyLocation","parseContractKeyLocation","hashVerifierKey"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;AAaG;AAYH;;;;;;;;AAQG;AACH,MAAM,iBAAiB,GAAG,CAAsC,gBAA0C,KACxG,CA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A,OAAO,UAAkB;AAC3B;AAyBA;;;AAGG;AACI,MAAM,4BAA4B,GAAG,CAAmB,QAAqB,KAAI;IACtF,OAAO;QACL,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,EAAE,EAAE,QAAQ,CAAC,IAAI;KAClB;AACH;AAEA;;AAEG;AACI,MAAM,WAAW,GAAG;AAE3B;;AAEG;AACI,MAAM,cAAc,GAAG;AAQ9B;;AAEG;AACI,MAAM,YAAY,GAAG;AAE5B;;;;;AAKG;AACI,MAAM,YAAY,GAAG;AAE5B;;;AAGG;AACI,MAAM,eAAe,GAAG;;AC7J/B;;;;;;;;;;;;;AAaG;AAgCH;;;AAGG;AACI,MAAM,iBAAiB,GAAG;AA4FjC;;;AAGG;AACI,MAAM,uBAAuB,GAAG;;ACjJvC;;;;;;;;;;;;;AAaG;
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/contract.ts","../src/errors.ts","../src/logger-provider.ts","../src/midnight-types.ts","../src/private-state-provider.ts","../src/proof-provider.ts","../src/zk-config-provider.ts","../src/zk-config-registry.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":["Effect","Option","Contract","ZKConfigurationReadError","Layer","ZKConfiguration","Configuration","ConfigProvider","ContractExecutableRuntime","Exit","Cause","ContractAddress","LogLevel","CostModel","encodeContractKeyLocation","parseContractKeyLocation","hashVerifierKey"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;AAaG;AAYH;;;;;;;;AAQG;AACH,MAAM,iBAAiB,GAAG,CAAsC,gBAA0C,KACxG,CAAC,gBAA0D,KACzDA,eAAM,CAAC,GAAG,CAAC,aAAS;;;IAGlB,MAAM,cAAc,GAAG,CAAC,iBAAgD,KACtEA,eAAM,CAAC,UAAU,CAAC;AAChB,QAAA,GAAG,EAAE,MAAM,gBAAgB,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC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;IAC9B;AAEA;;;;;AAKG;AACK,IAAA,MAAM,WAAW,CACvB,MAAgC,EAChC,SAAiB,EACjB,WAAyB,EAAA;AAEzB,QAAA,MAAM,CAAC,SAAS,EAAE,mBAAmB,EAAE,IAAI,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;AAC/D,YAAA,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC;AAC9B,YAAA,WAAW,KAAK,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC;AAC3F,YAAA,MAAM,CAAC,OAAO,CAAC,SAAS;AACzB,SAAA,CAAC;QACF,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,mBAAmB,EAAE,IAAI,EAAE;IACzE;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.cts
CHANGED
|
@@ -825,7 +825,10 @@ type UnboundTransaction = Transaction<SignatureEnabled, Proof, PreBinding>;
|
|
|
825
825
|
*/
|
|
826
826
|
interface ProveTxConfig {
|
|
827
827
|
/**
|
|
828
|
-
* The timeout for the request.
|
|
828
|
+
* The timeout for the request, in milliseconds. This is a per-request timeout for the underlying
|
|
829
|
+
* proof server call, not a hard wall-clock ceiling for the whole `proveTx` call — the proof
|
|
830
|
+
* provider's internal retry/backoff means a `proveTx` call may take longer than this value when
|
|
831
|
+
* retries occur. See https://github.com/midnightntwrk/midnight-js/issues/974.
|
|
829
832
|
*/
|
|
830
833
|
readonly timeout?: number;
|
|
831
834
|
}
|
|
@@ -1316,7 +1319,15 @@ interface MidnightProviders<PCK extends AnyProvableCircuitId = AnyProvableCircui
|
|
|
1316
1319
|
*/
|
|
1317
1320
|
declare class ZKArtifactNotFoundError extends Error {
|
|
1318
1321
|
readonly keyLocation: ContractKeyLocation;
|
|
1319
|
-
|
|
1322
|
+
readonly suppressedErrors: readonly unknown[];
|
|
1323
|
+
/**
|
|
1324
|
+
* @param keyLocation The location that could not be resolved.
|
|
1325
|
+
* @param suppressedErrors Errors raised by individual sources while probing their verifier key
|
|
1326
|
+
* (integrity violations, permission/IO failures, or a genuine absence of the circuit). They are
|
|
1327
|
+
* attached as this error's `cause` so a real failure — for example a `ZkArtifactIntegrityError` —
|
|
1328
|
+
* is not hidden behind the "missing or stale" message.
|
|
1329
|
+
*/
|
|
1330
|
+
constructor(keyLocation: ContractKeyLocation, suppressedErrors?: readonly unknown[]);
|
|
1320
1331
|
}
|
|
1321
1332
|
/**
|
|
1322
1333
|
* Resolves canonical contract key locations to ZK artifacts across a *set* of compiled-contract
|
|
@@ -1332,12 +1343,23 @@ declare class ZKArtifactNotFoundError extends Error {
|
|
|
1332
1343
|
* resolution immune to redeploys, multiple deployments of one contract, and circuit-name
|
|
1333
1344
|
* collisions across contracts.
|
|
1334
1345
|
*
|
|
1335
|
-
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs
|
|
1336
|
-
*
|
|
1346
|
+
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs. The
|
|
1347
|
+
* location→source binding and each source's verifier-key hashes are memoized; the (potentially
|
|
1348
|
+
* multi-MB) artifacts themselves are re-fetched from the bound source rather than retained, so the
|
|
1349
|
+
* registry's memory does not grow with the number of distinct locations resolved.
|
|
1337
1350
|
*/
|
|
1338
1351
|
declare class ZKConfigRegistry {
|
|
1339
1352
|
private readonly sources;
|
|
1340
|
-
|
|
1353
|
+
/**
|
|
1354
|
+
* Binds a resolved key location to the source that serves it — a single source reference per
|
|
1355
|
+
* location, so it can be held for the registry's lifetime without retaining artifact bytes.
|
|
1356
|
+
*/
|
|
1357
|
+
private readonly boundSource;
|
|
1358
|
+
/**
|
|
1359
|
+
* Memoizes each source's verifier-key hash per circuit, so source selection reuses computed
|
|
1360
|
+
* hashes instead of re-fetching and re-hashing keys on every new location.
|
|
1361
|
+
*/
|
|
1362
|
+
private readonly vkHashByCircuit;
|
|
1341
1363
|
/**
|
|
1342
1364
|
* @param sources The compiled-contract artifact sources to resolve against — one per compiled
|
|
1343
1365
|
* contract the application can call (its own contracts and any cross-contract call targets).
|
|
@@ -1366,6 +1388,19 @@ declare class ZKConfigRegistry {
|
|
|
1366
1388
|
*/
|
|
1367
1389
|
asKeyMaterialProvider(): KeyMaterialProvider;
|
|
1368
1390
|
private resolve;
|
|
1391
|
+
/**
|
|
1392
|
+
* Returns a source's verifier-key hash for a circuit, memoized per source and circuit. The
|
|
1393
|
+
* verifier key bytes are included only when freshly fetched (a memo miss), so a caller that
|
|
1394
|
+
* matches on the hash can reuse them and avoid a second fetch (and re-integrity-verification).
|
|
1395
|
+
*/
|
|
1396
|
+
private probeVerifierKeyHash;
|
|
1397
|
+
/**
|
|
1398
|
+
* Assembles the {@link ZKConfig} for a circuit from a source. Reuses an already-fetched verifier
|
|
1399
|
+
* key when the caller has one, so it is not fetched (and re-integrity-verified) a second time;
|
|
1400
|
+
* otherwise fetches all three artifacts from the source. Unlike {@link ZKConfigProvider.get}, the
|
|
1401
|
+
* three fetches run concurrently.
|
|
1402
|
+
*/
|
|
1403
|
+
private buildConfig;
|
|
1369
1404
|
}
|
|
1370
1405
|
|
|
1371
1406
|
export { ExportDecryptionError, FailEntirely, FailFallible, ImportConflictError, InvalidExportFormatError, InvalidProtocolSchemeError, LogLevel, MAX_EXPORT_SIGNING_KEYS, MAX_EXPORT_STATES, PrivateStateExportError, PrivateStateImportError, SegmentFail, SegmentSuccess, SigningKeyExportError, SucceedEntirely, ZKArtifactNotFoundError, ZKConfigProvider, ZKConfigRegistry, asContractAddress, asEffectOption, createProofProvider, createProverKey, createVerifierKey, createZKIR, exitResultOrError, makeContractExecutableRuntime, zkConfigToProvingKeyMaterial };
|
package/dist/index.d.mts
CHANGED
|
@@ -825,7 +825,10 @@ type UnboundTransaction = Transaction<SignatureEnabled, Proof, PreBinding>;
|
|
|
825
825
|
*/
|
|
826
826
|
interface ProveTxConfig {
|
|
827
827
|
/**
|
|
828
|
-
* The timeout for the request.
|
|
828
|
+
* The timeout for the request, in milliseconds. This is a per-request timeout for the underlying
|
|
829
|
+
* proof server call, not a hard wall-clock ceiling for the whole `proveTx` call — the proof
|
|
830
|
+
* provider's internal retry/backoff means a `proveTx` call may take longer than this value when
|
|
831
|
+
* retries occur. See https://github.com/midnightntwrk/midnight-js/issues/974.
|
|
829
832
|
*/
|
|
830
833
|
readonly timeout?: number;
|
|
831
834
|
}
|
|
@@ -1316,7 +1319,15 @@ interface MidnightProviders<PCK extends AnyProvableCircuitId = AnyProvableCircui
|
|
|
1316
1319
|
*/
|
|
1317
1320
|
declare class ZKArtifactNotFoundError extends Error {
|
|
1318
1321
|
readonly keyLocation: ContractKeyLocation;
|
|
1319
|
-
|
|
1322
|
+
readonly suppressedErrors: readonly unknown[];
|
|
1323
|
+
/**
|
|
1324
|
+
* @param keyLocation The location that could not be resolved.
|
|
1325
|
+
* @param suppressedErrors Errors raised by individual sources while probing their verifier key
|
|
1326
|
+
* (integrity violations, permission/IO failures, or a genuine absence of the circuit). They are
|
|
1327
|
+
* attached as this error's `cause` so a real failure — for example a `ZkArtifactIntegrityError` —
|
|
1328
|
+
* is not hidden behind the "missing or stale" message.
|
|
1329
|
+
*/
|
|
1330
|
+
constructor(keyLocation: ContractKeyLocation, suppressedErrors?: readonly unknown[]);
|
|
1320
1331
|
}
|
|
1321
1332
|
/**
|
|
1322
1333
|
* Resolves canonical contract key locations to ZK artifacts across a *set* of compiled-contract
|
|
@@ -1332,12 +1343,23 @@ declare class ZKArtifactNotFoundError extends Error {
|
|
|
1332
1343
|
* resolution immune to redeploys, multiple deployments of one contract, and circuit-name
|
|
1333
1344
|
* collisions across contracts.
|
|
1334
1345
|
*
|
|
1335
|
-
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs
|
|
1336
|
-
*
|
|
1346
|
+
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs. The
|
|
1347
|
+
* location→source binding and each source's verifier-key hashes are memoized; the (potentially
|
|
1348
|
+
* multi-MB) artifacts themselves are re-fetched from the bound source rather than retained, so the
|
|
1349
|
+
* registry's memory does not grow with the number of distinct locations resolved.
|
|
1337
1350
|
*/
|
|
1338
1351
|
declare class ZKConfigRegistry {
|
|
1339
1352
|
private readonly sources;
|
|
1340
|
-
|
|
1353
|
+
/**
|
|
1354
|
+
* Binds a resolved key location to the source that serves it — a single source reference per
|
|
1355
|
+
* location, so it can be held for the registry's lifetime without retaining artifact bytes.
|
|
1356
|
+
*/
|
|
1357
|
+
private readonly boundSource;
|
|
1358
|
+
/**
|
|
1359
|
+
* Memoizes each source's verifier-key hash per circuit, so source selection reuses computed
|
|
1360
|
+
* hashes instead of re-fetching and re-hashing keys on every new location.
|
|
1361
|
+
*/
|
|
1362
|
+
private readonly vkHashByCircuit;
|
|
1341
1363
|
/**
|
|
1342
1364
|
* @param sources The compiled-contract artifact sources to resolve against — one per compiled
|
|
1343
1365
|
* contract the application can call (its own contracts and any cross-contract call targets).
|
|
@@ -1366,6 +1388,19 @@ declare class ZKConfigRegistry {
|
|
|
1366
1388
|
*/
|
|
1367
1389
|
asKeyMaterialProvider(): KeyMaterialProvider;
|
|
1368
1390
|
private resolve;
|
|
1391
|
+
/**
|
|
1392
|
+
* Returns a source's verifier-key hash for a circuit, memoized per source and circuit. The
|
|
1393
|
+
* verifier key bytes are included only when freshly fetched (a memo miss), so a caller that
|
|
1394
|
+
* matches on the hash can reuse them and avoid a second fetch (and re-integrity-verification).
|
|
1395
|
+
*/
|
|
1396
|
+
private probeVerifierKeyHash;
|
|
1397
|
+
/**
|
|
1398
|
+
* Assembles the {@link ZKConfig} for a circuit from a source. Reuses an already-fetched verifier
|
|
1399
|
+
* key when the caller has one, so it is not fetched (and re-integrity-verified) a second time;
|
|
1400
|
+
* otherwise fetches all three artifacts from the source. Unlike {@link ZKConfigProvider.get}, the
|
|
1401
|
+
* three fetches run concurrently.
|
|
1402
|
+
*/
|
|
1403
|
+
private buildConfig;
|
|
1369
1404
|
}
|
|
1370
1405
|
|
|
1371
1406
|
export { ExportDecryptionError, FailEntirely, FailFallible, ImportConflictError, InvalidExportFormatError, InvalidProtocolSchemeError, LogLevel, MAX_EXPORT_SIGNING_KEYS, MAX_EXPORT_STATES, PrivateStateExportError, PrivateStateImportError, SegmentFail, SegmentSuccess, SigningKeyExportError, SucceedEntirely, ZKArtifactNotFoundError, ZKConfigProvider, ZKConfigRegistry, asContractAddress, asEffectOption, createProofProvider, createProverKey, createVerifierKey, createZKIR, exitResultOrError, makeContractExecutableRuntime, zkConfigToProvingKeyMaterial };
|
package/dist/index.d.ts
CHANGED
|
@@ -825,7 +825,10 @@ type UnboundTransaction = Transaction<SignatureEnabled, Proof, PreBinding>;
|
|
|
825
825
|
*/
|
|
826
826
|
interface ProveTxConfig {
|
|
827
827
|
/**
|
|
828
|
-
* The timeout for the request.
|
|
828
|
+
* The timeout for the request, in milliseconds. This is a per-request timeout for the underlying
|
|
829
|
+
* proof server call, not a hard wall-clock ceiling for the whole `proveTx` call — the proof
|
|
830
|
+
* provider's internal retry/backoff means a `proveTx` call may take longer than this value when
|
|
831
|
+
* retries occur. See https://github.com/midnightntwrk/midnight-js/issues/974.
|
|
829
832
|
*/
|
|
830
833
|
readonly timeout?: number;
|
|
831
834
|
}
|
|
@@ -1316,7 +1319,15 @@ interface MidnightProviders<PCK extends AnyProvableCircuitId = AnyProvableCircui
|
|
|
1316
1319
|
*/
|
|
1317
1320
|
declare class ZKArtifactNotFoundError extends Error {
|
|
1318
1321
|
readonly keyLocation: ContractKeyLocation;
|
|
1319
|
-
|
|
1322
|
+
readonly suppressedErrors: readonly unknown[];
|
|
1323
|
+
/**
|
|
1324
|
+
* @param keyLocation The location that could not be resolved.
|
|
1325
|
+
* @param suppressedErrors Errors raised by individual sources while probing their verifier key
|
|
1326
|
+
* (integrity violations, permission/IO failures, or a genuine absence of the circuit). They are
|
|
1327
|
+
* attached as this error's `cause` so a real failure — for example a `ZkArtifactIntegrityError` —
|
|
1328
|
+
* is not hidden behind the "missing or stale" message.
|
|
1329
|
+
*/
|
|
1330
|
+
constructor(keyLocation: ContractKeyLocation, suppressedErrors?: readonly unknown[]);
|
|
1320
1331
|
}
|
|
1321
1332
|
/**
|
|
1322
1333
|
* Resolves canonical contract key locations to ZK artifacts across a *set* of compiled-contract
|
|
@@ -1332,12 +1343,23 @@ declare class ZKArtifactNotFoundError extends Error {
|
|
|
1332
1343
|
* resolution immune to redeploys, multiple deployments of one contract, and circuit-name
|
|
1333
1344
|
* collisions across contracts.
|
|
1334
1345
|
*
|
|
1335
|
-
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs
|
|
1336
|
-
*
|
|
1346
|
+
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs. The
|
|
1347
|
+
* location→source binding and each source's verifier-key hashes are memoized; the (potentially
|
|
1348
|
+
* multi-MB) artifacts themselves are re-fetched from the bound source rather than retained, so the
|
|
1349
|
+
* registry's memory does not grow with the number of distinct locations resolved.
|
|
1337
1350
|
*/
|
|
1338
1351
|
declare class ZKConfigRegistry {
|
|
1339
1352
|
private readonly sources;
|
|
1340
|
-
|
|
1353
|
+
/**
|
|
1354
|
+
* Binds a resolved key location to the source that serves it — a single source reference per
|
|
1355
|
+
* location, so it can be held for the registry's lifetime without retaining artifact bytes.
|
|
1356
|
+
*/
|
|
1357
|
+
private readonly boundSource;
|
|
1358
|
+
/**
|
|
1359
|
+
* Memoizes each source's verifier-key hash per circuit, so source selection reuses computed
|
|
1360
|
+
* hashes instead of re-fetching and re-hashing keys on every new location.
|
|
1361
|
+
*/
|
|
1362
|
+
private readonly vkHashByCircuit;
|
|
1341
1363
|
/**
|
|
1342
1364
|
* @param sources The compiled-contract artifact sources to resolve against — one per compiled
|
|
1343
1365
|
* contract the application can call (its own contracts and any cross-contract call targets).
|
|
@@ -1366,6 +1388,19 @@ declare class ZKConfigRegistry {
|
|
|
1366
1388
|
*/
|
|
1367
1389
|
asKeyMaterialProvider(): KeyMaterialProvider;
|
|
1368
1390
|
private resolve;
|
|
1391
|
+
/**
|
|
1392
|
+
* Returns a source's verifier-key hash for a circuit, memoized per source and circuit. The
|
|
1393
|
+
* verifier key bytes are included only when freshly fetched (a memo miss), so a caller that
|
|
1394
|
+
* matches on the hash can reuse them and avoid a second fetch (and re-integrity-verification).
|
|
1395
|
+
*/
|
|
1396
|
+
private probeVerifierKeyHash;
|
|
1397
|
+
/**
|
|
1398
|
+
* Assembles the {@link ZKConfig} for a circuit from a source. Reuses an already-fetched verifier
|
|
1399
|
+
* key when the caller has one, so it is not fetched (and re-integrity-verified) a second time;
|
|
1400
|
+
* otherwise fetches all three artifacts from the source. Unlike {@link ZKConfigProvider.get}, the
|
|
1401
|
+
* three fetches run concurrently.
|
|
1402
|
+
*/
|
|
1403
|
+
private buildConfig;
|
|
1369
1404
|
}
|
|
1370
1405
|
|
|
1371
1406
|
export { ExportDecryptionError, FailEntirely, FailFallible, ImportConflictError, InvalidExportFormatError, InvalidProtocolSchemeError, LogLevel, MAX_EXPORT_SIGNING_KEYS, MAX_EXPORT_STATES, PrivateStateExportError, PrivateStateImportError, SegmentFail, SegmentSuccess, SigningKeyExportError, SucceedEntirely, ZKArtifactNotFoundError, ZKConfigProvider, ZKConfigRegistry, asContractAddress, asEffectOption, createProofProvider, createProverKey, createVerifierKey, createZKIR, exitResultOrError, makeContractExecutableRuntime, zkConfigToProvingKeyMaterial };
|
package/dist/index.mjs
CHANGED
|
@@ -416,11 +416,24 @@ class ZKConfigProvider {
|
|
|
416
416
|
*/
|
|
417
417
|
class ZKArtifactNotFoundError extends Error {
|
|
418
418
|
keyLocation;
|
|
419
|
-
|
|
419
|
+
suppressedErrors;
|
|
420
|
+
/**
|
|
421
|
+
* @param keyLocation The location that could not be resolved.
|
|
422
|
+
* @param suppressedErrors Errors raised by individual sources while probing their verifier key
|
|
423
|
+
* (integrity violations, permission/IO failures, or a genuine absence of the circuit). They are
|
|
424
|
+
* attached as this error's `cause` so a real failure — for example a `ZkArtifactIntegrityError` —
|
|
425
|
+
* is not hidden behind the "missing or stale" message.
|
|
426
|
+
*/
|
|
427
|
+
constructor(keyLocation, suppressedErrors = []) {
|
|
420
428
|
super(`No ZK artifact bundle matches the deployed verifier key for contract ` +
|
|
421
429
|
`'${keyLocation.contractAddress}', circuit '${keyLocation.circuitId}'. The local compiled ` +
|
|
422
|
-
`artifacts are missing or stale with respect to the deployed contract
|
|
430
|
+
`artifacts are missing or stale with respect to the deployed contract.`, suppressedErrors.length > 0
|
|
431
|
+
? {
|
|
432
|
+
cause: new AggregateError(suppressedErrors, 'One or more artifact sources errored while resolving the verifier key.')
|
|
433
|
+
}
|
|
434
|
+
: undefined);
|
|
423
435
|
this.keyLocation = keyLocation;
|
|
436
|
+
this.suppressedErrors = suppressedErrors;
|
|
424
437
|
this.name = 'ZKArtifactNotFoundError';
|
|
425
438
|
}
|
|
426
439
|
}
|
|
@@ -438,12 +451,23 @@ class ZKArtifactNotFoundError extends Error {
|
|
|
438
451
|
* resolution immune to redeploys, multiple deployments of one contract, and circuit-name
|
|
439
452
|
* collisions across contracts.
|
|
440
453
|
*
|
|
441
|
-
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs
|
|
442
|
-
*
|
|
454
|
+
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs. The
|
|
455
|
+
* location→source binding and each source's verifier-key hashes are memoized; the (potentially
|
|
456
|
+
* multi-MB) artifacts themselves are re-fetched from the bound source rather than retained, so the
|
|
457
|
+
* registry's memory does not grow with the number of distinct locations resolved.
|
|
443
458
|
*/
|
|
444
459
|
class ZKConfigRegistry {
|
|
445
460
|
sources;
|
|
446
|
-
|
|
461
|
+
/**
|
|
462
|
+
* Binds a resolved key location to the source that serves it — a single source reference per
|
|
463
|
+
* location, so it can be held for the registry's lifetime without retaining artifact bytes.
|
|
464
|
+
*/
|
|
465
|
+
boundSource = new Map();
|
|
466
|
+
/**
|
|
467
|
+
* Memoizes each source's verifier-key hash per circuit, so source selection reuses computed
|
|
468
|
+
* hashes instead of re-fetching and re-hashing keys on every new location.
|
|
469
|
+
*/
|
|
470
|
+
vkHashByCircuit = new Map();
|
|
447
471
|
/**
|
|
448
472
|
* @param sources The compiled-contract artifact sources to resolve against — one per compiled
|
|
449
473
|
* contract the application can call (its own contracts and any cross-contract call targets).
|
|
@@ -495,27 +519,65 @@ class ZKConfigRegistry {
|
|
|
495
519
|
};
|
|
496
520
|
}
|
|
497
521
|
async resolve(keyLocation, parsed) {
|
|
498
|
-
const
|
|
499
|
-
if (
|
|
500
|
-
return
|
|
522
|
+
const bound = this.boundSource.get(keyLocation);
|
|
523
|
+
if (bound !== undefined) {
|
|
524
|
+
return this.buildConfig(bound, parsed.circuitId);
|
|
501
525
|
}
|
|
526
|
+
const suppressedErrors = [];
|
|
502
527
|
for (const source of this.sources) {
|
|
503
|
-
let
|
|
528
|
+
let probe;
|
|
504
529
|
try {
|
|
505
|
-
|
|
530
|
+
probe = await this.probeVerifierKeyHash(source, parsed.circuitId);
|
|
506
531
|
}
|
|
507
|
-
catch {
|
|
508
|
-
//
|
|
532
|
+
catch (error) {
|
|
533
|
+
// A source may simply not have this circuit, or the read may have failed for a real reason
|
|
534
|
+
// (integrity violation, permissions, IO). The provider interface can't tell them apart, so
|
|
535
|
+
// keep probing other sources but retain the error to surface as the cause if none matches —
|
|
536
|
+
// never silently discard it.
|
|
537
|
+
suppressedErrors.push(error);
|
|
509
538
|
continue;
|
|
510
539
|
}
|
|
511
|
-
if (
|
|
540
|
+
if (probe.hash !== parsed.verifierKeyHash) {
|
|
512
541
|
continue;
|
|
513
542
|
}
|
|
514
|
-
|
|
515
|
-
this.
|
|
516
|
-
return config;
|
|
543
|
+
this.boundSource.set(keyLocation, source);
|
|
544
|
+
return this.buildConfig(source, parsed.circuitId, probe.verifierKey);
|
|
517
545
|
}
|
|
518
|
-
throw new ZKArtifactNotFoundError(parsed);
|
|
546
|
+
throw new ZKArtifactNotFoundError(parsed, suppressedErrors);
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Returns a source's verifier-key hash for a circuit, memoized per source and circuit. The
|
|
550
|
+
* verifier key bytes are included only when freshly fetched (a memo miss), so a caller that
|
|
551
|
+
* matches on the hash can reuse them and avoid a second fetch (and re-integrity-verification).
|
|
552
|
+
*/
|
|
553
|
+
async probeVerifierKeyHash(source, circuitId) {
|
|
554
|
+
const cached = this.vkHashByCircuit.get(source)?.get(circuitId);
|
|
555
|
+
if (cached !== undefined) {
|
|
556
|
+
return { hash: cached };
|
|
557
|
+
}
|
|
558
|
+
const verifierKey = await source.getVerifierKey(circuitId);
|
|
559
|
+
const hash = hashVerifierKey(verifierKey);
|
|
560
|
+
let byCircuit = this.vkHashByCircuit.get(source);
|
|
561
|
+
if (byCircuit === undefined) {
|
|
562
|
+
byCircuit = new Map();
|
|
563
|
+
this.vkHashByCircuit.set(source, byCircuit);
|
|
564
|
+
}
|
|
565
|
+
byCircuit.set(circuitId, hash);
|
|
566
|
+
return { hash, verifierKey };
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Assembles the {@link ZKConfig} for a circuit from a source. Reuses an already-fetched verifier
|
|
570
|
+
* key when the caller has one, so it is not fetched (and re-integrity-verified) a second time;
|
|
571
|
+
* otherwise fetches all three artifacts from the source. Unlike {@link ZKConfigProvider.get}, the
|
|
572
|
+
* three fetches run concurrently.
|
|
573
|
+
*/
|
|
574
|
+
async buildConfig(source, circuitId, verifierKey) {
|
|
575
|
+
const [proverKey, resolvedVerifierKey, zkir] = await Promise.all([
|
|
576
|
+
source.getProverKey(circuitId),
|
|
577
|
+
verifierKey !== undefined ? Promise.resolve(verifierKey) : source.getVerifierKey(circuitId),
|
|
578
|
+
source.getZKIR(circuitId)
|
|
579
|
+
]);
|
|
580
|
+
return { circuitId, proverKey, verifierKey: resolvedVerifierKey, zkir };
|
|
519
581
|
}
|
|
520
582
|
}
|
|
521
583
|
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/contract.ts","../src/errors.ts","../src/logger-provider.ts","../src/midnight-types.ts","../src/private-state-provider.ts","../src/proof-provider.ts","../src/zk-config-provider.ts","../src/zk-config-registry.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;AAaG;AAYH;;;;;;;;AAQG;AACH,MAAM,iBAAiB,GAAG,CAAsC,gBAA0C,KACxG,CAAC,gBAA0D,KACzD,MAAM,CAAC,GAAG,CAAC,aAAS;;;IAGlB,MAAM,cAAc,GAAG,CAAC,iBAAgD,KACtE,MAAM,CAAC,UAAU,CAAC;AAChB,QAAA,GAAG,EAAE,MAAM,gBAAgB,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,KAAK,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;AACnI,QAAA,KAAK,EAAE,CAAC,GAAY,KAAK,wBAAwB,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG;AACpH,KAAA,CAAC;IACJ,OAAO;QACL,cAAc;QACd,eAAe,EAAE,CAAC,kBAAkB,KAClC,MAAM,CAAC,OAAO,CACZ,kBAAkB,EAClB,CAAC,iBAAiB,KAChB,cAAc,CAAC,iBAAiB,CAAC,CAAC,IAAI,CACpC,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,KAAK,CAAC,iBAAiB,EAAE,WAAW,CAAU,CAAC,CACvE,EACH,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE;KAEO;AAC3D,CAAC,CAAC;AAEN,MAAM,uBAAuB,GAAG,CAAC,gBAA0C,EAAE,SAA8B,KACzG,KAAK,CAAC,QAAQ,CACZ,KAAK,CAAC,OAAO,CACX,eAAe,CAAC,eAAe,EAC/B,eAAe,CAAC,eAAe,CAAC,EAAE,CAAC;AACjC,IAAA,YAAY,EAAE,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M,eAAe,GAAG,CAAC,UAAsB,KAAe;AACnE,IAAA,OAAO,UAAuB;AAChC;AAYA;;;;AAIG;AACI,MAAM,iBAAiB,GAAG,CAAC,UAAsB,KAAiB;AACvE,IAAA,OAAO,UAAyB;AAClC;AAYA;;;;AAIG;AACI,MAAM,UAAU,GAAG,CAAC,UAAsB,KAAU;AACzD,IAAA,OAAO,UAAkB;AAC3B;AAyBA;;;AAGG;AACI,MAAM,4BAA4B,GAAG,CAAmB,QAAqB,KAAI;IACtF,OAAO;QACL,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,EAAE,EAAE,QAAQ,CAAC,IAAI;KAClB;AACH;AAEA;;AAEG;AACI,MAAM,WAAW,GAAG;AAE3B;;AAEG;AACI,MAAM,cAAc,GAAG;AAQ9B;;AAEG;AACI,MAAM,YAAY,GAAG;AAE5B;;;;;AAKG;AACI,MAAM,YAAY,GAAG;AAE5B;;;AAGG;AACI,MAAM,eAAe,GAAG;;AC7J/B;;;;;;;;;;;;;AAaG;AAgCH;;;AAGG;AACI,MAAM,iBAAiB,GAAG;AA4FjC;;;AAGG;AACI,MAAM,uBAAuB,GAAG;;ACjJvC;;;;;;;;;;;;;AAaG;
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/contract.ts","../src/errors.ts","../src/logger-provider.ts","../src/midnight-types.ts","../src/private-state-provider.ts","../src/proof-provider.ts","../src/zk-config-provider.ts","../src/zk-config-registry.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;AAaG;AAYH;;;;;;;;AAQG;AACH,MAAM,iBAAiB,GAAG,CAAsC,gBAA0C,KACxG,CAAC,gBAA0D,KACzD,MAAM,CAAC,GAAG,CAAC,aAAS;;;IAGlB,MAAM,cAAc,GAAG,CAAC,iBAAgD,KACtE,MAAM,CAAC,UAAU,CAAC;AAChB,QAAA,GAAG,EAAE,MAAM,g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AI,EAAE,WAAW,EAAE;IAC9B;AAEA;;;;;AAKG;AACK,IAAA,MAAM,WAAW,CACvB,MAAgC,EAChC,SAAiB,EACjB,WAAyB,EAAA;AAEzB,QAAA,MAAM,CAAC,SAAS,EAAE,mBAAmB,EAAE,IAAI,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;AAC/D,YAAA,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC;AAC9B,YAAA,WAAW,KAAK,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC;AAC3F,YAAA,MAAM,CAAC,OAAO,CAAC,SAAS;AACzB,SAAA,CAAC;QACF,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,mBAAmB,EAAE,IAAI,EAAE;IACzE;AACD;;;;"}
|
package/dist/proof-provider.d.ts
CHANGED
|
@@ -5,7 +5,10 @@ export type UnboundTransaction = Transaction<SignatureEnabled, Proof, PreBinding
|
|
|
5
5
|
*/
|
|
6
6
|
export interface ProveTxConfig {
|
|
7
7
|
/**
|
|
8
|
-
* The timeout for the request.
|
|
8
|
+
* The timeout for the request, in milliseconds. This is a per-request timeout for the underlying
|
|
9
|
+
* proof server call, not a hard wall-clock ceiling for the whole `proveTx` call — the proof
|
|
10
|
+
* provider's internal retry/backoff means a `proveTx` call may take longer than this value when
|
|
11
|
+
* retries occur. See https://github.com/midnightntwrk/midnight-js/issues/974.
|
|
9
12
|
*/
|
|
10
13
|
readonly timeout?: number;
|
|
11
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proof-provider.d.ts","sourceRoot":"","sources":["../src/proof-provider.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,SAAS,EACT,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACzB,MAAM,6CAA6C,CAAC;AAErD,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,gBAAgB,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AAElF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B
|
|
1
|
+
{"version":3,"file":"proof-provider.d.ts","sourceRoot":"","sources":["../src/proof-provider.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,SAAS,EACT,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACzB,MAAM,6CAA6C,CAAC;AAErD,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,gBAAgB,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AAElF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;OAOG;IACH,OAAO,CAAC,UAAU,EAAE,mBAAmB,EAAE,aAAa,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACtG;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC9B,iBAAiB,eAAe,EAChC,YAAW,SAAwC,KAClD,aAID,CAAC"}
|
|
@@ -8,7 +8,15 @@ import { type ContractKeyLocation } from './zk-key-location';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class ZKArtifactNotFoundError extends Error {
|
|
10
10
|
readonly keyLocation: ContractKeyLocation;
|
|
11
|
-
|
|
11
|
+
readonly suppressedErrors: readonly unknown[];
|
|
12
|
+
/**
|
|
13
|
+
* @param keyLocation The location that could not be resolved.
|
|
14
|
+
* @param suppressedErrors Errors raised by individual sources while probing their verifier key
|
|
15
|
+
* (integrity violations, permission/IO failures, or a genuine absence of the circuit). They are
|
|
16
|
+
* attached as this error's `cause` so a real failure — for example a `ZkArtifactIntegrityError` —
|
|
17
|
+
* is not hidden behind the "missing or stale" message.
|
|
18
|
+
*/
|
|
19
|
+
constructor(keyLocation: ContractKeyLocation, suppressedErrors?: readonly unknown[]);
|
|
12
20
|
}
|
|
13
21
|
/**
|
|
14
22
|
* Resolves canonical contract key locations to ZK artifacts across a *set* of compiled-contract
|
|
@@ -24,12 +32,23 @@ export declare class ZKArtifactNotFoundError extends Error {
|
|
|
24
32
|
* resolution immune to redeploys, multiple deployments of one contract, and circuit-name
|
|
25
33
|
* collisions across contracts.
|
|
26
34
|
*
|
|
27
|
-
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs
|
|
28
|
-
*
|
|
35
|
+
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs. The
|
|
36
|
+
* location→source binding and each source's verifier-key hashes are memoized; the (potentially
|
|
37
|
+
* multi-MB) artifacts themselves are re-fetched from the bound source rather than retained, so the
|
|
38
|
+
* registry's memory does not grow with the number of distinct locations resolved.
|
|
29
39
|
*/
|
|
30
40
|
export declare class ZKConfigRegistry {
|
|
31
41
|
private readonly sources;
|
|
32
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Binds a resolved key location to the source that serves it — a single source reference per
|
|
44
|
+
* location, so it can be held for the registry's lifetime without retaining artifact bytes.
|
|
45
|
+
*/
|
|
46
|
+
private readonly boundSource;
|
|
47
|
+
/**
|
|
48
|
+
* Memoizes each source's verifier-key hash per circuit, so source selection reuses computed
|
|
49
|
+
* hashes instead of re-fetching and re-hashing keys on every new location.
|
|
50
|
+
*/
|
|
51
|
+
private readonly vkHashByCircuit;
|
|
33
52
|
/**
|
|
34
53
|
* @param sources The compiled-contract artifact sources to resolve against — one per compiled
|
|
35
54
|
* contract the application can call (its own contracts and any cross-contract call targets).
|
|
@@ -58,5 +77,18 @@ export declare class ZKConfigRegistry {
|
|
|
58
77
|
*/
|
|
59
78
|
asKeyMaterialProvider(): KeyMaterialProvider;
|
|
60
79
|
private resolve;
|
|
80
|
+
/**
|
|
81
|
+
* Returns a source's verifier-key hash for a circuit, memoized per source and circuit. The
|
|
82
|
+
* verifier key bytes are included only when freshly fetched (a memo miss), so a caller that
|
|
83
|
+
* matches on the hash can reuse them and avoid a second fetch (and re-integrity-verification).
|
|
84
|
+
*/
|
|
85
|
+
private probeVerifierKeyHash;
|
|
86
|
+
/**
|
|
87
|
+
* Assembles the {@link ZKConfig} for a circuit from a source. Reuses an already-fetched verifier
|
|
88
|
+
* key when the caller has one, so it is not fetched (and re-integrity-verified) a second time;
|
|
89
|
+
* otherwise fetches all three artifacts from the source. Unlike {@link ZKConfigProvider.get}, the
|
|
90
|
+
* three fetches run concurrently.
|
|
91
|
+
*/
|
|
92
|
+
private buildConfig;
|
|
61
93
|
}
|
|
62
94
|
//# sourceMappingURL=zk-config-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zk-config-registry.d.ts","sourceRoot":"","sources":["../src/zk-config-registry.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"zk-config-registry.d.ts","sourceRoot":"","sources":["../src/zk-config-registry.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAe,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,KAAK,mBAAmB,EAAwE,MAAM,mBAAmB,CAAC;AAEnI;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAS9C,QAAQ,CAAC,WAAW,EAAE,mBAAmB;IACzC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,OAAO,EAAE;IAT/C;;;;;;OAMG;gBAEQ,WAAW,EAAE,mBAAmB,EAChC,gBAAgB,GAAE,SAAS,OAAO,EAAO;CAiBrD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsC;IAE9D;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+C;IAE3E;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA4D;IAE5F;;;OAGG;gBACS,OAAO,EAAE,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAIvD;;;;;OAKG;IACH,GAAG,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAI7D;;;;;;;;OAQG;IACG,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAQpF;;;OAGG;IACH,qBAAqB,IAAI,mBAAmB;YAe9B,OAAO;IA2BrB;;;;OAIG;YACW,oBAAoB;IAmBlC;;;;;OAKG;YACW,WAAW;CAY1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midnight-ntwrk/midnight-js-types",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.4",
|
|
4
4
|
"description": "Shared data types and interfaces for MidnightJS modules",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"repository": "git@github.com:midnight-ntwrk/artifacts",
|
|
19
|
-
"packageManager": "yarn@4.
|
|
19
|
+
"packageManager": "yarn@4.14.1",
|
|
20
20
|
"author": "IOHK",
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"scripts": {
|
|
@@ -29,12 +29,15 @@
|
|
|
29
29
|
"dist/"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@midnight-ntwrk/midnight-js-protocol": "5.0.0-beta.
|
|
32
|
+
"@midnight-ntwrk/midnight-js-protocol": "5.0.0-beta.4",
|
|
33
33
|
"effect": "^3.20.0",
|
|
34
34
|
"pino": "^10.3.1",
|
|
35
35
|
"rxjs": "^7.8.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"vitest": "^4.1.7"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=22"
|
|
39
42
|
}
|
|
40
43
|
}
|