@aztec/pxe 0.56.0 → 0.58.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 (111) hide show
  1. package/dest/bin/index.js +0 -0
  2. package/dest/contract_data_oracle/index.d.ts +1 -2
  3. package/dest/contract_data_oracle/index.d.ts.map +1 -1
  4. package/dest/contract_data_oracle/index.js +1 -1
  5. package/dest/contract_data_oracle/private_functions_tree.d.ts +1 -2
  6. package/dest/contract_data_oracle/private_functions_tree.d.ts.map +1 -1
  7. package/dest/contract_data_oracle/private_functions_tree.js +1 -1
  8. package/dest/database/contracts/contract_instance_db.d.ts +1 -2
  9. package/dest/database/contracts/contract_instance_db.d.ts.map +1 -1
  10. package/dest/database/deferred_note_dao.d.ts +6 -2
  11. package/dest/database/deferred_note_dao.d.ts.map +1 -1
  12. package/dest/database/deferred_note_dao.js +8 -5
  13. package/dest/database/incoming_note_dao.d.ts +3 -1
  14. package/dest/database/incoming_note_dao.d.ts.map +1 -1
  15. package/dest/database/incoming_note_dao.js +5 -1
  16. package/dest/database/kv_pxe_database.d.ts +1 -2
  17. package/dest/database/kv_pxe_database.d.ts.map +1 -1
  18. package/dest/database/kv_pxe_database.js +4 -4
  19. package/dest/database/outgoing_note_dao.d.ts +3 -1
  20. package/dest/database/outgoing_note_dao.d.ts.map +1 -1
  21. package/dest/database/outgoing_note_dao.js +5 -1
  22. package/dest/database/pxe_database.d.ts +1 -2
  23. package/dest/database/pxe_database.d.ts.map +1 -1
  24. package/dest/database/pxe_database_test_suite.d.ts.map +1 -1
  25. package/dest/database/pxe_database_test_suite.js +2 -3
  26. package/dest/kernel_oracle/index.d.ts +8 -4
  27. package/dest/kernel_oracle/index.d.ts.map +1 -1
  28. package/dest/kernel_oracle/index.js +6 -5
  29. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +28 -0
  30. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
  31. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +260 -0
  32. package/dest/kernel_prover/hints/index.d.ts +1 -2
  33. package/dest/kernel_prover/hints/index.d.ts.map +1 -1
  34. package/dest/kernel_prover/hints/index.js +2 -3
  35. package/dest/kernel_prover/kernel_prover.d.ts +2 -4
  36. package/dest/kernel_prover/kernel_prover.d.ts.map +1 -1
  37. package/dest/kernel_prover/kernel_prover.js +37 -30
  38. package/dest/kernel_prover/proving_data_oracle.d.ts +2 -2
  39. package/dest/kernel_prover/proving_data_oracle.d.ts.map +1 -1
  40. package/dest/kernel_prover/test/test_circuit_prover.d.ts +2 -3
  41. package/dest/kernel_prover/test/test_circuit_prover.d.ts.map +1 -1
  42. package/dest/kernel_prover/test/test_circuit_prover.js +10 -13
  43. package/dest/note_processor/note_processor.d.ts +3 -3
  44. package/dest/note_processor/note_processor.d.ts.map +1 -1
  45. package/dest/note_processor/note_processor.js +16 -18
  46. package/dest/note_processor/utils/add_nullable_field_to_payload.d.ts +12 -0
  47. package/dest/note_processor/utils/add_nullable_field_to_payload.d.ts.map +1 -0
  48. package/dest/note_processor/utils/add_nullable_field_to_payload.js +46 -0
  49. package/dest/note_processor/utils/brute_force_note_info.d.ts +26 -0
  50. package/dest/note_processor/utils/brute_force_note_info.d.ts.map +1 -0
  51. package/dest/note_processor/utils/brute_force_note_info.js +52 -0
  52. package/dest/note_processor/utils/index.d.ts +3 -0
  53. package/dest/note_processor/utils/index.d.ts.map +1 -0
  54. package/dest/note_processor/utils/index.js +2 -0
  55. package/dest/note_processor/{produce_note_dao.d.ts → utils/produce_note_daos.d.ts} +12 -8
  56. package/dest/note_processor/utils/produce_note_daos.d.ts.map +1 -0
  57. package/dest/note_processor/utils/produce_note_daos.js +53 -0
  58. package/dest/note_processor/utils/produce_note_daos_for_key.d.ts +9 -0
  59. package/dest/note_processor/utils/produce_note_daos_for_key.d.ts.map +1 -0
  60. package/dest/note_processor/utils/produce_note_daos_for_key.js +80 -0
  61. package/dest/pxe_http/pxe_http_server.d.ts.map +1 -1
  62. package/dest/pxe_http/pxe_http_server.js +13 -4
  63. package/dest/pxe_service/create_pxe_service.d.ts.map +1 -1
  64. package/dest/pxe_service/create_pxe_service.js +2 -18
  65. package/dest/pxe_service/pxe_service.d.ts +4 -6
  66. package/dest/pxe_service/pxe_service.d.ts.map +1 -1
  67. package/dest/pxe_service/pxe_service.js +55 -49
  68. package/dest/simulator_oracle/index.d.ts +1 -2
  69. package/dest/simulator_oracle/index.d.ts.map +1 -1
  70. package/dest/simulator_oracle/index.js +1 -1
  71. package/dest/synchronizer/synchronizer.d.ts +2 -2
  72. package/dest/synchronizer/synchronizer.d.ts.map +1 -1
  73. package/dest/synchronizer/synchronizer.js +6 -10
  74. package/package.json +17 -14
  75. package/src/contract_data_oracle/index.ts +1 -2
  76. package/src/contract_data_oracle/private_functions_tree.ts +1 -1
  77. package/src/database/contracts/contract_instance_db.ts +1 -2
  78. package/src/database/deferred_note_dao.ts +5 -1
  79. package/src/database/incoming_note_dao.ts +24 -1
  80. package/src/database/kv_pxe_database.ts +10 -3
  81. package/src/database/outgoing_note_dao.ts +23 -1
  82. package/src/database/pxe_database.ts +6 -2
  83. package/src/database/pxe_database_test_suite.ts +7 -2
  84. package/src/kernel_oracle/index.ts +5 -4
  85. package/src/kernel_prover/hints/build_private_kernel_reset_private_inputs.ts +467 -0
  86. package/src/kernel_prover/hints/index.ts +1 -2
  87. package/src/kernel_prover/kernel_prover.ts +74 -79
  88. package/src/kernel_prover/proving_data_oracle.ts +2 -1
  89. package/src/kernel_prover/test/test_circuit_prover.ts +13 -16
  90. package/src/note_processor/note_processor.ts +36 -27
  91. package/src/note_processor/utils/add_nullable_field_to_payload.ts +67 -0
  92. package/src/note_processor/utils/brute_force_note_info.ts +82 -0
  93. package/src/note_processor/utils/index.ts +2 -0
  94. package/src/note_processor/utils/produce_note_daos.ts +114 -0
  95. package/src/note_processor/utils/produce_note_daos_for_key.ts +157 -0
  96. package/src/pxe_http/pxe_http_server.ts +19 -3
  97. package/src/pxe_service/create_pxe_service.ts +1 -18
  98. package/src/pxe_service/pxe_service.ts +81 -83
  99. package/src/simulator_oracle/index.ts +1 -1
  100. package/src/synchronizer/synchronizer.ts +12 -10
  101. package/dest/kernel_prover/hints/build_private_kernel_reset_hints.d.ts +0 -5
  102. package/dest/kernel_prover/hints/build_private_kernel_reset_hints.d.ts.map +0 -1
  103. package/dest/kernel_prover/hints/build_private_kernel_reset_hints.js +0 -90
  104. package/dest/kernel_prover/hints/needs_reset.d.ts +0 -5
  105. package/dest/kernel_prover/hints/needs_reset.d.ts.map +0 -1
  106. package/dest/kernel_prover/hints/needs_reset.js +0 -38
  107. package/dest/note_processor/produce_note_dao.d.ts.map +0 -1
  108. package/dest/note_processor/produce_note_dao.js +0 -131
  109. package/src/kernel_prover/hints/build_private_kernel_reset_hints.ts +0 -249
  110. package/src/kernel_prover/hints/needs_reset.ts +0 -54
  111. package/src/note_processor/produce_note_dao.ts +0 -235
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.56.0",
3
+ "version": "0.58.0",
4
4
  "type": "module",
