@aztec/pxe 0.0.1-commit.6230a0c → 0.0.1-commit.643667a5cb

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 (128) 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 -28
  9. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  10. package/dest/contract_function_simulator/contract_function_simulator.js +174 -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 +2 -2
  16. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/oracle/oracle.d.ts +2 -2
  18. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  19. package/dest/contract_function_simulator/oracle/oracle.js +3 -3
  20. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +36 -35
  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 +64 -19
  23. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +32 -11
  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 +57 -31
  26. package/dest/contract_logging.d.ts +22 -0
  27. package/dest/contract_logging.d.ts.map +1 -0
  28. package/dest/contract_logging.js +23 -0
  29. package/dest/contract_sync/contract_sync_service.d.ts +43 -0
  30. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
  31. package/dest/contract_sync/contract_sync_service.js +97 -0
  32. package/dest/contract_sync/helpers.d.ts +29 -0
  33. package/dest/contract_sync/helpers.d.ts.map +1 -0
  34. package/dest/contract_sync/{index.js → helpers.js} +8 -14
  35. package/dest/debug/pxe_debug_utils.d.ts +14 -10
  36. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  37. package/dest/debug/pxe_debug_utils.js +16 -15
  38. package/dest/entrypoints/client/bundle/index.d.ts +4 -1
  39. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  40. package/dest/entrypoints/client/bundle/index.js +3 -0
  41. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  42. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  43. package/dest/entrypoints/client/bundle/utils.js +9 -1
  44. package/dest/entrypoints/client/lazy/index.d.ts +4 -1
  45. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  46. package/dest/entrypoints/client/lazy/index.js +3 -0
  47. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  48. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  49. package/dest/entrypoints/client/lazy/utils.js +9 -1
  50. package/dest/entrypoints/server/index.d.ts +4 -2
  51. package/dest/entrypoints/server/index.d.ts.map +1 -1
  52. package/dest/entrypoints/server/index.js +3 -1
  53. package/dest/entrypoints/server/utils.js +9 -1
  54. package/dest/logs/log_service.d.ts +3 -2
  55. package/dest/logs/log_service.d.ts.map +1 -1
  56. package/dest/logs/log_service.js +5 -10
  57. package/dest/notes/note_service.d.ts +4 -3
  58. package/dest/notes/note_service.d.ts.map +1 -1
  59. package/dest/notes/note_service.js +3 -2
  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 +2 -2
  64. package/dest/oracle_version.js +2 -2
  65. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  66. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  67. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  68. package/dest/private_kernel/hints/index.d.ts +1 -1
  69. package/dest/private_kernel/hints/index.js +1 -1
  70. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +4 -4
  71. package/dest/private_kernel/private_kernel_execution_prover.js +6 -6
  72. package/dest/private_kernel/private_kernel_oracle.d.ts +6 -2
  73. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  74. package/dest/private_kernel/private_kernel_oracle.js +7 -3
  75. package/dest/pxe.d.ts +69 -23
  76. package/dest/pxe.d.ts.map +1 -1
  77. package/dest/pxe.js +92 -60
  78. package/dest/storage/contract_store/contract_store.d.ts +42 -15
  79. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  80. package/dest/storage/contract_store/contract_store.js +145 -69
  81. package/dest/storage/note_store/note_store.d.ts +3 -3
  82. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  83. package/dest/storage/note_store/note_store.js +6 -4
  84. package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
  85. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
  86. package/dest/tagging/get_all_logs_by_tags.js +17 -3
  87. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +4 -4
  88. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
  89. package/package.json +25 -16
  90. package/src/access_scopes.ts +9 -0
  91. package/src/block_synchronizer/block_synchronizer.ts +6 -0
  92. package/src/config/package_info.ts +1 -1
  93. package/src/contract_function_simulator/contract_function_simulator.ts +330 -128
  94. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  95. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  96. package/src/contract_function_simulator/oracle/interfaces.ts +1 -1
  97. package/src/contract_function_simulator/oracle/oracle.ts +3 -3
  98. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +85 -96
  99. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +102 -29
  100. package/src/contract_logging.ts +39 -0
  101. package/src/contract_sync/contract_sync_service.ts +152 -0
  102. package/src/contract_sync/{index.ts → helpers.ts} +13 -34
  103. package/src/debug/pxe_debug_utils.ts +48 -18
  104. package/src/entrypoints/client/bundle/index.ts +3 -0
  105. package/src/entrypoints/client/bundle/utils.ts +9 -1
  106. package/src/entrypoints/client/lazy/index.ts +3 -0
  107. package/src/entrypoints/client/lazy/utils.ts +9 -1
  108. package/src/entrypoints/server/index.ts +3 -1
  109. package/src/entrypoints/server/utils.ts +7 -7
  110. package/src/logs/log_service.ts +7 -19
  111. package/src/notes/note_service.ts +4 -3
  112. package/src/notes_filter.ts +26 -0
  113. package/src/oracle_version.ts +2 -2
  114. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  115. package/src/private_kernel/hints/index.ts +1 -1
  116. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +7 -7
  117. package/src/private_kernel/private_kernel_execution_prover.ts +6 -6
  118. package/src/private_kernel/private_kernel_oracle.ts +7 -7
  119. package/src/pxe.ts +173 -112
  120. package/src/storage/contract_store/contract_store.ts +174 -75
  121. package/src/storage/note_store/note_store.ts +12 -5
  122. package/src/tagging/get_all_logs_by_tags.ts +28 -4
  123. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +4 -4
  124. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  125. package/dest/contract_sync/index.d.ts +0 -24
  126. package/dest/contract_sync/index.d.ts.map +0 -1
  127. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  128. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
