@aztec/pxe 0.0.1-commit.b655e406 → 0.0.1-commit.fce3e4f

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 (149) hide show
  1. package/dest/bin/check_oracle_version.d.ts +1 -1
  2. package/dest/config/index.d.ts +2 -10
  3. package/dest/config/index.d.ts.map +1 -1
  4. package/dest/config/index.js +7 -13
  5. package/dest/config/package_info.d.ts +1 -1
  6. package/dest/contract_function_simulator/contract_function_simulator.d.ts +4 -4
  7. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  8. package/dest/contract_function_simulator/contract_function_simulator.js +9 -10
  9. package/dest/contract_function_simulator/execution_data_provider.d.ts +2 -11
  10. package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -1
  11. package/dest/contract_function_simulator/execution_note_cache.d.ts +6 -5
  12. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  13. package/dest/contract_function_simulator/execution_note_cache.js +17 -10
  14. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +1 -1
  15. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  16. package/dest/contract_function_simulator/hashed_values_cache.d.ts +1 -1
  17. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
  18. package/dest/contract_function_simulator/index.d.ts +1 -1
  19. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +1 -1
  20. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  21. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +1 -1
  22. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
  24. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  25. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +4 -3
  26. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  27. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +9 -3
  28. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +1 -1
  29. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  30. package/dest/contract_function_simulator/oracle/index.d.ts +1 -1
  31. package/dest/contract_function_simulator/oracle/interfaces.d.ts +5 -2
  32. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  33. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +1 -3
  34. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  35. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +5 -3
  36. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  37. package/dest/contract_function_simulator/oracle/note_packing_utils.js +4 -3
  38. package/dest/contract_function_simulator/oracle/oracle.d.ts +4 -3
  39. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  40. package/dest/contract_function_simulator/oracle/oracle.js +9 -4
  41. package/dest/contract_function_simulator/oracle/private_execution.d.ts +1 -1
  42. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +4 -9
  43. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  44. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +13 -2
  45. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +2 -3
  46. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  47. package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
  48. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
  49. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  50. package/dest/contract_function_simulator/proxied_node.d.ts +1 -1
  51. package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -1
  52. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +3 -3
  53. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
  54. package/dest/contract_function_simulator/pxe_oracle_interface.js +8 -15
  55. package/dest/entrypoints/client/bundle/index.d.ts +1 -1
  56. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  57. package/dest/entrypoints/client/bundle/utils.js +2 -2
  58. package/dest/entrypoints/client/lazy/index.d.ts +1 -1
  59. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  60. package/dest/entrypoints/client/lazy/utils.js +2 -2
  61. package/dest/entrypoints/pxe_creation_options.d.ts +1 -1
  62. package/dest/entrypoints/server/index.d.ts +1 -1
  63. package/dest/entrypoints/server/utils.d.ts +1 -1
  64. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  65. package/dest/entrypoints/server/utils.js +4 -15
  66. package/dest/error_enriching.d.ts +1 -1
  67. package/dest/oracle_version.d.ts +3 -3
  68. package/dest/oracle_version.js +2 -2
  69. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +3 -3
  70. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
  71. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +7 -7
  72. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +1 -1
  73. package/dest/private_kernel/hints/index.d.ts +1 -1
  74. package/dest/private_kernel/index.d.ts +1 -1
  75. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  76. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  77. package/dest/private_kernel/private_kernel_execution_prover.js +7 -6
  78. package/dest/private_kernel/private_kernel_oracle.d.ts +1 -1
  79. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +2 -2
  80. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
  81. package/dest/pxe.d.ts +20 -13
  82. package/dest/pxe.d.ts.map +1 -1
  83. package/dest/pxe.js +19 -37
  84. package/dest/storage/address_data_provider/address_data_provider.d.ts +1 -1
  85. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -1
  86. package/dest/storage/address_data_provider/index.d.ts +1 -1
  87. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +1 -1
  88. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
  89. package/dest/storage/capsule_data_provider/index.d.ts +1 -1
  90. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +2 -12
  91. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
  92. package/dest/storage/contract_data_provider/contract_data_provider.js +0 -12
  93. package/dest/storage/contract_data_provider/index.d.ts +1 -1
  94. package/dest/storage/contract_data_provider/private_functions_tree.d.ts +1 -1
  95. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
  96. package/dest/storage/index.d.ts +1 -1
  97. package/dest/storage/metadata.d.ts +1 -1
  98. package/dest/storage/note_data_provider/index.d.ts +2 -2
  99. package/dest/storage/note_data_provider/index.d.ts.map +1 -1
  100. package/dest/storage/note_data_provider/index.js +1 -1
  101. package/dest/storage/note_data_provider/note_data_provider.d.ts +2 -2
  102. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
  103. package/dest/storage/note_data_provider/note_data_provider.js +13 -10
  104. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +2 -8
  105. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -1
  106. package/dest/storage/private_event_data_provider/private_event_data_provider.js +3 -2
  107. package/dest/storage/sync_data_provider/index.d.ts +1 -1
  108. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +1 -1
  109. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +1 -1
  110. package/dest/storage/tagging_data_provider/index.d.ts +1 -1
  111. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +1 -1
  112. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +1 -1
  113. package/dest/synchronizer/index.d.ts +1 -1
  114. package/dest/synchronizer/synchronizer.d.ts +1 -1
  115. package/dest/synchronizer/synchronizer.d.ts.map +1 -1
  116. package/dest/tagging/constants.d.ts +1 -1
  117. package/dest/tagging/index.d.ts +1 -1
  118. package/dest/tagging/siloed_tag.d.ts +1 -1
  119. package/dest/tagging/siloed_tag.d.ts.map +1 -1
  120. package/dest/tagging/tag.d.ts +1 -1
  121. package/dest/tagging/tag.d.ts.map +1 -1
  122. package/dest/tagging/utils.d.ts +1 -1
  123. package/package.json +20 -19
  124. package/src/config/index.ts +8 -23
  125. package/src/contract_function_simulator/contract_function_simulator.ts +17 -12
  126. package/src/contract_function_simulator/execution_data_provider.ts +1 -11
  127. package/src/contract_function_simulator/execution_note_cache.ts +15 -8
  128. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
  129. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +10 -1
  130. package/src/contract_function_simulator/oracle/interfaces.ts +11 -1
  131. package/src/contract_function_simulator/oracle/note_packing_utils.ts +5 -3
  132. package/src/contract_function_simulator/oracle/oracle.ts +10 -2
  133. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +9 -1
  134. package/src/contract_function_simulator/pxe_oracle_interface.ts +20 -31
  135. package/src/entrypoints/client/bundle/utils.ts +2 -2
  136. package/src/entrypoints/client/lazy/utils.ts +2 -2
  137. package/src/entrypoints/server/utils.ts +4 -18
  138. package/src/oracle_version.ts +2 -2
  139. package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +4 -8
  140. package/src/private_kernel/private_kernel_execution_prover.ts +7 -12
  141. package/src/pxe.ts +36 -64
  142. package/src/storage/contract_data_provider/contract_data_provider.ts +0 -17
  143. package/src/storage/note_data_provider/index.ts +1 -1
  144. package/src/storage/note_data_provider/note_data_provider.ts +15 -9
  145. package/src/storage/private_event_data_provider/private_event_data_provider.ts +4 -9
  146. package/dest/storage/note_data_provider/note_dao.d.ts +0 -100
  147. package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
  148. package/dest/storage/note_data_provider/note_dao.js +0 -102
  149. package/src/storage/note_data_provider/note_dao.ts +0 -154
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.0.1-commit.b655e406",
3
+ "version": "0.0.1-commit.fce3e4f",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./server": "./dest/entrypoints/server/index.js",
@@ -11,8 +11,8 @@
11
11
  },
