@aztec/pxe 0.0.1-commit.c80b6263 → 0.0.1-commit.cd76b27

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 (156) hide show
  1. package/dest/access_scopes.d.ts +9 -0
  2. package/dest/access_scopes.d.ts.map +1 -0
  3. package/dest/access_scopes.js +6 -0
  4. package/dest/block_synchronizer/block_synchronizer.d.ts +4 -2
  5. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  6. package/dest/block_synchronizer/block_synchronizer.js +7 -1
  7. package/dest/config/package_info.js +1 -1
  8. package/dest/contract_function_simulator/contract_function_simulator.d.ts +54 -30
  9. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  10. package/dest/contract_function_simulator/contract_function_simulator.js +172 -68
  11. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
  12. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
  13. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  14. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
  15. package/dest/contract_function_simulator/oracle/interfaces.d.ts +9 -9
  16. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/oracle/oracle.d.ts +5 -5
  18. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  19. package/dest/contract_function_simulator/oracle/oracle.js +32 -20
  20. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +36 -36
  21. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  22. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +74 -21
  23. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +48 -24
  24. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  25. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +85 -61
  26. package/dest/contract_sync/contract_sync_service.d.ts +43 -0
  27. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
  28. package/dest/contract_sync/contract_sync_service.js +97 -0
  29. package/dest/contract_sync/helpers.d.ts +29 -0
  30. package/dest/contract_sync/helpers.d.ts.map +1 -0
  31. package/dest/contract_sync/{index.js → helpers.js} +13 -12
  32. package/dest/debug/pxe_debug_utils.d.ts +14 -10
  33. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  34. package/dest/debug/pxe_debug_utils.js +16 -15
  35. package/dest/entrypoints/client/bundle/index.d.ts +3 -1
  36. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  37. package/dest/entrypoints/client/bundle/index.js +2 -0
  38. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  39. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  40. package/dest/entrypoints/client/bundle/utils.js +11 -2
  41. package/dest/entrypoints/client/lazy/index.d.ts +3 -1
  42. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  43. package/dest/entrypoints/client/lazy/index.js +2 -0
  44. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  45. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  46. package/dest/entrypoints/client/lazy/utils.js +11 -2
  47. package/dest/entrypoints/server/index.d.ts +4 -2
  48. package/dest/entrypoints/server/index.d.ts.map +1 -1
  49. package/dest/entrypoints/server/index.js +3 -1
  50. package/dest/entrypoints/server/utils.js +9 -1
  51. package/dest/events/event_service.d.ts +4 -5
  52. package/dest/events/event_service.d.ts.map +1 -1
  53. package/dest/events/event_service.js +5 -6
  54. package/dest/logs/log_service.d.ts +6 -5
  55. package/dest/logs/log_service.d.ts.map +1 -1
  56. package/dest/logs/log_service.js +14 -24
  57. package/dest/notes/note_service.d.ts +7 -7
  58. package/dest/notes/note_service.d.ts.map +1 -1
  59. package/dest/notes/note_service.js +9 -9
  60. package/dest/notes_filter.d.ts +25 -0
  61. package/dest/notes_filter.d.ts.map +1 -0
  62. package/dest/notes_filter.js +4 -0
  63. package/dest/oracle_version.d.ts +3 -3
  64. package/dest/oracle_version.d.ts.map +1 -1
  65. package/dest/oracle_version.js +2 -2
  66. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  67. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  68. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  69. package/dest/private_kernel/hints/index.d.ts +1 -1
  70. package/dest/private_kernel/hints/index.js +1 -1
  71. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +4 -4
  72. package/dest/private_kernel/private_kernel_execution_prover.js +6 -6
  73. package/dest/pxe.d.ts +69 -23
  74. package/dest/pxe.d.ts.map +1 -1
  75. package/dest/pxe.js +78 -50
  76. package/dest/storage/address_store/address_store.d.ts +1 -1
  77. package/dest/storage/address_store/address_store.d.ts.map +1 -1
  78. package/dest/storage/address_store/address_store.js +12 -11
  79. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -1
  80. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
  81. package/dest/storage/anchor_block_store/anchor_block_store.js +8 -1
  82. package/dest/storage/capsule_store/capsule_store.js +6 -8
  83. package/dest/storage/contract_store/contract_store.d.ts +1 -1
  84. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  85. package/dest/storage/contract_store/contract_store.js +27 -18
  86. package/dest/storage/metadata.d.ts +1 -1
  87. package/dest/storage/metadata.js +1 -1
  88. package/dest/storage/note_store/note_store.d.ts +13 -3
  89. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  90. package/dest/storage/note_store/note_store.js +147 -107
  91. package/dest/storage/private_event_store/private_event_store.d.ts +1 -1
  92. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
  93. package/dest/storage/private_event_store/private_event_store.js +84 -61
  94. package/dest/storage/private_event_store/stored_private_event.js +1 -1
  95. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +1 -1
  96. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  97. package/dest/storage/tagging_store/recipient_tagging_store.js +31 -19
  98. package/dest/storage/tagging_store/sender_address_book_store.d.ts +1 -1
  99. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -1
  100. package/dest/storage/tagging_store/sender_address_book_store.js +20 -14
  101. package/dest/storage/tagging_store/sender_tagging_store.d.ts +1 -1
  102. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  103. package/dest/storage/tagging_store/sender_tagging_store.js +183 -113
  104. package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
  105. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
  106. package/dest/tagging/get_all_logs_by_tags.js +17 -3
  107. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +4 -4
  108. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
  109. package/package.json +25 -16
  110. package/src/access_scopes.ts +9 -0
  111. package/src/block_synchronizer/block_synchronizer.ts +6 -0
  112. package/src/config/package_info.ts +1 -1
  113. package/src/contract_function_simulator/contract_function_simulator.ts +321 -125
  114. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  115. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  116. package/src/contract_function_simulator/oracle/interfaces.ts +10 -10
  117. package/src/contract_function_simulator/oracle/oracle.ts +35 -18
  118. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +97 -101
  119. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +129 -63
  120. package/src/contract_sync/contract_sync_service.ts +152 -0
  121. package/src/contract_sync/{index.ts → helpers.ts} +21 -21
  122. package/src/debug/pxe_debug_utils.ts +48 -18
  123. package/src/entrypoints/client/bundle/index.ts +2 -0
  124. package/src/entrypoints/client/bundle/utils.ts +12 -2
  125. package/src/entrypoints/client/lazy/index.ts +2 -0
  126. package/src/entrypoints/client/lazy/utils.ts +12 -2
  127. package/src/entrypoints/server/index.ts +3 -1
  128. package/src/entrypoints/server/utils.ts +7 -7
  129. package/src/events/event_service.ts +4 -6
  130. package/src/logs/log_service.ts +14 -29
  131. package/src/notes/note_service.ts +9 -10
  132. package/src/notes_filter.ts +26 -0
  133. package/src/oracle_version.ts +2 -2
  134. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  135. package/src/private_kernel/hints/index.ts +1 -1
  136. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +7 -7
  137. package/src/private_kernel/private_kernel_execution_prover.ts +6 -6
  138. package/src/pxe.ts +161 -98
  139. package/src/storage/address_store/address_store.ts +15 -15
  140. package/src/storage/anchor_block_store/anchor_block_store.ts +8 -0
  141. package/src/storage/capsule_store/capsule_store.ts +8 -8
  142. package/src/storage/contract_store/contract_store.ts +26 -15
  143. package/src/storage/metadata.ts +1 -1
  144. package/src/storage/note_store/note_store.ts +169 -132
  145. package/src/storage/private_event_store/private_event_store.ts +102 -81
  146. package/src/storage/private_event_store/stored_private_event.ts +1 -1
  147. package/src/storage/tagging_store/recipient_tagging_store.ts +31 -21
  148. package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
  149. package/src/storage/tagging_store/sender_tagging_store.ts +210 -126
  150. package/src/tagging/get_all_logs_by_tags.ts +28 -4
  151. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +4 -4
  152. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  153. package/dest/contract_sync/index.d.ts +0 -23
  154. package/dest/contract_sync/index.d.ts.map +0 -1
  155. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  156. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
