@aztec/pxe 0.16.3 → 0.16.5

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.
Files changed (35) hide show
  1. package/dest/bin/index.js +0 -0
  2. package/dest/database/memory_db.js +3 -3
  3. package/dest/pxe_http/pxe_http_server.d.ts.map +1 -1
  4. package/dest/pxe_http/pxe_http_server.js +2 -2
  5. package/dest/simulator_oracle/index.js +3 -3
  6. package/dest/synchronizer/synchronizer.js +2 -2
  7. package/package.json +9 -9
  8. package/src/bin/index.ts +0 -39
  9. package/src/config/index.ts +0 -37
  10. package/src/contract_data_oracle/index.ts +0 -163
  11. package/src/contract_database/index.ts +0 -1
  12. package/src/contract_database/memory_contract_database.ts +0 -58
  13. package/src/contract_tree/index.ts +0 -241
  14. package/src/database/database.ts +0 -140
  15. package/src/database/index.ts +0 -2
  16. package/src/database/memory_db.ts +0 -181
  17. package/src/database/note_dao.ts +0 -90
  18. package/src/index.ts +0 -11
  19. package/src/kernel_oracle/index.ts +0 -39
  20. package/src/kernel_prover/index.ts +0 -2
  21. package/src/kernel_prover/kernel_prover.ts +0 -325
  22. package/src/kernel_prover/proof_creator.ts +0 -155
  23. package/src/kernel_prover/proving_data_oracle.ts +0 -69
  24. package/src/note_processor/index.ts +0 -1
  25. package/src/note_processor/note_processor.ts +0 -286
  26. package/src/pxe_http/index.ts +0 -1
  27. package/src/pxe_http/pxe_http_server.ts +0 -78
  28. package/src/pxe_service/create_pxe_service.ts +0 -52
  29. package/src/pxe_service/index.ts +0 -3
  30. package/src/pxe_service/pxe_service.ts +0 -679
  31. package/src/pxe_service/test/pxe_test_suite.ts +0 -132
  32. package/src/simulator/index.ts +0 -24
  33. package/src/simulator_oracle/index.ts +0 -186
  34. package/src/synchronizer/index.ts +0 -1
  35. package/src/synchronizer/synchronizer.ts +0 -296
