@aztec/stdlib 0.85.0-alpha-testnet.1 → 0.85.0-alpha-testnet.3
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/block/l2_block.js +1 -1
- 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 +4 -9
- package/dest/interfaces/prover-coordination.d.ts.map +1 -1
- package/dest/interfaces/prover-coordination.js +1 -7
- package/dest/kernel/private_kernel_data.d.ts +3 -3
- package/dest/kernel/private_kernel_data.d.ts.map +1 -1
- package/dest/kernel/private_kernel_data.js +8 -8
- package/dest/kernel/private_kernel_prover_output.d.ts +6 -2
- package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_prover_output.js +17 -1
- package/dest/kernel/private_kernel_simulated_output.d.ts +3 -3
- package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
- 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 +1 -0
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +3 -0
- package/dest/tx/profiled_tx.d.ts.map +1 -1
- package/dest/tx/profiled_tx.js +2 -1
- package/package.json +7 -6
- package/src/block/l2_block.ts +1 -1
- package/src/interfaces/aztec-node.ts +1 -3
- package/src/interfaces/prover-coordination.ts +6 -16
- package/src/kernel/private_kernel_data.ts +6 -6
- package/src/kernel/private_kernel_prover_output.ts +18 -2
- package/src/kernel/private_kernel_simulated_output.ts +3 -3
- 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 +4 -0
- package/src/tx/profiled_tx.ts +1 -0
package/dest/block/l2_block.js
CHANGED
|
@@ -73,7 +73,7 @@ import { makeAppendOnlyTreeSnapshot, makeHeader } from './l2_block_code_to_purge
|
|
|
73
73
|
return new L2Block(AppendOnlyTreeSnapshot.zero(), BlockHeader.empty(), Body.empty());
|
|
74
74
|
}
|
|
75
75
|
get number() {
|
|
76
|
-
return
|
|
76
|
+
return this.header.getBlockNumber();
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Returns the block's hash (hash of block header).
|
|
@@ -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,w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AAkB,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAE3F;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEnH;;;OAGG;IACH,gBAAgB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC;IAEnE;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC,CAAC;IAErF;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAC9C;AAED,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,SAAS,CAgItD,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,QAAQ,GAAE,OAAO,CAAC,kBAAkB,CAAM,EAC1C,KAAK,sBAAe,GACnB,SAAS,CAMX"}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import type { ApiSchemaFor } from '../schemas/index.js';
|
|
2
1
|
import { Tx } from '../tx/tx.js';
|
|
3
2
|
import { TxHash } 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
|
-
* @returns The transactions
|
|
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,7 +4,7 @@ import { VK_TREE_HEIGHT } from '@aztec/constants';
|
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import { BufferReader, type Tuple } from '@aztec/foundation/serialize';
|
|
6
6
|
import type { UInt32 } from '../types/shared.js';
|
|
7
|
-
import {
|
|
7
|
+
import { VerificationKeyData } from '../vks/verification_key.js';
|
|
8
8
|
import { PrivateKernelCircuitPublicInputs } from './private_kernel_circuit_public_inputs.js';
|
|
9
9
|
/**
|
|
10
10
|
* Data of the previous kernel iteration in the chain of kernels.
|
|
@@ -17,7 +17,7 @@ export declare class PrivateKernelData {
|
|
|
17
17
|
/**
|
|
18
18
|
* Verification key of the previous kernel.
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
verificationKey: VerificationKeyData;
|
|
21
21
|
/**
|
|
22
22
|
* Index of the previous kernel's vk in a tree of vks.
|
|
23
23
|
*/
|
|
@@ -34,7 +34,7 @@ export declare class PrivateKernelData {
|
|
|
34
34
|
/**
|
|
35
35
|
* Verification key of the previous kernel.
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
verificationKey: VerificationKeyData,
|
|
38
38
|
/**
|
|
39
39
|
* Index of the previous kernel's vk in a tree of vks.
|
|
40
40
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_kernel_data.d.ts","sourceRoot":"","sources":["../../src/kernel/private_kernel_data.ts"],"names":[],"mappings":";;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"private_kernel_data.d.ts","sourceRoot":"","sources":["../../src/kernel/private_kernel_data.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,KAAK,KAAK,EAAqB,MAAM,6BAA6B,CAAC;AAE1F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAE7F;;GAEG;AACH,qBAAa,iBAAiB;IAI1B;;OAEG;IACI,YAAY,EAAE,gCAAgC;IACrD;;OAEG;IACI,eAAe,EAAE,mBAAmB;IAC3C;;OAEG;IACI,OAAO,EAAE,MAAM;IACtB;;OAEG;IACI,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,cAAc,CAAC;;IAf/C;;OAEG;IACI,YAAY,EAAE,gCAAgC;IACrD;;OAEG;IACI,eAAe,EAAE,mBAAmB;IAC3C;;OAEG;IACI,OAAO,EAAE,MAAM;IACtB;;OAEG;IACI,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,cAAc,CAAC;IAGjD;;;OAGG;IACH,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,iBAAiB;IAUnE,MAAM,CAAC,KAAK,IAAI,iBAAiB;CAQlC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
2
|
import { makeTuple } from '@aztec/foundation/array';
|
|
3
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
|
-
import {
|
|
5
|
+
import { VerificationKeyData } from '../vks/verification_key.js';
|
|
6
6
|
import { PrivateKernelCircuitPublicInputs } from './private_kernel_circuit_public_inputs.js';
|
|
7
7
|
/**
|
|
8
8
|
* Data of the previous kernel iteration in the chain of kernels.
|
|
9
9
|
*/ export class PrivateKernelData {
|
|
10
10
|
publicInputs;
|
|
11
|
-
|
|
11
|
+
verificationKey;
|
|
12
12
|
vkIndex;
|
|
13
13
|
vkPath;
|
|
14
14
|
// NOTE: as of move to honk and client IVC, previous private kernels no longer come with their proof
|
|
@@ -17,13 +17,13 @@ import { PrivateKernelCircuitPublicInputs } from './private_kernel_circuit_publi
|
|
|
17
17
|
* Public inputs of the previous kernel.
|
|
18
18
|
*/ publicInputs, /**
|
|
19
19
|
* Verification key of the previous kernel.
|
|
20
|
-
*/
|
|
20
|
+
*/ verificationKey, /**
|
|
21
21
|
* Index of the previous kernel's vk in a tree of vks.
|
|
22
22
|
*/ vkIndex, /**
|
|
23
23
|
* Sibling path of the previous kernel's vk in a tree of vks.
|
|
24
24
|
*/ vkPath){
|
|
25
25
|
this.publicInputs = publicInputs;
|
|
26
|
-
this.
|
|
26
|
+
this.verificationKey = verificationKey;
|
|
27
27
|
this.vkIndex = vkIndex;
|
|
28
28
|
this.vkPath = vkPath;
|
|
29
29
|
}
|
|
@@ -31,13 +31,13 @@ import { PrivateKernelCircuitPublicInputs } from './private_kernel_circuit_publi
|
|
|
31
31
|
* Serialize this as a buffer.
|
|
32
32
|
* @returns The buffer.
|
|
33
33
|
*/ toBuffer() {
|
|
34
|
-
return serializeToBuffer(this.publicInputs, this.
|
|
34
|
+
return serializeToBuffer(this.publicInputs, this.verificationKey, this.vkIndex, this.vkPath);
|
|
35
35
|
}
|
|
36
36
|
static fromBuffer(buffer) {
|
|
37
37
|
const reader = BufferReader.asReader(buffer);
|
|
38
|
-
return new this(reader.readObject(PrivateKernelCircuitPublicInputs), reader.readObject(
|
|
38
|
+
return new this(reader.readObject(PrivateKernelCircuitPublicInputs), reader.readObject(VerificationKeyData), reader.readNumber(), reader.readArray(VK_TREE_HEIGHT, Fr));
|
|
39
39
|
}
|
|
40
40
|
static empty() {
|
|
41
|
-
return new PrivateKernelData(PrivateKernelCircuitPublicInputs.empty(),
|
|
41
|
+
return new PrivateKernelData(PrivateKernelCircuitPublicInputs.empty(), VerificationKeyData.empty(), 0, makeTuple(VK_TREE_HEIGHT, Fr.zero));
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import type { WitnessMap } from '@aztec/noir-acvm_js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import type { ClientIvcProof } from '../proofs/client_ivc_proof.js';
|
|
6
|
-
import type { VerificationKeyAsFields } from '../vks/verification_key.js';
|
|
7
6
|
import type { PrivateKernelCircuitPublicInputs } from './private_kernel_circuit_public_inputs.js';
|
|
8
7
|
import type { PrivateKernelTailCircuitPublicInputs } from './private_kernel_tail_circuit_public_inputs.js';
|
|
9
8
|
export declare const PrivateExecutionStepSchema: z.ZodObject<{
|
|
@@ -11,13 +10,16 @@ export declare const PrivateExecutionStepSchema: z.ZodObject<{
|
|
|
11
10
|
gateCount: z.ZodOptional<z.ZodNumber>;
|
|
12
11
|
bytecode: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Buffer, string>;
|
|
13
12
|
witness: import("@aztec/foundation/schemas").ZodFor<Map<number, string>>;
|
|
13
|
+
vk: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Buffer, string>;
|
|
14
14
|
}, "strip", z.ZodTypeAny, {
|
|
15
15
|
bytecode: Buffer;
|
|
16
|
+
vk: Buffer;
|
|
16
17
|
functionName: string;
|
|
17
18
|
witness: Map<number, string>;
|
|
18
19
|
gateCount?: number | undefined;
|
|
19
20
|
}, {
|
|
20
21
|
bytecode: string;
|
|
22
|
+
vk: string;
|
|
21
23
|
functionName: string;
|
|
22
24
|
gateCount?: number | undefined;
|
|
23
25
|
witness?: any;
|
|
@@ -30,6 +32,7 @@ export interface PrivateExecutionStep {
|
|
|
30
32
|
gateCount?: number;
|
|
31
33
|
bytecode: Buffer;
|
|
32
34
|
witness: WitnessMap;
|
|
35
|
+
vk: Buffer;
|
|
33
36
|
}
|
|
34
37
|
/** Represents the output of proven PrivateKernelSimulateOutput.*/
|
|
35
38
|
export interface PrivateKernelExecutionProofOutput<PublicInputsType extends PrivateKernelCircuitPublicInputs | PrivateKernelTailCircuitPublicInputs> {
|
|
@@ -38,7 +41,7 @@ export interface PrivateKernelExecutionProofOutput<PublicInputsType extends Priv
|
|
|
38
41
|
/** The private IVC proof optimized for user devices. It will be consumed by an Aztec prover,
|
|
39
42
|
* which recursively verifies it through the "tube" circuit.*/
|
|
40
43
|
clientIvcProof: ClientIvcProof;
|
|
41
|
-
|
|
44
|
+
vk: Buffer;
|
|
42
45
|
/**
|
|
43
46
|
* The trace the clientIvcProof corresponds to.
|
|
44
47
|
* A trace of app circuits interleaved with private kernel circuits.
|
|
@@ -46,4 +49,5 @@ export interface PrivateKernelExecutionProofOutput<PublicInputsType extends Priv
|
|
|
46
49
|
*/
|
|
47
50
|
executionSteps: PrivateExecutionStep[];
|
|
48
51
|
}
|
|
52
|
+
export declare function serializePrivateExecutionSteps(steps: PrivateExecutionStep[]): Buffer;
|
|
49
53
|
//# sourceMappingURL=private_kernel_prover_output.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_kernel_prover_output.d.ts","sourceRoot":"","sources":["../../src/kernel/private_kernel_prover_output.ts"],"names":[],"mappings":";;AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"private_kernel_prover_output.d.ts","sourceRoot":"","sources":["../../src/kernel/private_kernel_prover_output.ts"],"names":[],"mappings":";;AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAItD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,gDAAgD,CAAC;AAE3G,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;EAMrC,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,UAAU,CAAC;IAEpB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,kEAAkE;AAClE,MAAM,WAAW,iCAAiC,CAChD,gBAAgB,SAAS,gCAAgC,GAAG,oCAAoC;IAEhG,8DAA8D;IAC9D,YAAY,EAAE,gBAAgB,CAAC;IAC/B;kEAC8D;IAC9D,cAAc,EAAE,cAAc,CAAC;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,cAAc,EAAE,oBAAoB,EAAE,CAAC;CACxC;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,oBAAoB,EAAE,UAU3E"}
|
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import { bufferSchema, mapSchema } from '@aztec/foundation/schemas';
|
|
2
|
+
import { serializeWitness } from '@aztec/noir-noirc_abi';
|
|
3
|
+
import { Encoder } from 'msgpackr';
|
|
2
4
|
import { z } from 'zod';
|
|
3
5
|
export const PrivateExecutionStepSchema = z.object({
|
|
4
6
|
functionName: z.string(),
|
|
5
7
|
gateCount: z.number().optional(),
|
|
6
8
|
bytecode: bufferSchema,
|
|
7
|
-
witness: mapSchema(z.number(), z.string())
|
|
9
|
+
witness: mapSchema(z.number(), z.string()),
|
|
10
|
+
vk: bufferSchema
|
|
8
11
|
});
|
|
12
|
+
export function serializePrivateExecutionSteps(steps) {
|
|
13
|
+
const stepToStruct = (step)=>{
|
|
14
|
+
return {
|
|
15
|
+
bytecode: step.bytecode,
|
|
16
|
+
witness: serializeWitness(step.witness),
|
|
17
|
+
vk: step.vk,
|
|
18
|
+
functionName: step.functionName
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
return new Encoder({
|
|
22
|
+
useRecords: false
|
|
23
|
+
}).pack(steps.map(stepToStruct));
|
|
24
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
import type { WitnessMap } from '@aztec/noir-acvm_js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { VerificationKeyData } from '../vks/verification_key.js';
|
|
5
5
|
import type { PrivateKernelCircuitPublicInputs } from './private_kernel_circuit_public_inputs.js';
|
|
6
6
|
import type { PrivateKernelTailCircuitPublicInputs } from './private_kernel_tail_circuit_public_inputs.js';
|
|
7
7
|
/**
|
|
@@ -12,13 +12,13 @@ export interface PrivateKernelSimulateOutput<PublicInputsType extends PrivateKer
|
|
|
12
12
|
/** The public inputs required for the proof generation process. */
|
|
13
13
|
publicInputs: PublicInputsType;
|
|
14
14
|
outputWitness: WitnessMap;
|
|
15
|
-
verificationKey:
|
|
15
|
+
verificationKey: VerificationKeyData;
|
|
16
16
|
bytecode: Buffer;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Represents the output of the circuit simulation process for init and inner private kernel circuit.
|
|
20
20
|
*/
|
|
21
21
|
export type AppCircuitSimulateOutput = {
|
|
22
|
-
verificationKey:
|
|
22
|
+
verificationKey: VerificationKeyData;
|
|
23
23
|
};
|
|
24
24
|
//# sourceMappingURL=private_kernel_simulated_output.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_kernel_simulated_output.d.ts","sourceRoot":"","sources":["../../src/kernel/private_kernel_simulated_output.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"private_kernel_simulated_output.d.ts","sourceRoot":"","sources":["../../src/kernel/private_kernel_simulated_output.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,gDAAgD,CAAC;AAE3G;;;GAGG;AACH,MAAM,WAAW,2BAA2B,CAC1C,gBAAgB,SAAS,gCAAgC,GAAG,oCAAoC;IAEhG,mEAAmE;IACnE,YAAY,EAAE,gBAAgB,CAAC;IAC/B,aAAa,EAAE,UAAU,CAAC;IAC1B,eAAe,EAAE,mBAAmB,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,eAAe,EAAE,mBAAmB,CAAC;CACtC,CAAC"}
|
|
@@ -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"}
|
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;;;;;;;;;;;;;;;;;;;;EAOE,CAAC"}
|
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,
|
|
@@ -41,6 +41,7 @@ export declare class BlockHeader {
|
|
|
41
41
|
static getFields(fields: FieldsOf<BlockHeader>): readonly [AppendOnlyTreeSnapshot, ContentCommitment, StateReference, GlobalVariables, Fr, Fr];
|
|
42
42
|
static from(fields: FieldsOf<BlockHeader>): BlockHeader;
|
|
43
43
|
getSlot(): bigint;
|
|
44
|
+
getBlockNumber(): number;
|
|
44
45
|
getSize(): number;
|
|
45
46
|
toBuffer(): Buffer;
|
|
46
47
|
toFields(): Fr[];
|
|
@@ -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,E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AAC,KAAK,EAAE,IAAI,GAAG,OAAO;CAUpC"}
|
package/dest/tx/block_header.js
CHANGED
|
@@ -52,6 +52,9 @@ import { StateReference } from './state_reference.js';
|
|
|
52
52
|
getSlot() {
|
|
53
53
|
return this.globalVariables.slotNumber.toBigInt();
|
|
54
54
|
}
|
|
55
|
+
getBlockNumber() {
|
|
56
|
+
return this.globalVariables.blockNumber.toNumber();
|
|
57
|
+
}
|
|
55
58
|
getSize() {
|
|
56
59
|
return this.lastArchive.getSize() + this.contentCommitment.getSize() + this.state.getSize() + this.globalVariables.getSize() + this.totalFees.size + this.totalManaUsed.size;
|
|
57
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiled_tx.d.ts","sourceRoot":"","sources":["../../src/tx/profiled_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAIxD,OAAO,EAAE,KAAK,oBAAoB,EAA8B,MAAM,2CAA2C,CAAC;AAElH,qBAAa,eAAe;IACP,cAAc,EAAE,oBAAoB,EAAE;gBAAtC,cAAc,EAAE,oBAAoB,EAAE;IAEzD,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,eAAe,CAAC,CAM3C;IAED,MAAM,CAAC,MAAM,IAAI,eAAe;
|
|
1
|
+
{"version":3,"file":"profiled_tx.d.ts","sourceRoot":"","sources":["../../src/tx/profiled_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAIxD,OAAO,EAAE,KAAK,oBAAoB,EAA8B,MAAM,2CAA2C,CAAC;AAElH,qBAAa,eAAe;IACP,cAAc,EAAE,oBAAoB,EAAE;gBAAtC,cAAc,EAAE,oBAAoB,EAAE;IAEzD,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,eAAe,CAAC,CAM3C;IAED,MAAM,CAAC,MAAM,IAAI,eAAe;CAUjC"}
|
package/dest/tx/profiled_tx.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "0.85.0-alpha-testnet.
|
|
3
|
+
"version": "0.85.0-alpha-testnet.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -68,11 +68,12 @@
|
|
|
68
68
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@aztec/bb.js": "0.85.0-alpha-testnet.
|
|
72
|
-
"@aztec/blob-lib": "0.85.0-alpha-testnet.
|
|
73
|
-
"@aztec/constants": "0.85.0-alpha-testnet.
|
|
74
|
-
"@aztec/ethereum": "0.85.0-alpha-testnet.
|
|
75
|
-
"@aztec/foundation": "0.85.0-alpha-testnet.
|
|
71
|
+
"@aztec/bb.js": "0.85.0-alpha-testnet.3",
|
|
72
|
+
"@aztec/blob-lib": "0.85.0-alpha-testnet.3",
|
|
73
|
+
"@aztec/constants": "0.85.0-alpha-testnet.3",
|
|
74
|
+
"@aztec/ethereum": "0.85.0-alpha-testnet.3",
|
|
75
|
+
"@aztec/foundation": "0.85.0-alpha-testnet.3",
|
|
76
|
+
"@aztec/noir-noirc_abi": "0.85.0-alpha-testnet.3",
|
|
76
77
|
"@google-cloud/storage": "^7.15.0",
|
|
77
78
|
"lodash.chunk": "^4.2.0",
|
|
78
79
|
"lodash.isequal": "^4.5.0",
|
package/src/block/l2_block.ts
CHANGED
|
@@ -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
|
-
* @returns The transactions
|
|
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
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
2
|
import { makeTuple } from '@aztec/foundation/array';
|
|
3
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
5
|
|
|
6
6
|
import type { UInt32 } from '../types/shared.js';
|
|
7
|
-
import {
|
|
7
|
+
import { VerificationKeyData } from '../vks/verification_key.js';
|
|
8
8
|
import { PrivateKernelCircuitPublicInputs } from './private_kernel_circuit_public_inputs.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -21,7 +21,7 @@ export class PrivateKernelData {
|
|
|
21
21
|
/**
|
|
22
22
|
* Verification key of the previous kernel.
|
|
23
23
|
*/
|
|
24
|
-
public
|
|
24
|
+
public verificationKey: VerificationKeyData,
|
|
25
25
|
/**
|
|
26
26
|
* Index of the previous kernel's vk in a tree of vks.
|
|
27
27
|
*/
|
|
@@ -37,14 +37,14 @@ export class PrivateKernelData {
|
|
|
37
37
|
* @returns The buffer.
|
|
38
38
|
*/
|
|
39
39
|
toBuffer() {
|
|
40
|
-
return serializeToBuffer(this.publicInputs, this.
|
|
40
|
+
return serializeToBuffer(this.publicInputs, this.verificationKey, this.vkIndex, this.vkPath);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
static fromBuffer(buffer: Buffer | BufferReader): PrivateKernelData {
|
|
44
44
|
const reader = BufferReader.asReader(buffer);
|
|
45
45
|
return new this(
|
|
46
46
|
reader.readObject(PrivateKernelCircuitPublicInputs),
|
|
47
|
-
reader.readObject(
|
|
47
|
+
reader.readObject(VerificationKeyData),
|
|
48
48
|
reader.readNumber(),
|
|
49
49
|
reader.readArray(VK_TREE_HEIGHT, Fr),
|
|
50
50
|
);
|
|
@@ -53,7 +53,7 @@ export class PrivateKernelData {
|
|
|
53
53
|
static empty(): PrivateKernelData {
|
|
54
54
|
return new PrivateKernelData(
|
|
55
55
|
PrivateKernelCircuitPublicInputs.empty(),
|
|
56
|
-
|
|
56
|
+
VerificationKeyData.empty(),
|
|
57
57
|
0,
|
|
58
58
|
makeTuple(VK_TREE_HEIGHT, Fr.zero),
|
|
59
59
|
);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { bufferSchema, mapSchema } from '@aztec/foundation/schemas';
|
|
2
2
|
import type { WitnessMap } from '@aztec/noir-acvm_js';
|
|
3
|
+
import { serializeWitness } from '@aztec/noir-noirc_abi';
|
|
3
4
|
|
|
5
|
+
import { Encoder } from 'msgpackr';
|
|
4
6
|
import { z } from 'zod';
|
|
5
7
|
|
|
6
8
|
import type { ClientIvcProof } from '../proofs/client_ivc_proof.js';
|
|
7
|
-
import type { VerificationKeyAsFields } from '../vks/verification_key.js';
|
|
8
9
|
import type { PrivateKernelCircuitPublicInputs } from './private_kernel_circuit_public_inputs.js';
|
|
9
10
|
import type { PrivateKernelTailCircuitPublicInputs } from './private_kernel_tail_circuit_public_inputs.js';
|
|
10
11
|
|
|
@@ -13,6 +14,7 @@ export const PrivateExecutionStepSchema = z.object({
|
|
|
13
14
|
gateCount: z.number().optional(),
|
|
14
15
|
bytecode: bufferSchema,
|
|
15
16
|
witness: mapSchema(z.number(), z.string()),
|
|
17
|
+
vk: bufferSchema,
|
|
16
18
|
});
|
|
17
19
|
|
|
18
20
|
/**
|
|
@@ -23,6 +25,8 @@ export interface PrivateExecutionStep {
|
|
|
23
25
|
gateCount?: number;
|
|
24
26
|
bytecode: Buffer;
|
|
25
27
|
witness: WitnessMap;
|
|
28
|
+
/* TODO(https://github.com/AztecProtocol/barretenberg/issues/1328) this should get its own proper class. */
|
|
29
|
+
vk: Buffer;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
/** Represents the output of proven PrivateKernelSimulateOutput.*/
|
|
@@ -34,7 +38,7 @@ export interface PrivateKernelExecutionProofOutput<
|
|
|
34
38
|
/** The private IVC proof optimized for user devices. It will be consumed by an Aztec prover,
|
|
35
39
|
* which recursively verifies it through the "tube" circuit.*/
|
|
36
40
|
clientIvcProof: ClientIvcProof;
|
|
37
|
-
|
|
41
|
+
vk: Buffer;
|
|
38
42
|
/**
|
|
39
43
|
* The trace the clientIvcProof corresponds to.
|
|
40
44
|
* A trace of app circuits interleaved with private kernel circuits.
|
|
@@ -42,3 +46,15 @@ export interface PrivateKernelExecutionProofOutput<
|
|
|
42
46
|
*/
|
|
43
47
|
executionSteps: PrivateExecutionStep[];
|
|
44
48
|
}
|
|
49
|
+
|
|
50
|
+
export function serializePrivateExecutionSteps(steps: PrivateExecutionStep[]) {
|
|
51
|
+
const stepToStruct = (step: PrivateExecutionStep) => {
|
|
52
|
+
return {
|
|
53
|
+
bytecode: step.bytecode,
|
|
54
|
+
witness: serializeWitness(step.witness),
|
|
55
|
+
vk: step.vk,
|
|
56
|
+
functionName: step.functionName,
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
return new Encoder({ useRecords: false }).pack(steps.map(stepToStruct));
|
|
60
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { WitnessMap } from '@aztec/noir-acvm_js';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { VerificationKeyData } from '../vks/verification_key.js';
|
|
4
4
|
import type { PrivateKernelCircuitPublicInputs } from './private_kernel_circuit_public_inputs.js';
|
|
5
5
|
import type { PrivateKernelTailCircuitPublicInputs } from './private_kernel_tail_circuit_public_inputs.js';
|
|
6
6
|
|
|
@@ -14,7 +14,7 @@ export interface PrivateKernelSimulateOutput<
|
|
|
14
14
|
/** The public inputs required for the proof generation process. */
|
|
15
15
|
publicInputs: PublicInputsType;
|
|
16
16
|
outputWitness: WitnessMap;
|
|
17
|
-
verificationKey:
|
|
17
|
+
verificationKey: VerificationKeyData;
|
|
18
18
|
bytecode: Buffer;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -22,5 +22,5 @@ export interface PrivateKernelSimulateOutput<
|
|
|
22
22
|
* Represents the output of the circuit simulation process for init and inner private kernel circuit.
|
|
23
23
|
*/
|
|
24
24
|
export type AppCircuitSimulateOutput = {
|
|
25
|
-
verificationKey:
|
|
25
|
+
verificationKey: VerificationKeyData;
|
|
26
26
|
};
|
|
@@ -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