@@ -26,7 +26,7 @@ import {
26
26
  type PrivateKernelSimulateOutput,
27
27
  ReadRequestActionEnum,
28
28
  ReadRequestResetActions,
29
- type ScopedKeyValidationRequestAndGenerator,
29
+ type ScopedKeyValidationRequestAndSeparator,
30
30
  ScopedNoteHash,
31
31
  ScopedNullifier,
32
32
  ScopedReadRequest,
@@ -68,9 +68,9 @@ function getNullifierMembershipWitnessResolver(oracle: PrivateKernelOracle) {
68
68
  };
69
69
  }
70
70
 
71
- async function getMasterSecretKeysAndAppKeyGenerators(
71
+ async function getMasterSecretKeysAndKeyTypeDomainSeparators(
72
72
  keyValidationRequests: ClaimedLengthArray<
73
- ScopedKeyValidationRequestAndGenerator,
73
+ ScopedKeyValidationRequestAndSeparator,
74
74
  typeof MAX_KEY_VALIDATION_REQUESTS_PER_TX
75
75
  >,
76
76
  numRequestsToVerify: number,
@@ -189,8 +189,8 @@ export class PrivateKernelResetPrivateInputsBuilder {
189
189
  this.previousKernel.validationRequests.nullifierReadRequests,
190
190
  this.nullifierResetActions,
191
191
  ),
192
- getMasterSecretKeysAndAppKeyGenerators(
193
- this.previousKernel.validationRequests.scopedKeyValidationRequestsAndGenerators,
192
+ getMasterSecretKeysAndKeyTypeDomainSeparators(
193
+ this.previousKernel.validationRequests.scopedKeyValidationRequestsAndSeparators,
194
194
  dimensions.KEY_VALIDATION,
195
195
  oracle,
196
196
  ),
@@ -357,8 +357,8 @@ export class PrivateKernelResetPrivateInputsBuilder {
357
357
  }
358
358
 
359
359
  private needsResetNullifierKeys() {
360
- const numCurr = this.previousKernel.validationRequests.scopedKeyValidationRequestsAndGenerators.claimedLength;
361
- const numNext = this.nextIteration ? this.nextIteration.keyValidationRequestsAndGenerators.claimedLength : 0;
360
+ const numCurr = this.previousKernel.validationRequests.scopedKeyValidationRequestsAndSeparators.claimedLength;
361
+ const numNext = this.nextIteration ? this.nextIteration.keyValidationRequestsAndSeparators.claimedLength : 0;
362
362
  const maxAmountToKeep = !this.nextIteration ? 0 : MAX_KEY_VALIDATION_REQUESTS_PER_TX;
363
363
  if (numCurr + numNext <= maxAmountToKeep) {
364
364
  return false;
@@ -260,20 +260,20 @@ export class PrivateKernelExecutionProver {
260
260
  // TODO: Enable padding once we better understand the final amounts to pad to.
261
261
  const paddedSideEffectAmounts = PaddedSideEffectAmounts.empty();
262
262
 
263
- // Use the aggregated includeByTimestamp set throughout the tx execution.
264
- // TODO: Call `computeTxIncludeByTimestamp` to round the value down and reduce precision, improving privacy.
265
- const includeByTimestampUpperBound = previousKernelData.publicInputs.includeByTimestamp;
263
+ // Use the aggregated expirationTimestamp set throughout the tx execution.
264
+ // TODO: Call `computeTxExpirationTimestamp` to round the value down and reduce precision, improving privacy.
265
+ const expirationTimestampUpperBound = previousKernelData.publicInputs.expirationTimestamp;
266
266
  const anchorBlockTimestamp = previousKernelData.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp;
267
- if (includeByTimestampUpperBound <= anchorBlockTimestamp) {
267
+ if (expirationTimestampUpperBound <= anchorBlockTimestamp) {
268
268
  throw new Error(
269
- `Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${includeByTimestampUpperBound}.`,
269
+ `Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${expirationTimestampUpperBound}.`,
270
270
  );
271
271
  }
272
272
 
273
273
  const privateInputs = new PrivateKernelTailCircuitPrivateInputs(
274
274
  previousKernelData,
275
275
  paddedSideEffectAmounts,
276
- includeByTimestampUpperBound,
276
+ expirationTimestampUpperBound,
277
277
  );
278
278
 
279
279
  const witgenTimer = new Timer();
@@ -8,11 +8,7 @@ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
8
8
  import type { FunctionSelector } from '@aztec/stdlib/abi';
9
9
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
10
10
  import { BlockHash } from '@aztec/stdlib/block';
11
- import {
12
- type ContractInstanceWithAddress,
13
- computeContractClassIdPreimage,
14
- computeSaltedInitializationHash,
15
- } from '@aztec/stdlib/contract';
11
+ import { type ContractInstanceWithAddress, computeSaltedInitializationHash } from '@aztec/stdlib/contract';
16
12
  import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
17
13
  import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
18
14
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
@@ -49,11 +45,15 @@ export class PrivateKernelOracle {
49
45
 
50
46
  /** Retrieves the preimage of a contract class id from the contract classes db. */
51
47
  public async getContractClassIdPreimage(contractClassId: Fr) {
52
- const contractClass = await this.contractStore.getContractClass(contractClassId);
48
+ const contractClass = await this.contractStore.getContractClassWithPreimage(contractClassId);
53
49
  if (!contractClass) {
54
50
  throw new Error(`Contract class not found when getting class id preimage. Class id: ${contractClassId}.`);
55
51
  }
56
- return computeContractClassIdPreimage(contractClass);
52
+ return {
53
+ artifactHash: contractClass.artifactHash,
54
+ privateFunctionsRoot: contractClass.privateFunctionsRoot,
55
+ publicBytecodeCommitment: contractClass.publicBytecodeCommitment,
56
+ };
57
57
  }
58
58
 
59
59
  /** Returns a membership witness with the sibling path and leaf index in our private functions tree. */