@aztec/pxe 0.38.0 → 0.40.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 (56) hide show
  1. package/dest/database/kv_pxe_database.js +2 -2
  2. package/dest/database/pxe_database_test_suite.d.ts.map +1 -1
  3. package/dest/database/pxe_database_test_suite.js +12 -9
  4. package/dest/index.d.ts +0 -1
  5. package/dest/index.d.ts.map +1 -1
  6. package/dest/index.js +1 -3
  7. package/dest/kernel_prover/kernel_prover.d.ts +2 -2
  8. package/dest/kernel_prover/kernel_prover.d.ts.map +1 -1
  9. package/dest/kernel_prover/kernel_prover.js +16 -13
  10. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_tail_hints.d.ts.map +1 -1
  11. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_tail_hints.js +2 -2
  12. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_tail_outputs.d.ts +2 -2
  13. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_tail_outputs.d.ts.map +1 -1
  14. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_tail_outputs.js +4 -4
  15. package/dest/kernel_prover/proving_data_oracle.d.ts +2 -2
  16. package/dest/kernel_prover/proving_data_oracle.d.ts.map +1 -1
  17. package/dest/kernel_prover/test/test_circuit_prover.d.ts +7 -6
  18. package/dest/kernel_prover/test/test_circuit_prover.d.ts.map +1 -1
  19. package/dest/kernel_prover/test/test_circuit_prover.js +18 -18
  20. package/dest/note_processor/produce_note_dao.js +5 -7
  21. package/dest/pxe_service/create_pxe_service.d.ts +1 -2
  22. package/dest/pxe_service/create_pxe_service.d.ts.map +1 -1
  23. package/dest/pxe_service/create_pxe_service.js +2 -2
  24. package/dest/pxe_service/pxe_service.d.ts +4 -6
  25. package/dest/pxe_service/pxe_service.d.ts.map +1 -1
  26. package/dest/pxe_service/pxe_service.js +36 -44
  27. package/dest/pxe_service/test/pxe_test_suite.d.ts.map +1 -1
  28. package/dest/pxe_service/test/pxe_test_suite.js +5 -4
  29. package/dest/simulator_oracle/index.d.ts +1 -2
  30. package/dest/simulator_oracle/index.d.ts.map +1 -1
  31. package/dest/simulator_oracle/index.js +1 -10
  32. package/dest/synchronizer/synchronizer.d.ts.map +1 -1
  33. package/dest/synchronizer/synchronizer.js +2 -2
  34. package/package.json +14 -13
  35. package/src/database/kv_pxe_database.ts +1 -1
  36. package/src/database/pxe_database_test_suite.ts +23 -8
  37. package/src/index.ts +0 -3
  38. package/src/kernel_prover/kernel_prover.ts +27 -18
  39. package/src/kernel_prover/private_inputs_builders/build_private_kernel_tail_hints.ts +7 -7
  40. package/src/kernel_prover/private_inputs_builders/build_private_kernel_tail_outputs.ts +7 -7
  41. package/src/kernel_prover/proving_data_oracle.ts +2 -2
  42. package/src/kernel_prover/test/test_circuit_prover.ts +24 -25
  43. package/src/note_processor/produce_note_dao.ts +11 -6
  44. package/src/pxe_service/create_pxe_service.ts +2 -3
  45. package/src/pxe_service/pxe_service.ts +58 -64
  46. package/src/pxe_service/test/pxe_test_suite.ts +8 -2
  47. package/src/simulator_oracle/index.ts +0 -12
  48. package/src/synchronizer/synchronizer.ts +2 -1
  49. package/dest/kernel_prover/bb_prover/bb_native_proof_creator.d.ts +0 -95
  50. package/dest/kernel_prover/bb_prover/bb_native_proof_creator.d.ts.map +0 -1
  51. package/dest/kernel_prover/bb_prover/bb_native_proof_creator.js +0 -437
  52. package/dest/kernel_prover/interface/proof_creator.d.ts +0 -61
  53. package/dest/kernel_prover/interface/proof_creator.d.ts.map +0 -1
  54. package/dest/kernel_prover/interface/proof_creator.js +0 -2
  55. package/src/kernel_prover/bb_prover/bb_native_proof_creator.ts +0 -713
  56. package/src/kernel_prover/interface/proof_creator.ts +0 -79
@@ -1,21 +1,22 @@
1
+ import { type AppCircuitProofOutput, type KernelProofOutput, type ProofCreator } from '@aztec/circuit-types';
1
2
  import { type CircuitSimulationStats } from '@aztec/circuit-types/stats';