@@ -13,7 +13,7 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
13
13
  // (highestAgedIndex, highestFinalizedIndex + WINDOW_LEN]
14
14
  //
15
15
  // highestAgedIndex is the highest index that was used in a tx that is included in a block at least
16
- // `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds ago.
16
+ // `MAX_TX_LIFETIME` seconds ago.
17
17
  // highestFinalizedIndex is the highest index that was used in a tx that is included in a finalized block.
18
18
  //
19
19
  // "(" denotes an open end of the range - the index is not included in the range.
@@ -25,19 +25,19 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
25
25
  // ever appear.
26
26
  //
27
27
  // This relies on the "maximum inclusion timestamp" rule enforced by the kernel and rollup circuits:
28
- // - a transaction's maximum inclusion timestamp is at most `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds after
28
+ // - a transaction's maximum inclusion timestamp is at most `MAX_TX_LIFETIME` seconds after
29
29
  // the timestamp of its anchor block; and
30
30
  // - a rollup only includes transactions whose inclusion timestamp is >= the L2 block's timestamp.
31
31
  //
32
32
  // Suppose some device used index `I` in a transaction anchored to block `B_N` at time `N`, and that block is now at
33
- // least `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds in the past. Then there is no possibility of any *other* device
33
+ // least `MAX_TX_LIFETIME` seconds in the past. Then there is no possibility of any *other* device
34
34
  // trying to use an index <= `I` while anchoring to a *newer* block than `B_N` because if we were anchoring to