12
12
  "bin": "./dest/bin/index.js",
13
13
  "scripts": {
14
- "build": "yarn clean && yarn generate && tsc -b",
15
- "build:dev": "tsc -b --watch",
14
+ "build": "yarn clean && yarn generate && tsgo -b",
15
+ "build:dev": "tsgo -b --watch",
16
16
  "clean": "rm -rf ./dest .tsbuildinfo ./src/config/package_info.ts",
17
17
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
18
18
  "generate": "node ./scripts/generate_package_info.js",
@@ -61,34 +61,35 @@
61
61
  ]
62
62
  },
63
63
  "dependencies": {
64
- "@aztec/bb-prover": "0.0.1-commit.b655e406",
65
- "@aztec/bb.js": "0.0.1-commit.b655e406",
66
- "@aztec/builder": "0.0.1-commit.b655e406",
67
- "@aztec/constants": "0.0.1-commit.b655e406",
68
- "@aztec/ethereum": "0.0.1-commit.b655e406",
69
- "@aztec/foundation": "0.0.1-commit.b655e406",
70
- "@aztec/key-store": "0.0.1-commit.b655e406",
71
- "@aztec/kv-store": "0.0.1-commit.b655e406",
72
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.b655e406",
73
- "@aztec/noir-types": "0.0.1-commit.b655e406",
74
- "@aztec/protocol-contracts": "0.0.1-commit.b655e406",
75
- "@aztec/simulator": "0.0.1-commit.b655e406",
76
- "@aztec/stdlib": "0.0.1-commit.b655e406",
64
+ "@aztec/bb-prover": "0.0.1-commit.fce3e4f",
65
+ "@aztec/bb.js": "0.0.1-commit.fce3e4f",
66
+ "@aztec/builder": "0.0.1-commit.fce3e4f",
67
+ "@aztec/constants": "0.0.1-commit.fce3e4f",
68
+ "@aztec/ethereum": "0.0.1-commit.fce3e4f",
69
+ "@aztec/foundation": "0.0.1-commit.fce3e4f",
70
+ "@aztec/key-store": "0.0.1-commit.fce3e4f",
71
+ "@aztec/kv-store": "0.0.1-commit.fce3e4f",
72
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.fce3e4f",
73
+ "@aztec/noir-types": "0.0.1-commit.fce3e4f",
74
+ "@aztec/protocol-contracts": "0.0.1-commit.fce3e4f",
75
+ "@aztec/simulator": "0.0.1-commit.fce3e4f",
76
+ "@aztec/stdlib": "0.0.1-commit.fce3e4f",
77
77
  "koa": "^2.16.1",
78
78
  "koa-router": "^13.1.1",
79
79
  "lodash.omit": "^4.5.0",
80
80
  "sha3": "^2.1.4",
81
81
  "tslib": "^2.4.0",
82
- "viem": "npm:@spalladino/viem@2.38.2-eip7594.0"
82
+ "viem": "npm:@aztec/viem@2.38.2"
83
83
  },
