@aztec/pxe 0.80.0 → 0.82.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.
Files changed (86) hide show
  1. package/dest/config/package_info.js +1 -1
  2. package/dest/entrypoints/server/utils.d.ts +15 -7
  3. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  4. package/dest/entrypoints/server/utils.js +17 -9
  5. package/dest/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.d.ts +2 -2
  6. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
  7. package/dest/private_kernel/hints/index.d.ts.map +1 -0
  8. package/dest/private_kernel/index.d.ts +3 -0
  9. package/dest/private_kernel/index.d.ts.map +1 -0
  10. package/dest/private_kernel/index.js +2 -0
  11. package/dest/{kernel_prover/kernel_prover.d.ts → private_kernel/private_kernel_execution_prover.d.ts} +13 -14
  12. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
  13. package/dest/{kernel_prover/kernel_prover.js → private_kernel/private_kernel_execution_prover.js} +64 -64
  14. package/dest/{kernel_prover/proving_data_oracle.d.ts → private_kernel/private_kernel_oracle.d.ts} +17 -28
  15. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
  16. package/dest/private_kernel/private_kernel_oracle.js +4 -0
  17. package/dest/{kernel_oracle/index.d.ts → private_kernel/private_kernel_oracle_impl.d.ts} +5 -5
  18. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -0
  19. package/dest/{kernel_oracle/index.js → private_kernel/private_kernel_oracle_impl.js} +2 -2
  20. package/dest/pxe_oracle_interface/pxe_oracle_interface.d.ts +14 -22
  21. package/dest/pxe_oracle_interface/pxe_oracle_interface.d.ts.map +1 -1
  22. package/dest/pxe_oracle_interface/pxe_oracle_interface.js +51 -107
  23. package/dest/pxe_service/pxe_service.d.ts +13 -27
  24. package/dest/pxe_service/pxe_service.d.ts.map +1 -1
  25. package/dest/pxe_service/pxe_service.js +213 -241
  26. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +2 -2
  27. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
  28. package/dest/storage/contract_data_provider/contract_data_provider.js +6 -1
  29. package/dest/storage/contract_data_provider/private_functions_tree.d.ts +2 -2
  30. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
  31. package/dest/storage/index.d.ts +1 -2
  32. package/dest/storage/index.d.ts.map +1 -1
  33. package/dest/storage/index.js +1 -2
  34. package/dest/storage/metadata.d.ts +2 -0
  35. package/dest/storage/metadata.d.ts.map +1 -0
  36. package/dest/storage/metadata.js +1 -0
  37. package/dest/storage/note_data_provider/note_dao.d.ts +9 -13
  38. package/dest/storage/note_data_provider/note_dao.d.ts.map +1 -1
  39. package/dest/storage/note_data_provider/note_dao.js +11 -15
  40. package/dest/storage/note_data_provider/note_data_provider.d.ts +2 -2
  41. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
  42. package/dest/storage/note_data_provider/note_data_provider.js +18 -19
  43. package/dest/synchronizer/synchronizer.js +1 -1
  44. package/package.json +15 -15
  45. package/src/config/package_info.ts +1 -1
  46. package/src/entrypoints/server/utils.ts +25 -11
  47. package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts +4 -4
  48. package/src/private_kernel/index.ts +2 -0
  49. package/src/{kernel_prover/kernel_prover.ts → private_kernel/private_kernel_execution_prover.ts} +76 -71
  50. package/src/{kernel_prover/proving_data_oracle.ts → private_kernel/private_kernel_oracle.ts} +17 -29
  51. package/src/{kernel_oracle/index.ts → private_kernel/private_kernel_oracle_impl.ts} +6 -5
  52. package/src/pxe_oracle_interface/pxe_oracle_interface.ts +77 -153
  53. package/src/pxe_service/pxe_service.ts +289 -310
  54. package/src/storage/contract_data_provider/contract_data_provider.ts +11 -2
  55. package/src/storage/contract_data_provider/private_functions_tree.ts +2 -2
  56. package/src/storage/index.ts +1 -3
  57. package/src/storage/metadata.ts +1 -0
  58. package/src/storage/note_data_provider/note_dao.ts +9 -18
  59. package/src/storage/note_data_provider/note_data_provider.ts +22 -28
  60. package/src/synchronizer/synchronizer.ts +1 -1
  61. package/dest/kernel_oracle/index.d.ts.map +0 -1
  62. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  63. package/dest/kernel_prover/hints/index.d.ts.map +0 -1
  64. package/dest/kernel_prover/index.d.ts +0 -3
  65. package/dest/kernel_prover/index.d.ts.map +0 -1
  66. package/dest/kernel_prover/index.js +0 -2
  67. package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
  68. package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
  69. package/dest/kernel_prover/proving_data_oracle.js +0 -4
  70. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
  71. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
  72. package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
  73. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
  74. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
  75. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
  76. package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
  77. package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
  78. package/dest/storage/auth_witness_data_provider/index.js +0 -1
  79. package/src/kernel_prover/index.ts +0 -2
  80. package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
  81. package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
  82. package/src/storage/auth_witness_data_provider/index.ts +0 -1
  83. /package/dest/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.js +0 -0
  84. /package/dest/{kernel_prover → private_kernel}/hints/index.d.ts +0 -0
  85. /package/dest/{kernel_prover → private_kernel}/hints/index.js +0 -0
  86. /package/src/{kernel_prover → private_kernel}/hints/index.ts +0 -0