35
35
  // a newer block than `B_N` then we would already have seen the log with index `I` and hence the device would have
36
36
  // chosen a larger index.
37
37
  // If that *other* device would anchor to a block older than `B_N` then that tx could never be included in a block
38
38
  // because it would already have been expired.
39
39
  //
40
- // Therefore, once we see that index `I` has been used in a block that is at least `MAX_INCLUDE_BY_TIMESTAMP_DURATION`
40
+ // Therefore, once we see that index `I` has been used in a block that is at least `MAX_TX_LIFETIME`
41
41
  // seconds old, we can safely stop syncing logs for all indexes <= `I` and set highestAgedIndex = `I`.
42
42
  //
43
43
  // ## Explanation of the upper bound `highestFinalizedIndex + WINDOW_LEN`
@@ -1,4 +1,4 @@
1
- import { MAX_INCLUDE_BY_TIMESTAMP_DURATION } from '@aztec/constants';
1
+ import { MAX_TX_LIFETIME } from '@aztec/constants';
2
2
  /**
3
3
  * Finds the highest aged and the highest finalized tagging indexes.
4
4
  */ export function findHighestIndexes(privateLogsWithIndexes, currentTimestamp, finalizedBlockNumber) {
@@ -6,7 +6,7 @@ import { MAX_INCLUDE_BY_TIMESTAMP_DURATION } from '@aztec/constants';
6
6
  let highestFinalizedIndex = undefined;
7
7
  for (const { log, taggingIndex } of privateLogsWithIndexes){
8
8
  const ageInSeconds = currentTimestamp - log.blockTimestamp;
9
- if (ageInSeconds >= BigInt(MAX_INCLUDE_BY_TIMESTAMP_DURATION) && (highestAgedIndex === undefined || taggingIndex > highestAgedIndex)) {
9
+ if (ageInSeconds >= BigInt(MAX_TX_LIFETIME) && (highestAgedIndex === undefined || taggingIndex > highestAgedIndex)) {
10
10
  highestAgedIndex = taggingIndex;
11
11
  }
12
12
  if (log.blockNumber <= finalizedBlockNumber && (highestFinalizedIndex === undefined || taggingIndex > highestFinalizedIndex)) {
package/package.json CHANGED
@@ -1,7 +1,16 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.0.1-commit.c80b6263",
3
+ "version": "0.0.1-commit.cd76b27",
4
4
  "type": "module",
5
+ "typedocOptions": {
6
+ "entryPoints": [
7
+ "./src/entrypoints/server/index.ts",
8
+ "./src/entrypoints/client/lazy/index.ts",
9
+ "./src/config/index.ts"
10
+ ],
11
+ "name": "PXE",
12
+ "tsconfig": "./tsconfig.json"
13
+ },
5
14
  "exports": {
6
15
  "./server": "./dest/entrypoints/server/index.js",
7
16
  "./client/lazy": "./dest/entrypoints/client/lazy/index.js",
@@ -61,19 +70,19 @@
61
70
  ]
62
71
  },
63
72
  "dependencies": {
64
- "@aztec/bb-prover": "0.0.1-commit.c80b6263",
65
- "@aztec/bb.js": "0.0.1-commit.c80b6263",
66
- "@aztec/builder": "0.0.1-commit.c80b6263",
67
- "@aztec/constants": "0.0.1-commit.c80b6263",
68
- "@aztec/ethereum": "0.0.1-commit.c80b6263",
69
- "@aztec/foundation": "0.0.1-commit.c80b6263",
70
- "@aztec/key-store": "0.0.1-commit.c80b6263",
71
- "@aztec/kv-store": "0.0.1-commit.c80b6263",
72
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.c80b6263",
73
- "@aztec/noir-types": "0.0.1-commit.c80b6263",
74
- "@aztec/protocol-contracts": "0.0.1-commit.c80b6263",
75
- "@aztec/simulator": "0.0.1-commit.c80b6263",
76
- "@aztec/stdlib": "0.0.1-commit.c80b6263",
73
+ "@aztec/bb-prover": "0.0.1-commit.cd76b27",
74
+ "@aztec/bb.js": "0.0.1-commit.cd76b27",
75
+ "@aztec/builder": "0.0.1-commit.cd76b27",
76
+ "@aztec/constants": "0.0.1-commit.cd76b27",
77
+ "@aztec/ethereum": "0.0.1-commit.cd76b27",
78
+ "@aztec/foundation": "0.0.1-commit.cd76b27",
79
+ "@aztec/key-store": "0.0.1-commit.cd76b27",
80
+ "@aztec/kv-store": "0.0.1-commit.cd76b27",
81
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.cd76b27",
82
+ "@aztec/noir-types": "0.0.1-commit.cd76b27",
83
+ "@aztec/protocol-contracts": "0.0.1-commit.cd76b27",
84
+ "@aztec/simulator": "0.0.1-commit.cd76b27",
85
+ "@aztec/stdlib": "0.0.1-commit.cd76b27",
77
86
  "koa": "^2.16.1",
78
87
  "koa-router": "^13.1.1",
79
88
  "lodash.omit": "^4.5.0",
@@ -82,8 +91,8 @@
82
91
  "viem": "npm:@aztec/viem@2.38.2"
83
92
  },
84
93
  "devDependencies": {
85
- "@aztec/merkle-tree": "0.0.1-commit.c80b6263",
86
- "@aztec/noir-test-contracts.js": "0.0.1-commit.c80b6263",
94
+ "@aztec/merkle-tree": "0.0.1-commit.cd76b27",
95
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.cd76b27",
87
96
  "@jest/globals": "^30.0.0",
88
97
  "@types/jest": "^30.0.0",
89
98
  "@types/lodash.omit": "^4.5.7",
@@ -0,0 +1,9 @@
1
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
+
3
+ /**
4
+ * Controls which accounts' private state and keys are accessible during execution.
5
+ * - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
6
+ * - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
7
+ * - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
8
+ */
9
+ export type AccessScopes = 'ALL_SCOPES' | AztecAddress[];
@@ -7,6 +7,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
7
7
  import type { BlockHeader } from '@aztec/stdlib/tx';
8
8
 
9
9
  import type { BlockSynchronizerConfig } from '../config/index.js';
10
+ import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
10
11
  import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
11
12
  import type { NoteStore } from '../storage/note_store/note_store.js';
12
13
  import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
@@ -28,6 +29,7 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
28
29
  private noteStore: NoteStore,
29
30
  private privateEventStore: PrivateEventStore,
30
31
  private l2TipsStore: L2TipsKVStore,
32
+ private contractSyncService: ContractSyncService,
31
33
  private config: Partial<BlockSynchronizerConfig> = {},
32
34
  bindings?: LoggerBindings,
33
35
  ) {
@@ -125,6 +127,10 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
125
127
 
126
128
  /** Updates the anchor block header to the target block */
127
129
  private async updateAnchorBlockHeader(blockHeader: BlockHeader) {
130
+ // Whenever the anchor block header is updated, we need to synchronize the private state of contracts again.
131
+ // Therefore, we clear the contract synchronization cache here such that the sync is re-triggered upon new
132
+ // execution.
133
+ this.contractSyncService.wipe();
128
134
  this.log.verbose(`Updated pxe last block to ${blockHeader.getBlockNumber()}`, blockHeader.toInspect());
129
135
  await this.anchorBlockStore.setHeader(blockHeader);
130
136
  }
@@ -1,3 +1,3 @@
1
1
  export function getPackageInfo() {
2
- return { version: '4.0.0', name: '@aztec/pxe' };
2
+ return { version: '5.0.0', name: '@aztec/pxe' };
3
3
  }