@@ -1,39 +0,0 @@
1
- import { AztecAddress, Fr, FunctionSelector, MembershipWitness, NOTE_HASH_TREE_HEIGHT } from '@aztec/circuits.js';
2
- import { Tuple } from '@aztec/foundation/serialize';
3
- import { AztecNode, MerkleTreeId } from '@aztec/types';
4
-
5
- import { ContractDataOracle } from '../contract_data_oracle/index.js';
6
- import { ProvingDataOracle } from './../kernel_prover/proving_data_oracle.js';
7
-
8
- /**
9
- * A data oracle that provides information needed for simulating a transaction.
10
- */
11
- export class KernelOracle implements ProvingDataOracle {
12
- constructor(private contractDataOracle: ContractDataOracle, private node: AztecNode) {}
13
-
14
- public async getContractMembershipWitness(contractAddress: AztecAddress) {
15
- return await this.contractDataOracle.getContractMembershipWitness(contractAddress);
16
- }
17
-
18
- public async getFunctionMembershipWitness(contractAddress: AztecAddress, selector: FunctionSelector) {
19
- return await this.contractDataOracle.getFunctionMembershipWitness(contractAddress, selector);
20
- }
21
-
22
- public async getVkMembershipWitness() {
23
- return await this.contractDataOracle.getVkMembershipWitness();
24
- }
25
-
26
- async getNoteMembershipWitness(leafIndex: bigint): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>> {
27
- const path = await this.node.getNoteHashSiblingPath('latest', leafIndex);
28
- return new MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>(
29
- path.pathSize,
30
- leafIndex,
31
- path.toFieldArray() as Tuple<Fr, typeof NOTE_HASH_TREE_HEIGHT>,
32
- );
33
- }
34
-
35
- async getNoteHashTreeRoot(): Promise<Fr> {
36
- const roots = await this.node.getTreeRoots();
37
- return roots[MerkleTreeId.NOTE_HASH_TREE];
38
- }
39
- }
@@ -1,2 +0,0 @@
1
- export * from './kernel_prover.js';
2
- export * from './proving_data_oracle.js';
@@ -1,325 +0,0 @@
1
- import { ExecutionResult, NoteAndSlot } from '@aztec/acir-simulator';
2
- import {
3
- AztecAddress,
4
- CONTRACT_TREE_HEIGHT,
5
- CallRequest,
6
- EMPTY_NULLIFIED_COMMITMENT,
7
- Fr,
8
- MAX_NEW_COMMITMENTS_PER_TX,
9
- MAX_NEW_NULLIFIERS_PER_TX,
10
- MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL,
11
- MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL,
12
- MAX_READ_REQUESTS_PER_CALL,
13
- MAX_READ_REQUESTS_PER_TX,
14
- MembershipWitness,
15
- PreviousKernelData,
16
- PrivateCallData,
17
- PrivateKernelInputsInit,
18
- PrivateKernelInputsInner,
19
- PrivateKernelInputsOrdering,
20
- PrivateKernelPublicInputs,
21
- ReadRequestMembershipWitness,
22
- TxRequest,
23
- VK_TREE_HEIGHT,
24
- VerificationKey,
25
- makeEmptyProof,
26
- makeTuple,
27
- } from '@aztec/circuits.js';
28
- import { padArrayEnd } from '@aztec/foundation/collection';
29
- import { Tuple, assertLength } from '@aztec/foundation/serialize';
30
- import { pushTestData } from '@aztec/foundation/testing';
31
-
32
- import { KernelProofCreator, ProofCreator, ProofOutput, ProofOutputFinal } from './proof_creator.js';
33
- import { ProvingDataOracle } from './proving_data_oracle.js';
34
-
35
- /**
36
- * Represents an output note data object.
37
- * Contains the contract address, new note data and commitment for the note,
38
- * resulting from the execution of a transaction in the Aztec network.
39
- */
40
- export interface OutputNoteData {
41
- /**
42
- * The address of the contract the note was created in.
43
- */
44
- contractAddress: AztecAddress;
45
- /**
46
- * The encrypted note data for an output note.
47
- */
48
- data: NoteAndSlot;
49
- /**
50
- * The unique value representing the note.
51
- */
52
- commitment: Fr;
53
- }
54
-
55
- /**
56
- * Represents the output data of the Kernel Prover.
57
- * Provides information about the newly created notes, along with the public inputs and proof.
58
- */
59
- export interface KernelProverOutput extends ProofOutputFinal {
60
- /**
61
- * An array of output notes containing the contract address, note data, and commitment for each new note.
62
- */
63
- outputNotes: OutputNoteData[];
64
- }
65
-
66
- /**
67
- * The KernelProver class is responsible for generating kernel proofs.
68
- * It takes a transaction request, its signature, and the simulation result as inputs, and outputs a proof
69
- * along with output notes. The class interacts with a ProvingDataOracle to fetch membership witnesses and
70
- * constructs private call data based on the execution results.
71
- */
72
- export class KernelProver {
73
- constructor(private oracle: ProvingDataOracle, private proofCreator: ProofCreator = new KernelProofCreator()) {}
74
-
75
- /**
76
- * Generate a proof for a given transaction request and execution result.
77
- * The function iterates through the nested executions in the execution result, creates private call data,
78
- * and generates a proof using the provided ProofCreator instance. It also maintains an index of new notes
79
- * created during the execution and returns them as a part of the KernelProverOutput.
80
- *
81
- * @param txRequest - The authenticated transaction request object.
82
- * @param executionResult - The execution result object containing nested executions and preimages.
83
- * @returns A Promise that resolves to a KernelProverOutput object containing proof, public inputs, and output notes.
84
- */
85
- async prove(txRequest: TxRequest, executionResult: ExecutionResult): Promise<KernelProverOutput> {
86
- const executionStack = [executionResult];
87
- const newNotes: { [commitmentStr: string]: OutputNoteData } = {};
88
- let firstIteration = true;
89
- let previousVerificationKey = VerificationKey.makeFake();
90
-
91
- let output: ProofOutput = {
92
- publicInputs: PrivateKernelPublicInputs.empty(),
93
- proof: makeEmptyProof(),
94
- };
95
-
96
- while (executionStack.length) {
97
- const currentExecution = executionStack.pop()!;
98
- executionStack.push(...currentExecution.nestedExecutions);
99
-
100
- const privateCallRequests = currentExecution.nestedExecutions.map(result => result.callStackItem.toCallRequest());
101
- const publicCallRequests = currentExecution.enqueuedPublicFunctionCalls.map(result => result.toCallRequest());
102
-
103
- // Start with the partially filled in read request witnesses from the simulator
104
- // and fill the non-transient ones in with sibling paths via oracle.
105
- const readRequestMembershipWitnesses = currentExecution.readRequestPartialWitnesses;
106
- for (let rr = 0; rr < readRequestMembershipWitnesses.length; rr++) {
107
- // Pretty sure this check was forever broken. I made some changes to Fr and this started triggering.
108
- // The conditional makes no sense to me anyway.
109
- // if (currentExecution.callStackItem.publicInputs.readRequests[rr] == Fr.ZERO) {
110
- // throw new Error(
111
- // 'Number of read requests output from Noir circuit does not match number of read request commitment indices output from simulator.',
112
- // );
113
- // }
114
- const rrWitness = readRequestMembershipWitnesses[rr];
115
- if (!rrWitness.isTransient) {
116
- // Non-transient reads must contain full membership witness with sibling path from commitment to root.
117
- // Get regular membership witness to fill in sibling path in the read request witness.
118
- const membershipWitness = await this.oracle.getNoteMembershipWitness(rrWitness.leafIndex.toBigInt());
119
- rrWitness.siblingPath = membershipWitness.siblingPath;
120
- }
121
- }
122
-
123
- // fill in witnesses for remaining/empty read requests
124
- readRequestMembershipWitnesses.push(
125
- ...Array(MAX_READ_REQUESTS_PER_CALL - readRequestMembershipWitnesses.length)
126
- .fill(0)
127
- .map(() => ReadRequestMembershipWitness.empty(BigInt(0))),
128
- );
129
-
130
- const privateCallData = await this.createPrivateCallData(
131
- currentExecution,
132
- privateCallRequests,
133
- publicCallRequests,
134
- readRequestMembershipWitnesses,
135
- );
136
-
137
- if (firstIteration) {
138
- const proofInput = new PrivateKernelInputsInit(txRequest, privateCallData);
139
- output = await this.proofCreator.createProofInit(proofInput);
140
- } else {
141
- const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(previousVerificationKey);
142
- const previousKernelData = new PreviousKernelData(
143
- output.publicInputs,
144
- output.proof,
145
- previousVerificationKey,
146
- Number(previousVkMembershipWitness.leafIndex),
147
- assertLength<Fr, typeof VK_TREE_HEIGHT>(previousVkMembershipWitness.siblingPath, VK_TREE_HEIGHT),
148
- );
149
- const proofInput = new PrivateKernelInputsInner(previousKernelData, privateCallData);
150
- pushTestData('private-kernel-inputs-inner', proofInput);
151
- output = await this.proofCreator.createProofInner(proofInput);
152
- }
153
- (await this.getNewNotes(currentExecution)).forEach(n => {
154
- newNotes[n.commitment.toString()] = n;
155
- });
156
- firstIteration = false;
157
- previousVerificationKey = privateCallData.vk;
158
- }
159
-
160
- const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(previousVerificationKey);
161
- const previousKernelData = new PreviousKernelData(
162
- output.publicInputs,
163
- output.proof,
164
- previousVerificationKey,
165
- Number(previousVkMembershipWitness.leafIndex),
166
- assertLength<Fr, typeof VK_TREE_HEIGHT>(previousVkMembershipWitness.siblingPath, VK_TREE_HEIGHT),
167
- );
168
-
169
- const readCommitmentHints = this.getReadRequestHints(
170
- output.publicInputs.end.readRequests,
171
- output.publicInputs.end.newCommitments,
172
- );
173
-
174
- const nullifierCommitmentHints = this.getNullifierHints(
175
- output.publicInputs.end.nullifiedCommitments,
176
- output.publicInputs.end.newCommitments,
177
- );
178
-
179
- const privateInputs = new PrivateKernelInputsOrdering(
180
- previousKernelData,
181
- readCommitmentHints,
182
- nullifierCommitmentHints,
183
- );
184
- const outputFinal = await this.proofCreator.createProofOrdering(privateInputs);
185
-
186
- // Only return the notes whose commitment is in the commitments of the final proof.
187
- const finalNewCommitments = outputFinal.publicInputs.end.newCommitments;
188
- const outputNotes = finalNewCommitments.map(c => newNotes[c.toString()]).filter(c => !!c);
189
-
190
- return { ...outputFinal, outputNotes };
191
- }
192
-
193
- private async createPrivateCallData(
194
- { callStackItem, vk }: ExecutionResult,
195
- privateCallRequests: CallRequest[],
196
- publicCallRequests: CallRequest[],
197
- readRequestMembershipWitnesses: ReadRequestMembershipWitness[],
198
- ) {
199
- const { contractAddress, functionData, publicInputs } = callStackItem;
200
- const { portalContractAddress } = publicInputs.callContext;
201
-
202
- // Pad with empty items to reach max/const length expected by circuit.
203
- const privateCallStack = padArrayEnd(
204
- privateCallRequests,
205
- CallRequest.empty(),
206
- MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL,
207
- );
208
- const publicCallStack = padArrayEnd(publicCallRequests, CallRequest.empty(), MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL);
209
-
210
- const contractLeafMembershipWitness = functionData.isConstructor
211
- ? MembershipWitness.random(CONTRACT_TREE_HEIGHT)
212
- : await this.oracle.getContractMembershipWitness(contractAddress);
213
-
214
- const functionLeafMembershipWitness = await this.oracle.getFunctionMembershipWitness(
215
- contractAddress,
216
- functionData.selector,
217
- );
218
-
219
- // TODO(#262): Use real acir hash
220
- // const acirHash = keccak(Buffer.from(bytecode, 'hex'));
221
- const acirHash = Fr.fromBuffer(Buffer.alloc(32, 0));
222
-
223
- // TODO
224
- const proof = makeEmptyProof();
225
-
226
- return new PrivateCallData(
227
- callStackItem,
228
- privateCallStack,
229
- publicCallStack,
230
- proof,
231
- VerificationKey.fromBuffer(vk),
232
- functionLeafMembershipWitness,
233
- contractLeafMembershipWitness,
234
- makeTuple(MAX_READ_REQUESTS_PER_CALL, i => readRequestMembershipWitnesses[i], 0),
235
- portalContractAddress.toField(),
236
- acirHash,
237
- );
238
- }
239
-
240
- /**
241
- * Retrieves the new output notes for a given execution result.
242
- * The function maps over the new notes and associates them with their corresponding
243
- * commitments in the public inputs of the execution result. It also includes the contract address
244
- * from the call context of the public inputs.
245
- *
246
- * @param executionResult - The execution result object containing notes and public inputs.
247
- * @returns An array of OutputNoteData objects, each representing an output note with its associated data.
248
- */
249
- private async getNewNotes(executionResult: ExecutionResult): Promise<OutputNoteData[]> {
250
- const {
251
- callStackItem: { publicInputs },
252
- newNotes,
253
- } = executionResult;
254
- const contractAddress = publicInputs.callContext.storageContractAddress;
255
- // Assuming that for each new commitment there's an output note added to the execution result.
256
- const newCommitments = await this.proofCreator.getSiloedCommitments(publicInputs);
257
- return newNotes.map((data, i) => ({
258
- contractAddress,
259
- data,
260
- commitment: newCommitments[i],
261
- }));
262
- }
263
-
264
- /**
265
- * Performs the matching between an array of read request and an array of commitments. This produces
266
- * hints for the private kernel ordering circuit to efficiently match a read request with the corresponding
267
- * commitment.
268
- *
269
- * @param readRequests - The array of read requests.
270
- * @param commitments - The array of commitments.
271
- * @returns An array of hints where each element is the index of the commitment in commitments array
272
- * corresponding to the read request. In other words we have readRequests[i] == commitments[hints[i]].
273
- */
274
- private getReadRequestHints(
275
- readRequests: Tuple<Fr, typeof MAX_READ_REQUESTS_PER_TX>,
276
- commitments: Tuple<Fr, typeof MAX_NEW_COMMITMENTS_PER_TX>,
277
- ): Tuple<Fr, typeof MAX_READ_REQUESTS_PER_TX> {
278
- const hints = makeTuple(MAX_READ_REQUESTS_PER_TX, Fr.zero);
279
- for (let i = 0; i < MAX_READ_REQUESTS_PER_TX && !readRequests[i].isZero(); i++) {
280
- const equalToRR = (cmt: Fr) => cmt.equals(readRequests[i]);
281
- const result = commitments.findIndex(equalToRR);
282
- if (result == -1) {
283
- throw new Error(
284
- `The read request at index ${i} with value ${readRequests[i].toString()} does not match to any commitment.`,
285
- );
286
- } else {
287
- hints[i] = new Fr(result);
288
- }
289
- }
290
- return hints;
291
- }
292
-
293
- /**
294
- * Performs the matching between an array of nullified commitments and an array of commitments. This produces
295
- * hints for the private kernel ordering circuit to efficiently match a nullifier with the corresponding
296
- * commitment.
297
- *
298
- * @param nullifiedCommitments - The array of nullified commitments.
299
- * @param commitments - The array of commitments.
300
- * @returns An array of hints where each element is the index of the commitment in commitments array
301
- * corresponding to the nullified commitments. In other words we have nullifiedCommitments[i] == commitments[hints[i]].
302
- */
303
- private getNullifierHints(
304
- nullifiedCommitments: Tuple<Fr, typeof MAX_NEW_NULLIFIERS_PER_TX>,
305
- commitments: Tuple<Fr, typeof MAX_NEW_COMMITMENTS_PER_TX>,
306
- ): Tuple<Fr, typeof MAX_NEW_NULLIFIERS_PER_TX> {
307
- const hints = makeTuple(MAX_NEW_NULLIFIERS_PER_TX, Fr.zero);
308
- for (let i = 0; i < MAX_NEW_NULLIFIERS_PER_TX; i++) {
309
- if (!nullifiedCommitments[i].isZero() && !nullifiedCommitments[i].equals(new Fr(EMPTY_NULLIFIED_COMMITMENT))) {
310
- const equalToCommitment = (cmt: Fr) => cmt.equals(nullifiedCommitments[i]);
311
- const result = commitments.findIndex(equalToCommitment);
312
- if (result == -1) {
313
- throw new Error(
314
- `The nullified commitment at index ${i} with value ${nullifiedCommitments[
315
- i
316
- ].toString()} does not match to any commitment.`,
317
- );
318
- } else {
319
- hints[i] = new Fr(result);
320
- }
321
- }
322
- }
323
- return hints;
324
- }
325
- }
@@ -1,155 +0,0 @@
1
- import {
2
- KernelCircuitPublicInputs,
3
- KernelCircuitPublicInputsFinal,
4
- PrivateCircuitPublicInputs,
5
- PrivateKernelInputsInit,
6
- PrivateKernelInputsInner,
7
- PrivateKernelInputsOrdering,
8
- Proof,
9
- makeEmptyProof,
10
- } from '@aztec/circuits.js';
11
- import { siloCommitment } from '@aztec/circuits.js/abis';
12
- import { Fr } from '@aztec/foundation/fields';
13
- import { createDebugLogger } from '@aztec/foundation/log';
14
- import { elapsed } from '@aztec/foundation/timer';
15
- import { executeInit, executeInner, executeOrdering } from '@aztec/noir-protocol-circuits';
16
- import { CircuitSimulationStats } from '@aztec/types/stats';
17
-
18
- /**
19
- * Represents the output of the proof creation process for init and inner private kernel circuit.
20
- * Contains the public inputs required for the init and inner private kernel circuit and the generated proof.
21
- */
22
- export interface ProofOutput {
23
- /**
24
- * The public inputs required for the proof generation process.
25
- */
26
- publicInputs: KernelCircuitPublicInputs;
27
- /**
28
- * The zk-SNARK proof for the kernel execution.
29
- */
30
- proof: Proof;
31
- }
32
-
33
- /**
34
- * Represents the output of the proof creation process for final ordering private kernel circuit.
35
- * Contains the public inputs required for the final ordering private kernel circuit and the generated proof.
36
- */
37
- export interface ProofOutputFinal {
38
- /**
39
- * The public inputs required for the proof generation process.
40
- */
41
- publicInputs: KernelCircuitPublicInputsFinal;
42
- /**
43
- * The zk-SNARK proof for the kernel execution.
44
- */
45
- proof: Proof;
46
- }
47
-
48
- /**
49
- * ProofCreator provides functionality to create and validate proofs, and retrieve
50
- * siloed commitments necessary for maintaining transaction privacy and security on the network.
51
- */
52
- export interface ProofCreator {
53
- /**
54
- * Computes the siloed commitments for a given set of public inputs.
55
- *
56
- * @param publicInputs - The public inputs containing the contract address and new commitments to be used in generating siloed commitments.
57
- * @returns An array of Fr (finite field) elements representing the siloed commitments.
58
- */
59
- getSiloedCommitments(publicInputs: PrivateCircuitPublicInputs): Promise<Fr[]>;
60
-
61
- /**
62
- * Creates a proof output for a given signed transaction request and private call data for the first iteration.
63
- *
64
- * @param privateKernelInputsInit - The private data structure for the initial iteration.
65
- * @returns A Promise resolving to a ProofOutput object containing public inputs and the kernel proof.
66
- */
67
- createProofInit(privateKernelInputsInit: PrivateKernelInputsInit): Promise<ProofOutput>;
68
-
69
- /**
70
- * Creates a proof output for a given previous kernel data and private call data for an inner iteration.
71
- *
72
- * @param privateKernelInputsInner - The private input data structure for the inner iteration.
73
- * @returns A Promise resolving to a ProofOutput object containing public inputs and the kernel proof.
74
- */
75
- createProofInner(privateKernelInputsInner: PrivateKernelInputsInner): Promise<ProofOutput>;
76
-
77
- /**
78
- * Creates a proof output based on the last inner kernel iteration kernel data for the final ordering iteration.
79
- *
80
- * @param privateKernelInputsOrdering - The private input data structure for the final ordering iteration.
81
- * @returns A Promise resolving to a ProofOutput object containing public inputs and the kernel proof.
82
- */
83
- createProofOrdering(privateKernelInputsOrdering: PrivateKernelInputsOrdering): Promise<ProofOutputFinal>;
84
- }
85
-
86
- /**
87
- * The KernelProofCreator class is responsible for generating siloed commitments and zero-knowledge proofs
88
- * for private kernel circuit. It leverages Barretenberg to perform cryptographic operations and proof creation.
89
- * The class provides methods to compute commitments based on the given public inputs and to generate proofs based on
90
- * signed transaction requests, previous kernel data, private call data, and a flag indicating whether it's the first
91
- * iteration or not.
92
- */
93
- export class KernelProofCreator implements ProofCreator {
94
- constructor(private log = createDebugLogger('aztec:kernel_proof_creator')) {}
95
-
96
- public getSiloedCommitments(publicInputs: PrivateCircuitPublicInputs) {
97
- const contractAddress = publicInputs.callContext.storageContractAddress;
98
-
99
- return Promise.resolve(publicInputs.newCommitments.map(commitment => siloCommitment(contractAddress, commitment)));
100
- }
101
-
102
- public async createProofInit(privateInputs: PrivateKernelInputsInit): Promise<ProofOutput> {
103
- const [duration, result] = await elapsed(() => executeInit(privateInputs));
104
- this.log(`Simulated private kernel init`, {
105
- eventName: 'circuit-simulation',
106
- circuitName: 'private-kernel-init',
107
- duration,
108
- inputSize: privateInputs.toBuffer().length,
109
- outputSize: result.toBuffer().length,
110
- } satisfies CircuitSimulationStats);
111
- this.log('Skipping private kernel init proving...');
112
- const proof = makeEmptyProof();
113
-
114
- return {
115
- publicInputs: result,
116
- proof: proof,
117
- };
118
- }
119
-
120
- public async createProofInner(privateInputs: PrivateKernelInputsInner): Promise<ProofOutput> {
121
- const [duration, result] = await elapsed(() => executeInner(privateInputs));
122
- this.log(`Simulated private kernel inner`, {
123
- eventName: 'circuit-simulation',
124
- circuitName: 'private-kernel-inner',
125
- duration,
126
- inputSize: privateInputs.toBuffer().length,
127
- outputSize: result.toBuffer().length,
128
- } satisfies CircuitSimulationStats);
129
- this.log('Skipping private kernel inner proving...');
130
- const proof = makeEmptyProof();
131
-
132
- return {
133
- publicInputs: result,
134
- proof: proof,
135
- };
136
- }
137
-
138
- public async createProofOrdering(privateInputs: PrivateKernelInputsOrdering): Promise<ProofOutputFinal> {
139
- const [duration, result] = await elapsed(() => executeOrdering(privateInputs));
140
- this.log(`Simulated private kernel ordering`, {
141
- eventName: 'circuit-simulation',
142
- circuitName: 'private-kernel-ordering',
143
- duration,
144
- inputSize: privateInputs.toBuffer().length,
145
- outputSize: result.toBuffer().length,
146
- } satisfies CircuitSimulationStats);
147
- this.log('Skipping private kernel ordering proving...');
148
- const proof = makeEmptyProof();
149
-
150
- return {
151
- publicInputs: result,
152
- proof: proof,
153
- };
154
- }
155
- }
@@ -1,69 +0,0 @@
1
- import {
2
- CONTRACT_TREE_HEIGHT,
3
- FUNCTION_TREE_HEIGHT,
4
- Fr,
5
- FunctionSelector,
6
- MembershipWitness,
7
- NOTE_HASH_TREE_HEIGHT,
8
- VK_TREE_HEIGHT,
9
- VerificationKey,
10
- } from '@aztec/circuits.js';
11
- import { AztecAddress } from '@aztec/foundation/aztec-address';
12
-
13
- /**
14
- * Provides functionality to fetch membership witnesses for verification keys,
15
- * contract addresses, and function selectors in their respective merkle trees.
16
- */
17
- export interface ProvingDataOracle {
18
- /**
19
- * Retrieves the contract membership witness for a given contract address.
20
- * A contract membership witness is a cryptographic proof that the contract exists in the Aztec network.
21
- * This function will search for an existing contract tree associated with the contract address and obtain its
22
- * membership witness. If no such contract tree exists, it will throw an error.
23
- *
24
- * @param contractAddress - The contract address.
25
- * @returns A promise that resolves to a MembershipWitness instance representing the contract membership witness.
26
- * @throws Error if the contract address is unknown or not found.
27
- */
28
- getContractMembershipWitness(contractAddress: AztecAddress): Promise<MembershipWitness<typeof CONTRACT_TREE_HEIGHT>>;
29
-
30
- /**
31
- * Retrieve the function membership witness for the given contract address and function selector.
32
- * The function membership witness represents a proof that the function belongs to the specified contract.
33
- * Throws an error if the contract address or function selector is unknown.
34
- *
35
- * @param contractAddress - The contract address.
36
- * @param selector - The function selector.
37
- * @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
38
- */
39
- getFunctionMembershipWitness(
40
- contractAddress: AztecAddress,
41
- selector: FunctionSelector,
42
- ): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT>>;
43
-
44
- /**
45
- * Retrieve the membership witness corresponding to a verification key.
46
- * This function currently returns a random membership witness of the specified height,
47
- * which is a placeholder implementation until a concrete membership witness calculation
48
- * is implemented.
49
- *
50
- * @param vk - The VerificationKey for which the membership witness is needed.
51
- * @returns A Promise that resolves to the MembershipWitness instance.
52
- */
53
- getVkMembershipWitness(vk: VerificationKey): Promise<MembershipWitness<typeof VK_TREE_HEIGHT>>;
54
-
55
- /**
56
- * Get the note membership witness for a note in the note hash tree at the given leaf index.
57
- *
58
- * @param leafIndex - The leaf index of the note in the note hash tree.
59
- * @returns the MembershipWitness for the note.
60
- */
61
- getNoteMembershipWitness(leafIndex: bigint): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>>;
62
-
63
- /**
64
- * Get the root of the note hash tree.
65
- *
66
- * @returns the root of the note hash tree.
67
- */
68
- getNoteHashTreeRoot(): Promise<Fr>;
69
- }
@@ -1 +0,0 @@
1
- export * from './note_processor.js';