@aztec/pxe 0.0.1-commit.a5db02d → 0.0.1-commit.aa0c64f

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 (103) hide show
  1. package/dest/bin/check_oracle_version.js +3 -8
  2. package/dest/bin/index.d.ts +2 -2
  3. package/dest/bin/index.d.ts.map +1 -1
  4. package/dest/bin/index.js +1 -1
  5. package/dest/bin/oracle_version_helpers.d.ts +8 -25
  6. package/dest/bin/oracle_version_helpers.d.ts.map +1 -1
  7. package/dest/bin/oracle_version_helpers.js +11 -219
  8. package/dest/config/package_info.js +1 -1
  9. package/dest/contract/helpers.d.ts +1 -1
  10. package/dest/contract/helpers.d.ts.map +1 -1
  11. package/dest/contract/helpers.js +3 -3
  12. package/dest/contract/skip_sync_contracts.d.ts +11 -0
  13. package/dest/contract/skip_sync_contracts.d.ts.map +1 -0
  14. package/dest/contract/skip_sync_contracts.js +18 -0
  15. package/dest/contract_function_simulator/contract_function_simulator.d.ts +1 -1
  16. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/contract_function_simulator.js +5 -3
  18. package/dest/contract_function_simulator/index.d.ts +3 -3
  19. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/index.js +1 -2
  21. package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +7 -9
  22. package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/noir-structs/resolved_tx.js +3 -44
  24. package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +5 -4
  25. package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -1
  26. package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +2 -2
  27. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +3 -3
  28. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
  29. package/dest/contract_function_simulator/oracle/oracle_registry.js +6 -6
  30. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +87 -35
  31. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
  32. package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +286 -286
  33. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +1 -1
  34. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  35. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +5 -6
  36. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +2 -2
  37. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  38. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +2 -1
  39. package/dest/entrypoints/client/store.d.ts +1 -1
  40. package/dest/entrypoints/client/store.d.ts.map +1 -1
  41. package/dest/entrypoints/client/store.js +16 -2
  42. package/dest/logs/log_service.d.ts +1 -1
  43. package/dest/logs/log_service.d.ts.map +1 -1
  44. package/dest/logs/log_service.js +7 -2
  45. package/dest/messages/tx_resolver_service.d.ts +2 -2
  46. package/dest/messages/tx_resolver_service.d.ts.map +1 -1
  47. package/dest/messages/tx_resolver_service.js +7 -2
  48. package/dest/oracle_version.d.ts +1 -1
  49. package/dest/oracle_version.js +2 -2
  50. package/dest/private_kernel/batch_planner.d.ts +1 -1
  51. package/dest/private_kernel/batch_planner.d.ts.map +1 -1
  52. package/dest/private_kernel/batch_planner.js +1 -1
  53. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  54. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  55. package/dest/private_kernel/private_kernel_execution_prover.js +45 -5
  56. package/dest/storage/fact_store/fact_store.d.ts +1 -1
  57. package/dest/storage/fact_store/fact_store.js +1 -1
  58. package/dest/storage/fact_store/index.d.ts +2 -2
  59. package/dest/storage/fact_store/index.d.ts.map +1 -1
  60. package/dest/storage/fact_store/index.js +1 -1
  61. package/dest/storage/fact_store/origin_state.d.ts +3 -1
  62. package/dest/storage/fact_store/origin_state.d.ts.map +1 -1
  63. package/dest/storage/fact_store/origin_state.js +7 -0
  64. package/dest/tagging/constants.d.ts +2 -1
  65. package/dest/tagging/constants.d.ts.map +1 -1
  66. package/dest/tagging/constants.js +9 -0
  67. package/dest/tagging/index.d.ts +2 -2
  68. package/dest/tagging/index.d.ts.map +1 -1
  69. package/dest/tagging/index.js +1 -1
  70. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +9 -4
  71. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -1
  72. package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +60 -25
  73. package/dest/tagging/testing/tag_query_test_utils.d.ts +6 -0
  74. package/dest/tagging/testing/tag_query_test_utils.d.ts.map +1 -0
  75. package/dest/tagging/testing/tag_query_test_utils.js +10 -0
  76. package/package.json +17 -17
  77. package/src/bin/check_oracle_version.ts +3 -10
  78. package/src/bin/index.ts +1 -5
  79. package/src/bin/oracle_version_helpers.ts +11 -268
  80. package/src/config/package_info.ts +1 -1
  81. package/src/contract/helpers.ts +3 -3
  82. package/src/contract/skip_sync_contracts.ts +23 -0
  83. package/src/contract_function_simulator/contract_function_simulator.ts +5 -3
  84. package/src/contract_function_simulator/index.ts +23 -3
  85. package/src/contract_function_simulator/noir-structs/resolved_tx.ts +11 -45
  86. package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +4 -3
  87. package/src/contract_function_simulator/oracle/oracle_registry.ts +7 -8
  88. package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +285 -197
  89. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +12 -7
  90. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +8 -3
  91. package/src/entrypoints/client/store.ts +23 -7
  92. package/src/logs/log_service.ts +7 -2
  93. package/src/messages/tx_resolver_service.ts +8 -8
  94. package/src/oracle_version.ts +2 -2
  95. package/src/private_kernel/batch_planner.ts +0 -1
  96. package/src/private_kernel/private_kernel_execution_prover.ts +90 -4
  97. package/src/storage/fact_store/fact_store.ts +1 -1
  98. package/src/storage/fact_store/index.ts +1 -0
  99. package/src/storage/fact_store/origin_state.ts +9 -0
  100. package/src/tagging/constants.ts +10 -0
  101. package/src/tagging/index.ts +1 -1
  102. package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +103 -46
  103. package/src/tagging/testing/tag_query_test_utils.ts +11 -0