84
84
  "devDependencies": {
85
- "@aztec/merkle-tree": "0.0.1-commit.b655e406",
86
- "@aztec/noir-test-contracts.js": "0.0.1-commit.b655e406",
85
+ "@aztec/merkle-tree": "0.0.1-commit.fce3e4f",
86
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.fce3e4f",
87
87
  "@jest/globals": "^30.0.0",
88
88
  "@types/jest": "^30.0.0",
89
89
  "@types/lodash.omit": "^4.5.7",
90
90
  "@types/lodash.times": "^4.3.9",
91
91
  "@types/node": "^22.15.17",
92
+ "@typescript/native-preview": "7.0.0-dev.20251126.1",
92
93
  "jest": "^30.0.0",
93
94
  "jest-mock-extended": "^4.0.0",
94
95
  "lodash.times": "^4.3.2",
@@ -10,15 +10,6 @@ import { type ChainConfig, chainConfigMappings } from '@aztec/stdlib/config';
10
10
 
11
11
  export { getPackageInfo } from './package_info.js';
12
12
 
13
- /**
14
- * Temporary configuration until WASM can be used instead of native
15
- */
16
- export interface BBProverConfig {
17
- bbWorkingDirectory?: string;
18
- bbBinaryPath?: string;
19
- bbSkipCleanup?: boolean;
20
- }
21
-
22
13
  /**
23
14
  * Configuration settings for the prover factory
24
15
  */
@@ -35,7 +26,7 @@ export interface SynchronizerConfig {
35
26
  l2BlockBatchSize: number;
36
27
  }
37
28
 
38
- export type PXEConfig = KernelProverConfig & BBProverConfig & DataStoreConfig & ChainConfig & SynchronizerConfig;
29
+ export type PXEConfig = KernelProverConfig & DataStoreConfig & ChainConfig & SynchronizerConfig;
39
30
 
40
31
  export type CliPXEOptions = {
41
32
  /** Custom Aztec Node URL to connect to */
@@ -50,19 +41,13 @@ export const pxeConfigMappings: ConfigMappingsType<PXEConfig> = {
50
41
  ...numberConfigHelper(50),
51
42
  description: 'Maximum amount of blocks to pull from the stream in one request when synchronizing',
52
43
  },
53
- bbBinaryPath: {
54
- env: 'BB_BINARY_PATH',
55
- description: 'Path to the BB binary',
56
- },
57
- bbWorkingDirectory: {
58
- env: 'BB_WORKING_DIRECTORY',
59
- description: 'Working directory for the BB binary',
60
- },
61
- bbSkipCleanup: {
62
- env: 'BB_SKIP_CLEANUP',
63
- description: 'True to skip cleanup of temporary files for debugging purposes',
64
- ...booleanConfigHelper(),
65
- },
44
+ // TODO: We're losing this feature in moving to bb.js api.
45
+ // Reimplement it as a setting that dumps the msgpack data on the bb.js backend if needed.
46
+ // bbSkipCleanup: {
47
+ // env: 'BB_SKIP_CLEANUP',
48
+ // description: 'True to skip cleanup of temporary files for debugging purposes',
49
+ // ...booleanConfigHelper(),
50
+ // },
66
51
  proverEnabled: {
67
52
  env: 'PXE_PROVER_ENABLED',
68
53
  description: 'Enable real proofs',
@@ -32,12 +32,18 @@ import {
32
32
  toACVMWitness,
33
33
  witnessMapToFields,
34
34
  } from '@aztec/simulator/client';
35
- import type { AbiDecoded, FunctionCall } from '@aztec/stdlib/abi';
36
- import { FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
35
+ import type { FunctionCall } from '@aztec/stdlib/abi';
36
+ import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
37
37
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
38
38
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
39
39
  import { Gas } from '@aztec/stdlib/gas';
40
- import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
40
+ import {
41
+ computeNoteHashNonce,
42
+ computeProtocolNullifier,
43
+ computeUniqueNoteHash,
44
+ siloNoteHash,
45
+ siloNullifier,
46
+ } from '@aztec/stdlib/hash';
41
47
  import {
42
48
  PartialPrivateTailPublicInputsForPublic,
43
49
  PartialPrivateTailPublicInputsForRollup,
@@ -123,7 +129,7 @@ export class ContractFunctionSimulator {
123
129
  }
124
130
 
125
131
  // reserve the first side effect for the tx hash (inserted by the private kernel)
126
- const startSideEffectCounter = 1;
132
+ const startSideEffectCounter = 2;
127
133
 
128
134
  const callContext = new CallContext(
129
135
  msgSender,
@@ -132,8 +138,8 @@ export class ContractFunctionSimulator {
132
138
  entryPointArtifact.isStatic,
133
139
  );
134
140
 
135
- const txRequestHash = await request.toTxRequest().hash();
136
- const noteCache = new ExecutionNoteCache(txRequestHash);
141
+ const protocolNullifier = await computeProtocolNullifier(await request.toTxRequest().hash());
142
+ const noteCache = new ExecutionNoteCache(protocolNullifier);
137
143
  const taggingIndexCache = new ExecutionTaggingIndexCache();
138
144
 
139
145
  const privateExecutionOracle = new PrivateExecutionOracle(
@@ -170,8 +176,8 @@ export class ContractFunctionSimulator {
170
176
  request.functionSelector,
171
177
  );
172
178
  const simulatorTeardownTimer = new Timer();
173
- const { usedTxRequestHashForNonces } = noteCache.finish();
174
- const firstNullifierHint = usedTxRequestHashForNonces ? Fr.ZERO : noteCache.getAllNullifiers()[0];
179
+ const { usedProtocolNullifierForNonces } = noteCache.finish();
180
+ const firstNullifierHint = usedProtocolNullifierForNonces ? Fr.ZERO : noteCache.getAllNullifiers()[0];
175
181
 
176
182
  const publicCallRequests = collectNested([executionResult], r =>
177
183
  r.publicInputs.publicCallRequests
@@ -209,9 +215,9 @@ export class ContractFunctionSimulator {
209
215
  * @param authwits - Authentication witnesses required for the function call.
210
216
  * @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
211
217
  * accounts if not specified.
212
- * @returns A decoded ABI value containing the function's return data.
218
+ * @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
213
219
  */
214
- public async runUtility(call: FunctionCall, authwits: AuthWitness[], scopes?: AztecAddress[]): Promise<AbiDecoded> {
220
+ public async runUtility(call: FunctionCall, authwits: AuthWitness[], scopes?: AztecAddress[]): Promise<Fr[]> {
215
221
  await verifyCurrentClassId(call.to, this.executionDataProvider);
216
222
 
217
223
  const entryPointArtifact = await this.executionDataProvider.getFunctionArtifact(call.to, call.selector);
@@ -244,9 +250,8 @@ export class ContractFunctionSimulator {
244
250
  );
245
251
  });
246
252
 
247
- const returnWitness = witnessMapToFields(acirExecutionResult.returnWitness);
248
253
  this.log.verbose(`Utility simulation for ${call.to}.${call.selector} completed`);
249
- return decodeFromAbi(entryPointArtifact.returnTypes, returnWitness);
254
+ return witnessMapToFields(acirExecutionResult.returnWitness);
250
255
  } catch (err) {
251
256
  throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
252
257
  }
@@ -1,6 +1,6 @@
1
1
  import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
2
2
  import type { Fr, Point } from '@aztec/foundation/fields';
3
- import type { FunctionArtifact, FunctionArtifactWithContractName, FunctionSelector } from '@aztec/stdlib/abi';
3
+ import type { FunctionArtifactWithContractName, FunctionSelector } from '@aztec/stdlib/abi';
4
4
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
5
  import type { L2Block } from '@aztec/stdlib/block';
6
6
  import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
@@ -106,16 +106,6 @@ export interface ExecutionDataProvider {
106
106
  */
107
107
  getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
108
108
 
109
- /**
110
- * Retrieves the artifact of a specified function within a given contract.
111
- * The function is identified by its name, which is unique within a contract.
112
- *
113
- * @param contractAddress - The AztecAddress representing the contract containing the function.
114
- * @param functionName - The name of the function.
115
- * @returns The corresponding function's artifact as an object.
116
- */
117
- getFunctionArtifactByName(contractAddress: AztecAddress, functionName: string): Promise<FunctionArtifact | undefined>;
118
-
119
109
  /**
120
110
  * Gets the index of a nullifier in the nullifier tree.
121
111
  * @param nullifier - The nullifier.
@@ -44,9 +44,9 @@ export class ExecutionNoteCache {
44
44
  * We don't need to use the tx request hash for nonces if another non revertible nullifier is emitted.
45
45
  * In that case we disable injecting the tx request hash as a nullifier.
46
46
  */
47
- private usedTxRequestHashForNonces = true;
47
+ private usedProtocolNullifierForNonces = true;
48
48
 
49
- constructor(private readonly txRequestHash: Fr) {}
49
+ constructor(private readonly protocolNullifier: Fr) {}
50
50
 
51
51
  /**
52
52
  * Enters the revertible phase of the transaction.
@@ -60,12 +60,11 @@ export class ExecutionNoteCache {
60
60
  }
61
61
  this.inRevertiblePhase = true;
62
62
  this.minRevertibleSideEffectCounter = minRevertibleSideEffectCounter;
63
-
64
- let nonceGenerator = this.txRequestHash;
63
+ let nonceGenerator = this.protocolNullifier;
65
64
  const nullifiers = this.getAllNullifiers();
66
65
  if (nullifiers.length > 0) {
67
66
  nonceGenerator = new Fr(nullifiers[0]);
68
- this.usedTxRequestHashForNonces = false;
67
+ this.usedProtocolNullifierForNonces = false;
69
68
  }
70
69
 
71
70
  // The existing pending notes are all non-revertible.
@@ -92,14 +91,22 @@ export class ExecutionNoteCache {
92
91
  updatedNotes.forEach(n => this.#addNote(n));
93
92
  }
94
93
 
94
+ public isSideEffectCounterRevertible(sideEffectCounter: number): boolean {
95
+ if (!this.inRevertiblePhase) {
96
+ return false;
97
+ }
98
+ return sideEffectCounter >= this.minRevertibleSideEffectCounter;
99
+ }
100
+
95
101
  public finish() {
96
- // If we never entered the revertible phase, we need to use the tx request hash as a nonce for the notes if no nullifiers have been emitted.
102
+ // If we never entered the revertible phase, we need to use the protocol nullifier to compute the nonces for the
103
+ // notes if no nullifiers have been emitted.
97
104
  if (!this.inRevertiblePhase) {
98
- this.usedTxRequestHashForNonces = this.getAllNullifiers().length === 0;
105
+ this.usedProtocolNullifierForNonces = this.getAllNullifiers().length === 0;
99
106
  }
100
107
  // If we entered the revertible phase, the nonce generator was decided based on wether or not a nullifier was emitted before entering.
101
108
  return {
102
- usedTxRequestHashForNonces: this.usedTxRequestHashForNonces,
109
+ usedProtocolNullifierForNonces: this.usedProtocolNullifierForNonces,
103
110
  };
104
111
  }
105
112
 
@@ -42,7 +42,7 @@ export class LogRetrievalResponse {
42
42
  return range(serializationLen).map(_ => Fr.zero());
43
43
  }
44
44
 
45
- static toSerializedOption(response?: LogRetrievalResponse): Fr[] {
45
+ static toSerializedOption(response: LogRetrievalResponse | null): Fr[] {
46
46
  if (response) {
47
47
  return [new Fr(1), ...response.toFields()];
48
48
  } else {
@@ -4,7 +4,7 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import { TxHash } from '@aztec/stdlib/tx';
5
5
 
6
6
  // TODO(#14617): should we compute this from constants? This value is aztec-nr specific.
7
- export const MAX_NOTE_PACKED_LEN = 12;
7
+ export const MAX_NOTE_PACKED_LEN = 11;
8
8
 
9
9
  /**
10
10
  * Intermediate struct used to perform batch note validation by PXE. The `utilityValidateEnqueuedNotesAndEvents` oracle
@@ -14,6 +14,7 @@ export class NoteValidationRequest {
14
14
  constructor(
15
15
  public contractAddress: AztecAddress,
16
16
  public storageSlot: Fr,
17
+ public randomness: Fr,
17
18
  public noteNonce: Fr,
18
19
  public content: Fr[],
19
20
  public noteHash: Fr,
@@ -27,6 +28,7 @@ export class NoteValidationRequest {
27
28
 
28
29
  const contractAddress = AztecAddress.fromField(reader.readField());
29
30
  const storageSlot = reader.readField();
31
+ const randomness = reader.readField();
30
32
  const noteNonce = reader.readField();
31
33
 
32
34
  const contentStorage = reader.readFieldArray(MAX_NOTE_PACKED_LEN);
@@ -38,9 +40,16 @@ export class NoteValidationRequest {
38
40
  const txHash = TxHash.fromField(reader.readField());
39
41
  const recipient = AztecAddress.fromField(reader.readField());
40
42
 
43
+ if (reader.remainingFields() !== 0) {
44
+ throw new Error(
45
+ `Error converting array of fields to NoteValidationRequest. Hint: check that MAX_NOTE_PACKED_LEN is consistent with private_notes::MAX_NOTE_PACKED_LEN in Aztec-nr.`,
46
+ );
47
+ }
48
+
41
49
  return new NoteValidationRequest(
42
50
  contractAddress,
43
51
  storageSlot,
52
+ randomness,
44
53
  noteNonce,
45
54
  content,
46
55
  noteHash,
@@ -23,6 +23,8 @@ export interface NoteData {
23
23
  contractAddress: AztecAddress;
24
24
  /** The storage slot of the note. */
25
25
  storageSlot: Fr;
26
+ /** The randomness injected to the note */
27
+ randomness: Fr;
26
28
  /** The nonce injected into the note hash preimage by kernels. */
27
29
  noteNonce: Fr;
28
30
  /** A hash of the note as it gets stored in the note hash tree. */
@@ -129,7 +131,14 @@ export interface IPrivateExecutionOracle {
129
131
 
130
132
  privateStoreInExecutionCache(values: Fr[], hash: Fr): void;
131
133
  privateLoadFromExecutionCache(hash: Fr): Promise<Fr[]>;
132
- privateNotifyCreatedNote(storageSlot: Fr, noteTypeId: NoteSelector, note: Fr[], noteHash: Fr, counter: number): void;
134
+ privateNotifyCreatedNote(
135
+ storageSlot: Fr,
136
+ randomness: Fr,
137
+ noteTypeId: NoteSelector,
138
+ note: Fr[],
139
+ noteHash: Fr,
140
+ counter: number,
141
+ ): void;
133
142
  privateNotifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number): Promise<void>;
134
143
  privateNotifyCreatedNullifier(innerNullifier: Fr): Promise<void>;
135
144
  privateNotifyCreatedContractClassLog(log: ContractClassLog, counter: number): void;
@@ -153,6 +162,7 @@ export interface IPrivateExecutionOracle {
153
162
  isStaticCall: boolean,
154
163
  ): Promise<void>;
155
164
  privateNotifySetMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void>;
165
+ privateIsSideEffectCounterRevertible(sideEffectCounter: number): Promise<boolean>;
156
166
  privateGetSenderForTags(): Promise<AztecAddress | undefined>;
157
167
  privateSetSenderForTags(senderForTags: AztecAddress): Promise<void>;
158
168
  privateGetNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag>;
@@ -24,6 +24,7 @@ function fromRawData(nonzeroNoteHashCounter: boolean, maybeNoteNonce: Fr): { sta
24
24
  * and only after that it packs the retrieved note. Hence it doesn't map one to one with `RetrievedNote::pack()`.
25
25
  *
26
26
  * @param contractAddress - The address of the contract that owns the note
27
+ * @param randomness - The randomness injected into the note to get the hiding property of commitments
27
28
  * @param noteNonce - The nonce injected into the note hash preimage by kernels.
28
29
  * @param index - Optional index in the note hash tree. If undefined, indicates a transient note
29
30
  * @param note - The note content containing the actual note data
@@ -31,22 +32,23 @@ function fromRawData(nonzeroNoteHashCounter: boolean, maybeNoteNonce: Fr): { sta
31
32
  */
32
33
  export function packAsRetrievedNote({
33
34
  contractAddress,
35
+ randomness,
34
36
  noteNonce,
35
37
  index,
36
38
  note,
37
39
  }: {
38
40
  contractAddress: AztecAddress;
41
+ randomness: Fr;
39
42
  noteNonce: Fr;
40
43
  index?: bigint;
41
44
  note: Note;
42
45
  }) {
43
46
  // If index is undefined, the note is transient which implies that the nonzero_note_hash_counter has to be true
44
- const noteIsTransient = index === undefined;
45
- const nonzeroNoteHashCounter = noteIsTransient ? true : false;
47
+ const nonzeroNoteHashCounter = index === undefined;
46
48
 
47
49
  // To pack the note as retrieved note we first need to reconstruct the note metadata.
48
50
  const noteMetadata = fromRawData(nonzeroNoteHashCounter, noteNonce);
49
51
 
50
52
  // Pack metadata first (stage and maybe_note_nonce), followed by the rest
51
- return [...note.items, contractAddress, new Fr(noteMetadata.stage), noteMetadata.maybeNoteNonce];
53
+ return [...note.items, contractAddress, randomness, new Fr(noteMetadata.stage), noteMetadata.maybeNoteNonce];
52
54
  }
@@ -100,8 +100,7 @@ export class Oracle {
100
100
  return Promise.resolve([toACVMField(val)]);
101
101
  }
102
102
 
103
- // Since the argument is a slice, noir automatically adds a length field to oracle call.
104
- privateStoreInExecutionCache(_length: ACVMField[], values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
103
+ privateStoreInExecutionCache(values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
105
104
  this.handlerAsPrivate().privateStoreInExecutionCache(values.map(Fr.fromString), Fr.fromString(hash));
106
105
  return Promise.resolve([]);
107
106
  }
@@ -283,6 +282,7 @@ export class Oracle {
283
282
 
284
283
  privateNotifyCreatedNote(
285
284
  [storageSlot]: ACVMField[],
285
+ [randomness]: ACVMField[],
286
286
  [noteTypeId]: ACVMField[],
287
287
  note: ACVMField[],
288
288
  [noteHash]: ACVMField[],
@@ -290,6 +290,7 @@ export class Oracle {
290
290
  ): Promise<ACVMField[]> {
291
291
  this.handlerAsPrivate().privateNotifyCreatedNote(
292
292
  Fr.fromString(storageSlot),
293
+ Fr.fromString(randomness),
293
294
  NoteSelector.fromField(Fr.fromString(noteTypeId)),
294
295
  note.map(Fr.fromString),
295
296
  Fr.fromString(noteHash),
@@ -433,6 +434,13 @@ export class Oracle {
433
434
  return Promise.resolve([]);
434
435
  }
435
436
 
437
+ async privateIsSideEffectCounterRevertible([sideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
438
+ const isRevertible = await this.handlerAsPrivate().privateIsSideEffectCounterRevertible(
439
+ Fr.fromString(sideEffectCounter).toNumber(),
440
+ );
441
+ return Promise.resolve([toACVMField(isRevertible)]);
442
+ }
443
+
436
444
  async privateGetNextAppTagAsSender([sender]: ACVMField[], [recipient]: ACVMField[]): Promise<ACVMField[]> {
437
445
  const tag = await this.handlerAsPrivate().privateGetNextAppTagAsSender(
438
446
  AztecAddress.fromString(sender),
@@ -367,6 +367,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
367
367
  * It can be used in subsequent calls (or transactions when chaining txs is possible).
368
368
  * @param contractAddress - The contract address.
369
369
  * @param storageSlot - The storage slot.
370
+ * @param randomness - The randomness injected into the note.
370
371
  * @param noteTypeId - The type ID of the note.
371
372
  * @param noteItems - The items to be included in a Note.
372
373
  * @param noteHash - A hash of the new note.
@@ -374,6 +375,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
374
375
  */
375
376
  public privateNotifyCreatedNote(
376
377
  storageSlot: Fr,
378
+ randomness: Fr,
377
379
  noteTypeId: NoteSelector,
378
380
  noteItems: Fr[],
379
381
  noteHash: Fr,
@@ -382,6 +384,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
382
384
  this.log.debug(`Notified of new note with inner hash ${noteHash}`, {
383
385
  contractAddress: this.callContext.contractAddress,
384
386
  storageSlot,
387
+ randomness,
385
388
  noteTypeId,
386
389
  counter,
387
390
  });
@@ -391,6 +394,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
391
394
  {
392
395
  contractAddress: this.callContext.contractAddress,
393
396
  storageSlot,
397
+ randomness,
394
398
  noteNonce: Fr.ZERO, // Nonce cannot be known during private execution.
395
399
  note,
396
400
  siloedNullifier: undefined, // Siloed nullifier cannot be known for newly created note.
@@ -398,7 +402,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
398
402
  },
399
403
  counter,
400
404
  );
401
- this.newNotes.push(new NoteAndSlot(note, storageSlot, noteTypeId));
405
+ this.newNotes.push(NoteAndSlot.from({ note, storageSlot, randomness, noteTypeId }));
402
406
  }
403
407
 
404
408
  /**
@@ -594,6 +598,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
594
598
  return this.noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
595
599
  }
596
600
 
601
+ public privateIsSideEffectCounterRevertible(sideEffectCounter: number): Promise<boolean> {
602
+ return Promise.resolve(this.noteCache.isSideEffectCounterRevertible(sideEffectCounter));
603
+ }
604
+
597
605
  /**
598
606
  * Derives the call context for a nested execution.
599
607
  * @param targetContractAddress - The address of the contract being called.
@@ -3,12 +3,7 @@ import { timesParallel } from '@aztec/foundation/collection';
3
3
  import { Fr, Point } from '@aztec/foundation/fields';
4
4
  import { createLogger } from '@aztec/foundation/log';
5
5
  import type { KeyStore } from '@aztec/key-store';
6
- import {
7
- EventSelector,
8
- type FunctionArtifactWithContractName,
9
- FunctionSelector,
10
- getFunctionArtifact,
11
- } from '@aztec/stdlib/abi';
6
+ import { EventSelector, type FunctionArtifactWithContractName, FunctionSelector } from '@aztec/stdlib/abi';
12
7
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
13
8
  import type { InBlock, L2Block, L2BlockNumber } from '@aztec/stdlib/block';
14
9
  import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
@@ -26,6 +21,7 @@ import {
26
21
  } from '@aztec/stdlib/logs';
27
22
  import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
28
23
  import { Note, type NoteStatus } from '@aztec/stdlib/note';
24
+ import { NoteDao } from '@aztec/stdlib/note';
29
25
  import { MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
30
26
  import type { BlockHeader } from '@aztec/stdlib/tx';
31
27
  import { TxHash } from '@aztec/stdlib/tx';
@@ -36,7 +32,6 @@ import { ORACLE_VERSION } from '../oracle_version.js';
36
32
  import type { AddressDataProvider } from '../storage/address_data_provider/address_data_provider.js';
37
33
  import type { CapsuleDataProvider } from '../storage/capsule_data_provider/capsule_data_provider.js';
38
34
  import type { ContractDataProvider } from '../storage/contract_data_provider/contract_data_provider.js';
39
- import { NoteDao } from '../storage/note_data_provider/note_dao.js';
40
35
  import type { NoteDataProvider } from '../storage/note_data_provider/note_data_provider.js';
41
36
  import type { PrivateEventDataProvider } from '../storage/private_event_data_provider/private_event_data_provider.js';
42
37
  import type { SyncDataProvider } from '../storage/sync_data_provider/sync_data_provider.js';
@@ -102,16 +97,19 @@ export class PXEOracleInterface implements ExecutionDataProvider {
102
97
  status,
103
98
  scopes,
104
99
  });
105
- return noteDaos.map(({ contractAddress, storageSlot, noteNonce, note, noteHash, siloedNullifier, index }) => ({
106
- contractAddress,
107
- storageSlot,
108
- noteNonce,
109
- note,
110
- noteHash,
111
- siloedNullifier,
112
- // PXE can use this index to get full MembershipWitness
113
- index,
114
- }));
100
+ return noteDaos.map(
101
+ ({ contractAddress, storageSlot, randomness, noteNonce, note, noteHash, siloedNullifier, index }) => ({
102
+ contractAddress,
103
+ storageSlot,
104
+ randomness,
105
+ noteNonce,
106
+ note,
107
+ noteHash,
108
+ siloedNullifier,
109
+ // PXE can use this index to get full MembershipWitness
110
+ index,
111
+ }),
112
+ );
115
113
  }
116
114
 
117
115
  async getFunctionArtifact(
@@ -129,18 +127,6 @@ export class PXEOracleInterface implements ExecutionDataProvider {
129
127
  };
130
128
  }
131
129
 
132
- async getFunctionArtifactByName(
133
- contractAddress: AztecAddress,
134
- functionName: string,
135
- ): Promise<FunctionArtifactWithContractName | undefined> {
136
- const instance = await this.contractDataProvider.getContractInstance(contractAddress);
137
- if (!instance) {
138
- return;
139
- }
140
- const artifact = await this.contractDataProvider.getContractArtifact(instance.currentContractClassId);
141
- return artifact && getFunctionArtifact(artifact, functionName);
142
- }
143
-
144
130
  /**
145
131
  * Fetches a message from the db, given its key.
146
132
  * @param contractAddress - Address of a contract by which the message was emitted.
@@ -614,6 +600,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
614
600
  this.deliverNote(
615
601
  request.contractAddress,
616
602
  request.storageSlot,
603
+ request.randomness,
617
604
  request.noteNonce,
618
605
  request.content,
619
606
  request.noteHash,
@@ -644,6 +631,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
644
631
  async deliverNote(
645
632
  contractAddress: AztecAddress,
646
633
  storageSlot: Fr,
634
+ randomness: Fr,
647
635
  noteNonce: Fr,
648
636
  content: Fr[],
649
637
  noteHash: Fr,
@@ -695,6 +683,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
695
683
  new Note(content),
696
684
  contractAddress,
697
685
  storageSlot,
686
+ randomness,
698
687
  noteNonce,
699
688
  noteHash,
700
689
  siloedNullifier,
@@ -702,9 +691,9 @@ export class PXEOracleInterface implements ExecutionDataProvider {
702
691
  uniqueNoteHashTreeIndexInBlock?.l2BlockNumber,
703
692
  uniqueNoteHashTreeIndexInBlock?.l2BlockHash.toString(),
704
693
  uniqueNoteHashTreeIndexInBlock?.data,
705
- recipient,
706
694
  );
707
695
 
696
+ // The note was found by `recipient`, so we use that as the scope when storing the note.
708
697
  await this.noteDataProvider.addNotes([noteDao], recipient);
709
698
  this.log.verbose('Added note', {
710
699
  index: noteDao.index,
@@ -767,7 +756,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
767
756
  privateLog.firstNullifierInTx,
768
757
  );
769
758
  } else {
770
- null;
759
+ return null;
771
760
  }
772
761
  }),
773
762
  );
@@ -1,4 +1,4 @@
1
- import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bundle';
1
+ import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
2
2
  import { randomBytes } from '@aztec/foundation/crypto';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { createStore } from '@aztec/kv-store/indexeddb';
@@ -49,7 +49,7 @@ export async function createPXE(
49
49
  ? loggers.prover
50
50
  : createLogger('pxe:bb:wasm:bundle' + (logSuffix ? `:${logSuffix}` : ''));
51
51
 
52
- const prover = options.prover ?? new BBWASMBundlePrivateKernelProver(simulator, 16, proverLogger);
52
+ const prover = options.prover ?? new BBBundlePrivateKernelProver(simulator, proverLogger);
53
53
  const protocolContractsProvider = new BundledProtocolContractsProvider();
54
54
 
55
55
  const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
@@ -1,4 +1,4 @@
1
- import { BBWASMLazyPrivateKernelProver } from '@aztec/bb-prover/client/wasm/lazy';
1
+ import { BBLazyPrivateKernelProver } from '@aztec/bb-prover/client/lazy';
2
2
  import { randomBytes } from '@aztec/foundation/crypto';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { createStore } from '@aztec/kv-store/indexeddb';
@@ -48,7 +48,7 @@ export async function createPXE(
48
48
  ? loggers.prover
49
49
  : createLogger('pxe:bb:wasm:bundle' + (logSuffix ? `:${logSuffix}` : ''));
50
50
 
51
- const prover = options.prover ?? new BBWASMLazyPrivateKernelProver(simulator, 16, proverLogger);
51
+ const prover = options.prover ?? new BBLazyPrivateKernelProver(simulator, proverLogger);
52
52
 
53
53
  const protocolContractsProvider = new LazyProtocolContractsProvider();
54
54