2
3
  import {
4
+ NESTED_RECURSIVE_PROOF_LENGTH,
3
5
  type PrivateCircuitPublicInputs,
4
6
  type PrivateKernelCircuitPublicInputs,
5
7
  type PrivateKernelInitCircuitPrivateInputs,
6
8
  type PrivateKernelInnerCircuitPrivateInputs,
7
9
  type PrivateKernelTailCircuitPrivateInputs,
8
10
  type PrivateKernelTailCircuitPublicInputs,
9
- Proof,
10
- makeEmptyProof,
11
+ RECURSIVE_PROOF_LENGTH,
12
+ VerificationKeyAsFields,
13
+ makeRecursiveProof,
11
14
  } from '@aztec/circuits.js';
12
15
  import { siloNoteHash } from '@aztec/circuits.js/hash';
13
16
  import { createDebugLogger } from '@aztec/foundation/log';
14
17
  import { elapsed } from '@aztec/foundation/timer';
15
18
  import { executeInit, executeInner, executeTail, executeTailForPublic } from '@aztec/noir-protocol-circuits-types';
16
19
 
17
- import { type ProofCreator, type ProofOutput } from '../interface/proof_creator.js';
18
-
19
20
  /**
20
21
  * Test Proof Creator executes circuit simulations and provides fake proofs.
21
22
  */