@@ -1,75 +1,13 @@
1
- /* eslint-disable import-x/no-named-as-default-member */
2
1
  import { readFileSync } from 'fs';
3
- import ts from 'typescript';
4
2
 
5
- /**
6
- * Extracts method signatures from TypeScript classes or interfaces and returns a deterministic string representation.
7
- *
8
- * This is used to detect when an oracle interface changes so that the oracle version can be bumped. It works with both
9
- * class declarations (e.g. PXE's `Oracle` class) and interface declarations (e.g. TXE's `IAvmExecutionOracle`).
10
- *
11
- * @param sourcePath - Absolute path to the TypeScript source file to parse.
12
- * @param targets - Names of classes or interfaces to extract methods from.
13
- * @param excludedMembers - Method names to skip (e.g. non-oracle helpers like `constructor`).
14
- */
15
- export function getOracleInterfaceSignature(sourcePath: string, targets: string[], excludedMembers: string[]): string {
16
- const sourceCode = readFileSync(sourcePath, 'utf-8');
17
- const sourceFile = ts.createSourceFile(sourcePath, sourceCode, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
18
-
19
- const methodSignatures: string[] = [];
20
-
21
- function visit(node: ts.Node) {
22
- const isTarget =
23
- (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node)) && targets.includes(node.name?.text ?? '');
24
-
25
- if (isTarget) {
26
- node.members.forEach(member => {
27
- if (
28
- (ts.isMethodDeclaration(member) || ts.isMethodSignature(member)) &&
29
- member.name &&
30
- ts.isIdentifier(member.name)
31
- ) {
32
- const methodName = member.name.text;
33
-
34
- if (excludedMembers.includes(methodName)) {
35
- return;
36
- }
37
-
38
- const paramSignatures: string[] = [];
39
- member.parameters.forEach(param => {
40
- const paramName = extractParameterName(param, sourceFile);
41
- const paramType = extractTypeString(param.type, sourceFile);
42
- paramSignatures.push(`${paramName}: ${paramType}`);
43
- });
44
-
45
- const returnType = extractTypeString(member.type, sourceFile);
46
-
47
- const signature = `${methodName}(${paramSignatures.join(', ')}): ${returnType}`;
48
- methodSignatures.push(signature);
49
- }
50
- });
51
- }
52
-
53
- ts.forEachChild(node, visit);
54
- }
55
-
56
- visit(sourceFile);
57
-
58
- methodSignatures.sort();
59
-
60
- return methodSignatures.join('');
61
- }
3
+ import type { OracleRegistryEntry } from '../contract_function_simulator/index.js';
62
4
 
