@aztec/stdlib 0.87.2 → 0.87.3-nightly.20250528
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/abi/abi.d.ts +3 -0
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +38 -0
- package/dest/avm/avm.d.ts +696 -12
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +16 -8
- package/dest/avm/avm_accumulated_data.d.ts +77 -0
- package/dest/avm/avm_accumulated_data.d.ts.map +1 -1
- package/dest/avm/avm_accumulated_data.js +67 -0
- package/dest/avm/avm_circuit_public_inputs.d.ts +73 -3
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.js +19 -9
- package/dest/avm/avm_proving_request.d.ts +366 -0
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/block/body.d.ts +1 -1
- package/dest/block/body.d.ts.map +1 -1
- package/dest/block/body.js +2 -2
- package/dest/block/index.d.ts +1 -0
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +1 -0
- package/dest/block/l2_block.d.ts +1 -1
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +2 -2
- package/dest/block/l2_block_source.d.ts +9 -4
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +1 -0
- package/dest/block/proposal/committee_attestation.d.ts +34 -0
- package/dest/block/proposal/committee_attestation.d.ts.map +1 -0
- package/dest/block/proposal/committee_attestation.js +59 -0
- package/dest/block/proposal/index.d.ts +2 -0
- package/dest/block/proposal/index.d.ts.map +1 -0
- package/dest/block/proposal/index.js +1 -0
- package/dest/block/published_l2_block.d.ts +99 -69
- package/dest/block/published_l2_block.d.ts.map +1 -1
- package/dest/block/published_l2_block.js +38 -12
- package/dest/block/test/l2_tips_store_test_suite.js +1 -1
- package/dest/interfaces/archiver.js +2 -2
- package/dest/interfaces/aztec-node.js +2 -2
- package/dest/interfaces/prover-agent.d.ts +31 -6
- package/dest/interfaces/prover-agent.d.ts.map +1 -1
- package/dest/interfaces/prover-agent.js +15 -6
- package/dest/interfaces/proving-job.d.ts +370 -4
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +2 -2
- package/dest/interfaces/server_circuit_prover.d.ts +3 -2
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/kernel/index.d.ts +1 -0
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +1 -0
- package/dest/kernel/padded_side_effects.d.ts +26 -0
- package/dest/kernel/padded_side_effects.d.ts.map +1 -0
- package/dest/kernel/padded_side_effects.js +51 -0
- package/dest/kernel/private_kernel_data.d.ts +6 -25
- package/dest/kernel/private_kernel_data.d.ts.map +1 -1
- package/dest/kernel/private_kernel_data.js +8 -19
- package/dest/kernel/private_kernel_prover_output.d.ts +3 -0
- package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts +5 -2
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.js +9 -5
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +10 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +8 -3
- package/dest/kernel/public_call_request.d.ts +54 -0
- package/dest/kernel/public_call_request.d.ts.map +1 -1
- package/dest/kernel/public_call_request.js +58 -0
- package/dest/logs/pending_tagged_log.d.ts +1 -1
- package/dest/logs/pending_tagged_log.js +1 -1
- package/dest/rollup/avm_proof_data.d.ts +7 -5
- package/dest/rollup/avm_proof_data.d.ts.map +1 -1
- package/dest/rollup/avm_proof_data.js +12 -4
- package/dest/rollup/previous_rollup_block_data.d.ts +6 -15
- package/dest/rollup/previous_rollup_block_data.d.ts.map +1 -1
- package/dest/rollup/previous_rollup_block_data.js +8 -13
- package/dest/rollup/previous_rollup_data.d.ts +6 -15
- package/dest/rollup/previous_rollup_data.d.ts.map +1 -1
- package/dest/rollup/previous_rollup_data.js +8 -13
- package/dest/rollup/private_tube_data.d.ts +3 -3
- package/dest/rollup/private_tube_data.d.ts.map +1 -1
- package/dest/rollup/private_tube_data.js +3 -3
- package/dest/rollup/public_tube_data.d.ts +3 -3
- package/dest/rollup/public_tube_data.d.ts.map +1 -1
- package/dest/rollup/public_tube_data.js +3 -3
- package/dest/rollup/root_rollup.d.ts +9 -10
- package/dest/rollup/root_rollup.d.ts.map +1 -1
- package/dest/rollup/root_rollup.js +9 -20
- package/dest/tests/factories.d.ts +2 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +21 -15
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +4 -3
- package/dest/tx/private_execution_result.d.ts +6 -0
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/profiling.d.ts +41 -0
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +4 -1
- package/dest/tx/proven_tx.d.ts +40 -18
- package/dest/tx/proven_tx.d.ts.map +1 -1
- package/dest/tx/proven_tx.js +2 -2
- package/dest/tx/tx_effect.d.ts +1 -1
- package/dest/tx/tx_effect.d.ts.map +1 -1
- package/dest/tx/tx_effect.js +2 -2
- package/dest/validators/types.d.ts +4 -0
- package/dest/validators/types.d.ts.map +1 -1
- package/dest/vks/index.d.ts +1 -1
- package/dest/vks/index.d.ts.map +1 -1
- package/dest/vks/index.js +1 -1
- package/dest/vks/{vk_witness_data.d.ts → vk_data.d.ts} +8 -8
- package/dest/vks/vk_data.d.ts.map +1 -0
- package/dest/vks/{vk_witness_data.js → vk_data.js} +10 -10
- package/package.json +7 -7
- package/src/abi/abi.ts +37 -0
- package/src/avm/avm.ts +14 -0
- package/src/avm/avm_accumulated_data.ts +93 -0
- package/src/avm/avm_circuit_public_inputs.ts +22 -2
- package/src/block/body.ts +7 -2
- package/src/block/index.ts +1 -0
- package/src/block/l2_block.ts +2 -1
- package/src/block/l2_block_source.ts +9 -3
- package/src/block/proposal/committee_attestation.ts +70 -0
- package/src/block/proposal/index.ts +1 -0
- package/src/block/published_l2_block.ts +38 -24
- package/src/block/test/l2_tips_store_test_suite.ts +1 -1
- package/src/interfaces/archiver.ts +2 -2
- package/src/interfaces/aztec-node.ts +2 -2
- package/src/interfaces/prover-agent.ts +9 -10
- package/src/interfaces/proving-job.ts +3 -3
- package/src/interfaces/server_circuit_prover.ts +3 -2
- package/src/kernel/index.ts +1 -0
- package/src/kernel/padded_side_effects.ts +73 -0
- package/src/kernel/private_kernel_data.ts +7 -29
- package/src/kernel/private_kernel_prover_output.ts +1 -0
- package/src/kernel/private_kernel_reset_circuit_private_inputs.ts +6 -3
- package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +10 -2
- package/src/kernel/public_call_request.ts +66 -0
- package/src/logs/pending_tagged_log.ts +1 -1
- package/src/rollup/avm_proof_data.ts +14 -7
- package/src/rollup/previous_rollup_block_data.ts +6 -12
- package/src/rollup/previous_rollup_data.ts +6 -12
- package/src/rollup/private_tube_data.ts +4 -4
- package/src/rollup/public_tube_data.ts +4 -4
- package/src/rollup/root_rollup.ts +6 -19
- package/src/tests/factories.ts +32 -20
- package/src/tests/mocks.ts +6 -3
- package/src/tx/private_execution_result.ts +1 -1
- package/src/tx/profiling.ts +6 -1
- package/src/tx/proven_tx.ts +2 -2
- package/src/tx/tx_effect.ts +23 -5
- package/src/validators/types.ts +2 -0
- package/src/vks/index.ts +1 -1
- package/src/vks/{vk_witness_data.ts → vk_data.ts} +6 -6
- package/dest/vks/vk_witness_data.d.ts.map +0 -1
|
@@ -17,7 +17,7 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
17
17
|
const makeBlock = (number: number): PublishedL2Block => ({
|
|
18
18
|
block: { number, header: { hash: () => Promise.resolve(new Fr(number)) } as BlockHeader } as L2Block,
|
|
19
19
|
l1: { blockNumber: BigInt(number), blockHash: `0x${number}`, timestamp: BigInt(number) },
|
|
20
|
-
|
|
20
|
+
attestations: [],
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
const makeBlockId = (number: number): L2BlockId => ({
|
|
@@ -4,7 +4,7 @@ import { z } from 'zod';
|
|
|
4
4
|
|
|
5
5
|
import { L2Block } from '../block/l2_block.js';
|
|
6
6
|
import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
|
|
7
|
-
import {
|
|
7
|
+
import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
8
8
|
import {
|
|
9
9
|
ContractClassPublicSchema,
|
|
10
10
|
type ContractDataSource,
|
|
@@ -45,7 +45,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
45
45
|
getPublishedBlocks: z
|
|
46
46
|
.function()
|
|
47
47
|
.args(schemas.Integer, schemas.Integer, optional(z.boolean()))
|
|
48
|
-
.returns(z.array(
|
|
48
|
+
.returns(z.array(PublishedL2Block.schema)),
|
|
49
49
|
getTxEffect: z.function().args(TxHash.schema).returns(indexedTxSchema().optional()),
|
|
50
50
|
getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
|
|
51
51
|
getL2SlotNumber: z.function().args().returns(schemas.BigInt),
|
|
@@ -17,7 +17,7 @@ import { type InBlock, inBlockSchemaFor } from '../block/in_block.js';
|
|
|
17
17
|
import { L2Block } from '../block/l2_block.js';
|
|
18
18
|
import { type L2BlockNumber, L2BlockNumberSchema } from '../block/l2_block_number.js';
|
|
19
19
|
import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
|
|
20
|
-
import {
|
|
20
|
+
import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
21
21
|
import {
|
|
22
22
|
type ContractClassPublic,
|
|
23
23
|
ContractClassPublicSchema,
|
|
@@ -484,7 +484,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
484
484
|
|
|
485
485
|
getBlocks: z.function().args(z.number(), z.number()).returns(z.array(L2Block.schema)),
|
|
486
486
|
|
|
487
|
-
getPublishedBlocks: z.function().args(z.number(), z.number()).returns(z.array(
|
|
487
|
+
getPublishedBlocks: z.function().args(z.number(), z.number()).returns(z.array(PublishedL2Block.schema)),
|
|
488
488
|
|
|
489
489
|
getCurrentBaseFees: z.function().returns(GasFees.schema),
|
|
490
490
|
|
|
@@ -2,19 +2,18 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
import type { ApiSchemaFor } from '../schemas/index.js';
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
|
|
5
|
+
export const ProverAgentStatusSchema = z.discriminatedUnion('status', [
|
|
6
|
+
z.object({ status: z.literal('stopped') }),
|
|
7
|
+
z.object({ status: z.literal('running') }),
|
|
8
|
+
z.object({ status: z.literal('proving'), jobId: z.string(), proofType: z.number(), startedAtISO: z.string() }),
|
|
9
|
+
]);
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
export type ProverAgentStatus = z.infer<typeof ProverAgentStatusSchema>;
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
export interface ProverAgentApi {
|
|
14
|
+
getStatus(): Promise<unknown>;
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
export const ProverAgentApiSchema: ApiSchemaFor<ProverAgentApi> = {
|
|
14
|
-
|
|
15
|
-
isRunning: z.function().args().returns(z.boolean()),
|
|
16
|
-
getCurrentJobs: z
|
|
17
|
-
.function()
|
|
18
|
-
.args()
|
|
19
|
-
.returns(z.array(z.object({ id: z.string(), type: z.string() }))),
|
|
18
|
+
getStatus: z.function().args().returns(ProverAgentStatusSchema),
|
|
20
19
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
|
|
3
3
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
4
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
5
|
RECURSIVE_PROOF_LENGTH,
|
|
@@ -179,7 +179,7 @@ export type ProvingJobInputsMap = {
|
|
|
179
179
|
export const ProvingJobResult = z.discriminatedUnion('type', [
|
|
180
180
|
z.object({
|
|
181
181
|
type: z.literal(ProvingRequestType.PUBLIC_VM),
|
|
182
|
-
result: schemaForRecursiveProofAndVerificationKey(
|
|
182
|
+
result: schemaForRecursiveProofAndVerificationKey(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED),
|
|
183
183
|
}),
|
|
184
184
|
z.object({
|
|
185
185
|
type: z.literal(ProvingRequestType.PRIVATE_BASE_ROLLUP),
|
|
@@ -249,7 +249,7 @@ export const ProvingJobResult = z.discriminatedUnion('type', [
|
|
|
249
249
|
]);
|
|
250
250
|
export type ProvingJobResult = z.infer<typeof ProvingJobResult>;
|
|
251
251
|
export type ProvingJobResultsMap = {
|
|
252
|
-
[ProvingRequestType.PUBLIC_VM]: ProofAndVerificationKey<typeof
|
|
252
|
+
[ProvingRequestType.PUBLIC_VM]: ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>;
|
|
253
253
|
[ProvingRequestType.PRIVATE_BASE_ROLLUP]: PublicInputsAndRecursiveProof<
|
|
254
254
|
BaseOrMergeRollupPublicInputs,
|
|
255
255
|
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
2
|
+
AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
|
|
3
3
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
4
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
5
|
RECURSIVE_PROOF_LENGTH,
|
|
@@ -149,9 +149,10 @@ export interface ServerCircuitProver {
|
|
|
149
149
|
*/
|
|
150
150
|
getAvmProof(
|
|
151
151
|
inputs: AvmCircuitInputs,
|
|
152
|
+
skipPublicInputsValidation?: boolean, // TODO(#14234)[Unconditional PIs validation]: Remove.
|
|
152
153
|
signal?: AbortSignal,
|
|
153
154
|
epochNumber?: number,
|
|
154
|
-
): Promise<ProofAndVerificationKey<typeof
|
|
155
|
+
): Promise<ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>>;
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
/**
|
package/src/kernel/index.ts
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_LOGS_PER_TX } from '@aztec/constants';
|
|
2
|
+
import { makeTuple } from '@aztec/foundation/array';
|
|
3
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
+
import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
|
+
|
|
6
|
+
import { PrivateLog } from '../logs/index.js';
|
|
7
|
+
|
|
8
|
+
export class PaddedSideEffects {
|
|
9
|
+
constructor(
|
|
10
|
+
public noteHashes: Tuple<Fr, typeof MAX_NOTE_HASHES_PER_TX>,
|
|
11
|
+
public nullifiers: Tuple<Fr, typeof MAX_NULLIFIERS_PER_TX>,
|
|
12
|
+
public privateLogs: Tuple<PrivateLog, typeof MAX_PRIVATE_LOGS_PER_TX>,
|
|
13
|
+
) {}
|
|
14
|
+
|
|
15
|
+
toBuffer() {
|
|
16
|
+
return serializeToBuffer(this.noteHashes, this.nullifiers, this.privateLogs);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
20
|
+
const reader = BufferReader.asReader(buffer);
|
|
21
|
+
return new PaddedSideEffects(
|
|
22
|
+
reader.readArray(MAX_NOTE_HASHES_PER_TX, Fr),
|
|
23
|
+
reader.readArray(MAX_NULLIFIERS_PER_TX, Fr),
|
|
24
|
+
reader.readArray(MAX_PRIVATE_LOGS_PER_TX, PrivateLog),
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static empty() {
|
|
29
|
+
return new PaddedSideEffects(
|
|
30
|
+
makeTuple(MAX_NOTE_HASHES_PER_TX, Fr.zero),
|
|
31
|
+
makeTuple(MAX_NULLIFIERS_PER_TX, Fr.zero),
|
|
32
|
+
makeTuple(MAX_PRIVATE_LOGS_PER_TX, PrivateLog.empty),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class PaddedSideEffectAmounts {
|
|
38
|
+
constructor(
|
|
39
|
+
public nonRevertibleNoteHashes: number,
|
|
40
|
+
public revertibleNoteHashes: number,
|
|
41
|
+
public nonRevertibleNullifiers: number,
|
|
42
|
+
public revertibleNullifiers: number,
|
|
43
|
+
public nonRevertiblePrivateLogs: number,
|
|
44
|
+
public revertiblePrivateLogs: number,
|
|
45
|
+
) {}
|
|
46
|
+
|
|
47
|
+
toBuffer() {
|
|
48
|
+
return serializeToBuffer(
|
|
49
|
+
this.nonRevertibleNoteHashes,
|
|
50
|
+
this.revertibleNoteHashes,
|
|
51
|
+
this.nonRevertibleNullifiers,
|
|
52
|
+
this.revertibleNullifiers,
|
|
53
|
+
this.nonRevertiblePrivateLogs,
|
|
54
|
+
this.revertiblePrivateLogs,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
59
|
+
const reader = BufferReader.asReader(buffer);
|
|
60
|
+
return new PaddedSideEffectAmounts(
|
|
61
|
+
reader.readNumber(),
|
|
62
|
+
reader.readNumber(),
|
|
63
|
+
reader.readNumber(),
|
|
64
|
+
reader.readNumber(),
|
|
65
|
+
reader.readNumber(),
|
|
66
|
+
reader.readNumber(),
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static empty() {
|
|
71
|
+
return new PaddedSideEffectAmounts(0, 0, 0, 0, 0, 0);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { makeTuple } from '@aztec/foundation/array';
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
1
|
+
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
2
|
|
|
6
|
-
import
|
|
7
|
-
import { VerificationKeyData } from '../vks/verification_key.js';
|
|
3
|
+
import { VkData } from '../vks/index.js';
|
|
8
4
|
import { PrivateKernelCircuitPublicInputs } from './private_kernel_circuit_public_inputs.js';
|
|
9
5
|
|
|
10
6
|
/**
|
|
@@ -19,17 +15,9 @@ export class PrivateKernelData {
|
|
|
19
15
|
*/
|
|
20
16
|
public publicInputs: PrivateKernelCircuitPublicInputs,
|
|
21
17
|
/**
|
|
22
|
-
*
|
|
18
|
+
* The verification key and the witness of the vk in the vk tree.
|
|
23
19
|
*/
|
|
24
|
-
public
|
|
25
|
-
/**
|
|
26
|
-
* Index of the previous kernel's vk in a tree of vks.
|
|
27
|
-
*/
|
|
28
|
-
public vkIndex: UInt32,
|
|
29
|
-
/**
|
|
30
|
-
* Sibling path of the previous kernel's vk in a tree of vks.
|
|
31
|
-
*/
|
|
32
|
-
public vkPath: Tuple<Fr, typeof VK_TREE_HEIGHT>,
|
|
20
|
+
public vkData: VkData,
|
|
33
21
|
) {}
|
|
34
22
|
|
|
35
23
|
/**
|
|
@@ -37,25 +25,15 @@ export class PrivateKernelData {
|
|
|
37
25
|
* @returns The buffer.
|
|
38
26
|
*/
|
|
39
27
|
toBuffer() {
|
|
40
|
-
return serializeToBuffer(this.publicInputs, this.
|
|
28
|
+
return serializeToBuffer(this.publicInputs, this.vkData);
|
|
41
29
|
}
|
|
42
30
|
|
|
43
31
|
static fromBuffer(buffer: Buffer | BufferReader): PrivateKernelData {
|
|
44
32
|
const reader = BufferReader.asReader(buffer);
|
|
45
|
-
return new this(
|
|
46
|
-
reader.readObject(PrivateKernelCircuitPublicInputs),
|
|
47
|
-
reader.readObject(VerificationKeyData),
|
|
48
|
-
reader.readNumber(),
|
|
49
|
-
reader.readArray(VK_TREE_HEIGHT, Fr),
|
|
50
|
-
);
|
|
33
|
+
return new this(reader.readObject(PrivateKernelCircuitPublicInputs), reader.readObject(VkData));
|
|
51
34
|
}
|
|
52
35
|
|
|
53
36
|
static empty(): PrivateKernelData {
|
|
54
|
-
return new PrivateKernelData(
|
|
55
|
-
PrivateKernelCircuitPublicInputs.empty(),
|
|
56
|
-
VerificationKeyData.empty(),
|
|
57
|
-
0,
|
|
58
|
-
makeTuple(VK_TREE_HEIGHT, Fr.zero),
|
|
59
|
-
);
|
|
37
|
+
return new PrivateKernelData(PrivateKernelCircuitPublicInputs.empty(), VkData.empty());
|
|
60
38
|
}
|
|
61
39
|
}
|
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
import { serializeToBuffer } from '@aztec/foundation/serialize';
|
|
8
8
|
|
|
9
9
|
import type { PrivateKernelResetHints } from './hints/private_kernel_reset_hints.js';
|
|
10
|
+
import type { PaddedSideEffects } from './padded_side_effects.js';
|
|
10
11
|
import type { PrivateKernelData } from './private_kernel_data.js';
|
|
11
12
|
import type { PrivateKernelResetDimensions } from './private_kernel_reset_dimensions.js';
|
|
12
13
|
|
|
@@ -20,6 +21,7 @@ export class PrivateKernelResetCircuitPrivateInputsVariants<
|
|
|
20
21
|
> {
|
|
21
22
|
constructor(
|
|
22
23
|
public previousKernel: PrivateKernelData,
|
|
24
|
+
public paddedSideEffects: PaddedSideEffects,
|
|
23
25
|
public hints: PrivateKernelResetHints<
|
|
24
26
|
NH_RR_PENDING,
|
|
25
27
|
NH_RR_SETTLED,
|
|
@@ -31,7 +33,7 @@ export class PrivateKernelResetCircuitPrivateInputsVariants<
|
|
|
31
33
|
) {}
|
|
32
34
|
|
|
33
35
|
toBuffer() {
|
|
34
|
-
return serializeToBuffer(this.previousKernel, this.hints);
|
|
36
|
+
return serializeToBuffer(this.previousKernel, this.paddedSideEffects, this.hints);
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -44,6 +46,7 @@ export class PrivateKernelResetCircuitPrivateInputs {
|
|
|
44
46
|
* The previous kernel data
|
|
45
47
|
*/
|
|
46
48
|
public previousKernel: PrivateKernelData,
|
|
49
|
+
public paddedSideEffects: PaddedSideEffects,
|
|
47
50
|
public hints: PrivateKernelResetHints<
|
|
48
51
|
typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
49
52
|
typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
@@ -60,7 +63,7 @@ export class PrivateKernelResetCircuitPrivateInputs {
|
|
|
60
63
|
* @returns The buffer.
|
|
61
64
|
*/
|
|
62
65
|
toBuffer() {
|
|
63
|
-
return serializeToBuffer(this.previousKernel, this.hints, this.dimensions);
|
|
66
|
+
return serializeToBuffer(this.previousKernel, this.paddedSideEffects, this.hints, this.dimensions);
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
trimToSizes() {
|
|
@@ -72,6 +75,6 @@ export class PrivateKernelResetCircuitPrivateInputs {
|
|
|
72
75
|
this.dimensions.NULLIFIER_KEYS,
|
|
73
76
|
this.dimensions.TRANSIENT_DATA_AMOUNT,
|
|
74
77
|
);
|
|
75
|
-
return new PrivateKernelResetCircuitPrivateInputsVariants(this.previousKernel, hints);
|
|
78
|
+
return new PrivateKernelResetCircuitPrivateInputsVariants(this.previousKernel, this.paddedSideEffects, hints);
|
|
76
79
|
}
|
|
77
80
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
2
2
|
|
|
3
|
+
import { PaddedSideEffectAmounts } from './padded_side_effects.js';
|
|
3
4
|
import { PrivateKernelData } from './private_kernel_data.js';
|
|
4
5
|
import { countAccumulatedItems } from './utils/order_and_comparison.js';
|
|
5
6
|
|
|
@@ -12,6 +13,10 @@ export class PrivateKernelTailCircuitPrivateInputs {
|
|
|
12
13
|
* The previous kernel data
|
|
13
14
|
*/
|
|
14
15
|
public previousKernel: PrivateKernelData,
|
|
16
|
+
/**
|
|
17
|
+
* The number of the padded side effects.
|
|
18
|
+
*/
|
|
19
|
+
public paddedSideEffectAmounts: PaddedSideEffectAmounts,
|
|
15
20
|
) {}
|
|
16
21
|
|
|
17
22
|
isForPublic() {
|
|
@@ -26,7 +31,7 @@ export class PrivateKernelTailCircuitPrivateInputs {
|
|
|
26
31
|
* @returns The buffer.
|
|
27
32
|
*/
|
|
28
33
|
toBuffer() {
|
|
29
|
-
return serializeToBuffer(this.previousKernel);
|
|
34
|
+
return serializeToBuffer(this.previousKernel, this.paddedSideEffectAmounts);
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
/**
|
|
@@ -36,6 +41,9 @@ export class PrivateKernelTailCircuitPrivateInputs {
|
|
|
36
41
|
*/
|
|
37
42
|
static fromBuffer(buffer: Buffer | BufferReader): PrivateKernelTailCircuitPrivateInputs {
|
|
38
43
|
const reader = BufferReader.asReader(buffer);
|
|
39
|
-
return new PrivateKernelTailCircuitPrivateInputs(
|
|
44
|
+
return new PrivateKernelTailCircuitPrivateInputs(
|
|
45
|
+
reader.readObject(PrivateKernelData),
|
|
46
|
+
reader.readObject(PaddedSideEffectAmounts),
|
|
47
|
+
);
|
|
40
48
|
}
|
|
41
49
|
}
|
|
@@ -123,6 +123,72 @@ export class PublicCallRequest {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Represents lengths of arrays of public call requests.
|
|
128
|
+
*/
|
|
129
|
+
export class PublicCallRequestArrayLengths {
|
|
130
|
+
constructor(
|
|
131
|
+
/**
|
|
132
|
+
* Number of setup call requests
|
|
133
|
+
*/
|
|
134
|
+
public setupCalls: number,
|
|
135
|
+
/**
|
|
136
|
+
* Number of app logic call requests
|
|
137
|
+
*/
|
|
138
|
+
public appLogicCalls: number,
|
|
139
|
+
/**
|
|
140
|
+
* Whether there is a teardown call request
|
|
141
|
+
*/
|
|
142
|
+
public teardownCall: boolean,
|
|
143
|
+
) {}
|
|
144
|
+
|
|
145
|
+
static get schema() {
|
|
146
|
+
return z
|
|
147
|
+
.object({
|
|
148
|
+
setupCalls: z.number(),
|
|
149
|
+
appLogicCalls: z.number(),
|
|
150
|
+
teardownCall: z.boolean(),
|
|
151
|
+
})
|
|
152
|
+
.transform(({ setupCalls, appLogicCalls, teardownCall }) => {
|
|
153
|
+
return new PublicCallRequestArrayLengths(setupCalls, appLogicCalls, teardownCall);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
static getFields(fields: FieldsOf<PublicCallRequestArrayLengths>) {
|
|
158
|
+
return [fields.setupCalls, fields.appLogicCalls, fields.teardownCall] as const;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
static fromFields(fields: Fr[] | FieldReader): PublicCallRequestArrayLengths {
|
|
162
|
+
const reader = FieldReader.asReader(fields);
|
|
163
|
+
return new PublicCallRequestArrayLengths(reader.readU32(), reader.readU32(), reader.readBoolean());
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
toFields(): Fr[] {
|
|
167
|
+
return serializeToFields(...PublicCallRequestArrayLengths.getFields(this));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
171
|
+
const reader = BufferReader.asReader(buffer);
|
|
172
|
+
return new PublicCallRequestArrayLengths(reader.readNumber(), reader.readNumber(), reader.readBoolean());
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
toBuffer() {
|
|
176
|
+
return serializeToBuffer(...PublicCallRequestArrayLengths.getFields(this));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
static empty() {
|
|
180
|
+
return new PublicCallRequestArrayLengths(0, 0, false);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
[inspect.custom]() {
|
|
184
|
+
return `PublicCallRequestArrayLengths {
|
|
185
|
+
setupCalls: ${this.setupCalls}
|
|
186
|
+
appLogicCalls: ${this.appLogicCalls}
|
|
187
|
+
teardownCall: ${this.teardownCall}
|
|
188
|
+
}`;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
126
192
|
export class CountedPublicCallRequest {
|
|
127
193
|
constructor(
|
|
128
194
|
public inner: PublicCallRequest,
|
|
@@ -5,7 +5,7 @@ import type { AztecAddress } from '../aztec-address/index.js';
|
|
|
5
5
|
import type { TxHash } from '../tx/tx_hash.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Represents a pending tagged log as it is stored in the pending tagged log array to which the
|
|
8
|
+
* Represents a pending tagged log as it is stored in the pending tagged log array to which the fetchTaggedLogs oracle
|
|
9
9
|
* inserts found private logs. A TS version of `pending_tagged_log.nr`.
|
|
10
10
|
*/
|
|
11
11
|
export class PendingTaggedLog {
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
4
|
|
|
4
5
|
import { AvmCircuitPublicInputs } from '../avm/avm_circuit_public_inputs.js';
|
|
5
6
|
import { RecursiveProof, makeEmptyRecursiveProof } from '../proofs/recursive_proof.js';
|
|
6
|
-
import {
|
|
7
|
+
import { VkData } from '../vks/vk_data.js';
|
|
7
8
|
|
|
8
9
|
export class AvmProofData {
|
|
9
10
|
constructor(
|
|
10
11
|
public publicInputs: AvmCircuitPublicInputs,
|
|
11
|
-
public proof: RecursiveProof<typeof
|
|
12
|
-
public vkData:
|
|
12
|
+
public proof: RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>,
|
|
13
|
+
public vkData: VkData,
|
|
13
14
|
) {}
|
|
14
15
|
|
|
15
16
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
@@ -17,7 +18,7 @@ export class AvmProofData {
|
|
|
17
18
|
return new AvmProofData(
|
|
18
19
|
reader.readObject(AvmCircuitPublicInputs),
|
|
19
20
|
RecursiveProof.fromBuffer(reader),
|
|
20
|
-
reader.readObject(
|
|
21
|
+
reader.readObject(VkData),
|
|
21
22
|
);
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -28,8 +29,14 @@ export class AvmProofData {
|
|
|
28
29
|
static empty() {
|
|
29
30
|
return new AvmProofData(
|
|
30
31
|
AvmCircuitPublicInputs.empty(),
|
|
31
|
-
makeEmptyRecursiveProof(
|
|
32
|
-
|
|
32
|
+
makeEmptyRecursiveProof(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED),
|
|
33
|
+
VkData.empty(),
|
|
33
34
|
);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
37
|
+
|
|
38
|
+
// TODO(#14234)[Unconditional PIs validation]: remove this function.
|
|
39
|
+
export function enhanceProofWithPiValidationFlag(proof: Fr[], skipPublicInputsValidation: boolean): Fr[] {
|
|
40
|
+
const skipPublicInputsField = skipPublicInputsValidation ? new Fr(1) : new Fr(0);
|
|
41
|
+
return [skipPublicInputsField].concat(proof).slice(0, AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED);
|
|
42
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
1
|
+
import { NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
|
|
2
2
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
|
-
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
4
3
|
|
|
5
4
|
import { RecursiveProof } from '../proofs/recursive_proof.js';
|
|
6
|
-
import {
|
|
5
|
+
import { VkData } from '../vks/index.js';
|
|
7
6
|
import { BlockRootOrBlockMergePublicInputs } from './block_root_or_block_merge_public_inputs.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -20,13 +19,9 @@ export class PreviousRollupBlockData {
|
|
|
20
19
|
*/
|
|
21
20
|
public proof: RecursiveProof<typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>,
|
|
22
21
|
/**
|
|
23
|
-
* The verification key
|
|
22
|
+
* The verification key and the witness of the vk in the vk tree.
|
|
24
23
|
*/
|
|
25
|
-
public
|
|
26
|
-
/**
|
|
27
|
-
* Sibling path of the rollup circuit's vk in a big tree of rollup circuit vks.
|
|
28
|
-
*/
|
|
29
|
-
public vkWitness: MembershipWitness<typeof VK_TREE_HEIGHT>,
|
|
24
|
+
public vkData: VkData,
|
|
30
25
|
) {}
|
|
31
26
|
|
|
32
27
|
/**
|
|
@@ -34,7 +29,7 @@ export class PreviousRollupBlockData {
|
|
|
34
29
|
* @returns The buffer of the serialized previous rollup data.
|
|
35
30
|
*/
|
|
36
31
|
public toBuffer(): Buffer {
|
|
37
|
-
return serializeToBuffer(this.blockRootOrBlockMergePublicInputs, this.proof, this.
|
|
32
|
+
return serializeToBuffer(this.blockRootOrBlockMergePublicInputs, this.proof, this.vkData);
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
/**
|
|
@@ -47,8 +42,7 @@ export class PreviousRollupBlockData {
|
|
|
47
42
|
return new PreviousRollupBlockData(
|
|
48
43
|
reader.readObject(BlockRootOrBlockMergePublicInputs),
|
|
49
44
|
RecursiveProof.fromBuffer(reader, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH),
|
|
50
|
-
reader.readObject(
|
|
51
|
-
MembershipWitness.fromBuffer(reader, VK_TREE_HEIGHT),
|
|
45
|
+
reader.readObject(VkData),
|
|
52
46
|
);
|
|
53
47
|
}
|
|
54
48
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
1
|
+
import { NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
|
|
2
2
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
|
-
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
4
3
|
|
|
5
4
|
import { RecursiveProof } from '../proofs/recursive_proof.js';
|
|
6
|
-
import {
|
|
5
|
+
import { VkData } from '../vks/index.js';
|
|
7
6
|
import { BaseOrMergeRollupPublicInputs } from './base_or_merge_rollup_public_inputs.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -20,13 +19,9 @@ export class PreviousRollupData {
|
|
|
20
19
|
*/
|
|
21
20
|
public proof: RecursiveProof<typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>,
|
|
22
21
|
/**
|
|
23
|
-
* The verification key of the
|
|
22
|
+
* The verification key and the witness of the vk in the vk tree.
|
|
24
23
|
*/
|
|
25
|
-
public
|
|
26
|
-
/**
|
|
27
|
-
* Sibling path of the rollup circuit's vk in a big tree of rollup circuit vks.
|
|
28
|
-
*/
|
|
29
|
-
public vkWitness: MembershipWitness<typeof VK_TREE_HEIGHT>,
|
|
24
|
+
public vkData: VkData,
|
|
30
25
|
) {}
|
|
31
26
|
|
|
32
27
|
/**
|
|
@@ -34,7 +29,7 @@ export class PreviousRollupData {
|
|
|
34
29
|
* @returns The buffer of the serialized previous rollup data.
|
|
35
30
|
*/
|
|
36
31
|
public toBuffer(): Buffer {
|
|
37
|
-
return serializeToBuffer(this.baseOrMergeRollupPublicInputs, this.proof, this.
|
|
32
|
+
return serializeToBuffer(this.baseOrMergeRollupPublicInputs, this.proof, this.vkData);
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
/**
|
|
@@ -47,8 +42,7 @@ export class PreviousRollupData {
|
|
|
47
42
|
return new PreviousRollupData(
|
|
48
43
|
reader.readObject(BaseOrMergeRollupPublicInputs),
|
|
49
44
|
RecursiveProof.fromBuffer(reader, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH),
|
|
50
|
-
reader.readObject(
|
|
51
|
-
MembershipWitness.fromBuffer(reader, VK_TREE_HEIGHT),
|
|
45
|
+
reader.readObject(VkData),
|
|
52
46
|
);
|
|
53
47
|
}
|
|
54
48
|
}
|
|
@@ -3,20 +3,20 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
|
3
3
|
|
|
4
4
|
import { PrivateToRollupKernelCircuitPublicInputs } from '../kernel/private_to_rollup_kernel_circuit_public_inputs.js';
|
|
5
5
|
import { RecursiveProof, makeEmptyRecursiveProof } from '../proofs/recursive_proof.js';
|
|
6
|
-
import {
|
|
6
|
+
import { VkData } from '../vks/index.js';
|
|
7
7
|
|
|
8
8
|
export class PrivateTubeData {
|
|
9
9
|
constructor(
|
|
10
10
|
public publicInputs: PrivateToRollupKernelCircuitPublicInputs,
|
|
11
11
|
public proof: RecursiveProof<typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>,
|
|
12
|
-
public vkData:
|
|
12
|
+
public vkData: VkData,
|
|
13
13
|
) {}
|
|
14
14
|
|
|
15
15
|
static empty() {
|
|
16
16
|
return new PrivateTubeData(
|
|
17
17
|
PrivateToRollupKernelCircuitPublicInputs.empty(),
|
|
18
18
|
makeEmptyRecursiveProof(NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH),
|
|
19
|
-
|
|
19
|
+
VkData.empty(),
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -25,7 +25,7 @@ export class PrivateTubeData {
|
|
|
25
25
|
return new PrivateTubeData(
|
|
26
26
|
reader.readObject(PrivateToRollupKernelCircuitPublicInputs),
|
|
27
27
|
RecursiveProof.fromBuffer(reader, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH),
|
|
28
|
-
reader.readObject(
|
|
28
|
+
reader.readObject(VkData),
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -3,20 +3,20 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
|
3
3
|
|
|
4
4
|
import { PrivateToPublicKernelCircuitPublicInputs } from '../kernel/private_to_public_kernel_circuit_public_inputs.js';
|
|
5
5
|
import { RecursiveProof, makeEmptyRecursiveProof } from '../proofs/recursive_proof.js';
|
|
6
|
-
import {
|
|
6
|
+
import { VkData } from '../vks/index.js';
|
|
7
7
|
|
|
8
8
|
export class PublicTubeData {
|
|
9
9
|
constructor(
|
|
10
10
|
public publicInputs: PrivateToPublicKernelCircuitPublicInputs,
|
|
11
11
|
public proof: RecursiveProof<typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>,
|
|
12
|
-
public vkData:
|
|
12
|
+
public vkData: VkData,
|
|
13
13
|
) {}
|
|
14
14
|
|
|
15
15
|
static empty() {
|
|
16
16
|
return new PublicTubeData(
|
|
17
17
|
PrivateToPublicKernelCircuitPublicInputs.empty(),
|
|
18
18
|
makeEmptyRecursiveProof(NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH),
|
|
19
|
-
|
|
19
|
+
VkData.empty(),
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -25,7 +25,7 @@ export class PublicTubeData {
|
|
|
25
25
|
return new PublicTubeData(
|
|
26
26
|
reader.readObject(PrivateToPublicKernelCircuitPublicInputs),
|
|
27
27
|
RecursiveProof.fromBuffer(reader, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH),
|
|
28
|
-
reader.readObject(
|
|
28
|
+
reader.readObject(VkData),
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
|