@aztec/prover-client 0.55.0 → 0.56.0
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/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +6 -27
- package/dest/mocks/test_context.d.ts +4 -5
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +7 -9
- package/dest/orchestrator/block-building-helpers.d.ts +12 -3
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +34 -32
- package/dest/orchestrator/{proving-state.d.ts → block-proving-state.d.ts} +17 -13
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -0
- package/dest/orchestrator/block-proving-state.js +170 -0
- package/dest/orchestrator/epoch-proving-state.d.ts +57 -0
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -0
- package/dest/orchestrator/epoch-proving-state.js +151 -0
- package/dest/orchestrator/orchestrator.d.ts +32 -11
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +246 -139
- package/dest/orchestrator/tx-proving-state.d.ts +3 -2
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.js +54 -26
- package/dest/prover-agent/memory-proving-queue.d.ts +11 -5
- package/dest/prover-agent/memory-proving-queue.d.ts.map +1 -1
- package/dest/prover-agent/memory-proving-queue.js +16 -6
- package/dest/prover-agent/prover-agent.d.ts.map +1 -1
- package/dest/prover-agent/prover-agent.js +10 -10
- package/dest/prover-agent/rpc.d.ts.map +1 -1
- package/dest/prover-agent/rpc.js +8 -2
- package/dest/test/mock_prover.d.ts +27 -0
- package/dest/test/mock_prover.d.ts.map +1 -0
- package/dest/test/mock_prover.js +58 -0
- package/package.json +13 -11
- package/src/mocks/fixtures.ts +5 -49
- package/src/mocks/test_context.ts +7 -12
- package/src/orchestrator/block-building-helpers.ts +90 -57
- package/src/orchestrator/{proving-state.ts → block-proving-state.ts} +42 -40
- package/src/orchestrator/epoch-proving-state.ts +232 -0
- package/src/orchestrator/orchestrator.ts +410 -244
- package/src/orchestrator/tx-proving-state.ts +63 -27
- package/src/prover-agent/memory-proving-queue.ts +30 -16
- package/src/prover-agent/prover-agent.ts +11 -9
- package/src/prover-agent/rpc.ts +9 -0
- package/src/test/mock_prover.ts +170 -0
- package/dest/orchestrator/proving-state.d.ts.map +0 -1
- package/dest/orchestrator/proving-state.js +0 -170
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
type AvmProvingRequest,
|
|
4
4
|
type MerkleTreeId,
|
|
5
5
|
type ProcessedTx,
|
|
6
|
+
ProvingRequestType,
|
|
6
7
|
type PublicKernelRequest,
|
|
7
|
-
PublicKernelType,
|
|
8
8
|
} from '@aztec/circuit-types';
|
|
9
9
|
import {
|
|
10
10
|
type AppendOnlyTreeSnapshot,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
type RECURSIVE_PROOF_LENGTH,
|
|
15
15
|
type RecursiveProof,
|
|
16
16
|
type VerificationKeyData,
|
|
17
|
+
makeEmptyProof,
|
|
17
18
|
} from '@aztec/circuits.js';
|
|
18
19
|
|
|
19
20
|
export enum TX_PROVING_CODE {
|
|
@@ -25,7 +26,7 @@ export enum TX_PROVING_CODE {
|
|
|
25
26
|
export type PublicFunction = {
|
|
26
27
|
vmRequest: AvmProvingRequest | undefined;
|
|
27
28
|
vmProof: Proof | undefined;
|
|
28
|
-
previousProofType:
|
|
29
|
+
previousProofType: ProvingRequestType;
|
|
29
30
|
previousKernelProven: boolean;
|
|
30
31
|
publicKernelRequest: PublicKernelRequest;
|
|
31
32
|
};
|
|
@@ -35,6 +36,7 @@ export type PublicFunction = {
|
|
|
35
36
|
export type TxProvingInstruction = {
|
|
36
37
|
code: TX_PROVING_CODE;
|
|
37
38
|
function: PublicFunction | undefined;
|
|
39
|
+
functionIndex?: number;
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
/**
|
|
@@ -50,20 +52,38 @@ export class TxProvingState {
|
|
|
50
52
|
public readonly baseRollupInputs: BaseRollupInputs,
|
|
51
53
|
public readonly treeSnapshots: Map<MerkleTreeId, AppendOnlyTreeSnapshot>,
|
|
52
54
|
) {
|
|
53
|
-
let previousProofType =
|
|
55
|
+
let previousProofType = ProvingRequestType.TUBE_PROOF;
|
|
54
56
|
for (let i = 0; i < processedTx.publicProvingRequests.length; i++) {
|
|
55
57
|
const provingRequest = processedTx.publicProvingRequests[i];
|
|
56
|
-
const
|
|
58
|
+
const publicKernelRequest = provingRequest.type === AVM_REQUEST ? provingRequest.kernelRequest : provingRequest;
|
|
57
59
|
const vmRequest = provingRequest.type === AVM_REQUEST ? provingRequest : undefined;
|
|
60
|
+
// TODO(#7124): Remove this temporary hack.
|
|
61
|
+
// There's no previous kernel for the first inner kernel in a chain of AvmProvingRequests.
|
|
62
|
+
// Setting its previousKernelProven to be true so that it will be ready once the vm proof is generated.
|
|
63
|
+
const previousKernelProven = !!vmRequest && previousProofType !== ProvingRequestType.PUBLIC_KERNEL_INNER;
|
|
64
|
+
const vmProof = provingRequest.type === ProvingRequestType.PUBLIC_KERNEL_TAIL ? makeEmptyProof() : undefined;
|
|
58
65
|
const publicFunction: PublicFunction = {
|
|
59
66
|
vmRequest,
|
|
60
|
-
vmProof
|
|
67
|
+
vmProof,
|
|
61
68
|
previousProofType,
|
|
62
|
-
previousKernelProven
|
|
63
|
-
publicKernelRequest:
|
|
69
|
+
previousKernelProven,
|
|
70
|
+
publicKernelRequest: {
|
|
71
|
+
type: publicKernelRequest.type,
|
|
72
|
+
// We take a deep copy (clone) of the inputs to be modified here and passed to the prover.
|
|
73
|
+
// bb-prover will also modify the inputs by reference.
|
|
74
|
+
inputs: publicKernelRequest.inputs.clone(),
|
|
75
|
+
} as PublicKernelRequest,
|
|
64
76
|
};
|
|
65
77
|
this.publicFunctions.push(publicFunction);
|
|
66
|
-
previousProofType =
|
|
78
|
+
previousProofType = publicKernelRequest.type;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (this.publicFunctions.length > 0) {
|
|
82
|
+
// The first merge kernel takes the tube proof.
|
|
83
|
+
const firstKernelIndex = this.publicFunctions.findIndex(
|
|
84
|
+
fn => fn.publicKernelRequest.type === ProvingRequestType.PUBLIC_KERNEL_MERGE,
|
|
85
|
+
);
|
|
86
|
+
this.publicFunctions[firstKernelIndex].previousProofType = ProvingRequestType.TUBE_PROOF;
|
|
67
87
|
}
|
|
68
88
|
}
|
|
69
89
|
|
|
@@ -75,29 +95,44 @@ export class TxProvingState {
|
|
|
75
95
|
verificationKey: VerificationKeyData,
|
|
76
96
|
): TxProvingInstruction {
|
|
77
97
|
const kernelRequest = this.getPublicFunctionState(provenIndex).publicKernelRequest;
|
|
78
|
-
const
|
|
79
|
-
|
|
98
|
+
const provenIsInner = kernelRequest.type === ProvingRequestType.PUBLIC_KERNEL_INNER;
|
|
99
|
+
// If the proven request is not an inner kernel, its next kernel should not be an inner kernel either.
|
|
100
|
+
const nextFunctionIndex = provenIsInner
|
|
101
|
+
? provenIndex + 1
|
|
102
|
+
: this.publicFunctions.findIndex(
|
|
103
|
+
(fn, i) => i > provenIndex && fn.publicKernelRequest.type !== ProvingRequestType.PUBLIC_KERNEL_INNER,
|
|
104
|
+
);
|
|
105
|
+
if (nextFunctionIndex >= this.publicFunctions.length || nextFunctionIndex === -1) {
|
|
80
106
|
// The next kernel index is greater than our set of functions, we are done!
|
|
81
107
|
return { code: TX_PROVING_CODE.COMPLETED, function: undefined };
|
|
82
108
|
}
|
|
83
109
|
|
|
84
110
|
// There is more work to do, are we ready?
|
|
85
|
-
const nextFunction = this.publicFunctions[
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
111
|
+
const nextFunction = this.publicFunctions[nextFunctionIndex];
|
|
112
|
+
|
|
113
|
+
if (provenIsInner && nextFunction.publicKernelRequest.type !== ProvingRequestType.PUBLIC_KERNEL_INNER) {
|
|
114
|
+
// TODO(#7124): Remove this temporary hack.
|
|
115
|
+
// If the proven request is inner (with vm proof) and the next one is regular kernel, set the vmProof to be
|
|
116
|
+
// not undefined.
|
|
117
|
+
// This should eventually be a real vm proof of the entire enqueued call.
|
|
118
|
+
nextFunction.vmProof = makeEmptyProof();
|
|
119
|
+
} else {
|
|
120
|
+
// pass both the proof and verification key forward to the next circuit
|
|
121
|
+
nextFunction.publicKernelRequest.inputs.previousKernel.proof = proof;
|
|
122
|
+
nextFunction.publicKernelRequest.inputs.previousKernel.vk = verificationKey;
|
|
123
|
+
|
|
124
|
+
// We need to update this so the state machine knows this proof is ready
|
|
125
|
+
nextFunction.previousKernelProven = true;
|
|
126
|
+
nextFunction.previousProofType = kernelRequest.type;
|
|
127
|
+
}
|
|
90
128
|
|
|
91
|
-
|
|
92
|
-
nextFunction.previousKernelProven = true;
|
|
93
|
-
nextFunction.previousProofType = kernelRequest.type;
|
|
94
|
-
if (nextFunction.vmProof === undefined) {
|
|
129
|
+
if (nextFunction.vmProof === undefined || !nextFunction.previousKernelProven) {
|
|
95
130
|
// The VM proof for the next function is not ready
|
|
96
131
|
return { code: TX_PROVING_CODE.NOT_READY, function: undefined };
|
|
97
132
|
}
|
|
98
133
|
|
|
99
134
|
// The VM proof is ready, we can continue
|
|
100
|
-
return { code: TX_PROVING_CODE.READY, function: nextFunction };
|
|
135
|
+
return { code: TX_PROVING_CODE.READY, function: nextFunction, functionIndex: nextFunctionIndex };
|
|
101
136
|
}
|
|
102
137
|
|
|
103
138
|
// Updates the transaction's proving state after completion of a tube proof
|
|
@@ -106,14 +141,16 @@ export class TxProvingState {
|
|
|
106
141
|
proof: RecursiveProof<typeof RECURSIVE_PROOF_LENGTH>,
|
|
107
142
|
verificationKey: VerificationKeyData,
|
|
108
143
|
): TxProvingInstruction {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
144
|
+
const nextFunctionIndex = this.publicFunctions.findIndex(
|
|
145
|
+
(fn, i) => i > 0 && fn.previousProofType === ProvingRequestType.TUBE_PROOF,
|
|
146
|
+
);
|
|
147
|
+
if (nextFunctionIndex === -1) {
|
|
148
|
+
// There are no public functions to be processed, we are done!
|
|
112
149
|
return { code: TX_PROVING_CODE.COMPLETED, function: undefined };
|
|
113
150
|
}
|
|
114
151
|
|
|
115
152
|
// There is more work to do, are we ready?
|
|
116
|
-
const nextFunction = this.publicFunctions[
|
|
153
|
+
const nextFunction = this.publicFunctions[nextFunctionIndex];
|
|
117
154
|
|
|
118
155
|
// pass both the proof and verification key forward to the next circuit
|
|
119
156
|
nextFunction.publicKernelRequest.inputs.previousKernel.proof = proof;
|
|
@@ -121,14 +158,13 @@ export class TxProvingState {
|
|
|
121
158
|
|
|
122
159
|
// We need to update this so the state machine knows this proof is ready
|
|
123
160
|
nextFunction.previousKernelProven = true;
|
|
124
|
-
nextFunction.previousProofType = PublicKernelType.NON_PUBLIC;
|
|
125
161
|
if (nextFunction.vmProof === undefined) {
|
|
126
162
|
// The VM proof for the next function is not ready
|
|
127
163
|
return { code: TX_PROVING_CODE.NOT_READY, function: undefined };
|
|
128
164
|
}
|
|
129
165
|
|
|
130
166
|
// The VM proof is ready, we can continue
|
|
131
|
-
return { code: TX_PROVING_CODE.READY, function: nextFunction };
|
|
167
|
+
return { code: TX_PROVING_CODE.READY, function: nextFunction, functionIndex: nextFunctionIndex };
|
|
132
168
|
}
|
|
133
169
|
|
|
134
170
|
// Updates the transaction's proving state after completion of a VM proof
|
|
@@ -142,7 +178,7 @@ export class TxProvingState {
|
|
|
142
178
|
return { code: TX_PROVING_CODE.NOT_READY, function: undefined };
|
|
143
179
|
}
|
|
144
180
|
// The previous kernel is ready so we can prove this kernel
|
|
145
|
-
return { code: TX_PROVING_CODE.READY, function: provenFunction };
|
|
181
|
+
return { code: TX_PROVING_CODE.READY, function: provenFunction, functionIndex: provenIndex };
|
|
146
182
|
}
|
|
147
183
|
|
|
148
184
|
// Returns the public function state at the given index
|
|
@@ -6,8 +6,6 @@ import {
|
|
|
6
6
|
type ProvingRequestResult,
|
|
7
7
|
ProvingRequestType,
|
|
8
8
|
type PublicInputsAndRecursiveProof,
|
|
9
|
-
type PublicKernelNonTailRequest,
|
|
10
|
-
type PublicKernelTailRequest,
|
|
11
9
|
type ServerCircuitProver,
|
|
12
10
|
} from '@aztec/circuit-types';
|
|
13
11
|
import type {
|
|
@@ -22,7 +20,10 @@ import type {
|
|
|
22
20
|
MergeRollupInputs,
|
|
23
21
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
24
22
|
PrivateKernelEmptyInputData,
|
|
23
|
+
PublicKernelCircuitPrivateInputs,
|
|
25
24
|
PublicKernelCircuitPublicInputs,
|
|
25
|
+
PublicKernelInnerCircuitPrivateInputs,
|
|
26
|
+
PublicKernelTailCircuitPrivateInputs,
|
|
26
27
|
RECURSIVE_PROOF_LENGTH,
|
|
27
28
|
RecursiveProof,
|
|
28
29
|
RootParityInput,
|
|
@@ -30,6 +31,7 @@ import type {
|
|
|
30
31
|
RootRollupInputs,
|
|
31
32
|
RootRollupPublicInputs,
|
|
32
33
|
TubeInputs,
|
|
34
|
+
VMCircuitPublicInputs,
|
|
33
35
|
VerificationKeyData,
|
|
34
36
|
} from '@aztec/circuits.js';
|
|
35
37
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
@@ -349,6 +351,14 @@ export class MemoryProvingQueue implements ServerCircuitProver, ProvingJobSource
|
|
|
349
351
|
return this.enqueue({ type: ProvingRequestType.BLOCK_ROOT_ROLLUP, inputs: input }, signal, epochNumber);
|
|
350
352
|
}
|
|
351
353
|
|
|
354
|
+
getBlockRootRollupFinalProof(
|
|
355
|
+
input: BlockRootRollupInputs,
|
|
356
|
+
signal?: AbortSignal,
|
|
357
|
+
epochNumber?: number,
|
|
358
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs>> {
|
|
359
|
+
return this.enqueue({ type: ProvingRequestType.BLOCK_ROOT_ROLLUP_FINAL, inputs: input }, signal, epochNumber);
|
|
360
|
+
}
|
|
361
|
+
|
|
352
362
|
/**
|
|
353
363
|
* Creates a proof for the given input.
|
|
354
364
|
* @param input - Input to the circuit.
|
|
@@ -374,19 +384,27 @@ export class MemoryProvingQueue implements ServerCircuitProver, ProvingJobSource
|
|
|
374
384
|
}
|
|
375
385
|
|
|
376
386
|
/**
|
|
377
|
-
* Create a public kernel proof.
|
|
387
|
+
* Create a public kernel inner proof.
|
|
378
388
|
* @param kernelRequest - Object containing the details of the proof required
|
|
379
389
|
*/
|
|
380
|
-
|
|
381
|
-
|
|
390
|
+
getPublicKernelInnerProof(
|
|
391
|
+
inputs: PublicKernelInnerCircuitPrivateInputs,
|
|
392
|
+
signal?: AbortSignal,
|
|
393
|
+
epochNumber?: number,
|
|
394
|
+
): Promise<PublicInputsAndRecursiveProof<VMCircuitPublicInputs>> {
|
|
395
|
+
return this.enqueue({ type: ProvingRequestType.PUBLIC_KERNEL_INNER, inputs }, signal, epochNumber);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Create a public kernel merge proof.
|
|
400
|
+
* @param kernelRequest - Object containing the details of the proof required
|
|
401
|
+
*/
|
|
402
|
+
getPublicKernelMergeProof(
|
|
403
|
+
inputs: PublicKernelCircuitPrivateInputs,
|
|
382
404
|
signal?: AbortSignal,
|
|
383
405
|
epochNumber?: number,
|
|
384
406
|
): Promise<PublicInputsAndRecursiveProof<PublicKernelCircuitPublicInputs>> {
|
|
385
|
-
return this.enqueue(
|
|
386
|
-
{ type: ProvingRequestType.PUBLIC_KERNEL_NON_TAIL, kernelType: kernelRequest.type, inputs: kernelRequest.inputs },
|
|
387
|
-
signal,
|
|
388
|
-
epochNumber,
|
|
389
|
-
);
|
|
407
|
+
return this.enqueue({ type: ProvingRequestType.PUBLIC_KERNEL_MERGE, inputs }, signal, epochNumber);
|
|
390
408
|
}
|
|
391
409
|
|
|
392
410
|
/**
|
|
@@ -394,15 +412,11 @@ export class MemoryProvingQueue implements ServerCircuitProver, ProvingJobSource
|
|
|
394
412
|
* @param kernelRequest - Object containing the details of the proof required
|
|
395
413
|
*/
|
|
396
414
|
getPublicTailProof(
|
|
397
|
-
|
|
415
|
+
inputs: PublicKernelTailCircuitPrivateInputs,
|
|
398
416
|
signal?: AbortSignal,
|
|
399
417
|
epochNumber?: number,
|
|
400
418
|
): Promise<PublicInputsAndRecursiveProof<KernelCircuitPublicInputs>> {
|
|
401
|
-
return this.enqueue(
|
|
402
|
-
{ type: ProvingRequestType.PUBLIC_KERNEL_TAIL, kernelType: kernelRequest.type, inputs: kernelRequest.inputs },
|
|
403
|
-
signal,
|
|
404
|
-
epochNumber,
|
|
405
|
-
);
|
|
419
|
+
return this.enqueue({ type: ProvingRequestType.PUBLIC_KERNEL_TAIL, inputs }, signal, epochNumber);
|
|
406
420
|
}
|
|
407
421
|
|
|
408
422
|
/**
|
|
@@ -161,18 +161,16 @@ export class ProverAgent {
|
|
|
161
161
|
return this.circuitProver.getAvmProof(inputs);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
case ProvingRequestType.
|
|
165
|
-
return this.circuitProver.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
164
|
+
case ProvingRequestType.PUBLIC_KERNEL_INNER: {
|
|
165
|
+
return this.circuitProver.getPublicKernelInnerProof(inputs);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
case ProvingRequestType.PUBLIC_KERNEL_MERGE: {
|
|
169
|
+
return this.circuitProver.getPublicKernelMergeProof(inputs);
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
case ProvingRequestType.PUBLIC_KERNEL_TAIL: {
|
|
172
|
-
return this.circuitProver.getPublicTailProof(
|
|
173
|
-
type: request.kernelType,
|
|
174
|
-
inputs,
|
|
175
|
-
});
|
|
173
|
+
return this.circuitProver.getPublicTailProof(inputs);
|
|
176
174
|
}
|
|
177
175
|
|
|
178
176
|
case ProvingRequestType.BASE_ROLLUP: {
|
|
@@ -187,6 +185,10 @@ export class ProverAgent {
|
|
|
187
185
|
return this.circuitProver.getBlockRootRollupProof(inputs);
|
|
188
186
|
}
|
|
189
187
|
|
|
188
|
+
case ProvingRequestType.BLOCK_ROOT_ROLLUP_FINAL: {
|
|
189
|
+
return this.circuitProver.getBlockRootRollupFinalProof(inputs);
|
|
190
|
+
}
|
|
191
|
+
|
|
190
192
|
case ProvingRequestType.BLOCK_MERGE_ROLLUP: {
|
|
191
193
|
return this.circuitProver.getBlockMergeRollupProof(inputs);
|
|
192
194
|
}
|
package/src/prover-agent/rpc.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ProvingJobSource } from '@aztec/circuit-types';
|
|
2
2
|
import {
|
|
3
3
|
AvmCircuitInputs,
|
|
4
|
+
AvmVerificationKeyData,
|
|
4
5
|
AztecAddress,
|
|
5
6
|
BaseOrMergeRollupPublicInputs,
|
|
6
7
|
BaseParityInputs,
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
Proof,
|
|
19
20
|
PublicKernelCircuitPrivateInputs,
|
|
20
21
|
PublicKernelCircuitPublicInputs,
|
|
22
|
+
PublicKernelInnerCircuitPrivateInputs,
|
|
21
23
|
PublicKernelTailCircuitPrivateInputs,
|
|
22
24
|
RecursiveProof,
|
|
23
25
|
RootParityInput,
|
|
@@ -25,6 +27,7 @@ import {
|
|
|
25
27
|
RootRollupInputs,
|
|
26
28
|
RootRollupPublicInputs,
|
|
27
29
|
TubeInputs,
|
|
30
|
+
VMCircuitPublicInputs,
|
|
28
31
|
VerificationKeyData,
|
|
29
32
|
} from '@aztec/circuits.js';
|
|
30
33
|
import { createJsonRpcClient, makeFetch } from '@aztec/foundation/json-rpc/client';
|
|
@@ -37,6 +40,7 @@ export function createProvingJobSourceServer(queue: ProvingJobSource): JsonRpcSe
|
|
|
37
40
|
return new JsonRpcServer(
|
|
38
41
|
queue,
|
|
39
42
|
{
|
|
43
|
+
AvmVerificationKeyData,
|
|
40
44
|
AvmCircuitInputs,
|
|
41
45
|
BaseOrMergeRollupPublicInputs,
|
|
42
46
|
BaseParityInputs,
|
|
@@ -49,6 +53,8 @@ export function createProvingJobSourceServer(queue: ProvingJobSource): JsonRpcSe
|
|
|
49
53
|
Proof,
|
|
50
54
|
ProvingError,
|
|
51
55
|
PrivateKernelEmptyInputData,
|
|
56
|
+
VMCircuitPublicInputs,
|
|
57
|
+
PublicKernelInnerCircuitPrivateInputs,
|
|
52
58
|
PublicKernelCircuitPrivateInputs,
|
|
53
59
|
PublicKernelCircuitPublicInputs,
|
|
54
60
|
PublicKernelTailCircuitPrivateInputs,
|
|
@@ -75,6 +81,7 @@ export function createProvingJobSourceClient(
|
|
|
75
81
|
return createJsonRpcClient(
|
|
76
82
|
url,
|
|
77
83
|
{
|
|
84
|
+
AvmVerificationKeyData,
|
|
78
85
|
AvmCircuitInputs,
|
|
79
86
|
BaseOrMergeRollupPublicInputs,
|
|
80
87
|
BaseParityInputs,
|
|
@@ -87,6 +94,8 @@ export function createProvingJobSourceClient(
|
|
|
87
94
|
Proof,
|
|
88
95
|
ProvingError,
|
|
89
96
|
PrivateKernelEmptyInputData,
|
|
97
|
+
VMCircuitPublicInputs,
|
|
98
|
+
PublicKernelInnerCircuitPrivateInputs,
|
|
90
99
|
PublicKernelCircuitPrivateInputs,
|
|
91
100
|
PublicKernelCircuitPublicInputs,
|
|
92
101
|
PublicKernelTailCircuitPrivateInputs,
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type PublicInputsAndRecursiveProof,
|
|
3
|
+
type PublicInputsAndTubeProof,
|
|
4
|
+
type ServerCircuitProver,
|
|
5
|
+
makePublicInputsAndRecursiveProof,
|
|
6
|
+
} from '@aztec/circuit-types';
|
|
7
|
+
import {
|
|
8
|
+
AvmVerificationKeyData,
|
|
9
|
+
type BaseOrMergeRollupPublicInputs,
|
|
10
|
+
type BlockRootOrBlockMergePublicInputs,
|
|
11
|
+
type KernelCircuitPublicInputs,
|
|
12
|
+
type PublicKernelCircuitPublicInputs,
|
|
13
|
+
RECURSIVE_PROOF_LENGTH,
|
|
14
|
+
type RecursiveProof,
|
|
15
|
+
type RootRollupPublicInputs,
|
|
16
|
+
type VMCircuitPublicInputs,
|
|
17
|
+
VerificationKeyData,
|
|
18
|
+
makeEmptyProof,
|
|
19
|
+
makeRecursiveProof,
|
|
20
|
+
} from '@aztec/circuits.js';
|
|
21
|
+
import {
|
|
22
|
+
makeBaseOrMergeRollupPublicInputs,
|
|
23
|
+
makeBlockRootOrBlockMergeRollupPublicInputs,
|
|
24
|
+
makeKernelCircuitPublicInputs,
|
|
25
|
+
makePublicKernelCircuitPublicInputs,
|
|
26
|
+
makeRootParityInput,
|
|
27
|
+
makeRootRollupPublicInputs,
|
|
28
|
+
makeVMCircuitPublicInputs,
|
|
29
|
+
} from '@aztec/circuits.js/testing';
|
|
30
|
+
|
|
31
|
+
export class MockProver implements ServerCircuitProver {
|
|
32
|
+
constructor() {}
|
|
33
|
+
|
|
34
|
+
getAvmProof() {
|
|
35
|
+
return Promise.resolve(
|
|
36
|
+
Promise.resolve({
|
|
37
|
+
proof: makeEmptyProof(),
|
|
38
|
+
verificationKey: AvmVerificationKeyData.makeFake(),
|
|
39
|
+
}),
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
getBaseParityProof() {
|
|
44
|
+
return Promise.resolve(makeRootParityInput(RECURSIVE_PROOF_LENGTH));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
getRootParityProof() {
|
|
48
|
+
return Promise.resolve(makeRootParityInput(RECURSIVE_PROOF_LENGTH));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
getBaseRollupProof() {
|
|
52
|
+
return Promise.resolve(
|
|
53
|
+
makePublicInputsAndRecursiveProof(
|
|
54
|
+
makeBaseOrMergeRollupPublicInputs(),
|
|
55
|
+
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
56
|
+
VerificationKeyData.makeFake(),
|
|
57
|
+
),
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
getMergeRollupProof(): Promise<PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs>> {
|
|
62
|
+
return Promise.resolve(
|
|
63
|
+
makePublicInputsAndRecursiveProof(
|
|
64
|
+
makeBaseOrMergeRollupPublicInputs(),
|
|
65
|
+
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
66
|
+
VerificationKeyData.makeFake(),
|
|
67
|
+
),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
getBlockMergeRollupProof() {
|
|
72
|
+
return Promise.resolve(
|
|
73
|
+
makePublicInputsAndRecursiveProof(
|
|
74
|
+
makeBlockRootOrBlockMergeRollupPublicInputs(),
|
|
75
|
+
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
76
|
+
VerificationKeyData.makeFake(),
|
|
77
|
+
),
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getBlockRootRollupProof(): Promise<PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs>> {
|
|
82
|
+
return Promise.resolve(
|
|
83
|
+
makePublicInputsAndRecursiveProof(
|
|
84
|
+
makeBlockRootOrBlockMergeRollupPublicInputs(),
|
|
85
|
+
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
86
|
+
VerificationKeyData.makeFake(),
|
|
87
|
+
),
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
getBlockRootRollupFinalProof(): Promise<PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs>> {
|
|
92
|
+
return Promise.resolve(
|
|
93
|
+
makePublicInputsAndRecursiveProof(
|
|
94
|
+
makeBlockRootOrBlockMergeRollupPublicInputs(),
|
|
95
|
+
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
96
|
+
VerificationKeyData.makeFake(),
|
|
97
|
+
),
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
getEmptyPrivateKernelProof(): Promise<PublicInputsAndRecursiveProof<KernelCircuitPublicInputs>> {
|
|
102
|
+
return Promise.resolve(
|
|
103
|
+
makePublicInputsAndRecursiveProof(
|
|
104
|
+
makeKernelCircuitPublicInputs(),
|
|
105
|
+
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
106
|
+
VerificationKeyData.makeFake(),
|
|
107
|
+
),
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
getEmptyTubeProof(): Promise<PublicInputsAndTubeProof<KernelCircuitPublicInputs>> {
|
|
112
|
+
return Promise.resolve(
|
|
113
|
+
makePublicInputsAndRecursiveProof(
|
|
114
|
+
makeKernelCircuitPublicInputs(),
|
|
115
|
+
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
116
|
+
VerificationKeyData.makeFake(),
|
|
117
|
+
),
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
getPublicKernelInnerProof(): Promise<PublicInputsAndRecursiveProof<VMCircuitPublicInputs>> {
|
|
122
|
+
return Promise.resolve(
|
|
123
|
+
makePublicInputsAndRecursiveProof(
|
|
124
|
+
makeVMCircuitPublicInputs(),
|
|
125
|
+
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
126
|
+
VerificationKeyData.makeFake(),
|
|
127
|
+
),
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
getPublicKernelMergeProof(): Promise<PublicInputsAndRecursiveProof<PublicKernelCircuitPublicInputs>> {
|
|
132
|
+
return Promise.resolve(
|
|
133
|
+
makePublicInputsAndRecursiveProof(
|
|
134
|
+
makePublicKernelCircuitPublicInputs(),
|
|
135
|
+
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
136
|
+
VerificationKeyData.makeFake(),
|
|
137
|
+
),
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
getPublicTailProof(): Promise<PublicInputsAndRecursiveProof<KernelCircuitPublicInputs>> {
|
|
142
|
+
return Promise.resolve(
|
|
143
|
+
makePublicInputsAndRecursiveProof(
|
|
144
|
+
makeKernelCircuitPublicInputs(),
|
|
145
|
+
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
146
|
+
VerificationKeyData.makeFake(),
|
|
147
|
+
),
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
getRootRollupProof(): Promise<PublicInputsAndRecursiveProof<RootRollupPublicInputs>> {
|
|
152
|
+
return Promise.resolve(
|
|
153
|
+
makePublicInputsAndRecursiveProof(
|
|
154
|
+
makeRootRollupPublicInputs(),
|
|
155
|
+
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
156
|
+
VerificationKeyData.makeFake(),
|
|
157
|
+
),
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
getTubeProof(): Promise<{
|
|
162
|
+
tubeVK: VerificationKeyData;
|
|
163
|
+
tubeProof: RecursiveProof<typeof RECURSIVE_PROOF_LENGTH>;
|
|
164
|
+
}> {
|
|
165
|
+
return Promise.resolve({
|
|
166
|
+
tubeVK: VerificationKeyData.makeFake(),
|
|
167
|
+
tubeProof: makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proving-state.d.ts","sourceRoot":"","sources":["../../src/orchestrator/proving-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,iCAAiC,EACtC,KAAK,EAAE,EACP,KAAK,eAAe,EACpB,KAAK,wCAAwC,EAC7C,KAAK,6BAA6B,EAClC,KAAK,mCA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