@aztec/stdlib 0.87.1 → 0.87.2-nightly.20250524
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/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/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_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/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/tx/validator/error_texts.d.ts +1 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +1 -1
- 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/l2_block.ts +2 -1
- package/src/block/l2_block_source.ts +9 -3
- 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_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/tx/tx_effect.ts +23 -5
- package/src/tx/validator/error_texts.ts +1 -1
- 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
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
PrivateToAvmAccumulatedData,
|
|
15
15
|
PrivateToAvmAccumulatedDataArrayLengths,
|
|
16
16
|
} from '../kernel/private_to_avm_accumulated_data.js';
|
|
17
|
-
import { PublicCallRequest } from '../kernel/public_call_request.js';
|
|
17
|
+
import { PublicCallRequest, PublicCallRequestArrayLengths } from '../kernel/public_call_request.js';
|
|
18
18
|
import { GlobalVariables } from '../tx/global_variables.js';
|
|
19
19
|
import { TreeSnapshots } from '../tx/tree_snapshots.js';
|
|
20
|
-
import { AvmAccumulatedData } from './avm_accumulated_data.js';
|
|
20
|
+
import { AvmAccumulatedData, AvmAccumulatedDataArrayLengths } from './avm_accumulated_data.js';
|
|
21
21
|
import { serializeWithMessagePack } from './message_pack.js';
|
|
22
22
|
|
|
23
23
|
// Note: the {from,to}{Buffer,Fields,String} methods are needed by AvmProofData and PublicBaseRollupInputs.
|
|
@@ -31,6 +31,7 @@ export class AvmCircuitPublicInputs {
|
|
|
31
31
|
public startGasUsed: Gas,
|
|
32
32
|
public gasSettings: GasSettings,
|
|
33
33
|
public feePayer: AztecAddress,
|
|
34
|
+
public publicCallRequestArrayLengths: PublicCallRequestArrayLengths,
|
|
34
35
|
public publicSetupCallRequests: Tuple<PublicCallRequest, typeof MAX_ENQUEUED_CALLS_PER_TX>,
|
|
35
36
|
public publicAppLogicCallRequests: Tuple<PublicCallRequest, typeof MAX_ENQUEUED_CALLS_PER_TX>,
|
|
36
37
|
public publicTeardownCallRequest: PublicCallRequest,
|
|
@@ -42,6 +43,7 @@ export class AvmCircuitPublicInputs {
|
|
|
42
43
|
// Outputs.
|
|
43
44
|
public endTreeSnapshots: TreeSnapshots,
|
|
44
45
|
public endGasUsed: Gas,
|
|
46
|
+
public accumulatedDataArrayLengths: AvmAccumulatedDataArrayLengths,
|
|
45
47
|
public accumulatedData: AvmAccumulatedData,
|
|
46
48
|
public transactionFee: Fr,
|
|
47
49
|
public reverted: boolean,
|
|
@@ -55,6 +57,7 @@ export class AvmCircuitPublicInputs {
|
|
|
55
57
|
startGasUsed: Gas.schema,
|
|
56
58
|
gasSettings: GasSettings.schema,
|
|
57
59
|
feePayer: AztecAddress.schema,
|
|
60
|
+
publicCallRequestArrayLengths: PublicCallRequestArrayLengths.schema,
|
|
58
61
|
publicSetupCallRequests: PublicCallRequest.schema.array().max(MAX_ENQUEUED_CALLS_PER_TX),
|
|
59
62
|
publicAppLogicCallRequests: PublicCallRequest.schema.array().max(MAX_ENQUEUED_CALLS_PER_TX),
|
|
60
63
|
publicTeardownCallRequest: PublicCallRequest.schema,
|
|
@@ -64,6 +67,7 @@ export class AvmCircuitPublicInputs {
|
|
|
64
67
|
previousRevertibleAccumulatedData: PrivateToAvmAccumulatedData.schema,
|
|
65
68
|
endTreeSnapshots: TreeSnapshots.schema,
|
|
66
69
|
endGasUsed: Gas.schema,
|
|
70
|
+
accumulatedDataArrayLengths: AvmAccumulatedDataArrayLengths.schema,
|
|
67
71
|
accumulatedData: AvmAccumulatedData.schema,
|
|
68
72
|
transactionFee: schemas.Fr,
|
|
69
73
|
reverted: z.boolean(),
|
|
@@ -75,6 +79,7 @@ export class AvmCircuitPublicInputs {
|
|
|
75
79
|
startGasUsed,
|
|
76
80
|
gasSettings,
|
|
77
81
|
feePayer,
|
|
82
|
+
publicCallRequestArrayLengths,
|
|
78
83
|
publicSetupCallRequests,
|
|
79
84
|
publicAppLogicCallRequests,
|
|
80
85
|
publicTeardownCallRequest,
|
|
@@ -84,6 +89,7 @@ export class AvmCircuitPublicInputs {
|
|
|
84
89
|
previousRevertibleAccumulatedData,
|
|
85
90
|
endTreeSnapshots,
|
|
86
91
|
endGasUsed,
|
|
92
|
+
accumulatedDataArrayLengths,
|
|
87
93
|
accumulatedData,
|
|
88
94
|
transactionFee,
|
|
89
95
|
reverted,
|
|
@@ -94,6 +100,7 @@ export class AvmCircuitPublicInputs {
|
|
|
94
100
|
startGasUsed,
|
|
95
101
|
gasSettings,
|
|
96
102
|
feePayer,
|
|
103
|
+
publicCallRequestArrayLengths,
|
|
97
104
|
assertLength(publicSetupCallRequests, MAX_ENQUEUED_CALLS_PER_TX),
|
|
98
105
|
assertLength(publicAppLogicCallRequests, MAX_ENQUEUED_CALLS_PER_TX),
|
|
99
106
|
publicTeardownCallRequest,
|
|
@@ -103,6 +110,7 @@ export class AvmCircuitPublicInputs {
|
|
|
103
110
|
previousRevertibleAccumulatedData,
|
|
104
111
|
endTreeSnapshots,
|
|
105
112
|
endGasUsed,
|
|
113
|
+
accumulatedDataArrayLengths,
|
|
106
114
|
accumulatedData,
|
|
107
115
|
transactionFee,
|
|
108
116
|
reverted,
|
|
@@ -118,6 +126,7 @@ export class AvmCircuitPublicInputs {
|
|
|
118
126
|
reader.readObject(Gas),
|
|
119
127
|
reader.readObject(GasSettings),
|
|
120
128
|
reader.readObject(AztecAddress),
|
|
129
|
+
reader.readObject(PublicCallRequestArrayLengths),
|
|
121
130
|
reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
|
|
122
131
|
reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
|
|
123
132
|
reader.readObject(PublicCallRequest),
|
|
@@ -127,6 +136,7 @@ export class AvmCircuitPublicInputs {
|
|
|
127
136
|
reader.readObject(PrivateToAvmAccumulatedData),
|
|
128
137
|
reader.readObject(TreeSnapshots),
|
|
129
138
|
reader.readObject(Gas),
|
|
139
|
+
reader.readObject(AvmAccumulatedDataArrayLengths),
|
|
130
140
|
reader.readObject(AvmAccumulatedData),
|
|
131
141
|
reader.readObject(Fr),
|
|
132
142
|
reader.readBoolean(),
|
|
@@ -140,6 +150,7 @@ export class AvmCircuitPublicInputs {
|
|
|
140
150
|
this.startGasUsed,
|
|
141
151
|
this.gasSettings,
|
|
142
152
|
this.feePayer,
|
|
153
|
+
this.publicCallRequestArrayLengths,
|
|
143
154
|
this.publicSetupCallRequests,
|
|
144
155
|
this.publicAppLogicCallRequests,
|
|
145
156
|
this.publicTeardownCallRequest,
|
|
@@ -149,6 +160,7 @@ export class AvmCircuitPublicInputs {
|
|
|
149
160
|
this.previousRevertibleAccumulatedData,
|
|
150
161
|
this.endTreeSnapshots,
|
|
151
162
|
this.endGasUsed,
|
|
163
|
+
this.accumulatedDataArrayLengths,
|
|
152
164
|
this.accumulatedData,
|
|
153
165
|
this.transactionFee,
|
|
154
166
|
this.reverted,
|
|
@@ -171,6 +183,7 @@ export class AvmCircuitPublicInputs {
|
|
|
171
183
|
Gas.fromFields(reader),
|
|
172
184
|
GasSettings.fromFields(reader),
|
|
173
185
|
AztecAddress.fromFields(reader),
|
|
186
|
+
PublicCallRequestArrayLengths.fromFields(reader),
|
|
174
187
|
reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
|
|
175
188
|
reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
|
|
176
189
|
PublicCallRequest.fromFields(reader),
|
|
@@ -180,6 +193,7 @@ export class AvmCircuitPublicInputs {
|
|
|
180
193
|
PrivateToAvmAccumulatedData.fromFields(reader),
|
|
181
194
|
TreeSnapshots.fromFields(reader),
|
|
182
195
|
Gas.fromFields(reader),
|
|
196
|
+
AvmAccumulatedDataArrayLengths.fromFields(reader),
|
|
183
197
|
AvmAccumulatedData.fromFields(reader),
|
|
184
198
|
reader.readField(),
|
|
185
199
|
reader.readBoolean(),
|
|
@@ -193,6 +207,7 @@ export class AvmCircuitPublicInputs {
|
|
|
193
207
|
...this.startGasUsed.toFields(),
|
|
194
208
|
...this.gasSettings.toFields(),
|
|
195
209
|
this.feePayer,
|
|
210
|
+
...this.publicCallRequestArrayLengths.toFields(),
|
|
196
211
|
...this.publicSetupCallRequests.map(request => request.toFields()),
|
|
197
212
|
...this.publicAppLogicCallRequests.map(request => request.toFields()),
|
|
198
213
|
...this.publicTeardownCallRequest.toFields(),
|
|
@@ -202,6 +217,7 @@ export class AvmCircuitPublicInputs {
|
|
|
202
217
|
...this.previousRevertibleAccumulatedData.toFields(),
|
|
203
218
|
...this.endTreeSnapshots.toFields(),
|
|
204
219
|
...this.endGasUsed.toFields(),
|
|
220
|
+
...this.accumulatedDataArrayLengths.toFields(),
|
|
205
221
|
...this.accumulatedData.toFields(),
|
|
206
222
|
this.transactionFee,
|
|
207
223
|
this.reverted,
|
|
@@ -215,6 +231,7 @@ export class AvmCircuitPublicInputs {
|
|
|
215
231
|
Gas.empty(),
|
|
216
232
|
GasSettings.empty(),
|
|
217
233
|
AztecAddress.zero(),
|
|
234
|
+
PublicCallRequestArrayLengths.empty(),
|
|
218
235
|
makeTuple(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest.empty),
|
|
219
236
|
makeTuple(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest.empty),
|
|
220
237
|
PublicCallRequest.empty(),
|
|
@@ -224,6 +241,7 @@ export class AvmCircuitPublicInputs {
|
|
|
224
241
|
PrivateToAvmAccumulatedData.empty(),
|
|
225
242
|
TreeSnapshots.empty(),
|
|
226
243
|
Gas.empty(),
|
|
244
|
+
AvmAccumulatedDataArrayLengths.empty(),
|
|
227
245
|
AvmAccumulatedData.empty(),
|
|
228
246
|
Fr.zero(),
|
|
229
247
|
false,
|
|
@@ -241,6 +259,7 @@ export class AvmCircuitPublicInputs {
|
|
|
241
259
|
startGasUsed: ${inspect(this.startGasUsed)},
|
|
242
260
|
gasSettings: ${inspect(this.gasSettings)},
|
|
243
261
|
feePayer: ${inspect(this.feePayer)},
|
|
262
|
+
publicCallRequestArrayLengths: ${inspect(this.publicCallRequestArrayLengths)},
|
|
244
263
|
publicSetupCallRequests: [${this.publicSetupCallRequests
|
|
245
264
|
.filter(x => !x.isEmpty())
|
|
246
265
|
.map(h => inspect(h))
|
|
@@ -258,6 +277,7 @@ export class AvmCircuitPublicInputs {
|
|
|
258
277
|
previousRevertibleAccumulatedData: ${inspect(this.previousRevertibleAccumulatedData)},
|
|
259
278
|
endTreeSnapshots: ${inspect(this.endTreeSnapshots)},
|
|
260
279
|
endGasUsed: ${inspect(this.endGasUsed)},
|
|
280
|
+
accumulatedDataArrayLengths: ${inspect(this.accumulatedDataArrayLengths)},
|
|
261
281
|
accumulatedData: ${inspect(this.accumulatedData)},
|
|
262
282
|
transactionFee: ${inspect(this.transactionFee)},
|
|
263
283
|
reverted: ${this.reverted},
|
package/src/block/body.ts
CHANGED
|
@@ -87,9 +87,14 @@ export class Body {
|
|
|
87
87
|
}`;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
static async random(
|
|
90
|
+
static async random(
|
|
91
|
+
txsPerBlock = 4,
|
|
92
|
+
numPublicCallsPerTx = 3,
|
|
93
|
+
numPublicLogsPerCall = 1,
|
|
94
|
+
maxEffects: number | undefined = undefined,
|
|
95
|
+
) {
|
|
91
96
|
const txEffects = await timesParallel(txsPerBlock, () =>
|
|
92
|
-
TxEffect.random(numPublicCallsPerTx, numPublicLogsPerCall),
|
|
97
|
+
TxEffect.random(numPublicCallsPerTx, numPublicLogsPerCall, maxEffects),
|
|
93
98
|
);
|
|
94
99
|
|
|
95
100
|
return new Body(txEffects);
|
package/src/block/l2_block.ts
CHANGED
|
@@ -86,8 +86,9 @@ export class L2Block {
|
|
|
86
86
|
numPublicLogsPerCall = 1,
|
|
87
87
|
inHash: Buffer | undefined = undefined,
|
|
88
88
|
slotNumber: number | undefined = undefined,
|
|
89
|
+
maxEffects: number | undefined = undefined,
|
|
89
90
|
): Promise<L2Block> {
|
|
90
|
-
const body = await Body.random(txsPerBlock, numPublicCallsPerTx, numPublicLogsPerCall);
|
|
91
|
+
const body = await Body.random(txsPerBlock, numPublicCallsPerTx, numPublicLogsPerCall, maxEffects);
|
|
91
92
|
|
|
92
93
|
return new L2Block(
|
|
93
94
|
makeAppendOnlyTreeSnapshot(l2BlockNum + 1),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import type { TypedEventEmitter } from '@aztec/foundation/types';
|
|
2
3
|
|
|
3
|
-
import type { EventEmitter } from 'events';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
6
|
import type { L1RollupConstants } from '../epoch-helpers/index.js';
|
|
@@ -127,7 +127,12 @@ export interface L2BlockSource {
|
|
|
127
127
|
* L2BlockSource that emits events upon pending / proven chain changes.
|
|
128
128
|
* see L2BlockSourceEvents for the events emitted.
|
|
129
129
|
*/
|
|
130
|
-
|
|
130
|
+
|
|
131
|
+
export type ArchiverEmitter = TypedEventEmitter<{
|
|
132
|
+
[L2BlockSourceEvents.L2PruneDetected]: (args: L2BlockSourceEvent) => void;
|
|
133
|
+
[L2BlockSourceEvents.L2BlockProven]: (args: L2BlockSourceEvent) => void;
|
|
134
|
+
}>;
|
|
135
|
+
export interface L2BlockSourceEventEmitter extends L2BlockSource, ArchiverEmitter {}
|
|
131
136
|
|
|
132
137
|
/**
|
|
133
138
|
* Identifier for L2 block tags.
|
|
@@ -171,10 +176,11 @@ export const L2TipsSchema = z.object({
|
|
|
171
176
|
|
|
172
177
|
export enum L2BlockSourceEvents {
|
|
173
178
|
L2PruneDetected = 'l2PruneDetected',
|
|
179
|
+
L2BlockProven = 'l2BlockProven',
|
|
174
180
|
}
|
|
175
181
|
|
|
176
182
|
export type L2BlockSourceEvent = {
|
|
177
|
-
type: 'l2PruneDetected';
|
|
183
|
+
type: 'l2PruneDetected' | 'l2BlockProven';
|
|
178
184
|
blockNumber: bigint;
|
|
179
185
|
slotNumber: bigint;
|
|
180
186
|
epochNumber: bigint;
|
|
@@ -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
|
+
}
|