63
5
  /**
64
- * Extracts a deterministic signature string from an oracle registry object literal (e.g. PXE's `ORACLE_REGISTRY`).
65
- *
66
- * Reads the registry declaration where each oracle's wire ABI lives: the ordered parameter names with their
67
- * `TypeMapping` expressions and the return type. The resulting hash is sensitive to parameter, type, and return
68
- * changes, not just oracle additions and removals.
6
+ * Extracts a deterministic signature string from an oracle registry (e.g. PXE's `ORACLE_REGISTRY`).
69
7
  *
70
- * Type expressions are captured as their source text (e.g. `OPTION(AZTEC_ADDRESS)`, `BOUNDED_VEC(NOTE)`), so the
71
- * signature tracks the composition of types. However, if the internal serialization logic of a `TypeMapping` constant
72
- * (e.g. `FIELD`) changes without the constant being renamed, the hash will not change.
8
+ * Reads the registry where each oracle's wire ABI lives: the ordered parameter names with their `TypeMapping` labels
9
+ * and the return type. The resulting hash is sensitive to parameter, type, and return changes, not just oracle
10
+ * additions and removals.
73
11
  *
74
12
  * @example
75
13
  * // Given a registry like:
@@ -79,32 +17,13 @@ export function getOracleInterfaceSignature(sourcePath: string, targets: string[
79
17
  * // } satisfies Record<string, OracleRegistryEntry>;
80
18
  * //
81
19
  * // Returns (sorted, newline-joined):
82
- * // "aztec_prv_bar(): void\naztec_utl_foo(a: U32): BOOL"
83
- *
84
- * @param sourcePath - Absolute path to the TypeScript source file declaring the registry.
85
- * @param registryName - Name of the registry constant to read (e.g. `ORACLE_REGISTRY`).
20
+ * // "aztec_prv_bar(): void\naztec_utl_foo(a: u32): bool"
86
21
  */