5
5
  "exports": "./dest/index.js",
6
6
  "bin": "./dest/bin/index.js",
@@ -38,6 +38,9 @@
38
38
  "parser": {
39
39
  "syntax": "typescript",
40
40
  "decorators": true
41
+ },
42
+ "transform": {
43
+ "decoratorVersion": "2022-03"
41
44
  }
42
45
  }
43
46
  }
@@ -56,19 +59,19 @@
56
59
  ]
57
60
  },
58
61
  "dependencies": {
59
- "@aztec/bb-prover": "0.56.0",
60
- "@aztec/bb.js": "0.56.0",
61
- "@aztec/builder": "0.56.0",
62
- "@aztec/circuit-types": "0.56.0",
63
- "@aztec/circuits.js": "0.56.0",
64
- "@aztec/ethereum": "0.56.0",
65
- "@aztec/foundation": "0.56.0",
66
- "@aztec/key-store": "0.56.0",
67
- "@aztec/kv-store": "0.56.0",
68
- "@aztec/noir-protocol-circuits-types": "0.56.0",
69
- "@aztec/protocol-contracts": "0.56.0",
70
- "@aztec/simulator": "0.56.0",
71
- "@aztec/types": "0.56.0",
62
+ "@aztec/bb-prover": "0.58.0",
63
+ "@aztec/bb.js": "0.58.0",
64
+ "@aztec/builder": "0.58.0",
65
+ "@aztec/circuit-types": "0.58.0",
66
+ "@aztec/circuits.js": "0.58.0",
67
+ "@aztec/ethereum": "0.58.0",
68
+ "@aztec/foundation": "0.58.0",
69
+ "@aztec/key-store": "0.58.0",
70
+ "@aztec/kv-store": "0.58.0",
71
+ "@aztec/noir-protocol-circuits-types": "0.58.0",
72
+ "@aztec/protocol-contracts": "0.58.0",
73
+ "@aztec/simulator": "0.58.0",
74
+ "@aztec/types": "0.58.0",
72
75
  "@msgpack/msgpack": "^3.0.0-beta2",
73
76
  "@noir-lang/noirc_abi": "portal:../../noir/packages/noirc_abi",
74
77
  "@noir-lang/types": "workspace:*",
@@ -1,4 +1,4 @@
1
- import { type AztecAddress } from '@aztec/circuits.js';
1
+ import { type AztecAddress, type ContractClass, type ContractInstance } from '@aztec/circuits.js';
2
2
  import {
3
3
  type ContractArtifact,
4
4
  type FunctionArtifact,
@@ -8,7 +8,6 @@ import {
8
8
  } from '@aztec/foundation/abi';
9
9
  import { type Fr } from '@aztec/foundation/fields';
10
10
  import { ContractClassNotFoundError, ContractNotFoundError } from '@aztec/simulator';
11
- import { type ContractClass, type ContractInstance } from '@aztec/types/contracts';
12
11
 
13
12
  import { type ContractArtifactDatabase } from '../database/contracts/contract_artifact_db.js';
14
13
  import { type ContractInstanceDatabase } from '../database/contracts/contract_instance_db.js';
@@ -1,4 +1,5 @@
1
1
  import {
2
+ type ContractClassWithId,
2
3
  FUNCTION_TREE_HEIGHT,
3
4
  MembershipWitness,
4
5
  computePrivateFunctionLeaf,
@@ -9,7 +10,6 @@ import { type MerkleTree } from '@aztec/circuits.js/merkle';
9
10
  import { type ContractArtifact, type FunctionSelector } from '@aztec/foundation/abi';
10
11
  import { Fr } from '@aztec/foundation/fields';
11
12
  import { assertLength } from '@aztec/foundation/serialize';
12
- import { type ContractClassWithId } from '@aztec/types/contracts';
13
13
 
14
14
  /**
15
15
  * Represents a Merkle tree of functions for a particular Contract Class.
@@ -1,5 +1,4 @@
1
- import { type AztecAddress } from '@aztec/circuits.js';
2
- import { type ContractInstanceWithAddress } from '@aztec/types/contracts';
1
+ import { type AztecAddress, type ContractInstanceWithAddress } from '@aztec/circuits.js';
3
2
 
4
3
  /**
5
4
  * PXE database for managing contract instances.
@@ -1,4 +1,4 @@
1
- import { Note, TxHash } from '@aztec/circuit-types';
1
+ import { Note, TxHash, UnencryptedTxL2Logs } from '@aztec/circuit-types';
2
2
  import { AztecAddress, Fr, Point, type PublicKey, Vector } from '@aztec/circuits.js';
3
3
  import { NoteSelector } from '@aztec/foundation/abi';
4
4
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
@@ -26,6 +26,8 @@ export class DeferredNoteDao {
26
26
  public noteHashes: Fr[],
27
27
  /** The next available leaf index for the note hash tree for this transaction */
28
28
  public dataStartIndexForTx: number,
29
+ /** Unencrypted logs for the transaction (used to complete partial notes) */
30
+ public unencryptedLogs: UnencryptedTxL2Logs,
29
31
  ) {}
30
32
 
31
33
  toBuffer(): Buffer {
@@ -38,6 +40,7 @@ export class DeferredNoteDao {
38
40
  this.txHash,
39
41
  new Vector(this.noteHashes),
40
42
  this.dataStartIndexForTx,
43
+ this.unencryptedLogs,
41
44
  );
42
45
  }
43
46
  static fromBuffer(buffer: Buffer | BufferReader) {
@@ -51,6 +54,7 @@ export class DeferredNoteDao {
51
54
  reader.readObject(TxHash),
52
55
  reader.readVector(Fr),
53
56
  reader.readNumber(),
57
+ reader.readObject(UnencryptedTxL2Logs),
54
58
  );
55
59
  }
56
60
  }
@@ -1,10 +1,12 @@
1
- import { Note, TxHash } from '@aztec/circuit-types';
1
+ import { type L1NotePayload, Note, TxHash } from '@aztec/circuit-types';
2
2
  import { AztecAddress, Fr, Point, type PublicKey } from '@aztec/circuits.js';
3
3
  import { NoteSelector } from '@aztec/foundation/abi';
4
4
  import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
5
5
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
6
6
  import { type NoteData } from '@aztec/simulator';
7
7
 
8
+ import { type NoteInfo } from '../note_processor/utils/index.js';
9
+
8
10
  /**
9
11
  * A note with contextual data which was decrypted as incoming.
10
12
  */
@@ -38,6 +40,27 @@ export class IncomingNoteDao implements NoteData {
38
40
  public ivpkM: PublicKey,
39
41
  ) {}
40
42
 
43
+ static fromPayloadAndNoteInfo(
44
+ payload: L1NotePayload,
45
+ noteInfo: NoteInfo,
46
+ dataStartIndexForTx: number,
47
+ ivpkM: PublicKey,
48
+ ) {
49
+ const noteHashIndexInTheWholeTree = BigInt(dataStartIndexForTx + noteInfo.noteHashIndex);
50
+ return new IncomingNoteDao(
51
+ payload.note,
52
+ payload.contractAddress,
53
+ payload.storageSlot,
54
+ payload.noteTypeId,
55
+ noteInfo.txHash,
56
+ noteInfo.nonce,
57
+ noteInfo.noteHash,
58
+ noteInfo.siloedNullifier,
59
+ noteHashIndexInTheWholeTree,
60
+ ivpkM,
61
+ );
62
+ }
63
+
41
64
  toBuffer(): Buffer {
42
65
  return serializeToBuffer([
43
66
  this.note,
@@ -5,7 +5,13 @@ import {
5
5
  type OutgoingNotesFilter,
6
6
  type PublicKey,
7
7
  } from '@aztec/circuit-types';
8
- import { AztecAddress, CompleteAddress, Header } from '@aztec/circuits.js';
8
+ import {
9
+ AztecAddress,
10
+ CompleteAddress,
11
+ type ContractInstanceWithAddress,
12
+ Header,
13
+ SerializableContractInstance,
14
+ } from '@aztec/circuits.js';
9
15
  import { type ContractArtifact } from '@aztec/foundation/abi';
10
16
  import { toBufferBE } from '@aztec/foundation/bigint-buffer';
11
17
  import { Fr, type Point } from '@aztec/foundation/fields';
@@ -18,7 +24,6 @@ import {
18
24
  type AztecSingleton,
19
25
  } from '@aztec/kv-store';
20
26
  import { contractArtifactFromBuffer, contractArtifactToBuffer } from '@aztec/types/abi';
21
- import { type ContractInstanceWithAddress, SerializableContractInstance } from '@aztec/types/contracts';
22
27
 
23
28
  import { DeferredNoteDao } from './deferred_note_dao.js';
24
29
  import { IncomingNoteDao } from './incoming_note_dao.js';
@@ -495,7 +500,9 @@ export class KVPxeDatabase implements PxeDatabase {
495
500
  return true;
496
501
  }
497
502
 
498
- addCompleteAddress(completeAddress: CompleteAddress): Promise<boolean> {
503
+ async addCompleteAddress(completeAddress: CompleteAddress): Promise<boolean> {
504
+ await this.#addScope(completeAddress.address);
505
+
499
506
  return this.#db.transaction(() => {
500
507
  const addressString = completeAddress.address.toString();
501
508
  const buffer = completeAddress.toBuffer();
@@ -1,9 +1,11 @@
1
- import { Note, TxHash } from '@aztec/circuit-types';
1
+ import { type L1NotePayload, Note, TxHash } from '@aztec/circuit-types';
2
2
  import { AztecAddress, Fr, Point, type PublicKey } from '@aztec/circuits.js';
3
3
  import { NoteSelector } from '@aztec/foundation/abi';
4
4
  import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
5
5
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
6
6
 
7
+ import { type NoteInfo } from '../note_processor/utils/index.js';
8
+
7
9
  /**
8
10
  * A note with contextual data which was decrypted as outgoing.
9
11
  */
@@ -32,6 +34,26 @@ export class OutgoingNoteDao {
32
34
  public ovpkM: PublicKey,
33
35
  ) {}
34
36
 
37
+ static fromPayloadAndNoteInfo(
38
+ payload: L1NotePayload,
39
+ noteInfo: NoteInfo,
40
+ dataStartIndexForTx: number,
41
+ ivpkM: PublicKey,
42
+ ) {
43
+ const noteHashIndexInTheWholeTree = BigInt(dataStartIndexForTx + noteInfo.noteHashIndex);
44
+ return new OutgoingNoteDao(
45
+ payload.note,
46
+ payload.contractAddress,
47
+ payload.storageSlot,
48
+ payload.noteTypeId,
49
+ noteInfo.txHash,
50
+ noteInfo.nonce,
51
+ noteInfo.noteHash,
52
+ noteHashIndexInTheWholeTree,
53
+ ivpkM,
54
+ );
55
+ }
56
+
35
57
  toBuffer(): Buffer {
36
58
  return serializeToBuffer([
37
59
  this.note,
@@ -1,9 +1,13 @@
1
1
  import { type IncomingNotesFilter, type OutgoingNotesFilter } from '@aztec/circuit-types';
2
- import { type CompleteAddress, type Header, type PublicKey } from '@aztec/circuits.js';
2
+ import {
3
+ type CompleteAddress,
4
+ type ContractInstanceWithAddress,
5
+ type Header,
6
+ type PublicKey,
7
+ } from '@aztec/circuits.js';
3
8
  import { type ContractArtifact } from '@aztec/foundation/abi';
4
9
  import { type AztecAddress } from '@aztec/foundation/aztec-address';
5
10
  import { type Fr } from '@aztec/foundation/fields';
6
- import { type ContractInstanceWithAddress } from '@aztec/types/contracts';
7
11
 
8
12
  import { type ContractArtifactDatabase } from './contracts/contract_artifact_db.js';
9
13
  import { type ContractInstanceDatabase } from './contracts/contract_instance_db.js';
@@ -1,10 +1,15 @@
1
1
  import { type IncomingNotesFilter, NoteStatus, type OutgoingNotesFilter, randomTxHash } from '@aztec/circuit-types';
2
- import { AztecAddress, CompleteAddress, INITIAL_L2_BLOCK_NUM, PublicKeys } from '@aztec/circuits.js';
2
+ import {
3
+ AztecAddress,
4
+ CompleteAddress,
5
+ INITIAL_L2_BLOCK_NUM,
6
+ PublicKeys,
7
+ SerializableContractInstance,
8
+ } from '@aztec/circuits.js';
3
9
  import { makeHeader } from '@aztec/circuits.js/testing';
4
10
  import { randomInt } from '@aztec/foundation/crypto';
5
11
  import { Fr, Point } from '@aztec/foundation/fields';
6
12
  import { BenchmarkingContractArtifact } from '@aztec/noir-contracts.js/Benchmarking';
7
- import { SerializableContractInstance } from '@aztec/types/contracts';
8
13
 
9
14
  import { type IncomingNoteDao } from './incoming_note_dao.js';
10
15
  import { randomIncomingNoteDao } from './incoming_note_dao.test.js';
@@ -1,4 +1,4 @@
1
- import { type AztecNode } from '@aztec/circuit-types';
1
+ import { type AztecNode, type L2BlockNumber } from '@aztec/circuit-types';
2
2
  import {
3
3
  type AztecAddress,
4
4
  type Fr,
@@ -30,6 +30,7 @@ export class KernelOracle implements ProvingDataOracle {
30
30
  private contractDataOracle: ContractDataOracle,
31
31
  private keyStore: KeyStore,
32
32
  private node: AztecNode,
33
+ private blockNumber: L2BlockNumber = 'latest',
33
34
  private log = createDebugLogger('aztec:pxe:kernel_oracle'),
34
35
  ) {}
35
36
 
@@ -56,7 +57,7 @@ export class KernelOracle implements ProvingDataOracle {
56
57
  }
57
58
 
58
59
  async getNoteHashMembershipWitness(leafIndex: bigint): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>> {
59
- const path = await this.node.getNoteHashSiblingPath('latest', leafIndex);
60
+ const path = await this.node.getNoteHashSiblingPath(this.blockNumber, leafIndex);
60
61
  return new MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>(
61
62
  path.pathSize,
62
63
  leafIndex,
@@ -65,11 +66,11 @@ export class KernelOracle implements ProvingDataOracle {
65
66
  }
66
67
 
67
68
  getNullifierMembershipWitness(nullifier: Fr) {
68
- return this.node.getNullifierMembershipWitness('latest', nullifier);
69
+ return this.node.getNullifierMembershipWitness(this.blockNumber, nullifier);
69
70
  }
70
71
 
71
72
  async getNoteHashTreeRoot(): Promise<Fr> {
72
- const header = await this.node.getHeader();
73
+ const header = await this.node.getHeader(this.blockNumber);
73
74
  return header.state.partial.noteHashTree.root;
74
75
  }
75
76