@aztec/stdlib 0.85.0-nightly.20250424 → 0.86.0-nightly.20250425
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/interfaces/aztec-node.d.ts +1 -2
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/prover-coordination.d.ts +3 -8
- package/dest/interfaces/prover-coordination.d.ts.map +1 -1
- package/dest/interfaces/prover-coordination.js +1 -7
- package/dest/snapshots/download.d.ts +1 -1
- package/dest/snapshots/download.d.ts.map +1 -1
- package/dest/snapshots/download.js +3 -3
- package/dest/snapshots/index.d.ts +1 -1
- package/dest/snapshots/index.d.ts.map +1 -1
- package/dest/snapshots/index.js +1 -1
- package/dest/snapshots/types.d.ts +27 -4
- package/dest/snapshots/types.d.ts.map +1 -1
- package/dest/snapshots/types.js +8 -0
- package/dest/snapshots/upload.d.ts +6 -3
- package/dest/snapshots/upload.d.ts.map +1 -1
- package/dest/snapshots/upload.js +10 -6
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +1 -1
- package/package.json +7 -7
- package/src/interfaces/aztec-node.ts +1 -3
- package/src/interfaces/prover-coordination.ts +5 -15
- package/src/snapshots/download.ts +3 -4
- package/src/snapshots/index.ts +1 -1
- package/src/snapshots/types.ts +12 -0
- package/src/snapshots/upload.ts +19 -11
- package/src/tx/block_header.ts +2 -2
|
@@ -21,13 +21,12 @@ import { BlockHeader, type IndexedTxEffect, PublicSimulationOutput, Tx, TxHash,
|
|
|
21
21
|
import type { ValidatorsStats } from '../validators/types.js';
|
|
22
22
|
import { type ComponentsVersions } from '../versioning/index.js';
|
|
23
23
|
import { type GetContractClassLogsResponse, type GetPublicLogsResponse } from './get_logs_response.js';
|
|
24
|
-
import type { ProverCoordination } from './prover-coordination.js';
|
|
25
24
|
import { type WorldStateSyncStatus } from './world_state.js';
|
|
26
25
|
/**
|
|
27
26
|
* The aztec node.
|
|
28
27
|
* We will probably implement the additional interfaces by means other than Aztec Node as it's currently a privacy leak
|
|
29
28
|
*/
|
|
30
|
-
export interface AztecNode extends
|
|
29
|
+
export interface AztecNode extends Pick<L2BlockSource, 'getBlocks' | 'getPublishedBlocks' | 'getBlockHeader' | 'getL2Tips'> {
|
|
31
30
|
/**
|
|
32
31
|
* Returns the tips of the L2 chain.
|
|
33
32
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aztec-node.d.ts","sourceRoot":"","sources":["../../src/interfaces/aztec-node.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,mBAAmB,EAA6B,MAAM,uCAAuC,CAAC;AAC5G,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAA2B,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAItD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,KAAK,OAAO,EAAoB,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,6BAA6B,CAAC;AACtF,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,MAAM,EAAgB,MAAM,6BAA6B,CAAC;AAE5F,OAAO,EACL,KAAK,mBAAmB,EAExB,KAAK,2BAA2B,EAEhC,KAAK,QAAQ,EAEb,KAAK,yBAAyB,EAE/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE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} from '../tx/tx_hash.js';
|
|
3
|
+
import type { P2PClient } from './p2p.js';
|
|
4
4
|
/** Provides basic operations for ProverNodes to interact with other nodes in the network. */
|
|
5
5
|
export interface ProverCoordination {
|
|
6
|
-
/**
|
|
7
|
-
* Returns a transaction given its hash if available.
|
|
8
|
-
* @param txHash - The hash of the transaction, used as an ID.
|
|
9
|
-
* @returns The transaction, if found, 'undefined' otherwise.
|
|
10
|
-
*/
|
|
11
|
-
getTxByHash(txHash: TxHash): Promise<Tx | undefined>;
|
|
12
6
|
/**
|
|
13
7
|
* Returns a set of transactions given their hashes if available.
|
|
14
8
|
* @param txHashes - The hashes of the transactions, used as an ID.
|
|
15
9
|
* @returns The transactions found, no necessarily in the same order as the hashes.
|
|
16
10
|
*/
|
|
17
11
|
getTxsByHash(txHashes: TxHash[]): Promise<Tx[]>;
|
|
12
|
+
gatherTxs(txHashes: TxHash[]): Promise<void>;
|
|
13
|
+
getP2PClient(): P2PClient | undefined;
|
|
18
14
|
}
|
|
19
|
-
export declare const ProverCoordinationApiSchema: ApiSchemaFor<ProverCoordination>;
|
|
20
15
|
//# sourceMappingURL=prover-coordination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prover-coordination.d.ts","sourceRoot":"","sources":["../../src/interfaces/prover-coordination.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prover-coordination.d.ts","sourceRoot":"","sources":["../../src/interfaces/prover-coordination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,6FAA6F;AAC7F,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IAEhD,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C,YAAY,IAAI,SAAS,GAAG,SAAS,CAAC;CACvC"}
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Tx } from '../tx/tx.js';
|
|
3
|
-
import { TxHash } from '../tx/tx_hash.js';
|
|
4
|
-
export const ProverCoordinationApiSchema = {
|
|
5
|
-
getTxByHash: z.function().args(TxHash.schema).returns(Tx.schema.optional()),
|
|
6
|
-
getTxsByHash: z.function().args(z.array(TxHash.schema)).returns(z.array(Tx.schema))
|
|
7
|
-
};
|
|
1
|
+
/** Provides basic operations for ProverNodes to interact with other nodes in the network. */ export { };
|
|
@@ -4,6 +4,6 @@ export declare function getSnapshotIndex(metadata: SnapshotsIndexMetadata, store
|
|
|
4
4
|
export declare function getLatestSnapshotMetadata(metadata: SnapshotsIndexMetadata, store: ReadOnlyFileStore): Promise<SnapshotMetadata | undefined>;
|
|
5
5
|
export declare function getBasePath(metadata: SnapshotsIndexMetadata): string;
|
|
6
6
|
export declare function getSnapshotIndexPath(metadata: SnapshotsIndexMetadata): string;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function makeSnapshotPaths(baseDir: string): SnapshotDataUrls;
|
|
8
8
|
export declare function downloadSnapshot(snapshot: Pick<SnapshotMetadata, 'dataUrls'>, localPaths: Record<SnapshotDataKeys, string>, store: ReadOnlyFileStore): Promise<void>;
|
|
9
9
|
//# sourceMappingURL=download.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/snapshots/download.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/snapshots/download.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EACL,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAE5B,MAAM,YAAY,CAAC;AAEpB,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAarC;AAED,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAGvC;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,sBAAsB,GAAG,MAAM,CAEpE;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,sBAAsB,GAAG,MAAM,CAE7E;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAGnE;AAED,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,EAC5C,UAAU,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAC5C,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,IAAI,CAAC,CAEf"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { fromEntries, getEntries, maxBy } from '@aztec/foundation/collection';
|
|
2
2
|
import { jsonParseWithSchemaSync } from '@aztec/foundation/json-rpc';
|
|
3
|
-
import { join } from 'path';
|
|
4
3
|
import { SnapshotDataKeys, SnapshotsIndexSchema } from './types.js';
|
|
5
4
|
export async function getSnapshotIndex(metadata, store) {
|
|
6
5
|
const basePath = getBasePath(metadata);
|
|
@@ -26,10 +25,11 @@ export function getBasePath(metadata) {
|
|
|
26
25
|
export function getSnapshotIndexPath(metadata) {
|
|
27
26
|
return `${getBasePath(metadata)}/index.json`;
|
|
28
27
|
}
|
|
29
|
-
export function
|
|
28
|
+
export function makeSnapshotPaths(baseDir) {
|
|
29
|
+
// We do not use path.join since that screws up protocol prefixes
|
|
30
30
|
return fromEntries(SnapshotDataKeys.map((key)=>[
|
|
31
31
|
key,
|
|
32
|
-
|
|
32
|
+
`${baseDir}/${key}.db`
|
|
33
33
|
]));
|
|
34
34
|
}
|
|
35
35
|
export async function downloadSnapshot(snapshot, localPaths, store) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export * from './upload.js';
|
|
3
|
-
export { downloadSnapshot, getLatestSnapshotMetadata,
|
|
3
|
+
export { getBasePath, downloadSnapshot, getLatestSnapshotMetadata, makeSnapshotPaths } from './download.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/snapshots/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/snapshots/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
|
package/dest/snapshots/index.js
CHANGED
|
@@ -22,6 +22,7 @@ export type SnapshotsIndexMetadata = {
|
|
|
22
22
|
export type SnapshotsIndex = SnapshotsIndexMetadata & {
|
|
23
23
|
snapshots: SnapshotMetadata[];
|
|
24
24
|
};
|
|
25
|
+
export type UploadSnapshotMetadata = Pick<SnapshotMetadata, 'l2BlockNumber' | 'l2BlockHash' | 'l1BlockNumber'> & Pick<SnapshotsIndex, 'l1ChainId' | 'rollupVersion' | 'rollupAddress'>;
|
|
25
26
|
export declare const SnapshotsIndexSchema: z.ZodObject<{
|
|
26
27
|
l1ChainId: z.ZodNumber;
|
|
27
28
|
rollupVersion: z.ZodNumber;
|
|
@@ -47,21 +48,21 @@ export declare const SnapshotsIndexSchema: z.ZodObject<{
|
|
|
47
48
|
l2BlockNumber: number;
|
|
48
49
|
l2BlockHash: string;
|
|
49
50
|
l1BlockNumber: number;
|
|
51
|
+
dataUrls: Required<Partial<Record<"archiver" | "nullifier-tree" | "public-data-tree" | "note-hash-tree" | "archive-tree" | "l1-to-l2-message-tree", string>>>;
|
|
50
52
|
schemaVersions: {
|
|
51
53
|
archiver: number;
|
|
52
54
|
worldState: number;
|
|
53
55
|
};
|
|
54
|
-
dataUrls: Required<Partial<Record<"archiver" | "nullifier-tree" | "public-data-tree" | "note-hash-tree" | "archive-tree" | "l1-to-l2-message-tree", string>>>;
|
|
55
56
|
}, {
|
|
56
57
|
timestamp: number;
|
|
57
58
|
l2BlockNumber: number;
|
|
58
59
|
l2BlockHash: string;
|
|
59
60
|
l1BlockNumber: number;
|
|
61
|
+
dataUrls: Partial<Record<"archiver" | "nullifier-tree" | "public-data-tree" | "note-hash-tree" | "archive-tree" | "l1-to-l2-message-tree", string>>;
|
|
60
62
|
schemaVersions: {
|
|
61
63
|
archiver: number;
|
|
62
64
|
worldState: number;
|
|
63
65
|
};
|
|
64
|
-
dataUrls: Partial<Record<"archiver" | "nullifier-tree" | "public-data-tree" | "note-hash-tree" | "archive-tree" | "l1-to-l2-message-tree", string>>;
|
|
65
66
|
}>, "many">;
|
|
66
67
|
}, "strip", z.ZodTypeAny, {
|
|
67
68
|
rollupAddress: EthAddress;
|
|
@@ -72,11 +73,11 @@ export declare const SnapshotsIndexSchema: z.ZodObject<{
|
|
|
72
73
|
l2BlockNumber: number;
|
|
73
74
|
l2BlockHash: string;
|
|
74
75
|
l1BlockNumber: number;
|
|
76
|
+
dataUrls: Required<Partial<Record<"archiver" | "nullifier-tree" | "public-data-tree" | "note-hash-tree" | "archive-tree" | "l1-to-l2-message-tree", string>>>;
|
|
75
77
|
schemaVersions: {
|
|
76
78
|
archiver: number;
|
|
77
79
|
worldState: number;
|
|
78
80
|
};
|
|
79
|
-
dataUrls: Required<Partial<Record<"archiver" | "nullifier-tree" | "public-data-tree" | "note-hash-tree" | "archive-tree" | "l1-to-l2-message-tree", string>>>;
|
|
80
81
|
}[];
|
|
81
82
|
}, {
|
|
82
83
|
rollupAddress: string;
|
|
@@ -87,11 +88,33 @@ export declare const SnapshotsIndexSchema: z.ZodObject<{
|
|
|
87
88
|
l2BlockNumber: number;
|
|
88
89
|
l2BlockHash: string;
|
|
89
90
|
l1BlockNumber: number;
|
|
91
|
+
dataUrls: Partial<Record<"archiver" | "nullifier-tree" | "public-data-tree" | "note-hash-tree" | "archive-tree" | "l1-to-l2-message-tree", string>>;
|
|
90
92
|
schemaVersions: {
|
|
91
93
|
archiver: number;
|
|
92
94
|
worldState: number;
|
|
93
95
|
};
|
|
94
|
-
dataUrls: Partial<Record<"archiver" | "nullifier-tree" | "public-data-tree" | "note-hash-tree" | "archive-tree" | "l1-to-l2-message-tree", string>>;
|
|
95
96
|
}[];
|
|
96
97
|
}>;
|
|
98
|
+
export declare const UploadSnapshotMetadataSchema: z.ZodObject<{
|
|
99
|
+
l2BlockNumber: z.ZodNumber;
|
|
100
|
+
l2BlockHash: z.ZodString;
|
|
101
|
+
l1BlockNumber: z.ZodNumber;
|
|
102
|
+
l1ChainId: z.ZodNumber;
|
|
103
|
+
rollupVersion: z.ZodNumber;
|
|
104
|
+
rollupAddress: z.ZodType<EthAddress, any, string>;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
l2BlockNumber: number;
|
|
107
|
+
l2BlockHash: string;
|
|
108
|
+
rollupAddress: EthAddress;
|
|
109
|
+
l1ChainId: number;
|
|
110
|
+
rollupVersion: number;
|
|
111
|
+
l1BlockNumber: number;
|
|
112
|
+
}, {
|
|
113
|
+
l2BlockNumber: number;
|
|
114
|
+
l2BlockHash: string;
|
|
115
|
+
rollupAddress: string;
|
|
116
|
+
l1ChainId: number;
|
|
117
|
+
rollupVersion: number;
|
|
118
|
+
l1BlockNumber: number;
|
|
119
|
+
}>;
|
|
97
120
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/snapshots/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB,wHAOnB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,cAAc,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1D,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,UAAU,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,sBAAsB,GAAG;IACpD,SAAS,EAAE,gBAAgB,EAAE,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBE,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"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
package/dest/snapshots/types.js
CHANGED
|
@@ -25,3 +25,11 @@ export const SnapshotsIndexSchema = z.object({
|
|
|
25
25
|
.refine((obj)=>SnapshotDataKeys.every((key)=>!!obj[key]))
|
|
26
26
|
}))
|
|
27
27
|
});
|
|
28
|
+
export const UploadSnapshotMetadataSchema = z.object({
|
|
29
|
+
l2BlockNumber: z.number(),
|
|
30
|
+
l2BlockHash: z.string(),
|
|
31
|
+
l1BlockNumber: z.number(),
|
|
32
|
+
l1ChainId: z.number(),
|
|
33
|
+
rollupVersion: z.number(),
|
|
34
|
+
rollupAddress: schemas.EthAddress
|
|
35
|
+
});
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { FileStore } from '@aztec/stdlib/file-store';
|
|
2
|
-
import type { SnapshotDataKeys, SnapshotMetadata,
|
|
3
|
-
export
|
|
4
|
-
|
|
2
|
+
import type { SnapshotDataKeys, SnapshotMetadata, UploadSnapshotMetadata } from './types.js';
|
|
3
|
+
export declare function uploadSnapshotData(localPaths: Record<SnapshotDataKeys, string>, schemaVersions: SnapshotMetadata['schemaVersions'], metadata: UploadSnapshotMetadata, store: FileStore, opts?: {
|
|
4
|
+
pathFor?: (key: SnapshotDataKeys) => string;
|
|
5
|
+
private?: boolean;
|
|
6
|
+
}): Promise<SnapshotMetadata>;
|
|
7
|
+
export declare function uploadSnapshotToIndex(localPaths: Record<SnapshotDataKeys, string>, schemaVersions: SnapshotMetadata['schemaVersions'], metadata: UploadSnapshotMetadata, store: FileStore): Promise<SnapshotMetadata>;
|
|
5
8
|
//# sourceMappingURL=upload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/snapshots/upload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/snapshots/upload.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAG1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAkB,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAE7G,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAC5C,cAAc,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,EAClD,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,SAAS,EAChB,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAC5E,OAAO,CAAC,gBAAgB,CAAC,CAsB3B;AAED,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAC5C,cAAc,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,EAClD,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,SAAS,GACf,OAAO,CAAC,gBAAgB,CAAC,CAU3B"}
|
package/dest/snapshots/upload.js
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
import { fromEntries, getEntries, pick } from '@aztec/foundation/collection';
|
|
2
2
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
|
+
import { isoDate } from '@aztec/foundation/string';
|
|
3
4
|
import { getBasePath, getSnapshotIndex, getSnapshotIndexPath } from './download.js';
|
|
4
|
-
export async function
|
|
5
|
+
export async function uploadSnapshotData(localPaths, schemaVersions, metadata, store, opts = {}) {
|
|
5
6
|
const timestamp = Date.now();
|
|
6
|
-
const date =
|
|
7
|
+
const date = isoDate();
|
|
7
8
|
const basePath = getBasePath(metadata);
|
|
8
|
-
const targetPathFor = (key)=>`${basePath}/${key}-${date}-${metadata.l2BlockHash}.db
|
|
9
|
+
const targetPathFor = opts.pathFor ?? ((key)=>`${basePath}/${key}-${date}-${metadata.l2BlockHash}.db`);
|
|
9
10
|
const dataUrls = fromEntries(await Promise.all(getEntries(localPaths).map(async ([key, path])=>[
|
|
10
11
|
key,
|
|
11
12
|
await store.upload(targetPathFor(key), path, {
|
|
12
13
|
compress: true,
|
|
13
|
-
public:
|
|
14
|
+
public: !opts.private
|
|
14
15
|
})
|
|
15
16
|
])));
|
|
16
|
-
|
|
17
|
-
const newSnapshotMetadata = {
|
|
17
|
+
return {
|
|
18
18
|
...pick(metadata, 'l1BlockNumber', 'l2BlockHash', 'l2BlockNumber'),
|
|
19
19
|
schemaVersions,
|
|
20
20
|
timestamp,
|
|
21
21
|
dataUrls
|
|
22
22
|
};
|
|
23
|
+
}
|
|
24
|
+
export async function uploadSnapshotToIndex(localPaths, schemaVersions, metadata, store) {
|
|
25
|
+
const newSnapshotMetadata = await uploadSnapshotData(localPaths, schemaVersions, metadata, store);
|
|
26
|
+
const snapshotsIndex = await getSnapshotIndex(metadata, store) ?? createEmptyIndex(metadata);
|
|
23
27
|
snapshotsIndex.snapshots.unshift(newSnapshotMetadata);
|
|
24
28
|
await store.save(getSnapshotIndexPath(metadata), Buffer.from(jsonStringify(snapshotsIndex, true)), {
|
|
25
29
|
public: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_header.d.ts","sourceRoot":"","sources":["../../src/tx/block_header.ts"],"names":[],"mappings":";;;AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAwC,MAAM,6BAA6B,CAAC;AAE9G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,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AG,WAAW;IAYtE,OAAO,IAAI,OAAO;IAWlB;;;OAGG;IACI,QAAQ;IAIf,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW;IAI3C,IAAI,IAAI,OAAO,CAAC,EAAE,CAAC;IAInB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWT,CAAC,OAAO,CAAC,MAAM,CAAC;IAiBT,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO;CAUpC"}
|
package/dest/tx/block_header.js
CHANGED
|
@@ -53,7 +53,7 @@ import { StateReference } from './state_reference.js';
|
|
|
53
53
|
return this.globalVariables.slotNumber.toBigInt();
|
|
54
54
|
}
|
|
55
55
|
getBlockNumber() {
|
|
56
|
-
return
|
|
56
|
+
return this.globalVariables.blockNumber.toNumber();
|
|
57
57
|
}
|
|
58
58
|
getSize() {
|
|
59
59
|
return this.lastArchive.getSize() + this.contentCommitment.getSize() + this.state.getSize() + this.globalVariables.getSize() + this.totalFees.size + this.totalManaUsed.size;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.86.0-nightly.20250425",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@aztec/bb.js": "0.
|
|
70
|
-
"@aztec/blob-lib": "0.
|
|
71
|
-
"@aztec/constants": "0.
|
|
72
|
-
"@aztec/ethereum": "0.
|
|
73
|
-
"@aztec/foundation": "0.
|
|
74
|
-
"@aztec/noir-noirc_abi": "0.
|
|
69
|
+
"@aztec/bb.js": "0.86.0-nightly.20250425",
|
|
70
|
+
"@aztec/blob-lib": "0.86.0-nightly.20250425",
|
|
71
|
+
"@aztec/constants": "0.86.0-nightly.20250425",
|
|
72
|
+
"@aztec/ethereum": "0.86.0-nightly.20250425",
|
|
73
|
+
"@aztec/foundation": "0.86.0-nightly.20250425",
|
|
74
|
+
"@aztec/noir-noirc_abi": "0.86.0-nightly.20250425",
|
|
75
75
|
"@google-cloud/storage": "^7.15.0",
|
|
76
76
|
"lodash.chunk": "^4.2.0",
|
|
77
77
|
"lodash.isequal": "^4.5.0",
|
|
@@ -56,7 +56,6 @@ import {
|
|
|
56
56
|
type GetPublicLogsResponse,
|
|
57
57
|
GetPublicLogsResponseSchema,
|
|
58
58
|
} from './get_logs_response.js';
|
|
59
|
-
import type { ProverCoordination } from './prover-coordination.js';
|
|
60
59
|
import { type WorldStateSyncStatus, WorldStateSyncStatusSchema } from './world_state.js';
|
|
61
60
|
|
|
62
61
|
/**
|
|
@@ -64,8 +63,7 @@ import { type WorldStateSyncStatus, WorldStateSyncStatusSchema } from './world_s
|
|
|
64
63
|
* We will probably implement the additional interfaces by means other than Aztec Node as it's currently a privacy leak
|
|
65
64
|
*/
|
|
66
65
|
export interface AztecNode
|
|
67
|
-
extends
|
|
68
|
-
Pick<L2BlockSource, 'getBlocks' | 'getPublishedBlocks' | 'getBlockHeader' | 'getL2Tips'> {
|
|
66
|
+
extends Pick<L2BlockSource, 'getBlocks' | 'getPublishedBlocks' | 'getBlockHeader' | 'getL2Tips'> {
|
|
69
67
|
/**
|
|
70
68
|
* Returns the tips of the L2 chain.
|
|
71
69
|
*/
|
|
@@ -1,27 +1,17 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
import type { ApiSchemaFor } from '../schemas/index.js';
|
|
4
1
|
import { Tx } from '../tx/tx.js';
|
|
5
2
|
import { TxHash } from '../tx/tx_hash.js';
|
|
3
|
+
import type { P2PClient } from './p2p.js';
|
|
6
4
|
|
|
7
5
|
/** Provides basic operations for ProverNodes to interact with other nodes in the network. */
|
|
8
6
|
export interface ProverCoordination {
|
|
9
|
-
/**
|
|
10
|
-
* Returns a transaction given its hash if available.
|
|
11
|
-
* @param txHash - The hash of the transaction, used as an ID.
|
|
12
|
-
* @returns The transaction, if found, 'undefined' otherwise.
|
|
13
|
-
*/
|
|
14
|
-
getTxByHash(txHash: TxHash): Promise<Tx | undefined>;
|
|
15
|
-
|
|
16
7
|
/**
|
|
17
8
|
* Returns a set of transactions given their hashes if available.
|
|
18
9
|
* @param txHashes - The hashes of the transactions, used as an ID.
|
|
19
10
|
* @returns The transactions found, no necessarily in the same order as the hashes.
|
|
20
11
|
*/
|
|
21
12
|
getTxsByHash(txHashes: TxHash[]): Promise<Tx[]>;
|
|
22
|
-
}
|
|
23
13
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
14
|
+
gatherTxs(txHashes: TxHash[]): Promise<void>;
|
|
15
|
+
|
|
16
|
+
getP2PClient(): P2PClient | undefined;
|
|
17
|
+
}
|
|
@@ -2,8 +2,6 @@ import { fromEntries, getEntries, maxBy } from '@aztec/foundation/collection';
|
|
|
2
2
|
import { jsonParseWithSchemaSync } from '@aztec/foundation/json-rpc';
|
|
3
3
|
import type { ReadOnlyFileStore } from '@aztec/stdlib/file-store';
|
|
4
4
|
|
|
5
|
-
import { join } from 'path';
|
|
6
|
-
|
|
7
5
|
import {
|
|
8
6
|
SnapshotDataKeys,
|
|
9
7
|
type SnapshotDataUrls,
|
|
@@ -47,8 +45,9 @@ export function getSnapshotIndexPath(metadata: SnapshotsIndexMetadata): string {
|
|
|
47
45
|
return `${getBasePath(metadata)}/index.json`;
|
|
48
46
|
}
|
|
49
47
|
|
|
50
|
-
export function
|
|
51
|
-
|
|
48
|
+
export function makeSnapshotPaths(baseDir: string): SnapshotDataUrls {
|
|
49
|
+
// We do not use path.join since that screws up protocol prefixes
|
|
50
|
+
return fromEntries(SnapshotDataKeys.map(key => [key, `${baseDir}/${key}.db`]));
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
export async function downloadSnapshot(
|
package/src/snapshots/index.ts
CHANGED
package/src/snapshots/types.ts
CHANGED
|
@@ -35,6 +35,9 @@ export type SnapshotsIndex = SnapshotsIndexMetadata & {
|
|
|
35
35
|
snapshots: SnapshotMetadata[];
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
+
export type UploadSnapshotMetadata = Pick<SnapshotMetadata, 'l2BlockNumber' | 'l2BlockHash' | 'l1BlockNumber'> &
|
|
39
|
+
Pick<SnapshotsIndex, 'l1ChainId' | 'rollupVersion' | 'rollupAddress'>;
|
|
40
|
+
|
|
38
41
|
export const SnapshotsIndexSchema = z.object({
|
|
39
42
|
l1ChainId: z.number(),
|
|
40
43
|
rollupVersion: z.number(),
|
|
@@ -56,3 +59,12 @@ export const SnapshotsIndexSchema = z.object({
|
|
|
56
59
|
}),
|
|
57
60
|
),
|
|
58
61
|
}) satisfies ZodFor<SnapshotsIndex>;
|
|
62
|
+
|
|
63
|
+
export const UploadSnapshotMetadataSchema = z.object({
|
|
64
|
+
l2BlockNumber: z.number(),
|
|
65
|
+
l2BlockHash: z.string(),
|
|
66
|
+
l1BlockNumber: z.number(),
|
|
67
|
+
l1ChainId: z.number(),
|
|
68
|
+
rollupVersion: z.number(),
|
|
69
|
+
rollupAddress: schemas.EthAddress,
|
|
70
|
+
}) satisfies ZodFor<UploadSnapshotMetadata>;
|
package/src/snapshots/upload.ts
CHANGED
|
@@ -1,41 +1,49 @@
|
|
|
1
1
|
import { fromEntries, getEntries, pick } from '@aztec/foundation/collection';
|
|
2
2
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
|
+
import { isoDate } from '@aztec/foundation/string';
|
|
3
4
|
import type { FileStore } from '@aztec/stdlib/file-store';
|
|
4
5
|
|
|
5
6
|
import { getBasePath, getSnapshotIndex, getSnapshotIndexPath } from './download.js';
|
|
6
|
-
import type { SnapshotDataKeys, SnapshotMetadata, SnapshotsIndex } from './types.js';
|
|
7
|
+
import type { SnapshotDataKeys, SnapshotMetadata, SnapshotsIndex, UploadSnapshotMetadata } from './types.js';
|
|
7
8
|
|
|
8
|
-
export
|
|
9
|
-
Pick<SnapshotsIndex, 'l1ChainId' | 'rollupVersion' | 'rollupAddress'>;
|
|
10
|
-
|
|
11
|
-
export async function uploadSnapshot(
|
|
9
|
+
export async function uploadSnapshotData(
|
|
12
10
|
localPaths: Record<SnapshotDataKeys, string>,
|
|
13
11
|
schemaVersions: SnapshotMetadata['schemaVersions'],
|
|
14
12
|
metadata: UploadSnapshotMetadata,
|
|
15
13
|
store: FileStore,
|
|
14
|
+
opts: { pathFor?: (key: SnapshotDataKeys) => string; private?: boolean } = {},
|
|
16
15
|
): Promise<SnapshotMetadata> {
|
|
17
16
|
const timestamp = Date.now();
|
|
18
|
-
const date =
|
|
17
|
+
const date = isoDate();
|
|
19
18
|
const basePath = getBasePath(metadata);
|
|
20
|
-
const targetPathFor =
|
|
19
|
+
const targetPathFor =
|
|
20
|
+
opts.pathFor ?? ((key: SnapshotDataKeys) => `${basePath}/${key}-${date}-${metadata.l2BlockHash}.db`);
|
|
21
21
|
|
|
22
22
|
const dataUrls = fromEntries(
|
|
23
23
|
await Promise.all(
|
|
24
24
|
getEntries(localPaths).map(
|
|
25
25
|
async ([key, path]) =>
|
|
26
|
-
[key, await store.upload(targetPathFor(key), path, { compress: true, public:
|
|
26
|
+
[key, await store.upload(targetPathFor(key), path, { compress: true, public: !opts.private })] as const,
|
|
27
27
|
),
|
|
28
28
|
),
|
|
29
29
|
);
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const newSnapshotMetadata: SnapshotMetadata = {
|
|
31
|
+
return {
|
|
34
32
|
...pick(metadata, 'l1BlockNumber', 'l2BlockHash', 'l2BlockNumber'),
|
|
35
33
|
schemaVersions,
|
|
36
34
|
timestamp,
|
|
37
35
|
dataUrls,
|
|
38
36
|
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export async function uploadSnapshotToIndex(
|
|
40
|
+
localPaths: Record<SnapshotDataKeys, string>,
|
|
41
|
+
schemaVersions: SnapshotMetadata['schemaVersions'],
|
|
42
|
+
metadata: UploadSnapshotMetadata,
|
|
43
|
+
store: FileStore,
|
|
44
|
+
): Promise<SnapshotMetadata> {
|
|
45
|
+
const newSnapshotMetadata = await uploadSnapshotData(localPaths, schemaVersions, metadata, store);
|
|
46
|
+
const snapshotsIndex = (await getSnapshotIndex(metadata, store)) ?? createEmptyIndex(metadata);
|
|
39
47
|
snapshotsIndex.snapshots.unshift(newSnapshotMetadata);
|
|
40
48
|
|
|
41
49
|
await store.save(getSnapshotIndexPath(metadata), Buffer.from(jsonStringify(snapshotsIndex, true)), {
|
package/src/tx/block_header.ts
CHANGED
|
@@ -64,8 +64,8 @@ export class BlockHeader {
|
|
|
64
64
|
return this.globalVariables.slotNumber.toBigInt();
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
getBlockNumber()
|
|
68
|
-
return
|
|
67
|
+
getBlockNumber() {
|
|
68
|
+
return this.globalVariables.blockNumber.toNumber();
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
getSize() {
|