@aztec/stdlib 5.0.0-nightly.20260617 → 5.0.0-nightly.20260619
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/dest/file-store/factory.d.ts +1 -1
- package/dest/file-store/factory.d.ts.map +1 -1
- package/dest/file-store/factory.js +7 -0
- package/dest/file-store/index.d.ts +2 -1
- package/dest/file-store/index.d.ts.map +1 -1
- package/dest/file-store/index.js +1 -0
- package/dest/file-store/memory.d.ts +24 -0
- package/dest/file-store/memory.d.ts.map +1 -0
- package/dest/file-store/memory.js +80 -0
- package/dest/interfaces/proving-job.d.ts +70 -70
- package/package.json +8 -8
- package/src/file-store/factory.ts +7 -0
- package/src/file-store/index.ts +1 -0
- package/src/file-store/memory.ts +94 -0
|
@@ -5,4 +5,4 @@ export declare function createFileStore(config: string, logger?: Logger): Promis
|
|
|
5
5
|
export declare function createFileStore(config: undefined, logger?: Logger): Promise<undefined>;
|
|
6
6
|
export declare function createReadOnlyFileStore(config: string, logger?: Logger, options?: HttpFileStoreOptions): Promise<ReadOnlyFileStore>;
|
|
7
7
|
export declare function createReadOnlyFileStore(config: undefined, logger?: Logger, options?: HttpFileStoreOptions): Promise<undefined>;
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ZpbGUtc3RvcmUvZmFjdG9yeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFHbEUsT0FBTyxFQUFpQixLQUFLLG9CQUFvQixFQUFFLE1BQU0sV0FBVyxDQUFDO0FBQ3JFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBWW5FLHdCQUFzQixlQUFlLENBQUMsTUFBTSxFQUFFLE1BQU0sRUFBRSxNQUFNLENBQUMsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQzNGLHdCQUFzQixlQUFlLENBQUMsTUFBTSxFQUFFLFNBQVMsRUFBRSxNQUFNLENBQUMsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBbUQ5Rix3QkFBc0IsdUJBQXVCLENBQzNDLE1BQU0sRUFBRSxNQUFNLEVBQ2QsTUFBTSxDQUFDLEVBQUUsTUFBTSxFQUNmLE9BQU8sQ0FBQyxFQUFFLG9CQUFvQixHQUM3QixPQUFPLENBQUMsaUJBQWlCLENBQUMsQ0FBQztBQUM5Qix3QkFBc0IsdUJBQXVCLENBQzNDLE1BQU0sRUFBRSxTQUFTLEVBQ2pCLE1BQU0sQ0FBQyxFQUFFLE1BQU0sRUFDZixPQUFPLENBQUMsRUFBRSxvQkFBb0IsR0FDN0IsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/file-store/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/file-store/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAYnE,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAC3F,wBAAsB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAmD9F,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC9B,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,SAAS,EACjB,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
2
2
|
import { GoogleCloudFileStore } from './gcs.js';
|
|
3
3
|
import { HttpFileStore } from './http.js';
|
|
4
4
|
import { LocalFileStore } from './local.js';
|
|
5
|
+
import { InMemoryFileStore } from './memory.js';
|
|
5
6
|
import { S3FileStore } from './s3.js';
|
|
6
7
|
const supportedExamples = [
|
|
7
8
|
`gs://bucket-name/path/to/store`,
|
|
@@ -12,6 +13,12 @@ const supportedExamples = [
|
|
|
12
13
|
export async function createFileStore(config, logger = createLogger('stdlib:file-store')) {
|
|
13
14
|
if (config === undefined) {
|
|
14
15
|
return undefined;
|
|
16
|
+
} else if (config.startsWith('mem://')) {
|
|
17
|
+
// In-memory store for tests (see InMemoryFileStore). The namespace is everything after the
|
|
18
|
+
// scheme, so `mem://X` and a later `mem://X` share data, like two file:// stores over one dir.
|
|
19
|
+
const namespace = config.slice('mem://'.length).replace(/\/+$/, '');
|
|
20
|
+
logger.info(`Creating in-memory file store at ${namespace}`);
|
|
21
|
+
return new InMemoryFileStore(namespace);
|
|
15
22
|
} else if (config.startsWith('file://')) {
|
|
16
23
|
const url = new URL(config);
|
|
17
24
|
if (url.host) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './interface.js';
|
|
2
2
|
export * from './factory.js';
|
|
3
3
|
export { type HttpFileStoreOptions } from './http.js';
|
|
4
|
-
|
|
4
|
+
export { InMemoryFileStore } from './memory.js';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9maWxlLXN0b3JlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsZ0JBQWdCLENBQUM7QUFDL0IsY0FBYyxjQUFjLENBQUM7QUFDN0IsT0FBTyxFQUFFLEtBQUssb0JBQW9CLEVBQUUsTUFBTSxXQUFXLENBQUM7QUFDdEQsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sYUFBYSxDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/file-store/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/file-store/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
package/dest/file-store/index.js
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FileStore, FileStoreSaveOptions } from './interface.js';
|
|
2
|
+
/**
|
|
3
|
+
* In-memory {@link FileStore}, addressed via `mem://<namespace>/...`. Reads and writes are synchronous
|
|
4
|
+
* map operations with no disk I/O, so it is deterministic — useful for tests that exercise consumers
|
|
5
|
+
* of a file store (e.g. the tx file store) rather than the on-disk store itself, where a real
|
|
6
|
+
* filesystem can introduce timing flakes.
|
|
7
|
+
*/
|
|
8
|
+
export declare class InMemoryFileStore implements FileStore {
|
|
9
|
+
private readonly namespace;
|
|
10
|
+
private readonly files;
|
|
11
|
+
constructor(namespace: string);
|
|
12
|
+
/** Clears all in-memory file store data, or a single namespace. Intended for test isolation. */
|
|
13
|
+
static clear(namespace?: string): void;
|
|
14
|
+
save(path: string, data: Buffer, opts?: FileStoreSaveOptions): Promise<string>;
|
|
15
|
+
upload(destPath: string, srcPath: string, opts?: FileStoreSaveOptions): Promise<string>;
|
|
16
|
+
read(pathOrUrl: string): Promise<Buffer>;
|
|
17
|
+
download(pathOrUrl: string, destPath: string): Promise<void>;
|
|
18
|
+
exists(pathOrUrl: string): Promise<boolean>;
|
|
19
|
+
/** Lists stored file keys, optionally restricted to those under `prefix`. Not part of {@link FileStore}. */
|
|
20
|
+
listFiles(prefix?: string): string[];
|
|
21
|
+
/** Resolves a relative path or a `mem://` URI (as returned by `save`) to the registry key. */
|
|
22
|
+
private key;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVtb3J5LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZmlsZS1zdG9yZS9tZW1vcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFXdEU7Ozs7O0dBS0c7QUFDSCxxQkFBYSxpQkFBa0IsWUFBVyxTQUFTO0lBR3JDLE9BQU8sQ0FBQyxRQUFRLENBQUMsU0FBUztJQUZ0QyxPQUFPLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBc0I7SUFFNUMsWUFBNkIsU0FBUyxFQUFFLE1BQU0sRUFPN0M7SUFFRCxnR0FBZ0c7SUFDaEcsTUFBTSxDQUFDLEtBQUssQ0FBQyxTQUFTLENBQUMsRUFBRSxNQUFNLEdBQUcsSUFBSSxDQU1yQztJQUVZLElBQUksQ0FBQyxJQUFJLEVBQUUsTUFBTSxFQUFFLElBQUksRUFBRSxNQUFNLEVBQUUsSUFBSSxDQUFDLEVBQUUsb0JBQW9CLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUsxRjtJQUVZLE1BQU0sQ0FBQyxRQUFRLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxNQUFNLEVBQUUsSUFBSSxDQUFDLEVBQUUsb0JBQW9CLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUduRztJQUVZLElBQUksQ0FBQyxTQUFTLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FVcEQ7SUFFWSxRQUFRLENBQUMsU0FBUyxFQUFFLE1BQU0sRUFBRSxRQUFRLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFeEU7SUFFTSxNQUFNLENBQUMsU0FBUyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBRWpEO0lBRUQsNEdBQTRHO0lBQ3JHLFNBQVMsQ0FBQyxNQUFNLFNBQUssR0FBRyxNQUFNLEVBQUUsQ0FJdEM7SUFFRCw4RkFBOEY7SUFDOUYsT0FBTyxDQUFDLEdBQUc7Q0FXWiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/file-store/memory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAWtE;;;;;GAKG;AACH,qBAAa,iBAAkB,YAAW,SAAS;IAGrC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAFtC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;IAE5C,YAA6B,SAAS,EAAE,MAAM,EAO7C;IAED,gGAAgG;IAChG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAMrC;IAEY,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAK1F;IAEY,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAGnG;IAEY,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAUpD;IAEY,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAExE;IAEM,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEjD;IAED,4GAA4G;IACrG,SAAS,CAAC,MAAM,SAAK,GAAG,MAAM,EAAE,CAItC;IAED,8FAA8F;IAC9F,OAAO,CAAC,GAAG;CAWZ"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { writeFile } from 'fs/promises';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { gunzip as gunzipCb, gzip as gzipCb } from 'zlib';
|
|
4
|
+
const gzip = promisify(gzipCb);
|
|
5
|
+
const gunzip = promisify(gunzipCb);
|
|
6
|
+
// Backing data is shared per namespace so that a store created for writing and a (read-only) store
|
|
7
|
+
// created later from the same `mem://` URL observe the same files — mirroring how two `file://`
|
|
8
|
+
// stores over the same directory share state on disk. Without this, `FileStoreTxSource`, which
|
|
9
|
+
// builds its own store from the URL, would never see what a test wrote through a different instance.
|
|
10
|
+
const namespaces = new Map();
|
|
11
|
+
/**
|
|
12
|
+
* In-memory {@link FileStore}, addressed via `mem://<namespace>/...`. Reads and writes are synchronous
|
|
13
|
+
* map operations with no disk I/O, so it is deterministic — useful for tests that exercise consumers
|
|
14
|
+
* of a file store (e.g. the tx file store) rather than the on-disk store itself, where a real
|
|
15
|
+
* filesystem can introduce timing flakes.
|
|
16
|
+
*/ export class InMemoryFileStore {
|
|
17
|
+
namespace;
|
|
18
|
+
files;
|
|
19
|
+
constructor(namespace){
|
|
20
|
+
this.namespace = namespace;
|
|
21
|
+
let files = namespaces.get(namespace);
|
|
22
|
+
if (!files) {
|
|
23
|
+
files = new Map();
|
|
24
|
+
namespaces.set(namespace, files);
|
|
25
|
+
}
|
|
26
|
+
this.files = files;
|
|
27
|
+
}
|
|
28
|
+
/** Clears all in-memory file store data, or a single namespace. Intended for test isolation. */ static clear(namespace) {
|
|
29
|
+
if (namespace === undefined) {
|
|
30
|
+
namespaces.clear();
|
|
31
|
+
} else {
|
|
32
|
+
namespaces.delete(namespace);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async save(path, data, opts) {
|
|
36
|
+
const toStore = opts?.compress ? await gzip(data) : data;
|
|
37
|
+
const key = this.key(path);
|
|
38
|
+
this.files.set(key, Buffer.from(toStore));
|
|
39
|
+
return `mem://${this.namespace}/${key}`;
|
|
40
|
+
}
|
|
41
|
+
async upload(destPath, srcPath, opts) {
|
|
42
|
+
const { readFile } = await import('fs/promises');
|
|
43
|
+
return this.save(destPath, await readFile(srcPath), opts);
|
|
44
|
+
}
|
|
45
|
+
async read(pathOrUrl) {
|
|
46
|
+
const data = this.files.get(this.key(pathOrUrl));
|
|
47
|
+
if (data === undefined) {
|
|
48
|
+
throw new Error(`File not found in memory store: ${pathOrUrl}`);
|
|
49
|
+
}
|
|
50
|
+
// Match LocalFileStore: transparently gunzip content that was stored compressed.
|
|
51
|
+
if (data.length >= 2 && data[0] === 0x1f && data[1] === 0x8b) {
|
|
52
|
+
return await gunzip(data);
|
|
53
|
+
}
|
|
54
|
+
return data;
|
|
55
|
+
}
|
|
56
|
+
async download(pathOrUrl, destPath) {
|
|
57
|
+
await writeFile(destPath, await this.read(pathOrUrl));
|
|
58
|
+
}
|
|
59
|
+
exists(pathOrUrl) {
|
|
60
|
+
return Promise.resolve(this.files.has(this.key(pathOrUrl)));
|
|
61
|
+
}
|
|
62
|
+
/** Lists stored file keys, optionally restricted to those under `prefix`. Not part of {@link FileStore}. */ listFiles(prefix = '') {
|
|
63
|
+
const keys = [
|
|
64
|
+
...this.files.keys()
|
|
65
|
+
];
|
|
66
|
+
const normalizedPrefix = prefix.replace(/^\/+/, '');
|
|
67
|
+
return normalizedPrefix ? keys.filter((k)=>k.startsWith(normalizedPrefix)) : keys;
|
|
68
|
+
}
|
|
69
|
+
/** Resolves a relative path or a `mem://` URI (as returned by `save`) to the registry key. */ key(pathOrUrl) {
|
|
70
|
+
const ownPrefix = `mem://${this.namespace}/`;
|
|
71
|
+
if (pathOrUrl.startsWith(ownPrefix)) {
|
|
72
|
+
return pathOrUrl.slice(ownPrefix.length);
|
|
73
|
+
}
|
|
74
|
+
if (pathOrUrl.startsWith('mem://')) {
|
|
75
|
+
// A mem:// URI for some namespace: drop the scheme and the leading namespace segment.
|
|
76
|
+
return pathOrUrl.slice('mem://'.length).replace(/^[^/]*\//, '');
|
|
77
|
+
}
|
|
78
|
+
return pathOrUrl.replace(/^\/+/, '');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -415,18 +415,6 @@ export declare const ProvingJobInputs: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
415
415
|
}>>;
|
|
416
416
|
index: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
417
417
|
leafPreimage: z.ZodPipe<z.ZodObject<{
|
|
418
|
-
leaf: z.ZodPipe<z.ZodObject<{
|
|
419
|
-
nullifier: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
420
|
-
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeaf, {
|
|
421
|
-
nullifier: import("@aztec/foundation/schemas").Fr;
|
|
422
|
-
}>>;
|
|
423
|
-
nextKey: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
424
|
-
nextIndex: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
425
|
-
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeafPreimage, {
|
|
426
|
-
leaf: import("../trees/nullifier_leaf.js").NullifierLeaf;
|
|
427
|
-
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
428
|
-
nextIndex: bigint;
|
|
429
|
-
}>> | z.ZodPipe<z.ZodObject<{
|
|
430
418
|
leaf: z.ZodPipe<z.ZodObject<{
|
|
431
419
|
slot: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
432
420
|
value: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
@@ -440,6 +428,18 @@ export declare const ProvingJobInputs: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
440
428
|
leaf: import("../trees/public_data_leaf.js").PublicDataTreeLeaf;
|
|
441
429
|
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
442
430
|
nextIndex: bigint;
|
|
431
|
+
}>> | z.ZodPipe<z.ZodObject<{
|
|
432
|
+
leaf: z.ZodPipe<z.ZodObject<{
|
|
433
|
+
nullifier: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
434
|
+
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeaf, {
|
|
435
|
+
nullifier: import("@aztec/foundation/schemas").Fr;
|
|
436
|
+
}>>;
|
|
437
|
+
nextKey: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
438
|
+
nextIndex: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
439
|
+
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeafPreimage, {
|
|
440
|
+
leaf: import("../trees/nullifier_leaf.js").NullifierLeaf;
|
|
441
|
+
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
442
|
+
nextIndex: bigint;
|
|
443
443
|
}>>;
|
|
444
444
|
}, z.core.$strip>, z.ZodTransform<{
|
|
445
445
|
readonly hintKey: import("../trees/append_only_tree_snapshot.js").AppendOnlyTreeSnapshot;
|
|
@@ -460,18 +460,6 @@ export declare const ProvingJobInputs: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
460
460
|
}>>;
|
|
461
461
|
index: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
462
462
|
leafPreimage: z.ZodPipe<z.ZodObject<{
|
|
463
|
-
leaf: z.ZodPipe<z.ZodObject<{
|
|
464
|
-
nullifier: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
465
|
-
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeaf, {
|
|
466
|
-
nullifier: import("@aztec/foundation/schemas").Fr;
|
|
467
|
-
}>>;
|
|
468
|
-
nextKey: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
469
|
-
nextIndex: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
470
|
-
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeafPreimage, {
|
|
471
|
-
leaf: import("../trees/nullifier_leaf.js").NullifierLeaf;
|
|
472
|
-
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
473
|
-
nextIndex: bigint;
|
|
474
|
-
}>> | z.ZodPipe<z.ZodObject<{
|
|
475
463
|
leaf: z.ZodPipe<z.ZodObject<{
|
|
476
464
|
slot: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
477
465
|
value: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
@@ -485,6 +473,18 @@ export declare const ProvingJobInputs: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
485
473
|
leaf: import("../trees/public_data_leaf.js").PublicDataTreeLeaf;
|
|
486
474
|
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
487
475
|
nextIndex: bigint;
|
|
476
|
+
}>> | z.ZodPipe<z.ZodObject<{
|
|
477
|
+
leaf: z.ZodPipe<z.ZodObject<{
|
|
478
|
+
nullifier: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
479
|
+
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeaf, {
|
|
480
|
+
nullifier: import("@aztec/foundation/schemas").Fr;
|
|
481
|
+
}>>;
|
|
482
|
+
nextKey: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
483
|
+
nextIndex: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
484
|
+
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeafPreimage, {
|
|
485
|
+
leaf: import("../trees/nullifier_leaf.js").NullifierLeaf;
|
|
486
|
+
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
487
|
+
nextIndex: bigint;
|
|
488
488
|
}>>;
|
|
489
489
|
}, z.core.$strip>, z.ZodTransform<{
|
|
490
490
|
readonly hintKey: import("../trees/append_only_tree_snapshot.js").AppendOnlyTreeSnapshot;
|
|
@@ -529,30 +529,18 @@ export declare const ProvingJobInputs: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
529
529
|
}>>;
|
|
530
530
|
treeId: z.ZodNumber;
|
|
531
531
|
leaf: z.ZodPipe<z.ZodObject<{
|
|
532
|
-
nullifier: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
533
|
-
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeaf, {
|
|
534
|
-
nullifier: import("@aztec/foundation/schemas").Fr;
|
|
535
|
-
}>> | z.ZodPipe<z.ZodObject<{
|
|
536
532
|
slot: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
537
533
|
value: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
538
534
|
}, z.core.$strip>, z.ZodTransform<import("../trees/public_data_leaf.js").PublicDataTreeLeaf, {
|
|
539
535
|
slot: import("@aztec/foundation/schemas").Fr;
|
|
540
536
|
value: import("@aztec/foundation/schemas").Fr;
|
|
537
|
+
}>> | z.ZodPipe<z.ZodObject<{
|
|
538
|
+
nullifier: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
539
|
+
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeaf, {
|
|
540
|
+
nullifier: import("@aztec/foundation/schemas").Fr;
|
|
541
541
|
}>>;
|
|
542
542
|
lowLeavesWitnessData: z.ZodObject<{
|
|
543
543
|
leaf: z.ZodPipe<z.ZodObject<{
|
|
544
|
-
leaf: z.ZodPipe<z.ZodObject<{
|
|
545
|
-
nullifier: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
546
|
-
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeaf, {
|
|
547
|
-
nullifier: import("@aztec/foundation/schemas").Fr;
|
|
548
|
-
}>>;
|
|
549
|
-
nextKey: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
550
|
-
nextIndex: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
551
|
-
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeafPreimage, {
|
|
552
|
-
leaf: import("../trees/nullifier_leaf.js").NullifierLeaf;
|
|
553
|
-
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
554
|
-
nextIndex: bigint;
|
|
555
|
-
}>> | z.ZodPipe<z.ZodObject<{
|
|
556
544
|
leaf: z.ZodPipe<z.ZodObject<{
|
|
557
545
|
slot: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
558
546
|
value: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
@@ -566,12 +554,7 @@ export declare const ProvingJobInputs: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
566
554
|
leaf: import("../trees/public_data_leaf.js").PublicDataTreeLeaf;
|
|
567
555
|
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
568
556
|
nextIndex: bigint;
|
|
569
|
-
}
|
|
570
|
-
index: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
571
|
-
path: z.ZodArray<ZodFor<import("@aztec/foundation/schemas").Fr>>;
|
|
572
|
-
}, z.core.$strip>;
|
|
573
|
-
insertionWitnessData: z.ZodObject<{
|
|
574
|
-
leaf: z.ZodPipe<z.ZodObject<{
|
|
557
|
+
}>> | z.ZodPipe<z.ZodObject<{
|
|
575
558
|
leaf: z.ZodPipe<z.ZodObject<{
|
|
576
559
|
nullifier: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
577
560
|
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeaf, {
|
|
@@ -583,7 +566,12 @@ export declare const ProvingJobInputs: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
583
566
|
leaf: import("../trees/nullifier_leaf.js").NullifierLeaf;
|
|
584
567
|
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
585
568
|
nextIndex: bigint;
|
|
586
|
-
}
|
|
569
|
+
}>>;
|
|
570
|
+
index: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
571
|
+
path: z.ZodArray<ZodFor<import("@aztec/foundation/schemas").Fr>>;
|
|
572
|
+
}, z.core.$strip>;
|
|
573
|
+
insertionWitnessData: z.ZodObject<{
|
|
574
|
+
leaf: z.ZodPipe<z.ZodObject<{
|
|
587
575
|
leaf: z.ZodPipe<z.ZodObject<{
|
|
588
576
|
slot: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
589
577
|
value: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
@@ -597,6 +585,18 @@ export declare const ProvingJobInputs: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
597
585
|
leaf: import("../trees/public_data_leaf.js").PublicDataTreeLeaf;
|
|
598
586
|
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
599
587
|
nextIndex: bigint;
|
|
588
|
+
}>> | z.ZodPipe<z.ZodObject<{
|
|
589
|
+
leaf: z.ZodPipe<z.ZodObject<{
|
|
590
|
+
nullifier: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
591
|
+
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeaf, {
|
|
592
|
+
nullifier: import("@aztec/foundation/schemas").Fr;
|
|
593
|
+
}>>;
|
|
594
|
+
nextKey: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
595
|
+
nextIndex: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
596
|
+
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeafPreimage, {
|
|
597
|
+
leaf: import("../trees/nullifier_leaf.js").NullifierLeaf;
|
|
598
|
+
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
599
|
+
nextIndex: bigint;
|
|
600
600
|
}>>;
|
|
601
601
|
index: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
602
602
|
path: z.ZodArray<ZodFor<import("@aztec/foundation/schemas").Fr>>;
|
|
@@ -649,30 +649,18 @@ export declare const ProvingJobInputs: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
649
649
|
}>>;
|
|
650
650
|
treeId: z.ZodNumber;
|
|
651
651
|
leaf: z.ZodPipe<z.ZodObject<{
|
|
652
|
-
nullifier: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
653
|
-
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeaf, {
|
|
654
|
-
nullifier: import("@aztec/foundation/schemas").Fr;
|
|
655
|
-
}>> | z.ZodPipe<z.ZodObject<{
|
|
656
652
|
slot: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
657
653
|
value: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
658
654
|
}, z.core.$strip>, z.ZodTransform<import("../trees/public_data_leaf.js").PublicDataTreeLeaf, {
|
|
659
655
|
slot: import("@aztec/foundation/schemas").Fr;
|
|
660
656
|
value: import("@aztec/foundation/schemas").Fr;
|
|
657
|
+
}>> | z.ZodPipe<z.ZodObject<{
|
|
658
|
+
nullifier: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
659
|
+
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeaf, {
|
|
660
|
+
nullifier: import("@aztec/foundation/schemas").Fr;
|
|
661
661
|
}>>;
|
|
662
662
|
lowLeavesWitnessData: z.ZodObject<{
|
|
663
663
|
leaf: z.ZodPipe<z.ZodObject<{
|
|
664
|
-
leaf: z.ZodPipe<z.ZodObject<{
|
|
665
|
-
nullifier: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
666
|
-
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeaf, {
|
|
667
|
-
nullifier: import("@aztec/foundation/schemas").Fr;
|
|
668
|
-
}>>;
|
|
669
|
-
nextKey: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
670
|
-
nextIndex: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
671
|
-
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeafPreimage, {
|
|
672
|
-
leaf: import("../trees/nullifier_leaf.js").NullifierLeaf;
|
|
673
|
-
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
674
|
-
nextIndex: bigint;
|
|
675
|
-
}>> | z.ZodPipe<z.ZodObject<{
|
|
676
664
|
leaf: z.ZodPipe<z.ZodObject<{
|
|
677
665
|
slot: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
678
666
|
value: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
@@ -686,12 +674,7 @@ export declare const ProvingJobInputs: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
686
674
|
leaf: import("../trees/public_data_leaf.js").PublicDataTreeLeaf;
|
|
687
675
|
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
688
676
|
nextIndex: bigint;
|
|
689
|
-
}
|
|
690
|
-
index: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
691
|
-
path: z.ZodArray<ZodFor<import("@aztec/foundation/schemas").Fr>>;
|
|
692
|
-
}, z.core.$strip>;
|
|
693
|
-
insertionWitnessData: z.ZodObject<{
|
|
694
|
-
leaf: z.ZodPipe<z.ZodObject<{
|
|
677
|
+
}>> | z.ZodPipe<z.ZodObject<{
|
|
695
678
|
leaf: z.ZodPipe<z.ZodObject<{
|
|
696
679
|
nullifier: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
697
680
|
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeaf, {
|
|
@@ -703,7 +686,12 @@ export declare const ProvingJobInputs: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
703
686
|
leaf: import("../trees/nullifier_leaf.js").NullifierLeaf;
|
|
704
687
|
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
705
688
|
nextIndex: bigint;
|
|
706
|
-
}
|
|
689
|
+
}>>;
|
|
690
|
+
index: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
691
|
+
path: z.ZodArray<ZodFor<import("@aztec/foundation/schemas").Fr>>;
|
|
692
|
+
}, z.core.$strip>;
|
|
693
|
+
insertionWitnessData: z.ZodObject<{
|
|
694
|
+
leaf: z.ZodPipe<z.ZodObject<{
|
|
707
695
|
leaf: z.ZodPipe<z.ZodObject<{
|
|
708
696
|
slot: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
709
697
|
value: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
@@ -717,6 +705,18 @@ export declare const ProvingJobInputs: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
717
705
|
leaf: import("../trees/public_data_leaf.js").PublicDataTreeLeaf;
|
|
718
706
|
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
719
707
|
nextIndex: bigint;
|
|
708
|
+
}>> | z.ZodPipe<z.ZodObject<{
|
|
709
|
+
leaf: z.ZodPipe<z.ZodObject<{
|
|
710
|
+
nullifier: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
711
|
+
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeaf, {
|
|
712
|
+
nullifier: import("@aztec/foundation/schemas").Fr;
|
|
713
|
+
}>>;
|
|
714
|
+
nextKey: z.ZodType<import("@aztec/foundation/schemas").Fr, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Fr, string>>;
|
|
715
|
+
nextIndex: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
716
|
+
}, z.core.$strip>, z.ZodTransform<import("../trees/nullifier_leaf.js").NullifierLeafPreimage, {
|
|
717
|
+
leaf: import("../trees/nullifier_leaf.js").NullifierLeaf;
|
|
718
|
+
nextKey: import("@aztec/foundation/schemas").Fr;
|
|
719
|
+
nextIndex: bigint;
|
|
720
720
|
}>>;
|
|
721
721
|
index: z.ZodPipe<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodCoercedBigInt<string | number | bigint>>;
|
|
722
722
|
path: z.ZodArray<ZodFor<import("@aztec/foundation/schemas").Fr>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "5.0.0-nightly.
|
|
3
|
+
"version": "5.0.0-nightly.20260619",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -92,13 +92,13 @@
|
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
95
|
-
"@aztec/bb.js": "5.0.0-nightly.
|
|
96
|
-
"@aztec/blob-lib": "5.0.0-nightly.
|
|
97
|
-
"@aztec/constants": "5.0.0-nightly.
|
|
98
|
-
"@aztec/ethereum": "5.0.0-nightly.
|
|
99
|
-
"@aztec/foundation": "5.0.0-nightly.
|
|
100
|
-
"@aztec/l1-artifacts": "5.0.0-nightly.
|
|
101
|
-
"@aztec/noir-noirc_abi": "5.0.0-nightly.
|
|
95
|
+
"@aztec/bb.js": "5.0.0-nightly.20260619",
|
|
96
|
+
"@aztec/blob-lib": "5.0.0-nightly.20260619",
|
|
97
|
+
"@aztec/constants": "5.0.0-nightly.20260619",
|
|
98
|
+
"@aztec/ethereum": "5.0.0-nightly.20260619",
|
|
99
|
+
"@aztec/foundation": "5.0.0-nightly.20260619",
|
|
100
|
+
"@aztec/l1-artifacts": "5.0.0-nightly.20260619",
|
|
101
|
+
"@aztec/noir-noirc_abi": "5.0.0-nightly.20260619",
|
|
102
102
|
"@google-cloud/storage": "^7.15.0",
|
|
103
103
|
"axios": "^1.15.1",
|
|
104
104
|
"json-stringify-deterministic": "1.0.12",
|
|
@@ -4,6 +4,7 @@ import { GoogleCloudFileStore } from './gcs.js';
|
|
|
4
4
|
import { HttpFileStore, type HttpFileStoreOptions } from './http.js';
|
|
5
5
|
import type { FileStore, ReadOnlyFileStore } from './interface.js';
|
|
6
6
|
import { LocalFileStore } from './local.js';
|
|
7
|
+
import { InMemoryFileStore } from './memory.js';
|
|
7
8
|
import { S3FileStore } from './s3.js';
|
|
8
9
|
|
|
9
10
|
const supportedExamples = [
|
|
@@ -21,6 +22,12 @@ export async function createFileStore(
|
|
|
21
22
|
): Promise<FileStore | undefined> {
|
|
22
23
|
if (config === undefined) {
|
|
23
24
|
return undefined;
|
|
25
|
+
} else if (config.startsWith('mem://')) {
|
|
26
|
+
// In-memory store for tests (see InMemoryFileStore). The namespace is everything after the
|
|
27
|
+
// scheme, so `mem://X` and a later `mem://X` share data, like two file:// stores over one dir.
|
|
28
|
+
const namespace = config.slice('mem://'.length).replace(/\/+$/, '');
|
|
29
|
+
logger.info(`Creating in-memory file store at ${namespace}`);
|
|
30
|
+
return new InMemoryFileStore(namespace);
|
|
24
31
|
} else if (config.startsWith('file://')) {
|
|
25
32
|
const url = new URL(config);
|
|
26
33
|
if (url.host) {
|
package/src/file-store/index.ts
CHANGED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { writeFile } from 'fs/promises';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { gunzip as gunzipCb, gzip as gzipCb } from 'zlib';
|
|
4
|
+
|
|
5
|
+
import type { FileStore, FileStoreSaveOptions } from './interface.js';
|
|
6
|
+
|
|
7
|
+
const gzip = promisify(gzipCb);
|
|
8
|
+
const gunzip = promisify(gunzipCb);
|
|
9
|
+
|
|
10
|
+
// Backing data is shared per namespace so that a store created for writing and a (read-only) store
|
|
11
|
+
// created later from the same `mem://` URL observe the same files — mirroring how two `file://`
|
|
12
|
+
// stores over the same directory share state on disk. Without this, `FileStoreTxSource`, which
|
|
13
|
+
// builds its own store from the URL, would never see what a test wrote through a different instance.
|
|
14
|
+
const namespaces = new Map<string, Map<string, Buffer>>();
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* In-memory {@link FileStore}, addressed via `mem://<namespace>/...`. Reads and writes are synchronous
|
|
18
|
+
* map operations with no disk I/O, so it is deterministic — useful for tests that exercise consumers
|
|
19
|
+
* of a file store (e.g. the tx file store) rather than the on-disk store itself, where a real
|
|
20
|
+
* filesystem can introduce timing flakes.
|
|
21
|
+
*/
|
|
22
|
+
export class InMemoryFileStore implements FileStore {
|
|
23
|
+
private readonly files: Map<string, Buffer>;
|
|
24
|
+
|
|
25
|
+
constructor(private readonly namespace: string) {
|
|
26
|
+
let files = namespaces.get(namespace);
|
|
27
|
+
if (!files) {
|
|
28
|
+
files = new Map();
|
|
29
|
+
namespaces.set(namespace, files);
|
|
30
|
+
}
|
|
31
|
+
this.files = files;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Clears all in-memory file store data, or a single namespace. Intended for test isolation. */
|
|
35
|
+
static clear(namespace?: string): void {
|
|
36
|
+
if (namespace === undefined) {
|
|
37
|
+
namespaces.clear();
|
|
38
|
+
} else {
|
|
39
|
+
namespaces.delete(namespace);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public async save(path: string, data: Buffer, opts?: FileStoreSaveOptions): Promise<string> {
|
|
44
|
+
const toStore = opts?.compress ? await gzip(data) : data;
|
|
45
|
+
const key = this.key(path);
|
|
46
|
+
this.files.set(key, Buffer.from(toStore));
|
|
47
|
+
return `mem://${this.namespace}/${key}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public async upload(destPath: string, srcPath: string, opts?: FileStoreSaveOptions): Promise<string> {
|
|
51
|
+
const { readFile } = await import('fs/promises');
|
|
52
|
+
return this.save(destPath, await readFile(srcPath), opts);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public async read(pathOrUrl: string): Promise<Buffer> {
|
|
56
|
+
const data = this.files.get(this.key(pathOrUrl));
|
|
57
|
+
if (data === undefined) {
|
|
58
|
+
throw new Error(`File not found in memory store: ${pathOrUrl}`);
|
|
59
|
+
}
|
|
60
|
+
// Match LocalFileStore: transparently gunzip content that was stored compressed.
|
|
61
|
+
if (data.length >= 2 && data[0] === 0x1f && data[1] === 0x8b) {
|
|
62
|
+
return await gunzip(data);
|
|
63
|
+
}
|
|
64
|
+
return data;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public async download(pathOrUrl: string, destPath: string): Promise<void> {
|
|
68
|
+
await writeFile(destPath, await this.read(pathOrUrl));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public exists(pathOrUrl: string): Promise<boolean> {
|
|
72
|
+
return Promise.resolve(this.files.has(this.key(pathOrUrl)));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Lists stored file keys, optionally restricted to those under `prefix`. Not part of {@link FileStore}. */
|
|
76
|
+
public listFiles(prefix = ''): string[] {
|
|
77
|
+
const keys = [...this.files.keys()];
|
|
78
|
+
const normalizedPrefix = prefix.replace(/^\/+/, '');
|
|
79
|
+
return normalizedPrefix ? keys.filter(k => k.startsWith(normalizedPrefix)) : keys;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Resolves a relative path or a `mem://` URI (as returned by `save`) to the registry key. */
|
|
83
|
+
private key(pathOrUrl: string): string {
|
|
84
|
+
const ownPrefix = `mem://${this.namespace}/`;
|
|
85
|
+
if (pathOrUrl.startsWith(ownPrefix)) {
|
|
86
|
+
return pathOrUrl.slice(ownPrefix.length);
|
|
87
|
+
}
|
|
88
|
+
if (pathOrUrl.startsWith('mem://')) {
|
|
89
|
+
// A mem:// URI for some namespace: drop the scheme and the leading namespace segment.
|
|
90
|
+
return pathOrUrl.slice('mem://'.length).replace(/^[^/]*\//, '');
|
|
91
|
+
}
|
|
92
|
+
return pathOrUrl.replace(/^\/+/, '');
|
|
93
|
+
}
|
|
94
|
+
}
|