@aztec/prover-client 0.60.0 → 0.62.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/orchestrator/block-building-helpers.d.ts +2 -3
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +5 -12
- package/dest/orchestrator/orchestrator.d.ts +2 -12
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +83 -168
- package/dest/orchestrator/tx-proving-state.d.ts +17 -27
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.js +74 -112
- package/dest/prover-agent/memory-proving-queue.d.ts +4 -22
- package/dest/prover-agent/memory-proving-queue.d.ts.map +1 -1
- package/dest/prover-agent/memory-proving-queue.js +6 -28
- package/dest/prover-agent/prover-agent.d.ts.map +1 -1
- package/dest/prover-agent/prover-agent.js +5 -11
- package/dest/prover-agent/rpc.d.ts.map +1 -1
- package/dest/prover-agent/rpc.js +6 -10
- package/dest/test/mock_prover.d.ts +4 -6
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/dest/test/mock_prover.js +8 -14
- package/package.json +11 -11
- package/src/orchestrator/block-building-helpers.ts +4 -29
- package/src/orchestrator/orchestrator.ts +99 -277
- package/src/orchestrator/tx-proving-state.ts +113 -153
- package/src/prover-agent/memory-proving-queue.ts +15 -51
- package/src/prover-agent/prover-agent.ts +4 -12
- package/src/prover-agent/rpc.ts +6 -12
- package/src/test/mock_prover.ts +13 -36
|
@@ -1,43 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
EncryptedNoteTxL2Logs,
|
|
3
|
+
EncryptedTxL2Logs,
|
|
4
4
|
type MerkleTreeId,
|
|
5
5
|
type ProcessedTx,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type ProofAndVerificationKey,
|
|
7
|
+
UnencryptedTxL2Logs,
|
|
8
8
|
} from '@aztec/circuit-types';
|
|
9
9
|
import {
|
|
10
|
+
type AVM_PROOF_LENGTH_IN_FIELDS,
|
|
11
|
+
AVM_VK_INDEX,
|
|
10
12
|
type AppendOnlyTreeSnapshot,
|
|
11
|
-
|
|
12
|
-
type
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
AvmProofData,
|
|
14
|
+
type BaseRollupHints,
|
|
15
|
+
Fr,
|
|
16
|
+
PrivateBaseRollupInputs,
|
|
17
|
+
PrivateTubeData,
|
|
18
|
+
PublicBaseRollupInputs,
|
|
15
19
|
type RecursiveProof,
|
|
16
|
-
type
|
|
17
|
-
|
|
20
|
+
type TUBE_PROOF_LENGTH,
|
|
21
|
+
TUBE_VK_INDEX,
|
|
22
|
+
TubeInputs,
|
|
23
|
+
VMCircuitPublicInputs,
|
|
24
|
+
VkWitnessData,
|
|
18
25
|
} from '@aztec/circuits.js';
|
|
19
|
-
|
|
20
|
-
export enum TX_PROVING_CODE {
|
|
21
|
-
NOT_READY,
|
|
22
|
-
READY,
|
|
23
|
-
COMPLETED,
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type PublicFunction = {
|
|
27
|
-
vmRequest: AvmProvingRequest | undefined;
|
|
28
|
-
vmProof: Proof | undefined;
|
|
29
|
-
previousProofType: ProvingRequestType;
|
|
30
|
-
previousKernelProven: boolean;
|
|
31
|
-
publicKernelRequest: PublicKernelRequest;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
// Type encapsulating the instruction to the orchestrator as to what
|
|
35
|
-
// needs to be proven next
|
|
36
|
-
export type TxProvingInstruction = {
|
|
37
|
-
code: TX_PROVING_CODE;
|
|
38
|
-
function: PublicFunction | undefined;
|
|
39
|
-
functionIndex?: number;
|
|
40
|
-
};
|
|
26
|
+
import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types';
|
|
41
27
|
|
|
42
28
|
/**
|
|
43
29
|
* Helper class to manage the proving cycle of a transaction
|
|
@@ -45,153 +31,127 @@ export type TxProvingInstruction = {
|
|
|
45
31
|
* Also stores the inputs to the base rollup for this transaction and the tree snapshots
|
|
46
32
|
*/
|
|
47
33
|
export class TxProvingState {
|
|
48
|
-
private
|
|
34
|
+
private tube?: ProofAndVerificationKey<RecursiveProof<typeof TUBE_PROOF_LENGTH>>;
|
|
35
|
+
private avm?: ProofAndVerificationKey<RecursiveProof<typeof AVM_PROOF_LENGTH_IN_FIELDS>>;
|
|
49
36
|
|
|
50
37
|
constructor(
|
|
51
38
|
public readonly processedTx: ProcessedTx,
|
|
52
|
-
|
|
39
|
+
private readonly baseRollupHints: BaseRollupHints,
|
|
53
40
|
public readonly treeSnapshots: Map<MerkleTreeId, AppendOnlyTreeSnapshot>,
|
|
54
|
-
) {
|
|
55
|
-
let previousProofType = ProvingRequestType.TUBE_PROOF;
|
|
56
|
-
for (let i = 0; i < processedTx.publicProvingRequests.length; i++) {
|
|
57
|
-
const provingRequest = processedTx.publicProvingRequests[i];
|
|
58
|
-
const publicKernelRequest = provingRequest.type === AVM_REQUEST ? provingRequest.kernelRequest : provingRequest;
|
|
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;
|
|
65
|
-
const publicFunction: PublicFunction = {
|
|
66
|
-
vmRequest,
|
|
67
|
-
vmProof,
|
|
68
|
-
previousProofType,
|
|
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,
|
|
76
|
-
};
|
|
77
|
-
this.publicFunctions.push(publicFunction);
|
|
78
|
-
previousProofType = publicKernelRequest.type;
|
|
79
|
-
}
|
|
41
|
+
) {}
|
|
80
42
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const firstKernelIndex = this.publicFunctions.findIndex(
|
|
84
|
-
fn => fn.publicKernelRequest.type === ProvingRequestType.PUBLIC_KERNEL_MERGE,
|
|
85
|
-
);
|
|
86
|
-
this.publicFunctions[firstKernelIndex].previousProofType = ProvingRequestType.TUBE_PROOF;
|
|
87
|
-
}
|
|
43
|
+
get requireAvmProof() {
|
|
44
|
+
return !!this.processedTx.avmProvingRequest;
|
|
88
45
|
}
|
|
89
46
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
provenIndex: number,
|
|
94
|
-
proof: RecursiveProof<typeof NESTED_RECURSIVE_PROOF_LENGTH>,
|
|
95
|
-
verificationKey: VerificationKeyData,
|
|
96
|
-
): TxProvingInstruction {
|
|
97
|
-
const kernelRequest = this.getPublicFunctionState(provenIndex).publicKernelRequest;
|
|
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) {
|
|
106
|
-
// The next kernel index is greater than our set of functions, we are done!
|
|
107
|
-
return { code: TX_PROVING_CODE.COMPLETED, function: undefined };
|
|
108
|
-
}
|
|
47
|
+
public ready() {
|
|
48
|
+
return !!this.tube && (!this.requireAvmProof || !!this.avm);
|
|
49
|
+
}
|
|
109
50
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
}
|
|
51
|
+
public getTubeInputs() {
|
|
52
|
+
return new TubeInputs(this.processedTx.clientIvcProof);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public getAvmInputs() {
|
|
56
|
+
return this.processedTx.avmProvingRequest!.inputs;
|
|
57
|
+
}
|
|
128
58
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
59
|
+
public getPrivateBaseInputs() {
|
|
60
|
+
if (this.requireAvmProof) {
|
|
61
|
+
throw new Error('Should create public base rollup for a tx requiring avm proof.');
|
|
132
62
|
}
|
|
63
|
+
if (!this.tube) {
|
|
64
|
+
throw new Error('Tx not ready for proving base rollup.');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const vkData = this.getTubeVkData();
|
|
68
|
+
const tubeData = new PrivateTubeData(this.processedTx.data, this.tube.proof, vkData);
|
|
133
69
|
|
|
134
|
-
|
|
135
|
-
return { code: TX_PROVING_CODE.READY, function: nextFunction, functionIndex: nextFunctionIndex };
|
|
70
|
+
return new PrivateBaseRollupInputs(tubeData, this.baseRollupHints);
|
|
136
71
|
}
|
|
137
72
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (nextFunctionIndex === -1) {
|
|
148
|
-
// There are no public functions to be processed, we are done!
|
|
149
|
-
return { code: TX_PROVING_CODE.COMPLETED, function: undefined };
|
|
73
|
+
public getPublicBaseInputs() {
|
|
74
|
+
if (!this.requireAvmProof) {
|
|
75
|
+
throw new Error('Should create private base rollup for a tx not requiring avm proof.');
|
|
76
|
+
}
|
|
77
|
+
if (!this.tube) {
|
|
78
|
+
throw new Error('Tx not ready for proving base rollup: tube proof undefined');
|
|
79
|
+
}
|
|
80
|
+
if (!this.avm) {
|
|
81
|
+
throw new Error('Tx not ready for proving base rollup: avm proof undefined');
|
|
150
82
|
}
|
|
151
83
|
|
|
152
|
-
//
|
|
153
|
-
|
|
84
|
+
// Temporary hack.
|
|
85
|
+
// Passing this.processedTx.data to the tube, which is the output of the simulated public_kernel_tail,
|
|
86
|
+
// so that the output of the public base will contain all the side effects.
|
|
87
|
+
// This should be the output of the private_kernel_tail_to_public when the output of the avm proof is the result of
|
|
88
|
+
// simulating the entire public call stack.
|
|
89
|
+
const tubeData = new PrivateTubeData(this.processedTx.data, this.tube.proof, this.getTubeVkData());
|
|
90
|
+
|
|
91
|
+
const avmProofData = new AvmProofData(
|
|
92
|
+
VMCircuitPublicInputs.empty(), // TODO
|
|
93
|
+
this.avm.proof,
|
|
94
|
+
this.getAvmVkData(),
|
|
95
|
+
);
|
|
154
96
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
nextFunction.publicKernelRequest.inputs.previousKernel.vk = verificationKey;
|
|
97
|
+
return new PublicBaseRollupInputs(tubeData, avmProofData, this.baseRollupHints);
|
|
98
|
+
}
|
|
158
99
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
// The VM proof for the next function is not ready
|
|
163
|
-
return { code: TX_PROVING_CODE.NOT_READY, function: undefined };
|
|
164
|
-
}
|
|
100
|
+
public assignTubeProof(tubeProofAndVk: ProofAndVerificationKey<RecursiveProof<typeof TUBE_PROOF_LENGTH>>) {
|
|
101
|
+
this.tube = tubeProofAndVk;
|
|
102
|
+
}
|
|
165
103
|
|
|
166
|
-
|
|
167
|
-
|
|
104
|
+
public assignAvmProof(avmProofAndVk: ProofAndVerificationKey<RecursiveProof<typeof AVM_PROOF_LENGTH_IN_FIELDS>>) {
|
|
105
|
+
this.avm = avmProofAndVk;
|
|
168
106
|
}
|
|
169
107
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
|
|
108
|
+
public verifyStateOrReject(): string | undefined {
|
|
109
|
+
const kernelPublicInputs = this.processedTx.data;
|
|
110
|
+
|
|
111
|
+
const txNoteEncryptedLogs = EncryptedNoteTxL2Logs.hashNoteLogs(
|
|
112
|
+
kernelPublicInputs.end.noteEncryptedLogsHashes.filter(log => !log.isEmpty()).map(log => log.value.toBuffer()),
|
|
113
|
+
);
|
|
114
|
+
if (!txNoteEncryptedLogs.equals(this.processedTx.noteEncryptedLogs.hash())) {
|
|
115
|
+
return `Note encrypted logs hash mismatch: ${Fr.fromBuffer(txNoteEncryptedLogs)} === ${Fr.fromBuffer(
|
|
116
|
+
this.processedTx.noteEncryptedLogs.hash(),
|
|
117
|
+
)}`;
|
|
118
|
+
}
|
|
175
119
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
120
|
+
const txEncryptedLogs = EncryptedTxL2Logs.hashSiloedLogs(
|
|
121
|
+
kernelPublicInputs.end.encryptedLogsHashes.filter(log => !log.isEmpty()).map(log => log.getSiloedHash()),
|
|
122
|
+
);
|
|
123
|
+
if (!txEncryptedLogs.equals(this.processedTx.encryptedLogs.hash())) {
|
|
124
|
+
// @todo This rejection messages is never seen. Never making it out to the logs
|
|
125
|
+
return `Encrypted logs hash mismatch: ${Fr.fromBuffer(txEncryptedLogs)} === ${Fr.fromBuffer(
|
|
126
|
+
this.processedTx.encryptedLogs.hash(),
|
|
127
|
+
)}`;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const txUnencryptedLogs = UnencryptedTxL2Logs.hashSiloedLogs(
|
|
131
|
+
kernelPublicInputs.end.unencryptedLogsHashes.filter(log => !log.isEmpty()).map(log => log.getSiloedHash()),
|
|
132
|
+
);
|
|
133
|
+
if (!txUnencryptedLogs.equals(this.processedTx.unencryptedLogs.hash())) {
|
|
134
|
+
return `Unencrypted logs hash mismatch: ${Fr.fromBuffer(txUnencryptedLogs)} === ${Fr.fromBuffer(
|
|
135
|
+
this.processedTx.unencryptedLogs.hash(),
|
|
136
|
+
)}`;
|
|
179
137
|
}
|
|
180
|
-
// The previous kernel is ready so we can prove this kernel
|
|
181
|
-
return { code: TX_PROVING_CODE.READY, function: provenFunction, functionIndex: provenIndex };
|
|
182
138
|
}
|
|
183
139
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
140
|
+
private getTubeVkData() {
|
|
141
|
+
let vkIndex = TUBE_VK_INDEX;
|
|
142
|
+
try {
|
|
143
|
+
vkIndex = getVKIndex(this.tube!.verificationKey);
|
|
144
|
+
} catch (_ignored) {
|
|
145
|
+
// TODO(#7410) The VK for the tube won't be in the tree for now, so we manually set it to the tube vk index
|
|
189
146
|
}
|
|
190
|
-
|
|
147
|
+
const vkPath = getVKSiblingPath(vkIndex);
|
|
148
|
+
|
|
149
|
+
return new VkWitnessData(this.tube!.verificationKey, vkIndex, vkPath);
|
|
191
150
|
}
|
|
192
151
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
152
|
+
private getAvmVkData() {
|
|
153
|
+
const vkIndex = AVM_VK_INDEX;
|
|
154
|
+
const vkPath = getVKSiblingPath(vkIndex);
|
|
155
|
+
return new VkWitnessData(this.avm!.verificationKey, AVM_VK_INDEX, vkPath);
|
|
196
156
|
}
|
|
197
157
|
}
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
type ServerCircuitProver,
|
|
10
10
|
} from '@aztec/circuit-types';
|
|
11
11
|
import type {
|
|
12
|
+
AVM_PROOF_LENGTH_IN_FIELDS,
|
|
12
13
|
AvmCircuitInputs,
|
|
13
14
|
BaseOrMergeRollupPublicInputs,
|
|
14
15
|
BaseParityInputs,
|
|
15
|
-
BaseRollupInputs,
|
|
16
16
|
BlockMergeRollupInputs,
|
|
17
17
|
BlockRootOrBlockMergePublicInputs,
|
|
18
18
|
BlockRootRollupInputs,
|
|
@@ -20,12 +20,9 @@ import type {
|
|
|
20
20
|
KernelCircuitPublicInputs,
|
|
21
21
|
MergeRollupInputs,
|
|
22
22
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
23
|
+
PrivateBaseRollupInputs,
|
|
23
24
|
PrivateKernelEmptyInputData,
|
|
24
|
-
|
|
25
|
-
PublicKernelCircuitPrivateInputs,
|
|
26
|
-
PublicKernelCircuitPublicInputs,
|
|
27
|
-
PublicKernelInnerCircuitPrivateInputs,
|
|
28
|
-
PublicKernelTailCircuitPrivateInputs,
|
|
25
|
+
PublicBaseRollupInputs,
|
|
29
26
|
RECURSIVE_PROOF_LENGTH,
|
|
30
27
|
RecursiveProof,
|
|
31
28
|
RootParityInput,
|
|
@@ -33,7 +30,6 @@ import type {
|
|
|
33
30
|
RootRollupInputs,
|
|
34
31
|
RootRollupPublicInputs,
|
|
35
32
|
TubeInputs,
|
|
36
|
-
VMCircuitPublicInputs,
|
|
37
33
|
} from '@aztec/circuits.js';
|
|
38
34
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
39
35
|
import { AbortError, TimeoutError } from '@aztec/foundation/error';
|
|
@@ -316,16 +312,20 @@ export class MemoryProvingQueue implements ServerCircuitProver, ProvingJobSource
|
|
|
316
312
|
return this.enqueue({ type: ProvingRequestType.ROOT_PARITY, inputs }, signal, epochNumber);
|
|
317
313
|
}
|
|
318
314
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
315
|
+
getPrivateBaseRollupProof(
|
|
316
|
+
inputs: PrivateBaseRollupInputs,
|
|
317
|
+
signal?: AbortSignal,
|
|
318
|
+
epochNumber?: number,
|
|
319
|
+
): Promise<PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs>> {
|
|
320
|
+
return this.enqueue({ type: ProvingRequestType.PRIVATE_BASE_ROLLUP, inputs }, signal, epochNumber);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
getPublicBaseRollupProof(
|
|
324
|
+
inputs: PublicBaseRollupInputs,
|
|
325
325
|
signal?: AbortSignal,
|
|
326
326
|
epochNumber?: number,
|
|
327
327
|
): Promise<PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs>> {
|
|
328
|
-
return this.enqueue({ type: ProvingRequestType.
|
|
328
|
+
return this.enqueue({ type: ProvingRequestType.PUBLIC_BASE_ROLLUP, inputs }, signal, epochNumber);
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
/**
|
|
@@ -384,42 +384,6 @@ export class MemoryProvingQueue implements ServerCircuitProver, ProvingJobSource
|
|
|
384
384
|
return this.enqueue({ type: ProvingRequestType.ROOT_ROLLUP, inputs: input }, signal, epochNumber);
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
-
/**
|
|
388
|
-
* Create a public kernel inner proof.
|
|
389
|
-
* @param kernelRequest - Object containing the details of the proof required
|
|
390
|
-
*/
|
|
391
|
-
getPublicKernelInnerProof(
|
|
392
|
-
inputs: PublicKernelInnerCircuitPrivateInputs,
|
|
393
|
-
signal?: AbortSignal,
|
|
394
|
-
epochNumber?: number,
|
|
395
|
-
): Promise<PublicInputsAndRecursiveProof<VMCircuitPublicInputs>> {
|
|
396
|
-
return this.enqueue({ type: ProvingRequestType.PUBLIC_KERNEL_INNER, inputs }, signal, epochNumber);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Create a public kernel merge proof.
|
|
401
|
-
* @param kernelRequest - Object containing the details of the proof required
|
|
402
|
-
*/
|
|
403
|
-
getPublicKernelMergeProof(
|
|
404
|
-
inputs: PublicKernelCircuitPrivateInputs,
|
|
405
|
-
signal?: AbortSignal,
|
|
406
|
-
epochNumber?: number,
|
|
407
|
-
): Promise<PublicInputsAndRecursiveProof<PublicKernelCircuitPublicInputs>> {
|
|
408
|
-
return this.enqueue({ type: ProvingRequestType.PUBLIC_KERNEL_MERGE, inputs }, signal, epochNumber);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* Create a public kernel tail proof.
|
|
413
|
-
* @param kernelRequest - Object containing the details of the proof required
|
|
414
|
-
*/
|
|
415
|
-
getPublicTailProof(
|
|
416
|
-
inputs: PublicKernelTailCircuitPrivateInputs,
|
|
417
|
-
signal?: AbortSignal,
|
|
418
|
-
epochNumber?: number,
|
|
419
|
-
): Promise<PublicInputsAndRecursiveProof<KernelCircuitPublicInputs>> {
|
|
420
|
-
return this.enqueue({ type: ProvingRequestType.PUBLIC_KERNEL_TAIL, inputs }, signal, epochNumber);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
387
|
/**
|
|
424
388
|
* Creates an AVM proof.
|
|
425
389
|
*/
|
|
@@ -427,7 +391,7 @@ export class MemoryProvingQueue implements ServerCircuitProver, ProvingJobSource
|
|
|
427
391
|
inputs: AvmCircuitInputs,
|
|
428
392
|
signal?: AbortSignal,
|
|
429
393
|
epochNumber?: number,
|
|
430
|
-
): Promise<ProofAndVerificationKey<
|
|
394
|
+
): Promise<ProofAndVerificationKey<RecursiveProof<typeof AVM_PROOF_LENGTH_IN_FIELDS>>> {
|
|
431
395
|
return this.enqueue({ type: ProvingRequestType.PUBLIC_VM, inputs }, signal, epochNumber);
|
|
432
396
|
}
|
|
433
397
|
|
|
@@ -161,20 +161,12 @@ export class ProverAgent {
|
|
|
161
161
|
return this.circuitProver.getAvmProof(inputs);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
case ProvingRequestType.
|
|
165
|
-
return this.circuitProver.
|
|
164
|
+
case ProvingRequestType.PRIVATE_BASE_ROLLUP: {
|
|
165
|
+
return this.circuitProver.getPrivateBaseRollupProof(inputs);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
case ProvingRequestType.
|
|
169
|
-
return this.circuitProver.
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
case ProvingRequestType.PUBLIC_KERNEL_TAIL: {
|
|
173
|
-
return this.circuitProver.getPublicTailProof(inputs);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
case ProvingRequestType.BASE_ROLLUP: {
|
|
177
|
-
return this.circuitProver.getBaseRollupProof(inputs);
|
|
168
|
+
case ProvingRequestType.PUBLIC_BASE_ROLLUP: {
|
|
169
|
+
return this.circuitProver.getPublicBaseRollupProof(inputs);
|
|
178
170
|
}
|
|
179
171
|
|
|
180
172
|
case ProvingRequestType.MERGE_ROLLUP: {
|
package/src/prover-agent/rpc.ts
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
AztecAddress,
|
|
5
5
|
BaseOrMergeRollupPublicInputs,
|
|
6
6
|
BaseParityInputs,
|
|
7
|
-
BaseRollupInputs,
|
|
8
7
|
BlockMergeRollupInputs,
|
|
9
8
|
BlockRootOrBlockMergePublicInputs,
|
|
10
9
|
BlockRootRollupInputs,
|
|
@@ -15,12 +14,11 @@ import {
|
|
|
15
14
|
KernelCircuitPublicInputs,
|
|
16
15
|
MergeRollupInputs,
|
|
17
16
|
ParityPublicInputs,
|
|
17
|
+
PrivateBaseRollupInputs,
|
|
18
18
|
PrivateKernelEmptyInputData,
|
|
19
19
|
Proof,
|
|
20
|
-
|
|
20
|
+
PublicBaseRollupInputs,
|
|
21
21
|
PublicKernelCircuitPublicInputs,
|
|
22
|
-
PublicKernelInnerCircuitPrivateInputs,
|
|
23
|
-
PublicKernelTailCircuitPrivateInputs,
|
|
24
22
|
RecursiveProof,
|
|
25
23
|
RootParityInput,
|
|
26
24
|
RootParityInputs,
|
|
@@ -43,7 +41,8 @@ export function createProvingJobSourceServer(queue: ProvingJobSource): JsonRpcSe
|
|
|
43
41
|
AvmCircuitInputs,
|
|
44
42
|
BaseOrMergeRollupPublicInputs,
|
|
45
43
|
BaseParityInputs,
|
|
46
|
-
|
|
44
|
+
PrivateBaseRollupInputs,
|
|
45
|
+
PublicBaseRollupInputs,
|
|
47
46
|
Fr,
|
|
48
47
|
Header,
|
|
49
48
|
KernelCircuitPublicInputs,
|
|
@@ -53,10 +52,7 @@ export function createProvingJobSourceServer(queue: ProvingJobSource): JsonRpcSe
|
|
|
53
52
|
ProvingError,
|
|
54
53
|
PrivateKernelEmptyInputData,
|
|
55
54
|
VMCircuitPublicInputs,
|
|
56
|
-
PublicKernelInnerCircuitPrivateInputs,
|
|
57
|
-
PublicKernelCircuitPrivateInputs,
|
|
58
55
|
PublicKernelCircuitPublicInputs,
|
|
59
|
-
PublicKernelTailCircuitPrivateInputs,
|
|
60
56
|
RecursiveProof,
|
|
61
57
|
RootParityInput,
|
|
62
58
|
RootParityInputs,
|
|
@@ -84,7 +80,8 @@ export function createProvingJobSourceClient(
|
|
|
84
80
|
AvmCircuitInputs,
|
|
85
81
|
BaseOrMergeRollupPublicInputs,
|
|
86
82
|
BaseParityInputs,
|
|
87
|
-
|
|
83
|
+
PrivateBaseRollupInputs,
|
|
84
|
+
PublicBaseRollupInputs,
|
|
88
85
|
Fr,
|
|
89
86
|
Header,
|
|
90
87
|
KernelCircuitPublicInputs,
|
|
@@ -94,10 +91,7 @@ export function createProvingJobSourceClient(
|
|
|
94
91
|
ProvingError,
|
|
95
92
|
PrivateKernelEmptyInputData,
|
|
96
93
|
VMCircuitPublicInputs,
|
|
97
|
-
PublicKernelInnerCircuitPrivateInputs,
|
|
98
|
-
PublicKernelCircuitPrivateInputs,
|
|
99
94
|
PublicKernelCircuitPublicInputs,
|
|
100
|
-
PublicKernelTailCircuitPrivateInputs,
|
|
101
95
|
RecursiveProof,
|
|
102
96
|
RootParityInput,
|
|
103
97
|
RootParityInputs,
|
package/src/test/mock_prover.ts
CHANGED
|
@@ -6,28 +6,25 @@ import {
|
|
|
6
6
|
makePublicInputsAndRecursiveProof,
|
|
7
7
|
} from '@aztec/circuit-types';
|
|
8
8
|
import {
|
|
9
|
+
AVM_PROOF_LENGTH_IN_FIELDS,
|
|
9
10
|
AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS,
|
|
10
11
|
type BaseOrMergeRollupPublicInputs,
|
|
11
12
|
type BlockRootOrBlockMergePublicInputs,
|
|
12
13
|
type KernelCircuitPublicInputs,
|
|
13
|
-
type PublicKernelCircuitPublicInputs,
|
|
14
14
|
RECURSIVE_PROOF_LENGTH,
|
|
15
15
|
type RecursiveProof,
|
|
16
16
|
type RootRollupPublicInputs,
|
|
17
17
|
TUBE_PROOF_LENGTH,
|
|
18
|
-
type VMCircuitPublicInputs,
|
|
19
18
|
VerificationKeyData,
|
|
20
|
-
|
|
19
|
+
makeEmptyRecursiveProof,
|
|
21
20
|
makeRecursiveProof,
|
|
22
21
|
} from '@aztec/circuits.js';
|
|
23
22
|
import {
|
|
24
23
|
makeBaseOrMergeRollupPublicInputs,
|
|
25
24
|
makeBlockRootOrBlockMergeRollupPublicInputs,
|
|
26
25
|
makeKernelCircuitPublicInputs,
|
|
27
|
-
makePublicKernelCircuitPublicInputs,
|
|
28
26
|
makeRootParityInput,
|
|
29
27
|
makeRootRollupPublicInputs,
|
|
30
|
-
makeVMCircuitPublicInputs,
|
|
31
28
|
} from '@aztec/circuits.js/testing';
|
|
32
29
|
|
|
33
30
|
export class MockProver implements ServerCircuitProver {
|
|
@@ -36,7 +33,7 @@ export class MockProver implements ServerCircuitProver {
|
|
|
36
33
|
getAvmProof() {
|
|
37
34
|
return Promise.resolve(
|
|
38
35
|
makeProofAndVerificationKey(
|
|
39
|
-
|
|
36
|
+
makeEmptyRecursiveProof(AVM_PROOF_LENGTH_IN_FIELDS),
|
|
40
37
|
VerificationKeyData.makeFake(AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS),
|
|
41
38
|
),
|
|
42
39
|
);
|
|
@@ -50,7 +47,7 @@ export class MockProver implements ServerCircuitProver {
|
|
|
50
47
|
return Promise.resolve(makeRootParityInput(RECURSIVE_PROOF_LENGTH));
|
|
51
48
|
}
|
|
52
49
|
|
|
53
|
-
|
|
50
|
+
getPrivateBaseRollupProof(): Promise<PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs>> {
|
|
54
51
|
return Promise.resolve(
|
|
55
52
|
makePublicInputsAndRecursiveProof(
|
|
56
53
|
makeBaseOrMergeRollupPublicInputs(),
|
|
@@ -60,7 +57,7 @@ export class MockProver implements ServerCircuitProver {
|
|
|
60
57
|
);
|
|
61
58
|
}
|
|
62
59
|
|
|
63
|
-
|
|
60
|
+
getPublicBaseRollupProof(): Promise<PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs>> {
|
|
64
61
|
return Promise.resolve(
|
|
65
62
|
makePublicInputsAndRecursiveProof(
|
|
66
63
|
makeBaseOrMergeRollupPublicInputs(),
|
|
@@ -70,17 +67,17 @@ export class MockProver implements ServerCircuitProver {
|
|
|
70
67
|
);
|
|
71
68
|
}
|
|
72
69
|
|
|
73
|
-
|
|
70
|
+
getMergeRollupProof(): Promise<PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs>> {
|
|
74
71
|
return Promise.resolve(
|
|
75
72
|
makePublicInputsAndRecursiveProof(
|
|
76
|
-
|
|
73
|
+
makeBaseOrMergeRollupPublicInputs(),
|
|
77
74
|
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
78
75
|
VerificationKeyData.makeFakeHonk(),
|
|
79
76
|
),
|
|
80
77
|
);
|
|
81
78
|
}
|
|
82
79
|
|
|
83
|
-
|
|
80
|
+
getBlockMergeRollupProof() {
|
|
84
81
|
return Promise.resolve(
|
|
85
82
|
makePublicInputsAndRecursiveProof(
|
|
86
83
|
makeBlockRootOrBlockMergeRollupPublicInputs(),
|
|
@@ -90,7 +87,7 @@ export class MockProver implements ServerCircuitProver {
|
|
|
90
87
|
);
|
|
91
88
|
}
|
|
92
89
|
|
|
93
|
-
|
|
90
|
+
getEmptyBlockRootRollupProof(): Promise<PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs>> {
|
|
94
91
|
return Promise.resolve(
|
|
95
92
|
makePublicInputsAndRecursiveProof(
|
|
96
93
|
makeBlockRootOrBlockMergeRollupPublicInputs(),
|
|
@@ -100,17 +97,17 @@ export class MockProver implements ServerCircuitProver {
|
|
|
100
97
|
);
|
|
101
98
|
}
|
|
102
99
|
|
|
103
|
-
|
|
100
|
+
getBlockRootRollupProof(): Promise<PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs>> {
|
|
104
101
|
return Promise.resolve(
|
|
105
102
|
makePublicInputsAndRecursiveProof(
|
|
106
|
-
|
|
103
|
+
makeBlockRootOrBlockMergeRollupPublicInputs(),
|
|
107
104
|
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
108
105
|
VerificationKeyData.makeFakeHonk(),
|
|
109
106
|
),
|
|
110
107
|
);
|
|
111
108
|
}
|
|
112
109
|
|
|
113
|
-
|
|
110
|
+
getEmptyPrivateKernelProof(): Promise<PublicInputsAndRecursiveProof<KernelCircuitPublicInputs>> {
|
|
114
111
|
return Promise.resolve(
|
|
115
112
|
makePublicInputsAndRecursiveProof(
|
|
116
113
|
makeKernelCircuitPublicInputs(),
|
|
@@ -120,27 +117,7 @@ export class MockProver implements ServerCircuitProver {
|
|
|
120
117
|
);
|
|
121
118
|
}
|
|
122
119
|
|
|
123
|
-
|
|
124
|
-
return Promise.resolve(
|
|
125
|
-
makePublicInputsAndRecursiveProof(
|
|
126
|
-
makeVMCircuitPublicInputs(),
|
|
127
|
-
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
128
|
-
VerificationKeyData.makeFakeHonk(),
|
|
129
|
-
),
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
getPublicKernelMergeProof(): Promise<PublicInputsAndRecursiveProof<PublicKernelCircuitPublicInputs>> {
|
|
134
|
-
return Promise.resolve(
|
|
135
|
-
makePublicInputsAndRecursiveProof(
|
|
136
|
-
makePublicKernelCircuitPublicInputs(),
|
|
137
|
-
makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
|
|
138
|
-
VerificationKeyData.makeFakeHonk(),
|
|
139
|
-
),
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
getPublicTailProof(): Promise<PublicInputsAndRecursiveProof<KernelCircuitPublicInputs>> {
|
|
120
|
+
getEmptyTubeProof(): Promise<PublicInputsAndRecursiveProof<KernelCircuitPublicInputs>> {
|
|
144
121
|
return Promise.resolve(
|
|
145
122
|
makePublicInputsAndRecursiveProof(
|
|
146
123
|
makeKernelCircuitPublicInputs(),
|