@@ -32,7 +33,7 @@ export class TestProofCreator implements ProofCreator {
32
33
 
33
34
  public async createProofInit(
34
35
  privateInputs: PrivateKernelInitCircuitPrivateInputs,
35
- ): Promise<ProofOutput<PrivateKernelCircuitPublicInputs>> {
36
+ ): Promise<KernelProofOutput<PrivateKernelCircuitPublicInputs>> {
36
37
  const [duration, result] = await elapsed(() => executeInit(privateInputs));
37
38
  this.log.debug(`Simulated private kernel init`, {
38
39
  eventName: 'circuit-simulation',
@@ -41,17 +42,12 @@ export class TestProofCreator implements ProofCreator {
41
42
  inputSize: privateInputs.toBuffer().length,
42
43
  outputSize: result.toBuffer().length,
43
44
  } satisfies CircuitSimulationStats);
44
- const proof = makeEmptyProof();
45
-
46
- return {
47
- publicInputs: result,
48
- proof: proof,
49
- };
45
+ return this.makeEmptyKernelProofOutput<PrivateKernelCircuitPublicInputs>(result);
50
46
  }
51
47
 
52
48
  public async createProofInner(
53
49
  privateInputs: PrivateKernelInnerCircuitPrivateInputs,
54
- ): Promise<ProofOutput<PrivateKernelCircuitPublicInputs>> {
50
+ ): Promise<KernelProofOutput<PrivateKernelCircuitPublicInputs>> {
55
51
  const [duration, result] = await elapsed(() => executeInner(privateInputs));
56
52
  this.log.debug(`Simulated private kernel inner`, {
57
53
  eventName: 'circuit-simulation',
@@ -60,17 +56,12 @@ export class TestProofCreator implements ProofCreator {
60
56
  inputSize: privateInputs.toBuffer().length,
61
57
  outputSize: result.toBuffer().length,
62
58
  } satisfies CircuitSimulationStats);
63
- const proof = makeEmptyProof();
64
-
65
- return {
66
- publicInputs: result,
67
- proof: proof,
68
- };
59
+ return this.makeEmptyKernelProofOutput<PrivateKernelCircuitPublicInputs>(result);
69
60
  }
70
61
 
71
62
  public async createProofTail(
72
63
  privateInputs: PrivateKernelTailCircuitPrivateInputs,
73
- ): Promise<ProofOutput<PrivateKernelTailCircuitPublicInputs>> {
64
+ ): Promise<KernelProofOutput<PrivateKernelTailCircuitPublicInputs>> {
74
65
  const isForPublic = privateInputs.isForPublic();
75
66
  const [duration, result] = await elapsed(() =>
76
67
  isForPublic ? executeTailForPublic(privateInputs) : executeTail(privateInputs),
@@ -82,15 +73,23 @@ export class TestProofCreator implements ProofCreator {
82
73
  inputSize: privateInputs.toBuffer().length,
83
74
  outputSize: result.toBuffer().length,
84
75
  } satisfies CircuitSimulationStats);
85
- const proof = makeEmptyProof();
76
+ return this.makeEmptyKernelProofOutput<PrivateKernelTailCircuitPublicInputs>(result);
77
+ }
86
78
 
87
- return {
88
- publicInputs: result,
89
- proof: proof,
79
+ createAppCircuitProof(_1: Map<number, string>, _2: Buffer): Promise<AppCircuitProofOutput> {
80
+ const appCircuitProofOutput: AppCircuitProofOutput = {
81
+ proof: makeRecursiveProof<typeof RECURSIVE_PROOF_LENGTH>(RECURSIVE_PROOF_LENGTH),
82
+ verificationKey: VerificationKeyAsFields.makeEmpty(),
90
83
  };
84
+ return Promise.resolve(appCircuitProofOutput);
91
85
  }
92
86
 
93
- createAppCircuitProof(_1: Map<number, string>, _2: Buffer): Promise<Proof> {
94
- return Promise.resolve(new Proof(Buffer.alloc(0)));
87
+ private makeEmptyKernelProofOutput<PublicInputsType>(publicInputs: PublicInputsType) {
88
+ const kernelProofOutput: KernelProofOutput<PublicInputsType> = {
89
+ publicInputs,
90
+ proof: makeRecursiveProof<typeof NESTED_RECURSIVE_PROOF_LENGTH>(NESTED_RECURSIVE_PROOF_LENGTH),
91
+ verificationKey: VerificationKeyAsFields.makeEmpty(),
92
+ };
93
+ return kernelProofOutput;
95
94
  }
96
95
  }
@@ -1,6 +1,6 @@
1
1
  import { type L1NotePayload, type TxHash } from '@aztec/circuit-types';
2
2
  import { Fr, type PublicKey } from '@aztec/circuits.js';
3
- import { computeCommitmentNonce, siloNullifier } from '@aztec/circuits.js/hash';
3
+ import { computeNoteHashNonce, siloNullifier } from '@aztec/circuits.js/hash';
4
4
  import { type AcirSimulator } from '@aztec/simulator';
5
5
 
6
6
  import { NoteDao } from '../database/note_dao.js';
@@ -78,7 +78,6 @@ async function findNoteIndexAndNullifier(
78
78
  let nonce: Fr | undefined;
79
79
  let innerNoteHash: Fr | undefined;
80
80
  let siloedNoteHash: Fr | undefined;
81
- let uniqueSiloedNoteHash: Fr | undefined;
82
81
  let innerNullifier: Fr | undefined;
83
82
  const firstNullifier = Fr.fromBuffer(txHash.toBuffer());
84
83
 
@@ -92,10 +91,16 @@ async function findNoteIndexAndNullifier(
92
91
  break;
93
92
  }
94
93
 
95
- const expectedNonce = computeCommitmentNonce(firstNullifier, commitmentIndex);
96
- ({ innerNoteHash, siloedNoteHash, uniqueSiloedNoteHash, innerNullifier } =
97
- await simulator.computeNoteHashAndNullifier(contractAddress, expectedNonce, storageSlot, noteTypeId, note));
98
- if (commitment.equals(uniqueSiloedNoteHash)) {
94
+ const expectedNonce = computeNoteHashNonce(firstNullifier, commitmentIndex);
95
+ ({ innerNoteHash, siloedNoteHash, innerNullifier } = await simulator.computeNoteHashAndNullifier(
96
+ contractAddress,
97
+ expectedNonce,
98
+ storageSlot,
99
+ noteTypeId,
100
+ note,
101
+ ));
102
+
103
+ if (commitment.equals(siloedNoteHash)) {
99
104
  nonce = expectedNonce;
100
105
  break;
101
106
  }
@@ -1,4 +1,5 @@
1
- import { type AztecNode } from '@aztec/circuit-types';
1
+ import { BBNativeProofCreator } from '@aztec/bb-prover';
2
+ import { type AztecNode, type ProofCreator } from '@aztec/circuit-types';
2
3
  import { randomBytes } from '@aztec/foundation/crypto';
3
4
  import { TestKeyStore } from '@aztec/key-store';
4
5
  import { AztecLmdbStore } from '@aztec/kv-store/lmdb';
@@ -13,8 +14,6 @@ import { join } from 'path';
13
14
 
14
15
  import { type PXEServiceConfig } from '../config/index.js';
15
16
  import { KVPxeDatabase } from '../database/kv_pxe_database.js';
16
- import { BBNativeProofCreator } from '../kernel_prover/bb_prover/bb_native_proof_creator.js';
17
- import { type ProofCreator } from '../kernel_prover/interface/proof_creator.js';
18
17
  import { TestProofCreator } from '../kernel_prover/test/test_circuit_prover.js';
19
18
  import { PXEService } from './pxe_service.js';
20
19
 
@@ -11,6 +11,7 @@ import {
11
11
  MerkleTreeId,
12
12
  type NoteFilter,
13
13
  type PXE,
14
+ type ProofCreator,
14
15
  SimulatedTx,
15
16
  SimulationError,
16
17
  Tx,
@@ -25,19 +26,19 @@ import { type TxPXEProcessingStats } from '@aztec/circuit-types/stats';
25
26
  import {
26
27
  AztecAddress,
27
28
  CallRequest,
28
- CompleteAddress,
29
+ type CompleteAddress,
29
30
  FunctionData,
30
31
  MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX,
31
32
  type PartialAddress,
32
33
  type PrivateKernelTailCircuitPublicInputs,
33
- PublicCallRequest,
34
+ type PublicCallRequest,
34
35
  computeContractClassId,
35
36
  getContractClassFromArtifact,
36
37
  } from '@aztec/circuits.js';
37
- import { computeCommitmentNonce, siloNullifier } from '@aztec/circuits.js/hash';
38
+ import { computeNoteHashNonce, siloNullifier } from '@aztec/circuits.js/hash';
38
39
  import { type ContractArtifact, type DecodedReturn, FunctionSelector, encodeArguments } from '@aztec/foundation/abi';
39
40
  import { arrayNonEmptyLength, padArrayEnd } from '@aztec/foundation/collection';
40
- import { Fr, type Point } from '@aztec/foundation/fields';
41
+ import { Fr } from '@aztec/foundation/fields';
41
42
  import { SerialQueue } from '@aztec/foundation/fifo';
42
43
  import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log';
43
44
  import { Timer } from '@aztec/foundation/timer';
@@ -45,6 +46,7 @@ import {
45
46
  type AcirSimulator,
46
47
  type ExecutionResult,
47
48
  collectEnqueuedPublicFunctionCalls,
49
+ collectPublicTeardownFunctionCall,
48
50
  collectSortedEncryptedLogs,
49
51
  collectSortedUnencryptedLogs,
50
52
  resolveOpcodeLocations,
@@ -57,7 +59,6 @@ import { ContractDataOracle } from '../contract_data_oracle/index.js';
57
59
  import { type PxeDatabase } from '../database/index.js';
58
60
  import { NoteDao } from '../database/note_dao.js';
59
61
  import { KernelOracle } from '../kernel_oracle/index.js';
60
- import { type ProofCreator } from '../kernel_prover/interface/proof_creator.js';
61
62
  import { KernelProver } from '../kernel_prover/kernel_prover.js';
62
63
  import { getAcirSimulator } from '../simulator/index.js';
63
64
  import { Synchronizer } from '../synchronizer/index.js';
@@ -114,12 +115,16 @@ export class PXEService implements PXE {
114
115
 
115
116
  let count = 0;
116
117
  for (const address of registeredAddresses) {
117
- if (!publicKeysSet.has(address.publicKey.toString())) {
118
+ if (!publicKeysSet.has(address.publicKeys.masterIncomingViewingPublicKey.toString())) {
118
119
  continue;
119
120
  }
120
121
 
121
122
  count++;
122
- this.synchronizer.addAccount(address.publicKey, this.keyStore, this.config.l2StartingBlock);
123
+ this.synchronizer.addAccount(
124
+ address.publicKeys.masterIncomingViewingPublicKey,
125
+ this.keyStore,
126
+ this.config.l2StartingBlock,
127
+ );
123
128
  }
124
129
 
125
130
  if (count > 0) {
@@ -169,24 +174,21 @@ export class PXEService implements PXE {
169
174
 
170
175
  public async registerAccount(secretKey: Fr, partialAddress: PartialAddress): Promise<CompleteAddress> {
171
176
  const accounts = await this.keyStore.getAccounts();
172
- const account = await this.keyStore.addAccount(secretKey, partialAddress);
173
- const completeAddress = new CompleteAddress(
174
- account,
175
- await this.keyStore.getMasterIncomingViewingPublicKey(account),
176
- partialAddress,
177
- );
178
- if (accounts.includes(account)) {
179
- this.log.info(`Account:\n "${completeAddress.address.toString()}"\n already registered.`);
180
- return completeAddress;
177
+ const accountCompleteAddress = await this.keyStore.addAccount(secretKey, partialAddress);
178
+ if (accounts.includes(accountCompleteAddress.address)) {
179
+ this.log.info(`Account:\n "${accountCompleteAddress.address.toString()}"\n already registered.`);
180
+ return accountCompleteAddress;
181
181
  } else {
182
- const masterIncomingViewingPublicKey = await this.keyStore.getMasterIncomingViewingPublicKey(account);
182
+ const masterIncomingViewingPublicKey = await this.keyStore.getMasterIncomingViewingPublicKey(
183
+ accountCompleteAddress.address,
184
+ );
183
185
  this.synchronizer.addAccount(masterIncomingViewingPublicKey, this.keyStore, this.config.l2StartingBlock);
184
- this.log.info(`Registered account ${completeAddress.address.toString()}`);
185
- this.log.debug(`Registered account\n ${completeAddress.toReadableString()}`);
186
+ this.log.info(`Registered account ${accountCompleteAddress.address.toString()}`);
187
+ this.log.debug(`Registered account\n ${accountCompleteAddress.toReadableString()}`);
186
188
  }
187
189
 
188
- await this.db.addCompleteAddress(completeAddress);
189
- return completeAddress;
190
+ await this.db.addCompleteAddress(accountCompleteAddress);
191
+ return accountCompleteAddress;
190
192
  }
191
193
 
192
194
  public async getRegisteredAccounts(): Promise<CompleteAddress[]> {
@@ -213,20 +215,9 @@ export class PXEService implements PXE {
213
215
  return this.keyStore.getPublicKeysHash(address);
214
216
  }
215
217
 
216
- public async registerRecipient(recipient: CompleteAddress, publicKeys: Point[] = []): Promise<void> {
218
+ public async registerRecipient(recipient: CompleteAddress): Promise<void> {
217
219
  const wasAdded = await this.db.addCompleteAddress(recipient);
218
220
 
219
- // TODO #5834: This should be refactored to be okay with only adding complete address
220
- if (publicKeys.length !== 0) {
221
- await this.keyStore.addPublicKeysForAccount(
222
- recipient.address,
223
- publicKeys[0],
224
- publicKeys[1],
225
- publicKeys[2],
226
- publicKeys[3],
227
- );
228
- }
229
-
230
221
  if (wasAdded) {
231
222
  this.log.info(`Added recipient:\n ${recipient.toReadableString()}`);
232
223
  } else {
@@ -305,7 +296,7 @@ export class PXEService implements PXE {
305
296
  let owner = filter.owner;
306
297
  if (owner === undefined) {
307
298
  const completeAddresses = (await this.db.getCompleteAddresses()).find(address =>
308
- address.publicKey.equals(dao.publicKey),
299
+ address.publicKeys.masterIncomingViewingPublicKey.equals(dao.publicKey),
309
300
  );
310
301
  if (completeAddresses === undefined) {
311
302
  throw new Error(`Cannot find complete address for public key ${dao.publicKey.toString()}`);
@@ -318,9 +309,9 @@ export class PXEService implements PXE {
318
309
  }
319
310
 
320
311
  public async addNote(note: ExtendedNote) {
321
- const { publicKey } = (await this.db.getCompleteAddress(note.owner)) ?? {};
322
- if (!publicKey) {
323
- throw new Error('Unknown account.');
312
+ const owner = await this.db.getCompleteAddress(note.owner);
313
+ if (!owner) {
314
+ throw new Error(`Unknown account: ${note.owner.toString()}`);
324
315
  }
325
316
 
326
317
  const nonces = await this.getNoteNonces(note);
@@ -329,19 +320,15 @@ export class PXEService implements PXE {
329
320
  }
330
321
 
331
322
  for (const nonce of nonces) {
332
- const { innerNoteHash, siloedNoteHash, uniqueSiloedNoteHash, innerNullifier } =
333
- await this.simulator.computeNoteHashAndNullifier(
334
- note.contractAddress,
335
- nonce,
336
- note.storageSlot,
337
- note.noteTypeId,
338
- note.note,
339
- );
323
+ const { innerNoteHash, siloedNoteHash, innerNullifier } = await this.simulator.computeNoteHashAndNullifier(
324
+ note.contractAddress,
325
+ nonce,
326
+ note.storageSlot,
327
+ note.noteTypeId,
328
+ note.note,
329
+ );
340
330
 
341
- // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1386)
342
- // This can always be `uniqueSiloedNoteHash` once notes added from public also include nonces.
343
- const noteHashToLookUp = nonce.isZero() ? siloedNoteHash : uniqueSiloedNoteHash;
344
- const index = await this.node.findLeafIndex('latest', MerkleTreeId.NOTE_HASH_TREE, noteHashToLookUp);
331
+ const index = await this.node.findLeafIndex('latest', MerkleTreeId.NOTE_HASH_TREE, siloedNoteHash);
345
332
  if (index === undefined) {
346
333
  throw new Error('Note does not exist.');
347
334
  }
@@ -363,7 +350,7 @@ export class PXEService implements PXE {
363
350
  innerNoteHash,
364
351
  siloedNullifier,
365
352
  index,
366
- publicKey,
353
+ owner.publicKeys.masterIncomingViewingPublicKey,
367
354
  ),
368
355
  );
369
356
  }
@@ -383,6 +370,23 @@ export class PXEService implements PXE {
383
370
  }
384
371
 
385
372
  const nonces: Fr[] = [];
373
+
374
+ // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1386)
375
+ // Remove this once notes added from public also include nonces.
376
+ {
377
+ const publicNoteNonce = Fr.ZERO;
378
+ const { siloedNoteHash } = await this.simulator.computeNoteHashAndNullifier(
379
+ note.contractAddress,
380
+ publicNoteNonce,
381
+ note.storageSlot,
382
+ note.noteTypeId,
383
+ note.note,
384
+ );
385
+ if (tx.noteHashes.some(hash => hash.equals(siloedNoteHash))) {
386
+ nonces.push(publicNoteNonce);
387
+ }
388
+ }
389
+
386
390
  const firstNullifier = tx.nullifiers[0];
387
391
  const hashes = tx.noteHashes;
388
392
  for (let i = 0; i < hashes.length; ++i) {
@@ -391,21 +395,15 @@ export class PXEService implements PXE {
391
395
  break;
392
396
  }
393
397
 
394
- const nonce = computeCommitmentNonce(firstNullifier, i);
395
- const { siloedNoteHash, uniqueSiloedNoteHash } = await this.simulator.computeNoteHashAndNullifier(
398
+ const nonce = computeNoteHashNonce(firstNullifier, i);
399
+ const { siloedNoteHash } = await this.simulator.computeNoteHashAndNullifier(
396
400
  note.contractAddress,
397
401
  nonce,
398
402
  note.storageSlot,
399
403
  note.noteTypeId,
400
404
  note.note,
401
405
  );
402
- // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1386)
403
- // Remove this once notes added from public also include nonces.
404
406
  if (hash.equals(siloedNoteHash)) {
405
- nonces.push(Fr.ZERO);
406
- break;
407
- }
408
- if (hash.equals(uniqueSiloedNoteHash)) {
409
407
  nonces.push(nonce);
410
408
  }
411
409
  }
@@ -670,7 +668,7 @@ export class PXEService implements PXE {
670
668
  const unencryptedLogs = new UnencryptedTxL2Logs([collectSortedUnencryptedLogs(executionResult)]);
671
669
  const encryptedLogs = new EncryptedTxL2Logs([collectSortedEncryptedLogs(executionResult)]);
672
670
  const enqueuedPublicFunctions = collectEnqueuedPublicFunctionCalls(executionResult);
673
- const teardownPublicFunction = PublicCallRequest.empty();
671
+ const teardownPublicFunction = collectPublicTeardownFunctionCall(executionResult);
674
672
 
675
673
  // HACK(#1639): Manually patches the ordering of the public call stack
676
674
  // TODO(#757): Enforce proper ordering of enqueued public calls
@@ -678,7 +676,7 @@ export class PXEService implements PXE {
678
676
 
679
677
  const tx = new Tx(
680
678
  publicInputs,
681
- proof,
679
+ proof.binaryProof,
682
680
  encryptedLogs,
683
681
  unencryptedLogs,
684
682
  enqueuedPublicFunctions,
@@ -806,10 +804,6 @@ export class PXEService implements PXE {
806
804
  return Promise.resolve(this.synchronizer.getSyncStatus());
807
805
  }
808
806
 
809
- public getKeyStore() {
810
- return this.keyStore;
811
- }
812
-
813
807
  public async isContractClassPubliclyRegistered(id: Fr): Promise<boolean> {
814
808
  return !!(await this.node.getContractClass(id));
815
809
  }
@@ -12,6 +12,7 @@ import {
12
12
  FunctionData,
13
13
  INITIAL_L2_BLOCK_NUM,
14
14
  Point,
15
+ PublicKeys,
15
16
  TxContext,
16
17
  getContractClassFromArtifact,
17
18
  } from '@aztec/circuits.js';
@@ -68,9 +69,14 @@ export const pxeTestSuite = (testName: string, pxeSetup: () => Promise<PXE>) =>
68
69
  await pxe.registerAccount(randomSecretKey, randomPartialAddress);
69
70
  });
70
71
 
71
- it('cannot register a recipient with the same aztec address but different pub key or partial address', async () => {
72
+ // Disabled as CompleteAddress constructor now performs preimage validation.
73
+ it.skip('cannot register a recipient with the same aztec address but different pub key or partial address', async () => {
72
74
  const recipient1 = CompleteAddress.random();
73
- const recipient2 = new CompleteAddress(recipient1.address, Point.random(), Fr.random());
75
+ const recipient2 = new CompleteAddress(
76
+ recipient1.address,
77
+ new PublicKeys(Point.random(), Point.random(), Point.random(), Point.random()),
78
+ Fr.random(),
79
+ );
74
80
 
75
81
  await pxe.registerRecipient(recipient1);
76
82
  await expect(() => pxe.registerRecipient(recipient2)).rejects.toThrow(
@@ -15,7 +15,6 @@ import {
15
15
  type FunctionSelector,
16
16
  type Header,
17
17
  type L1_TO_L2_MSG_TREE_HEIGHT,
18
- type Point,
19
18
  } from '@aztec/circuits.js';
20
19
  import { computeL1ToL2MessageNullifier } from '@aztec/circuits.js/hash';
21
20
  import { type FunctionArtifact, getFunctionArtifact } from '@aztec/foundation/abi';
@@ -44,7 +43,6 @@ export class SimulatorOracle implements DBOracle {
44
43
  return { masterNullifierPublicKey, appNullifierSecretKey };
45
44
  }
46
45
 
47
- // TODO: #5834
48
46
  async getCompleteAddress(address: AztecAddress): Promise<CompleteAddress> {
49
47
  const completeAddress = await this.db.getCompleteAddress(address);
50
48
  if (!completeAddress) {
@@ -79,16 +77,6 @@ export class SimulatorOracle implements DBOracle {
79
77
  return capsule;
80
78
  }
81
79
 
82
- // TODO: #5834
83
- async getPublicKeysForAddress(address: AztecAddress): Promise<Point[]> {
84
- const nullifierPublicKey = await this.keyStore.getMasterNullifierPublicKey(address);
85
- const incomingViewingPublicKey = await this.keyStore.getMasterIncomingViewingPublicKey(address);
86
- const outgoingViewingPublicKey = await this.keyStore.getMasterOutgoingViewingPublicKey(address);
87
- const taggingPublicKey = await this.keyStore.getMasterTaggingPublicKey(address);
88
-
89
- return [nullifierPublicKey, incomingViewingPublicKey, outgoingViewingPublicKey, taggingPublicKey];
90
- }
91
-
92
80
  async getNotes(contractAddress: AztecAddress, storageSlot: Fr, status: NoteStatus) {
93
81
  const noteDaos = await this.db.getNotes({
94
82
  contractAddress,
@@ -285,7 +285,8 @@ export class Synchronizer {
285
285
  if (!completeAddress) {
286
286
  throw new Error(`Checking if account is synched is not possible for ${account} because it is not registered.`);
287
287
  }
288
- const findByPublicKey = (x: NoteProcessor) => x.masterIncomingViewingPublicKey.equals(completeAddress.publicKey);
288
+ const findByPublicKey = (x: NoteProcessor) =>
289
+ x.masterIncomingViewingPublicKey.equals(completeAddress.publicKeys.masterIncomingViewingPublicKey);
289
290
  const processor = this.noteProcessors.find(findByPublicKey) ?? this.noteProcessorsToCatchUp.find(findByPublicKey);
290
291
  if (!processor) {
291
292
  throw new Error(
@@ -1,95 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import { Fr, type PrivateCircuitPublicInputs, type PrivateKernelCircuitPublicInputs, type PrivateKernelInitCircuitPrivateInputs, type PrivateKernelInnerCircuitPrivateInputs, type PrivateKernelTailCircuitPrivateInputs, type PrivateKernelTailCircuitPublicInputs, Proof } from '@aztec/circuits.js';
3
- import { type LogFn } from '@aztec/foundation/log';
4
- import { type ClientProtocolArtifact } from '@aztec/noir-protocol-circuits-types';
5
- import { type ACVMField } from '@aztec/simulator';
6
- import { type NoirCompiledCircuit } from '@aztec/types/noir';
7
- import { type ProofCreator, type ProofOutput } from '../interface/proof_creator.js';
8
- declare enum BB_RESULT {
9
- SUCCESS = 0,
10
- FAILURE = 1,
11
- ALREADY_PRESENT = 2
12
- }
13
- type BBSuccess = {
14
- status: BB_RESULT.SUCCESS | BB_RESULT.ALREADY_PRESENT;
15
- duration: number;
16
- pkPath?: string;
17
- vkPath?: string;
18
- proofPath?: string;
19
- };
20
- type BBFailure = {
21
- status: BB_RESULT.FAILURE;
22
- reason: string;
23
- };
24
- /**
25
- * Used for generating proofs of noir circuits.
26
- * It is assumed that the working directory is a temporary and/or random directory used solely for generating this proof.
27
- * @param pathToBB - The full path to the bb binary
28
- * @param workingDirectory - A working directory for use by bb
29
- * @param circuitName - An identifier for the circuit
30
- * @param bytecode - The compiled circuit bytecode
31
- * @param inputWitnessFile - The circuit input witness
32
- * @param log - A logging function
33
- * @returns An object containing a result indication, the location of the proof and the duration taken
34
- */
35
- export declare function generateProof(pathToBB: string, workingDirectory: string, circuitName: string, bytecode: Buffer, inputWitnessFile: string, log: LogFn): Promise<BBFailure | BBSuccess>;
36
- /**
37
- * Used for generating either a proving or verification key, will exit early if the key already exists
38
- * It assumes the provided working directory is one where the caller wishes to maintain a permanent set of keys
39
- * It is not considered a temporary directory
40
- * @param pathToBB - The full path to the bb binary
41
- * @param workingDirectory - The directory into which the key should be created
42
- * @param circuitName - An identifier for the circuit
43
- * @param compiledCircuit - The compiled circuit
44
- * @param key - The type of key, either 'pk' or 'vk'
45
- * @param log - A logging function
46
- * @param force - Force the key to be regenerated even if it already exists
47
- * @returns An instance of BBResult
48
- */
49
- export declare function generateKeyForNoirCircuit(pathToBB: string, workingDirectory: string, circuitName: string, compiledCircuit: NoirCompiledCircuit, key: 'vk' | 'pk', log: LogFn, force?: boolean): Promise<BBSuccess | BBFailure>;
50
- /**
51
- * This proof creator implementation uses the native bb binary.
52
- * This is a temporary implementation until we make the WASM version work.
53
- */
54
- export declare class BBNativeProofCreator implements ProofCreator {
55
- private bbBinaryPath;
56
- private bbWorkingDirectory;
57
- private log;
58
- private simulator;
59
- private verificationKeys;
60
- constructor(bbBinaryPath: string, bbWorkingDirectory: string, log?: import("@aztec/foundation/log").Logger);
61
- getSiloedCommitments(publicInputs: PrivateCircuitPublicInputs): Promise<Fr[]>;
62
- createProofInit(inputs: PrivateKernelInitCircuitPrivateInputs): Promise<ProofOutput<PrivateKernelCircuitPublicInputs>>;
63
- createProofInner(inputs: PrivateKernelInnerCircuitPrivateInputs): Promise<ProofOutput<PrivateKernelCircuitPublicInputs>>;
64
- createProofTail(inputs: PrivateKernelTailCircuitPrivateInputs): Promise<ProofOutput<PrivateKernelTailCircuitPublicInputs>>;
65
- createAppCircuitProof(partialWitness: Map<number, ACVMField>, bytecode: Buffer): Promise<Proof>;
66
- /**
67
- * Verifies a proof, will generate the verification key if one is not cached internally
68
- * @param circuitType - The type of circuit whose proof is to be verified
69
- * @param proof - The proof to be verified
70
- */
71
- verifyProof(circuitType: ClientProtocolArtifact, proof: Proof): Promise<void>;
72
- /**
73
- * Returns the verification key data for a circuit, will generate and cache it if not cached internally
74
- * @param circuitType - The type of circuit for which the verification key is required
75
- * @returns The verification key data
76
- */
77
- private getVerificationKeyDataForCircuit;
78
- /**
79
- * Reads the verification key data stored at the specified location and parses into a VerificationKeyData
80
- * @param filePath - The directory containing the verification key data files
81
- * @returns The verification key data
82
- */
83
- private convertVk;
84
- /**
85
- * Ensures our verification key cache includes the key data located at the specified directory
86
- * @param filePath - The directory containing the verification key data files
87
- * @param circuitType - The type of circuit to which the verification key corresponds
88
- */
89
- private updateVerificationKeyAfterProof;
90
- private createSafeProof;
91
- private generateWitnessAndCreateProof;
92
- private createProof;
93
- }
94
- export {};
95
- //# sourceMappingURL=bb_native_proof_creator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bb_native_proof_creator.d.ts","sourceRoot":"","sources":["../../../src/kernel_prover/bb_prover/bb_native_proof_creator.ts"],"names":[],"mappings":"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"}