87
- export function getOracleRegistrySignature(sourcePath: string, registryName: string): string {
88
- const sourceCode = readFileSync(sourcePath, 'utf-8');
89
- const sourceFile = ts.createSourceFile(sourcePath, sourceCode, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
90
-
91
- const registry = findObjectLiteral(sourceFile, registryName);
92
- if (!registry) {
93
- throw new Error(`Could not find oracle registry '${registryName}' in ${sourcePath}.`);
94
- }
95
-
96
- const oracleSignatures = registry.properties.map(property => {
97
- if (!ts.isPropertyAssignment(property)) {
98
- throw new Error(
99
- `Unexpected member in oracle registry '${registryName}': ${property.getText(sourceFile)}. Spread elements ` +
100
- `are not supported.`,
101
- );
102
- }
103
-
104
- const oracleName = getPropertyName(property.name, sourceFile);
105
- const { params, returnType } = extractRegistryEntry(property.initializer, sourceFile);
106
- const paramSignatures = params.map(param => `${param.name}: ${param.type}`);
107
- return `${oracleName}(${paramSignatures.join(', ')}): ${returnType}`;
22
+ export function getOracleRegistrySignature(registry: Record<string, OracleRegistryEntry>): string {
23
+ const oracleSignatures = Object.entries(registry).map(([name, entry]) => {
24
+ const paramSignatures = entry.params.map(p => `${p.name}: ${p.type.label}`);
25
+ const returnType = entry.returnType === undefined ? 'void' : entry.returnType.label;
26
+ return `${name}(${paramSignatures.join(', ')}): ${returnType}`;
108
27
  });
109
28
 
110
29
  oracleSignatures.sort();
@@ -133,179 +52,3 @@ export function readNumericGlobal(sourcePath: string, name: string): number {
133
52
  }
134
53
  return Number(match[1]);
135
54
  }
136
-
137
- function extractParameterName(param: ts.ParameterDeclaration, sourceFile: ts.SourceFile): string {
138
- const name = param.name;
139
-
140
- if (ts.isIdentifier(name)) {
141
- return name.text;
142
- }
143
-
144
- if (ts.isArrayBindingPattern(name)) {
145
- if (name.elements.length > 0) {
146
- const element = name.elements[0];
147
- if (ts.isBindingElement(element)) {
148
- const elementName = element.name;
149
- if (ts.isIdentifier(elementName)) {
150
- return elementName.text;
151
- }
152
- if (ts.isArrayBindingPattern(elementName) || ts.isObjectBindingPattern(elementName)) {
153
- return elementName.getText(sourceFile);
154
- }
155
- }
156
- }
157
- return name.getText(sourceFile);
158
- }
159
-
160
- if (ts.isObjectBindingPattern(name)) {
161
- return name.getText(sourceFile);
162
- }
163
-
164
- return (name as ts.Node).getText(sourceFile);
165
- }
166
-
167
- /** Returns the source text of a type annotation, or `'void'` if absent. */
168
- function extractTypeString(typeNode: ts.TypeNode | undefined, sourceFile: ts.SourceFile): string {
169
- if (!typeNode) {
170
- return 'void';
171
- }
172
-
173
- return typeNode.getText(sourceFile).replace(/\s+/g, ' ').trim();
174
- }
175
-
176
- /**
177
- * Finds a top-level object-literal-valued constant by name, unwrapping `satisfies`/`as`/parenthesized wrappers.
178
- *
179
- * @example
180
- * // `const REGISTRY = { ... } satisfies Record<string, Entry>` => the `{ ... }` ObjectLiteralExpression
181
- */
182
- function findObjectLiteral(sourceFile: ts.SourceFile, name: string): ts.ObjectLiteralExpression | undefined {
183
- let result: ts.ObjectLiteralExpression | undefined;
184
-
185
- function visit(node: ts.Node) {
186
- if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.name.text === name && node.initializer) {
187
- result = unwrapObjectLiteral(node.initializer);
188
- }
189
- ts.forEachChild(node, visit);
190
- }
191
-
192
- visit(sourceFile);
193
- return result;
194
- }
195
-
196
- /** Peels `satisfies`, `as`, and parenthesized wrappers off an expression to reach the underlying object literal. */
197
- function unwrapObjectLiteral(node: ts.Expression): ts.ObjectLiteralExpression | undefined {
198
- let current = node;
199
- while (ts.isSatisfiesExpression(current) || ts.isAsExpression(current) || ts.isParenthesizedExpression(current)) {
200
- current = current.expression;
201
- }
202
- return ts.isObjectLiteralExpression(current) ? current : undefined;
203
- }
204
-
205
- /**
206
- * Extracts the ordered `params` (names + type expressions) and `returnType` from a `makeEntry({ ... })` call.
207
- *
208
- * @example
209
- * // makeEntry({ params: [{ name: 'a', type: OPTION(FIELD) }], returnType: BOOL })
210
- * // => { params: [{ name: 'a', type: 'OPTION(FIELD)' }], returnType: 'BOOL' }
211
- * //
212
- * // makeEntry()
213
- * // => { params: [], returnType: 'void' }
214
- */
215
- function extractRegistryEntry(
216
- initializer: ts.Expression,
217
- sourceFile: ts.SourceFile,
218
- ): { params: { name: string; type: string }[]; returnType: string } {
219
- if (!ts.isCallExpression(initializer)) {
220
- throw new Error(`Expected a makeEntry(...) call but got: ${initializer.getText(sourceFile)}`);
221
- }
222
-
223
- const [arg] = initializer.arguments;
224
- if (arg === undefined) {
225
- return { params: [], returnType: 'void' };
226
- }
227
- if (!ts.isObjectLiteralExpression(arg)) {
228
- throw new Error(`Expected a makeEntry object argument but got: ${arg.getText(sourceFile)}`);
229
- }
230
-
231
- let params: { name: string; type: string }[] = [];
232
- let returnType = 'void';
233
-
234
- arg.properties.forEach(property => {
235
- if (!ts.isPropertyAssignment(property)) {
236
- throw new Error(`Unexpected makeEntry property: ${property.getText(sourceFile)}`);
237
- }
238
- const key = getPropertyName(property.name, sourceFile);
239
- if (key === 'params') {
240
- params = extractRegistryParams(property.initializer, sourceFile);
241
- } else if (key === 'returnType') {
242
- returnType = normalizeExpressionText(property.initializer, sourceFile);
243
- } else {
244
- throw new Error(`Unexpected makeEntry property '${key}'.`);
245
- }
246
- });
247
-
248
- return { params, returnType };
249
- }
250
-
251
- /**
252
- * Extracts `{ name, type }` pairs from the `params` array literal inside a `makeEntry` call.
253
- */
254
- function extractRegistryParams(
255
- initializer: ts.Expression,
256
- sourceFile: ts.SourceFile,
257
- ): { name: string; type: string }[] {
258
- if (!ts.isArrayLiteralExpression(initializer)) {
259
- throw new Error(`Expected a params array but got: ${initializer.getText(sourceFile)}`);
260
- }
261
-
262
- return initializer.elements.map(element => {
263
- if (!ts.isObjectLiteralExpression(element)) {
264
- throw new Error(`Expected a param object but got: ${element.getText(sourceFile)}`);
265
- }
266
-
267
- let name: string | undefined;
268
- let type: string | undefined;
269
- element.properties.forEach(property => {
270
- if (!ts.isPropertyAssignment(property)) {
271
- throw new Error(`Unexpected param property: ${property.getText(sourceFile)}`);
272
- }
273
- const key = getPropertyName(property.name, sourceFile);
274
- if (key === 'name') {
275
- if (!ts.isStringLiteralLike(property.initializer)) {
276
- throw new Error(`Expected a string literal param name but got: ${property.initializer.getText(sourceFile)}`);
277
- }
278
- name = property.initializer.text;
279
- } else if (key === 'type') {
280
- type = normalizeExpressionText(property.initializer, sourceFile);
281
- } else {
282
- throw new Error(`Unexpected param property '${key}'.`);
283
- }
284
- });
285
-
286
- if (name === undefined || type === undefined) {
287
- throw new Error(`Param missing 'name' or 'type': ${element.getText(sourceFile)}`);
288
- }
289
- return { name, type };
290
- });
291
- }
292
-
293
- /** Returns the text of an identifier or string-literal property name, throwing on computed or numeric names. */
294
- function getPropertyName(name: ts.PropertyName, sourceFile: ts.SourceFile): string {
295
- if (ts.isIdentifier(name) || ts.isStringLiteralLike(name)) {
296
- return name.text;
297
- }
298
- throw new Error(`Unsupported property name: ${name.getText(sourceFile)}`);
299
- }
300
-
301
- /**
302
- * Returns the source text of an expression with all whitespace stripped for format-insensitive comparison.
303
- *
304
- * @example
305
- * // `OPTION(\n AZTEC_ADDRESS\n)` => `"OPTION(AZTEC_ADDRESS)"`
306
- */
307
- function normalizeExpressionText(node: ts.Expression, sourceFile: ts.SourceFile): string {
308
- // Type expressions are TypeMapping references and calls (identifiers, parentheses, commas, numbers) with no
309
- // meaningful whitespace, so we strip it entirely to keep the signature stable across reformatting.
310
- return node.getText(sourceFile).replace(/\s+/g, '');
311
- }
@@ -1,3 +1,3 @@
1
1
  export function getPackageInfo() {
2
- return { version: '5.0.1', name: '@aztec/pxe' };
2
+ return { version: '6.0.0', name: '@aztec/pxe' };
3
3
  }
@@ -1,10 +1,10 @@
1
- import { isProtocolContract } from '@aztec/protocol-contracts';
2
1
  import type { FunctionCall, FunctionSelector } from '@aztec/stdlib/abi';
3
2
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
3
  import type { BlockHeader } from '@aztec/stdlib/tx';
5
4
 
6
5
  import type { ContractStore } from '../storage/contract_store/contract_store.js';
7
6
  import type { ContractClassService } from './contract_class_service.js';
7
+ import { isSkipSyncContract } from './skip_sync_contracts.js';
8
8
 
9
9
  export async function syncScope(
10
10
  contractAddress: AztecAddress,
@@ -15,8 +15,8 @@ export async function syncScope(
15
15
  utilityExecutor: (privateSyncCall: FunctionCall, scopes: AztecAddress[]) => Promise<any>,
16
16
  scope: AztecAddress,
17
17
  ) {
18
- // Protocol contracts don't have private state to sync
19
- if (isProtocolContract(contractAddress)) {
18
+ // Some canonical contracts hold no private state, so there is nothing to sync (see `skipSyncContracts`).
19
+ if (isSkipSyncContract(contractAddress)) {
20
20
  return;
21
21
  }
22
22
 
@@ -0,0 +1,23 @@
1
+ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
2
+ import { STANDARD_AUTH_REGISTRY_ADDRESS } from '@aztec/standard-contracts/auth-registry/constants';
3
+ import { STANDARD_MULTI_CALL_ENTRYPOINT_ADDRESS } from '@aztec/standard-contracts/multi-call-entrypoint/constants';
4
+ import { STANDARD_PUBLIC_CHECKS_ADDRESS } from '@aztec/standard-contracts/public-checks/constants';
5
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
6
+
7
+ /**
8
+ * Canonical contracts that hold no private state and are therefore never synced.
9
+ *
10
+ * The protocol contracts (registries, fee juice) plus the standard AuthRegistry, MultiCallEntrypoint and PublicChecks
11
+ * declare no notes and no events, so their macro-generated `sync_state` has nothing to discover.
12
+ */
13
+ export const skipSyncContracts: AztecAddress[] = [
14
+ ...Object.values(ProtocolContractAddress),
15
+ STANDARD_AUTH_REGISTRY_ADDRESS,
16
+ STANDARD_MULTI_CALL_ENTRYPOINT_ADDRESS,
17
+ STANDARD_PUBLIC_CHECKS_ADDRESS,
18
+ ];
19
+
20
+ /** Returns whether the given contract should be skipped during private state synchronization. */
21
+ export function isSkipSyncContract(address: AztecAddress): boolean {
22
+ return skipSyncContracts.some(a => a.equals(address));
23
+ }
@@ -1,3 +1,4 @@
1
+ import { CircuitKind } from '@aztec/bb.js';
1
2
  import {
2
3
  AVM_EMITNOTEHASH_BASE_L2_GAS,
3
4
  AVM_EMITNULLIFIER_BASE_L2_GAS,
@@ -314,7 +315,7 @@ export class ContractFunctionSimulator {
314
315
  );
315
316
  const simulatorTeardownTimer = new Timer();
316
317
 
317
- const firstNullifier = noteCache.getNonceGenerator();
318
+ const firstNullifierHint = noteCache.getNonceGenerator();
318
319
 
319
320
  const publicCallRequests = collectNested([executionResult], r =>
320
321
  r.publicInputs.publicCallRequests
@@ -337,9 +338,9 @@ export class ContractFunctionSimulator {
337
338
  }
338
339
 
339
340
  // Not to be confused with a PrivateCallExecutionResult. This is a superset
340
- // of the PrivateCallExecutionResult, containing also firstNullifier
341
+ // of the PrivateCallExecutionResult, containing also firstNullifierHint
341
342
  // and publicFunctionsCalldata.
342
- return new PrivateExecutionResult(executionResult, firstNullifier, publicFunctionsCalldata);
343
+ return new PrivateExecutionResult(executionResult, firstNullifierHint, publicFunctionsCalldata);
343
344
  } catch (err) {
344
345
  throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
345
346
  }
@@ -587,6 +588,7 @@ export async function generateSimulatedProvingResult(
587
588
  execution.publicInputs.callContext.functionSelector,
588
589
  ),
589
590
  timings: execution.profileResult?.timings ?? { witgen: 0, oracles: {} },
591
+ kind: CircuitKind.App,
590
592
  bytecode: execution.acir,
591
593
  vk: execution.vk,
592
594
  witness: execution.partialWitness,
@@ -6,6 +6,7 @@ export {
6
6
  type ParamTypes,
7
7
  } from './oracle/oracle_registry.js';
8
8
  export {
9
+ ALIAS,
9
10
  ARRAY,
10
11
  AZTEC_ADDRESS,
11
12
  BIGINT,
@@ -13,8 +14,7 @@ export {
13
14
  BLOCK_NUMBER,
14
15
  BOOL,
15
16
  BOUNDED_VEC,
16
- BUFFER,
17
- BYTE,
17
+ U8,
18
18
  CONTRACT_INSTANCE,
19
19
  DELIVERY_MODE,
20
20
  EPHEMERAL_ARRAY,
@@ -23,6 +23,8 @@ export {
23
23
  FIELD,
24
24
  FIXED_ARRAY,
25
25
  FUNCTION_SELECTOR,
26
+ LEAF,
27
+ LEAF_INDEX,
26
28
  LOG_RETRIEVAL_REQUEST,
27
29
  LOG_RETRIEVAL_RESPONSE,
28
30
  MEMBERSHIP_WITNESS,
@@ -32,16 +34,34 @@ export {
32
34
  PENDING_TAGGED_LOG,
33
35
  POINT,
34
36
  PROVIDED_SECRET,
37
+ SCALAR,
35
38
  SLOT_NUMBER,
36
39
  STR,
37
40
  STRUCT,
38
41
  U32,
42
+ U64,
43
+ U128,
39
44
  tryFieldWidth,
45
+ isArrayMapping,
46
+ isBoundedVecMapping,
47
+ isEphemeralArrayMapping,
48
+ isFixedArrayMapping,
49
+ isFixedBoundedVecMapping,
50
+ isOptionMapping,
51
+ isStructMapping,
52
+ type ArrayMapping,
53
+ type BoundedVecMapping,
54
+ type CompositeMapping,
55
+ type EphemeralArrayMapping,
56
+ type FixedArrayMapping,
57
+ type FixedBoundedVecMapping,
40
58
  type InputSlot,
41
59
  type MaybePromise,
60
+ type OptionMapping,
42
61
  type OutputSlot,
43
62
  type SlotShape,
44
63
  type StructField,
64
+ type StructMapping,
45
65
  type TypeMapping,
46
66
  } from './oracle/oracle_type_mappings.js';
47
67
  export { ExecutionNoteCache } from './execution_note_cache.js';
@@ -74,5 +94,5 @@ export { NoteValidationRequest } from './noir-structs/note_validation_request.js
74
94
  export type { PendingTaggedLog } from './noir-structs/pending_tagged_log.js';
75
95
  export type { TxEffectData } from './noir-structs/tx_effect_data.js';
76
96
  export type { ProvidedSecret } from './noir-structs/provided_secret.js';
77
- export { ResolvedTx } from './noir-structs/resolved_tx.js';
97
+ export type { ResolvedTx } from './noir-structs/resolved_tx.js';
78
98
  export { TransientArrayService } from './transient_array_service.js';
@@ -1,7 +1,5 @@
1
- import { MAX_NOTE_HASHES_PER_TX } from '@aztec/constants';
2
- import { padArrayEnd } from '@aztec/foundation/collection';
3
- import { Fr } from '@aztec/foundation/curves/bn254';
4
- import { TxHash } from '@aztec/stdlib/tx';
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+ import type { TxHash } from '@aztec/stdlib/tx';
5
3
 
6
4
  /**
7
5
  * The resolved on-chain context of a transaction.
@@ -9,45 +7,13 @@ import { TxHash } from '@aztec/stdlib/tx';
9
7
  * Carries the note hashes and first nullifier needed to discover notes that originated from the transaction, plus the
10
8
  * number and hash of the block in which it was mined.
11
9
  *
12
- * A TS version of the `ResolvedTx` struct in `oracle/tx_resolution.nr`.
10
+ * A TS version of the `ResolvedTx` struct in `oracle/tx_resolution.nr`; its wire layout lives in the `RESOLVED_TX`
11
+ * type mapping.
13
12
  */
14
- export class ResolvedTx {
15
- constructor(
16
- public txHash: TxHash,
17
- public uniqueNoteHashesInTx: Fr[],
18
- public firstNullifierInTx: Fr,
19
- public blockNumber: number,
20
- public blockHash: Fr,
21
- ) {}
22
-
23
- toFields(): Fr[] {
24
- return [
25
- this.txHash.hash,
26
- ...serializeBoundedVec(this.uniqueNoteHashesInTx, MAX_NOTE_HASHES_PER_TX),
27
- this.firstNullifierInTx,
28
- new Fr(this.blockNumber),
29
- this.blockHash,
30
- ];
31
- }
32
-
33
- static empty(): ResolvedTx {
34
- return new ResolvedTx(TxHash.zero(), [], Fr.ZERO, 0, Fr.ZERO);
35
- }
36
- }
37
-
38
- /**
39
- * Helper function to serialize a bounded vector according to Noir's BoundedVec format: the storage array padded to
40
- * `maxLength`, followed by the actual length.
41
- * @param values - The values to serialize
42
- * @param maxLength - The maximum length of the bounded vector
43
- * @returns The serialized bounded vector as Fr[]
44
- */
45
- function serializeBoundedVec(values: Fr[], maxLength: number): Fr[] {
46
- const storage = padArrayEnd(
47
- values,
48
- Fr.ZERO,
49
- maxLength,
50
- `Attempted to serialize ${values} values into a BoundedVec with max length ${maxLength}`,
51
- );
52
- return [...storage, new Fr(values.length)];
53
- }
13
+ export type ResolvedTx = {
14
+ txHash: TxHash;
15
+ uniqueNoteHashesInTx: Fr[];
16
+ firstNullifierInTx: Fr;
17
+ blockNumber: number;
18
+ blockHash: Fr;
19
+ };
@@ -6,10 +6,11 @@ import type { ContractClassLogData } from './contract_class_log_data.js';
6
6
 
7
7
  /**
8
8
  * Wire form of a {@link TxEffect} as the `getTxEffect` oracle returns it: identical to the domain type except its logs
9
- * are flattened to their Noir layout. Keeping the conversion in the handler lets the `TX_EFFECT` mapping stay purely
10
- * structural.
9
+ * are flattened to their Noir layout and its revert code is the plain `u8` Noir declares. Keeping the conversion in
10
+ * the handler lets the `TX_EFFECT` mapping stay purely structural.
11
11
  */
12
- export type TxEffectData = Omit<FieldsOf<TxEffect>, 'publicLogs' | 'contractClassLogs'> & {
12
+ export type TxEffectData = Omit<FieldsOf<TxEffect>, 'revertCode' | 'publicLogs' | 'contractClassLogs'> & {
13
+ revertCode: number;
13
14
  publicLogs: FlatPublicLogs;
14
15
  contractClassLogs: ContractClassLogData[];
15
16
  };
@@ -13,8 +13,6 @@ import {
13
13
  BLOCK_NUMBER,
14
14
  BOOL,
15
15
  BOUNDED_VEC,
16
- BUFFER,
17
- BYTE,
18
16
  CALL_PRIVATE_RESULT,
19
17
  CONTRACT_CLASS_LOG,
20
18
  CONTRACT_INSTANCE,
@@ -23,6 +21,7 @@ import {
23
21
  EVENT_VALIDATION_REQUEST,
24
22
  FACT_COLLECTION,
25
23
  FIELD,
24
+ FIXED_ARRAY,
26
25
  FUNCTION_SELECTOR,
27
26
  type InputSlot,
28
27
  KEY_VALIDATION_REQUEST,
@@ -50,6 +49,7 @@ import {
50
49
  TX_EFFECT,
51
50
  TX_HASH,
52
51
  type TypeMapping,
52
+ U8,
53
53
  U32,
54
54
  UTILITY_CONTEXT,
55
55
  assertReadersConsumed,
@@ -63,8 +63,7 @@ export {
63
63
  BLOCK_NUMBER,
64
64
  BOOL,
65
65
  BOUNDED_VEC,
66
- BUFFER,
67
- BYTE,
66
+ U8,
68
67
  CONTRACT_CLASS_LOG,
69
68
  DELIVERY_MODE,
70
69
  RESOLVED_TAGGING_STRATEGY,
@@ -317,11 +316,11 @@ export const ORACLE_REGISTRY = {
317
316
 
318
317
  aztec_utl_decryptAes128: makeEntry({
319
318
  params: [
320
- { name: 'ciphertext', type: BOUNDED_VEC(BYTE) },
321
- { name: 'iv', type: BUFFER(8, 16) },
322
- { name: 'symKey', type: BUFFER(8, 16) },
319
+ { name: 'ciphertext', type: BOUNDED_VEC(U8) },
320
+ { name: 'iv', type: FIXED_ARRAY(U8, 16) },
321
+ { name: 'symKey', type: FIXED_ARRAY(U8, 16) },
323
322
  ],
324
- returnType: OPTION(BOUNDED_VEC(BYTE)),
323
+ returnType: OPTION(BOUNDED_VEC(U8)),
325
324
  }),
326
325
 
327
326
  aztec_utl_getSharedSecrets: makeEntry({