@@ -6,7 +6,6 @@ import { assertLength } from '@aztec/foundation/serialize';
6
6
  import { pushTestData } from '@aztec/foundation/testing';
7
7
  import { Timer } from '@aztec/foundation/timer';
8
8
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
9
- import type { WitnessMap } from '@aztec/noir-types';
10
9
  import { getProtocolContractLeafAndMembershipWitness, protocolContractTreeRoot } from '@aztec/protocol-contracts';
11
10
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
12
11
  import { computeContractAddressFromInstance } from '@aztec/stdlib/contract';
@@ -14,8 +13,10 @@ import { hashVK } from '@aztec/stdlib/hash';
14
13
  import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
15
14
  import {
16
15
  PrivateCallData,
16
+ type PrivateExecutionStep,
17
17
  PrivateKernelCircuitPublicInputs,
18
18
  PrivateKernelData,
19
+ type PrivateKernelExecutionProofOutput,
19
20
  PrivateKernelInitCircuitPrivateInputs,
20
21
  PrivateKernelInnerCircuitPrivateInputs,
21
22
  type PrivateKernelSimulateOutput,
@@ -37,32 +38,32 @@ import {
37
38
  import { VerificationKeyAsFields } from '@aztec/stdlib/vks';
38
39
 
39
40
  import { PrivateKernelResetPrivateInputsBuilder } from './hints/build_private_kernel_reset_private_inputs.js';
40
- import type { ProvingDataOracle } from './proving_data_oracle.js';
41
+ import type { PrivateKernelOracle } from './private_kernel_oracle.js';
41
42
 
42
- const NULL_PROVE_OUTPUT: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs> = {
43
+ const NULL_SIMULATE_OUTPUT: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs> = {
43
44
  publicInputs: PrivateKernelCircuitPublicInputs.empty(),
44
45
  verificationKey: VerificationKeyAsFields.makeEmpty(CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS),
45
46
  outputWitness: new Map(),
46
47
  bytecode: Buffer.from([]),
47
48
  };
48
49
 
49
- export type ProvingConfig = {
50
+ export interface PrivateKernelExecutionProverConfig {
50
51
  simulate: boolean;
51
52
  skipFeeEnforcement: boolean;
52
- profile: boolean;
53
- };
53
+ profileMode: 'gates' | 'execution-steps' | 'full' | 'none';
54
+ }
54
55
 
55
56
  /**
56
- * The KernelProver class is responsible for generating kernel proofs.
57
- * It takes a transaction request, its signature, and the simulation result as inputs, and outputs a proof
58
- * along with output notes. The class interacts with a ProvingDataOracle to fetch membership witnesses and
59
- * constructs private call data based on the execution results.
57
+ * The PrivateKernelSequencer class is responsible for taking a transaction request and sequencing the
58
+ * the execution of the private functions within, sequenced with private kernel "glue" to check protocol rules.
59
+ * The result can be a client IVC proof of the private transaction portion, or just a simulation that can e.g.
60
+ * inform state tree updates.
60
61
  */
61
- export class KernelProver {
62
- private log = createLogger('pxe:kernel-prover');
62
+ export class PrivateKernelExecutionProver {
63
+ private log = createLogger('pxe:private-kernel-execution-prover');
63
64
 
64
65
  constructor(
65
- private oracle: ProvingDataOracle,
66
+ private oracle: PrivateKernelOracle,
66
67
  private proofCreator: PrivateKernelProver,
67
68
  private fakeProofs = false,
68
69
  ) {}
@@ -77,19 +78,18 @@ export class KernelProver {
77
78
  * @param executionResult - The execution result object containing nested executions and preimages.
78
79
  * @param profile - Set true to profile the gate count for each circuit
79
80
  * @returns A Promise that resolves to a KernelProverOutput object containing proof, public inputs, and output notes.
80
- * TODO(#7368) this should be refactored to not recreate the ACIR bytecode now that it operates on a program stack
81
81
  */
82
- async prove(
82
+ async proveWithKernels(
83
83
  txRequest: TxRequest,
84
84
  executionResult: PrivateExecutionResult,
85
- { simulate, skipFeeEnforcement, profile }: ProvingConfig = {
85
+ { simulate, skipFeeEnforcement, profileMode }: PrivateKernelExecutionProverConfig = {
86
86
  simulate: false,
87
87
  skipFeeEnforcement: false,
88
- profile: false,
88
+ profileMode: 'none',
89
89
  },
90
- ): Promise<PrivateKernelSimulateOutput<PrivateKernelTailCircuitPublicInputs>> {
90
+ ): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>> {
91
91
  const skipProofGeneration = this.fakeProofs || simulate;
92
- const generateWitnesses = !skipProofGeneration || profile;
92
+ const generateWitnesses = !skipProofGeneration || profileMode !== 'none';
93
93
 
94
94
  const timer = new Timer();
95
95
 
@@ -98,15 +98,9 @@ export class KernelProver {
98
98
  const executionStack = [executionResult.entrypoint];
99
99
  let firstIteration = true;
100
100
 
101
- let output = NULL_PROVE_OUTPUT;
101
+ let output = NULL_SIMULATE_OUTPUT;
102
102
 
103
- const gateCounts: { circuitName: string; gateCount: number }[] = [];
104
- const addGateCount = async (circuitName: string, bytecode: Buffer) => {
105
- const gateCount = (await this.proofCreator.computeGateCountForCircuit(bytecode, circuitName)) as number;
106
- gateCounts.push({ circuitName, gateCount });
107
-
108
- this.log.debug(`Gate count for ${circuitName} - ${gateCount}`);
109
- };
103
+ const executionSteps: PrivateExecutionStep[] = [];
110
104
 
111
105
  const noteHashLeafIndexMap = collectNoteHashLeafIndexMap(executionResult);
112
106
  const noteHashNullifierCounterMap = collectNoteHashNullifierCounterMap(executionResult);
@@ -114,9 +108,6 @@ export class KernelProver {
114
108
  const hasPublicCalls =
115
109
  enqueuedPublicFunctions.length > 0 || !collectPublicTeardownFunctionCall(executionResult).isEmpty();
116
110
  const validationRequestsSplitCounter = hasPublicCalls ? getFinalMinRevertibleSideEffectCounter(executionResult) : 0;
117
- // vector of gzipped bincode acirs
118
- const acirs: Buffer[] = [];
119
- const witnessStack: WitnessMap[] = [];
120
111
 
121
112
  while (executionStack.length) {
122
113
  if (!firstIteration) {
@@ -128,16 +119,14 @@ export class KernelProver {
128
119
  );
129
120
  while (resetBuilder.needsReset()) {
130
121
  const privateInputs = await resetBuilder.build(this.oracle, noteHashLeafIndexMap);
131
- output = generateWitnesses
132
- ? await this.proofCreator.generateResetOutput(privateInputs)
133
- : await this.proofCreator.simulateReset(privateInputs);
134
- // TODO(#7368) consider refactoring this redundant bytecode pushing
135
- acirs.push(output.bytecode);
136
- witnessStack.push(output.outputWitness);
137
- if (profile) {
138
- await addGateCount('private_kernel_reset', output.bytecode);
139
- }
140
-
122
+ output = simulate
123
+ ? await this.proofCreator.simulateReset(privateInputs)
124
+ : await this.proofCreator.generateResetOutput(privateInputs);
125
+ executionSteps.push({
126
+ functionName: 'private_kernel_reset',
127
+ bytecode: output.bytecode,
128
+ witness: output.outputWitness,
129
+ });
141
130
  resetBuilder = new PrivateKernelResetPrivateInputsBuilder(
142
131
  output,
143
132
  executionStack,
@@ -156,13 +145,11 @@ export class KernelProver {
156
145
  currentExecution.publicInputs.callContext.functionSelector,
157
146
  );
158
147
 
159
- // TODO(#7368): This used to be associated with getDebugFunctionName
160
- // TODO(#7368): Is there any way to use this with client IVC proving?
161
- acirs.push(currentExecution.acir);
162
- witnessStack.push(currentExecution.partialWitness);
163
- if (profile) {
164
- await addGateCount(functionName as string, currentExecution.acir);
165
- }
148
+ executionSteps.push({
149
+ functionName: functionName!,
150
+ bytecode: currentExecution.acir,
151
+ witness: currentExecution.partialWitness,
152
+ });
166
153
 
167
154
  const privateCallData = await this.createPrivateCallData(currentExecution);
168
155
 
@@ -185,11 +172,11 @@ export class KernelProver {
185
172
  ? await this.proofCreator.generateInitOutput(proofInput)
186
173
  : await this.proofCreator.simulateInit(proofInput);
187
174
 
188
- acirs.push(output.bytecode);
189
- witnessStack.push(output.outputWitness);
190
- if (profile) {
191
- await addGateCount('private_kernel_init', output.bytecode);
192
- }
175
+ executionSteps.push({
176
+ functionName: 'private_kernel_init',
177
+ bytecode: output.bytecode,
178
+ witness: output.outputWitness,
179
+ });
193
180
  } else {
194
181
  const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(output.verificationKey);
195
182
  const previousKernelData = new PrivateKernelData(
@@ -206,11 +193,11 @@ export class KernelProver {
206
193
  ? await this.proofCreator.generateInnerOutput(proofInput)
207
194
  : await this.proofCreator.simulateInner(proofInput);
208
195
 
209
- acirs.push(output.bytecode);
210
- witnessStack.push(output.outputWitness);
211
- if (profile) {
212
- await addGateCount('private_kernel_inner', output.bytecode);
213
- }
196
+ executionSteps.push({
197
+ functionName: 'private_kernel_inner',
198
+ bytecode: output.bytecode,
199
+ witness: output.outputWitness,
200
+ });
214
201
  }
215
202
  firstIteration = false;
216
203
  }
@@ -228,11 +215,11 @@ export class KernelProver {
228
215
  ? await this.proofCreator.generateResetOutput(privateInputs)
229
216
  : await this.proofCreator.simulateReset(privateInputs);
230
217
 
231
- acirs.push(output.bytecode);
232
- witnessStack.push(output.outputWitness);
233
- if (profile) {
234
- await addGateCount('private_kernel_reset', output.bytecode);
235
- }
218
+ executionSteps.push({
219
+ functionName: 'private_kernel_reset',
220
+ bytecode: output.bytecode,
221
+ witness: output.outputWitness,
222
+ });
236
223
 
237
224
  resetBuilder = new PrivateKernelResetPrivateInputsBuilder(
238
225
  output,
@@ -269,26 +256,44 @@ export class KernelProver {
269
256
  ? await this.proofCreator.generateTailOutput(privateInputs)
270
257
  : await this.proofCreator.simulateTail(privateInputs);
271
258
 
272
- acirs.push(tailOutput.bytecode);
273
- witnessStack.push(tailOutput.outputWitness);
274
- if (profile) {
275
- await addGateCount('private_kernel_tail', tailOutput.bytecode);
276
- tailOutput.profileResult = { gateCounts };
259
+ executionSteps.push({
260
+ functionName: 'private_kernel_tail',
261
+ bytecode: tailOutput.bytecode,
262
+ witness: tailOutput.outputWitness,
263
+ });
264
+
265
+ if (profileMode == 'gates' || profileMode == 'full') {
266
+ for (const entry of executionSteps) {
267
+ const gateCount = await this.proofCreator.computeGateCountForCircuit(entry.bytecode, entry.functionName);
268
+ entry.gateCount = gateCount;
269
+ }
270
+ }
271
+ if (profileMode === 'gates') {
272
+ for (const entry of executionSteps) {
273
+ // These buffers are often a few megabytes in size - prevent accidentally serializing them if not requested.
274
+ entry.bytecode = Buffer.from([]);
275
+ entry.witness = new Map();
276
+ }
277
277
  }
278
278
 
279
279
  if (generateWitnesses) {
280
280
  this.log.info(`Private kernel witness generation took ${timer.ms()}ms`);
281
281
  }
282
282
 
283
+ let clientIvcProof: ClientIvcProof;
283
284
  // TODO(#7368) how do we 'bincode' encode these inputs?
284
285
  if (!skipProofGeneration) {
285
- const ivcProof = await this.proofCreator.createClientIvcProof(acirs, witnessStack);
286
- tailOutput.clientIvcProof = ivcProof;
286
+ clientIvcProof = await this.proofCreator.createClientIvcProof(executionSteps);
287
287
  } else {
288
- tailOutput.clientIvcProof = ClientIvcProof.random();
288
+ clientIvcProof = ClientIvcProof.random();
289
289
  }
290
290
 
291
- return tailOutput;
291
+ return {
292
+ publicInputs: tailOutput.publicInputs,
293
+ executionSteps,
294
+ clientIvcProof,
295
+ verificationKey: tailOutput.verificationKey,
296
+ };
292
297
  }
293
298
 
294
299
  private async createPrivateCallData({ publicInputs, vk: vkAsBuffer }: PrivateCallExecutionResult) {
@@ -1,6 +1,6 @@
1
- import type { FUNCTION_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
1
+ import { FUNCTION_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
2
2
  import type { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
3
- import type { MembershipWitness } from '@aztec/foundation/trees';
3
+ import { MembershipWitness } from '@aztec/foundation/trees';
4
4
  import type { FunctionSelector } from '@aztec/stdlib/abi';
5
5
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
6
6
  import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
@@ -9,10 +9,10 @@ import type { NullifierMembershipWitness } from '@aztec/stdlib/trees';
9
9
  import type { VerificationKeyAsFields } from '@aztec/stdlib/vks';
10
10
 
11
11
  /**
12
- * Provides functionality to fetch membership witnesses for verification keys,
13
- * contract addresses, and function selectors in their respective merkle trees.
12
+ * Provides functionality needed by the private kernel for interacting with our state trees.
13
+ * This is either PrivateKernelOracleImpl, or a mocked test implementation.
14
14
  */
15
- export interface ProvingDataOracle {
15
+ export interface PrivateKernelOracle {
16
16
  /** Retrieves the preimage of a contract address from the registered contract instances db. */
17
17
  getContractAddressPreimage(address: AztecAddress): Promise<{
18
18
  saltedInitializationHash: Fr;
@@ -27,13 +27,7 @@ export interface ProvingDataOracle {
27
27
  ): Promise<{ artifactHash: Fr; publicBytecodeCommitment: Fr; privateFunctionsRoot: Fr }>;
28
28
 
29
29
  /**
30
- * Retrieve the function membership witness for the given contract class and function selector.
31
- * The function membership witness represents a proof that the function belongs to the specified contract.
32
- * Throws an error if the contract address or function selector is unknown.
33
- *
34
- * @param contractClassId - The id of the class.
35
- * @param selector - The function selector.
36
- * @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
30
+ * Returns a membership witness with the sibling path and leaf index in our private functions tree.
37
31
  */
38
32
  getFunctionMembershipWitness(
39
33
  contractClassId: Fr,
@@ -41,30 +35,21 @@ export interface ProvingDataOracle {
41
35
  ): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT>>;
42
36
 
43
37
  /**
44
- * Retrieve the membership witness corresponding to a verification key.
45
- * This function currently returns a random membership witness of the specified height,
46
- * which is a placeholder implementation until a concrete membership witness calculation
47
- * is implemented.
48
- *
49
- * @param vk - The VerificationKey for which the membership witness is needed.
50
- * @returns A Promise that resolves to the MembershipWitness instance.
38
+ * Returns a membership witness with the sibling path and leaf index in our protocol VK indexed merkle tree.
39
+ * Used to validate the previous kernel's verification key.
51
40
  */
52
41
  getVkMembershipWitness(vk: VerificationKeyAsFields): Promise<MembershipWitness<typeof VK_TREE_HEIGHT>>;
53
42
 
54
43
  /**
55
- * Get the note membership witness for a note in the note hash tree at the given leaf index.
56
- *
57
- * @param leafIndex - The leaf index of the note in the note hash tree.
58
- * @returns the MembershipWitness for the note.
59
- */
60
- getNoteHashMembershipWitness(leafIndex: bigint): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>>;
44
+ * Returns a membership witness with the sibling path and leaf index in our private function indexed merkle tree.
45
+ */ getNoteHashMembershipWitness(leafIndex: bigint): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>>;
61
46
 
47
+ /**
48
+ * Returns a membership witness with the sibling path and leaf index in our nullifier indexed merkle tree.
49
+ */
62
50
  getNullifierMembershipWitness(nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
63
-
64
51
  /**
65
- * Get the root of the note hash tree.
66
- *
67
- * @returns the root of the note hash tree.
52
+ * Returns the root of our note hash merkle tree.
68
53
  */
69
54
  getNoteHashTreeRoot(): Promise<Fr>;
70
55
 
@@ -77,7 +62,10 @@ export interface ProvingDataOracle {
77
62
  */
78
63
  getMasterSecretKey(masterPublicKey: Point): Promise<GrumpkinScalar>;
79
64
 
65
+ /** Use debug data to get the function name corresponding to a selector. */
80
66
  getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
81
67
 
68
+ /** Returns a membership witness and leaf index to our public data indexed merkle tree,
69
+ * along with an associated SharedMutable containing the class ID to update. */
82
70
  getUpdatedClassIdHints(contractAddress: AztecAddress): Promise<UpdatedClassIdHints>;
83
71
  }
@@ -1,4 +1,4 @@
1
- import { type NOTE_HASH_TREE_HEIGHT, PUBLIC_DATA_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
1
+ import { NOTE_HASH_TREE_HEIGHT, PUBLIC_DATA_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
2
2
  import type { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import type { Tuple } from '@aztec/foundation/serialize';
@@ -17,15 +17,16 @@ import { SharedMutableValues, SharedMutableValuesWithHash } from '@aztec/stdlib/
17
17
  import type { NullifierMembershipWitness } from '@aztec/stdlib/trees';
18
18
  import type { VerificationKeyAsFields } from '@aztec/stdlib/vks';
19
19
 
20
- import type { ContractDataProvider } from '../storage/contract_data_provider/contract_data_provider.js';
21
- import type { ProvingDataOracle } from './../kernel_prover/proving_data_oracle.js';
20
+ import type { ContractDataProvider } from '../storage/index.js';
21
+ import type { PrivateKernelOracle } from './private_kernel_oracle.js';
22
22
 
23
23
  // TODO: Block number should not be "latest".
24
24
  // It should be fixed at the time the proof is being simulated. I.e., it should be the same as the value defined in the constant data.
25
25
  /**
26
26
  * A data oracle that provides information needed for simulating a transaction.
27
27
  */
28
- export class KernelOracle implements ProvingDataOracle {
28
+
29
+ export class PrivateKernelOracleImpl implements PrivateKernelOracle {
29
30
  constructor(
30
31
  private contractDataProvider: ContractDataProvider,
31
32
  private keyStore: KeyStore,
@@ -94,7 +95,7 @@ export class KernelOracle implements ProvingDataOracle {
94
95
  ProtocolContractAddress.ContractInstanceDeployer,
95
96
  sharedMutableHashSlot,
96
97
  );
97
- const updatedClassIdWitness = await this.node.getPublicDataTreeWitness(this.blockNumber, hashLeafSlot);
98
+ const updatedClassIdWitness = await this.node.getPublicDataWitness(this.blockNumber, hashLeafSlot);
98
99
 
99
100
  if (!updatedClassIdWitness) {
100
101
  throw new Error(`No public data tree witness found for ${hashLeafSlot}`);