@aztec/simulator 0.81.0 → 0.82.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dest/common/db_interfaces.d.ts +6 -12
  2. package/dest/common/db_interfaces.d.ts.map +1 -1
  3. package/dest/common/db_interfaces.js +1 -1
  4. package/dest/common/message_load_oracle_inputs.d.ts +4 -0
  5. package/dest/common/message_load_oracle_inputs.d.ts.map +1 -1
  6. package/dest/common/message_load_oracle_inputs.js +9 -0
  7. package/dest/private/acvm/acvm.d.ts +6 -1
  8. package/dest/private/acvm/acvm.d.ts.map +1 -1
  9. package/dest/private/acvm/acvm.js +7 -13
  10. package/dest/private/acvm/deserialize.d.ts +0 -18
  11. package/dest/private/acvm/deserialize.d.ts.map +1 -1
  12. package/dest/private/acvm/deserialize.js +3 -24
  13. package/dest/private/acvm/oracle/oracle.d.ts +34 -34
  14. package/dest/private/acvm/oracle/oracle.d.ts.map +1 -1
  15. package/dest/private/acvm/oracle/oracle.js +119 -79
  16. package/dest/private/acvm/oracle/typed_oracle.d.ts +1 -1
  17. package/dest/private/acvm/oracle/typed_oracle.d.ts.map +1 -1
  18. package/dest/private/acvm/oracle/typed_oracle.js +2 -2
  19. package/dest/private/execution_data_provider.d.ts +3 -9
  20. package/dest/private/execution_data_provider.d.ts.map +1 -1
  21. package/dest/private/private_execution.d.ts +2 -2
  22. package/dest/private/private_execution.d.ts.map +1 -1
  23. package/dest/private/private_execution.js +4 -5
  24. package/dest/private/providers/acvm_native.d.ts +6 -4
  25. package/dest/private/providers/acvm_native.d.ts.map +1 -1
  26. package/dest/private/providers/acvm_native.js +6 -3
  27. package/dest/private/providers/acvm_wasm.d.ts +6 -7
  28. package/dest/private/providers/acvm_wasm.d.ts.map +1 -1
  29. package/dest/private/providers/acvm_wasm.js +13 -15
  30. package/dest/private/providers/acvm_wasm_with_blobs.d.ts +5 -5
  31. package/dest/private/providers/acvm_wasm_with_blobs.d.ts.map +1 -1
  32. package/dest/private/providers/acvm_wasm_with_blobs.js +7 -9
  33. package/dest/private/providers/circuit_recording/circuit_recorder.d.ts +90 -0
  34. package/dest/private/providers/circuit_recording/circuit_recorder.d.ts.map +1 -0
  35. package/dest/private/providers/circuit_recording/circuit_recorder.js +246 -0
  36. package/dest/private/providers/circuit_recording/simulation_provider_recorder_wrapper.d.ts +18 -0
  37. package/dest/private/providers/circuit_recording/simulation_provider_recorder_wrapper.d.ts.map +1 -0
  38. package/dest/private/providers/circuit_recording/simulation_provider_recorder_wrapper.js +39 -0
  39. package/dest/private/providers/simulation_provider.d.ts +21 -7
  40. package/dest/private/providers/simulation_provider.d.ts.map +1 -1
  41. package/dest/private/simulator.d.ts +3 -2
  42. package/dest/private/simulator.d.ts.map +1 -1
  43. package/dest/private/simulator.js +2 -2
  44. package/dest/private/unconstrained_execution.d.ts +2 -2
  45. package/dest/private/unconstrained_execution.d.ts.map +1 -1
  46. package/dest/private/unconstrained_execution.js +1 -2
  47. package/dest/private/unconstrained_execution_oracle.d.ts +1 -1
  48. package/dest/private/unconstrained_execution_oracle.d.ts.map +1 -1
  49. package/dest/private/unconstrained_execution_oracle.js +3 -3
  50. package/dest/public/avm/avm_simulator.d.ts.map +1 -1
  51. package/dest/public/avm/avm_simulator.js +0 -2
  52. package/dest/public/avm/journal/journal.js +1 -1
  53. package/dest/public/avm/test_utils.js +1 -1
  54. package/dest/public/public_db_sources.d.ts +1 -1
  55. package/dest/public/public_db_sources.d.ts.map +1 -1
  56. package/dest/public/public_db_sources.js +3 -3
  57. package/dest/testing.d.ts +2 -0
  58. package/dest/testing.d.ts.map +1 -0
  59. package/dest/testing.js +1 -0
  60. package/package.json +15 -14
  61. package/src/common/db_interfaces.ts +6 -13
  62. package/src/common/message_load_oracle_inputs.ts +8 -0
  63. package/src/private/acvm/acvm.ts +8 -24
  64. package/src/private/acvm/deserialize.ts +3 -30
  65. package/src/private/acvm/oracle/oracle.ts +144 -136
  66. package/src/private/acvm/oracle/typed_oracle.ts +2 -2
  67. package/src/private/execution_data_provider.ts +6 -10
  68. package/src/private/private_execution.ts +11 -7
  69. package/src/private/providers/acvm_native.ts +17 -6
  70. package/src/private/providers/acvm_wasm.ts +27 -20
  71. package/src/private/providers/acvm_wasm_with_blobs.ts +15 -12
  72. package/src/private/providers/circuit_recording/circuit_recorder.ts +283 -0
  73. package/src/private/providers/circuit_recording/simulation_provider_recorder_wrapper.ts +82 -0
  74. package/src/private/providers/simulation_provider.ts +30 -5
  75. package/src/private/simulator.ts +5 -3
  76. package/src/private/unconstrained_execution.ts +8 -4
  77. package/src/private/unconstrained_execution_oracle.ts +3 -6
  78. package/src/public/avm/avm_simulator.ts +0 -2
  79. package/src/public/avm/journal/journal.ts +1 -1
  80. package/src/public/avm/test_utils.ts +1 -1
  81. package/src/public/public_db_sources.ts +3 -3
  82. package/src/testing.ts +1 -0
  83. package/dest/public/avm/bytecode_utils.d.ts +0 -5
  84. package/dest/public/avm/bytecode_utils.d.ts.map +0 -1
  85. package/dest/public/avm/bytecode_utils.js +0 -17
  86. package/src/public/avm/bytecode_utils.ts +0 -17
@@ -1,15 +1,14 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- import type { WitnessMap } from '@aztec/noir-types';
4
- import type { NoirCompiledCircuit } from '@aztec/stdlib/noir';
5
- import { type ACIRCallback } from '../acvm/acvm.js';
1
+ import { type ForeignCallHandler } from '@aztec/noir-acvm_js';
2
+ import type { FunctionArtifactWithContractName } from '@aztec/stdlib/abi';
3
+ import type { NoirCompiledCircuitWithName } from '@aztec/stdlib/noir';
4
+ import { type ACIRCallback, type ACIRExecutionResult } from '../acvm/acvm.js';
6
5
  import type { ACVMWitness } from '../acvm/acvm_types.js';
7
6
  import { type SimulationProvider } from './simulation_provider.js';
8
7
  export declare class WASMSimulator implements SimulationProvider {
9
8
  protected log: import("@aztec/foundation/log").Logger;
10
9
  constructor(log?: import("@aztec/foundation/log").Logger);
11
10
  init(): Promise<void>;
12
- executeProtocolCircuit(input: WitnessMap, compiledCircuit: NoirCompiledCircuit): Promise<WitnessMap>;
13
- executeUserCircuit(acir: Buffer, initialWitness: ACVMWitness, callback: ACIRCallback): Promise<import("../acvm/acvm.js").ACIRExecutionResult>;
11
+ executeProtocolCircuit(input: ACVMWitness, artifact: NoirCompiledCircuitWithName, callback: ForeignCallHandler): Promise<ACVMWitness>;
12
+ executeUserCircuit(input: ACVMWitness, artifact: FunctionArtifactWithContractName, callback: ACIRCallback): Promise<ACIRExecutionResult>;
14
13
  }
15
14
  //# sourceMappingURL=acvm_wasm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"acvm_wasm.d.ts","sourceRoot":"","sources":["../../../src/private/providers/acvm_wasm.ts"],"names":[],"mappings":";;AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAE,KAAK,YAAY,EAAQ,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,kBAAkB,EAAmB,MAAM,0BAA0B,CAAC;AAEpF,qBAAa,aAAc,YAAW,kBAAkB;IAC1C,SAAS,CAAC,GAAG;gBAAH,GAAG,yCAAiC;IAEpD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAUrB,sBAAsB,CAAC,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IAiCpG,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY;CAI3F"}
1
+ {"version":3,"file":"acvm_wasm.d.ts","sourceRoot":"","sources":["../../../src/private/providers/acvm_wasm.ts"],"names":[],"mappings":"AACA,OAAiB,EAAuB,KAAK,kBAAkB,EAAkB,MAAM,qBAAqB,CAAC;AAE7G,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAQ,MAAM,iBAAiB,CAAC;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,kBAAkB,EAAmB,MAAM,0BAA0B,CAAC;AAEpF,qBAAa,aAAc,YAAW,kBAAkB;IAC1C,SAAS,CAAC,GAAG;gBAAH,GAAG,yCAAiC;IAEpD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAUrB,sBAAsB,CAC1B,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,2BAA2B,EACrC,QAAQ,EAAE,kBAAkB,GAC3B,OAAO,CAAC,WAAW,CAAC;IAiCjB,kBAAkB,CACtB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,gCAAgC,EAC1C,QAAQ,EAAE,YAAY,GACrB,OAAO,CAAC,mBAAmB,CAAC;CAIhC"}
@@ -1,7 +1,6 @@
1
1
  import { createLogger } from '@aztec/foundation/log';
2
2
  import initACVM, { executeCircuit } from '@aztec/noir-acvm_js';
3
3
  import initAbi from '@aztec/noir-noirc_abi';
4
- import { foreignCallHandler } from '@aztec/noir-protocol-circuits-types/client';
5
4
  import { acvm } from '../acvm/acvm.js';
6
5
  import { enrichNoirError } from './simulation_provider.js';
7
6
  export class WASMSimulator {
@@ -20,43 +19,42 @@ export class WASMSimulator {
20
19
  ]);
21
20
  }
22
21
  }
23
- async executeProtocolCircuit(input, compiledCircuit) {
22
+ async executeProtocolCircuit(input, artifact, callback) {
24
23
  this.log.debug('init', {
25
- hash: compiledCircuit.hash
24
+ hash: artifact.hash
26
25
  });
27
26
  await this.init();
28
- // Execute the circuit on those initial witness values
29
- //
30
27
  // Decode the bytecode from base64 since the acvm does not know about base64 encoding
31
- const decodedBytecode = Buffer.from(compiledCircuit.bytecode, 'base64');
28
+ const decodedBytecode = Buffer.from(artifact.bytecode, 'base64');
32
29
  //
33
30
  // Execute the circuit
34
31
  try {
35
- const _witnessMap = await executeCircuit(decodedBytecode, input, foreignCallHandler);
32
+ const result = await executeCircuit(decodedBytecode, input, callback);
36
33
  this.log.debug('execution successful', {
37
- hash: compiledCircuit.hash
34
+ hash: artifact.hash
38
35
  });
39
- return _witnessMap;
36
+ return result;
40
37
  } catch (err) {
41
- // Typescript types catched errors as unknown or any, so we need to narrow its type to check if it has raw assertion payload.
38
+ // Typescript types caught errors as unknown or any, so we need to narrow its type to check if it has raw
39
+ // assertion payload.
42
40
  if (typeof err === 'object' && err !== null && 'rawAssertionPayload' in err) {
43
- const parsed = enrichNoirError(compiledCircuit, err);
41
+ const parsed = enrichNoirError(artifact, err);
44
42
  this.log.debug('execution failed', {
45
- hash: compiledCircuit.hash,
43
+ hash: artifact.hash,
46
44
  error: parsed,
47
45
  message: parsed.message
48
46
  });
49
47
  throw parsed;
50
48
  }
51
49
  this.log.debug('execution failed', {
52
- hash: compiledCircuit.hash,
50
+ hash: artifact.hash,
53
51
  error: err
54
52
  });
55
53
  throw new Error(`Circuit execution failed: ${err}`);
56
54
  }
57
55
  }
58
- async executeUserCircuit(acir, initialWitness, callback) {
56
+ async executeUserCircuit(input, artifact, callback) {
59
57
  await this.init();
60
- return acvm(acir, initialWitness, callback);
58
+ return acvm(artifact.bytecode, input, callback);
61
59
  }
62
60
  }
@@ -1,7 +1,7 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
1
+ import { type ForeignCallHandler } from '@aztec/noir-acvm_js';
3
2
  import type { WitnessMap } from '@aztec/noir-types';
4
- import type { NoirCompiledCircuit } from '@aztec/stdlib/noir';
3
+ import type { FunctionArtifactWithContractName } from '@aztec/stdlib/abi';
4
+ import type { NoirCompiledCircuitWithName } from '@aztec/stdlib/noir';
5
5
  import type { ACIRCallback, ACIRExecutionResult } from '../acvm/acvm.js';
6
6
  import type { ACVMWitness } from '../acvm/acvm_types.js';
7
7
  import { type SimulationProvider } from './simulation_provider.js';
@@ -13,7 +13,7 @@ import { type SimulationProvider } from './simulation_provider.js';
13
13
  * It is only used in the context of server-side code executing simulated protocol circuits.
14
14
  */
15
15
  export declare class WASMSimulatorWithBlobs implements SimulationProvider {
16
- executeProtocolCircuit(input: WitnessMap, compiledCircuit: NoirCompiledCircuit): Promise<WitnessMap>;
17
- executeUserCircuit(_acir: Buffer, _initialWitness: ACVMWitness, _callback: ACIRCallback): Promise<ACIRExecutionResult>;
16
+ executeProtocolCircuit(input: WitnessMap, artifact: NoirCompiledCircuitWithName, callback: ForeignCallHandler): Promise<WitnessMap>;
17
+ executeUserCircuit(_input: ACVMWitness, _artifact: FunctionArtifactWithContractName, _callback: ACIRCallback): Promise<ACIRExecutionResult>;
18
18
  }
19
19
  //# sourceMappingURL=acvm_wasm_with_blobs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"acvm_wasm_with_blobs.d.ts","sourceRoot":"","sources":["../../../src/private/providers/acvm_wasm_with_blobs.ts"],"names":[],"mappings":";;AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,kBAAkB,EAAmB,MAAM,0BAA0B,CAAC;AAEpF;;;;;;GAMG;AACH,qBAAa,sBAAuB,YAAW,kBAAkB;IACzD,sBAAsB,CAAC,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IAwB1G,kBAAkB,CAChB,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,WAAW,EAC5B,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,mBAAmB,CAAC;CAGhC"}
1
+ {"version":3,"file":"acvm_wasm_with_blobs.d.ts","sourceRoot":"","sources":["../../../src/private/providers/acvm_wasm_with_blobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,kBAAkB,EAAkB,MAAM,qBAAqB,CAAC;AACnG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,kBAAkB,EAAmB,MAAM,0BAA0B,CAAC;AAEpF;;;;;;GAMG;AACH,qBAAa,sBAAuB,YAAW,kBAAkB;IACzD,sBAAsB,CAC1B,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,2BAA2B,EACrC,QAAQ,EAAE,kBAAkB,GAC3B,OAAO,CAAC,UAAU,CAAC;IAuBtB,kBAAkB,CAChB,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,gCAAgC,EAC3C,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,mBAAmB,CAAC;CAGhC"}
@@ -1,5 +1,4 @@
1
1
  import { executeCircuit } from '@aztec/noir-acvm_js';
2
- import { foreignCallHandler } from '@aztec/noir-protocol-circuits-types/server';
3
2
  import { enrichNoirError } from './simulation_provider.js';
4
3
  /**
5
4
  * A simulation provider that uses the WASM simulator with the ability to handle blobs via the foreign call handler.
@@ -8,25 +7,24 @@ import { enrichNoirError } from './simulation_provider.js';
8
7
  *
9
8
  * It is only used in the context of server-side code executing simulated protocol circuits.
10
9
  */ export class WASMSimulatorWithBlobs {
11
- async executeProtocolCircuit(input, compiledCircuit) {
12
- // Execute the circuit on those initial witness values
13
- //
10
+ async executeProtocolCircuit(input, artifact, callback) {
14
11
  // Decode the bytecode from base64 since the acvm does not know about base64 encoding
15
- const decodedBytecode = Buffer.from(compiledCircuit.bytecode, 'base64');
12
+ const decodedBytecode = Buffer.from(artifact.bytecode, 'base64');
16
13
  //
17
14
  // Execute the circuit
18
15
  try {
19
- const _witnessMap = await executeCircuit(decodedBytecode, input, foreignCallHandler);
16
+ const _witnessMap = await executeCircuit(decodedBytecode, input, callback);
20
17
  return _witnessMap;
21
18
  } catch (err) {
22
- // Typescript types catched errors as unknown or any, so we need to narrow its type to check if it has raw assertion payload.
19
+ // Typescript types caught errors as unknown or any, so we need to narrow its type to check if it has raw
20
+ // assertion payload.
23
21
  if (typeof err === 'object' && err !== null && 'rawAssertionPayload' in err) {
24
- throw enrichNoirError(compiledCircuit, err);
22
+ throw enrichNoirError(artifact, err);
25
23
  }
26
24
  throw new Error(`Circuit execution failed: ${err}`);
27
25
  }
28
26
  }
29
- executeUserCircuit(_acir, _initialWitness, _callback) {
27
+ executeUserCircuit(_input, _artifact, _callback) {
30
28
  throw new Error('Not implemented');
31
29
  }
32
30
  }
@@ -0,0 +1,90 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ /// <reference types="node" resolution-mode="require"/>
3
+ import type { ForeignCallHandler } from '@aztec/noir-acvm_js';
4
+ import type { ACIRCallback } from '../../acvm/acvm.js';
5
+ import type { ACVMWitness } from '../../acvm/acvm_types.js';
6
+ /**
7
+ * Class responsible for recording circuit inputs necessary to replay the circuit. These inputs are the initial witness
8
+ * map and the oracle calls made during the circuit execution/witness generation.
9
+ *
10
+ * The recording is stored in a JSON file called `circuit_name_circuit_function_name_YYYY-MM-DD_N.json` where N is
11
+ * a counter to ensure unique filenames. The file is stored in the `recordDir` directory provided as a parameter to
12
+ * CircuitRecorder.start().
13
+ *
14
+ * Example recording file:
15
+ * ```json
16
+ * {
17
+ * "circuitName": "AMM",
18
+ * "functionName": "add_liquidity",
19
+ * "bytecodeMd5Hash": "b46c640ed38f20eac5f61a5e41d8dd1e",
20
+ * "timestamp": 1740691464360,
21
+ * "inputs": {
22
+ * "0": "0x1e89de1f0ad5204263733b7ddf65bec45b8f44714a4da85a46474dad677679ef",
23
+ * "1": "0x00f4d59c0ff773427bb0fed5b422557ca4dc5655abe53d31fa9408cb3c5a672f",
24
+ * "5": "0x000000000000000000000000000000000000000000000000000000000000000f"
25
+ * },
26
+ * "oracleCalls": [
27
+ * {
28
+ * "name": "loadCapsule",
29
+ * "inputs": [
30
+ * [
31
+ * "0x102422483bad6abd385948435667e144ac4c272576e325e7563608876cd446fd"
32
+ * ],
33
+ * [
34
+ * "0x000000000000000000000000000000000000000000000000000000000000004d"
35
+ * ],
36
+ * [
37
+ * "0x0000000000000000000000000000000000000000000000000000000000000001"
38
+ * ]
39
+ * ],
40
+ * "outputs": [
41
+ * "0x0000000000000000000000000000000000000000000000000000000000000000",
42
+ * [
43
+ * "0x0000000000000000000000000000000000000000000000000000000000000000"
44
+ * ]
45
+ * ]
46
+ * },
47
+ * {
48
+ * "name": "syncNotes",
49
+ * "inputs": []
50
+ * }
51
+ * ]
52
+ * }
53
+ * ```
54
+ */
55
+ export declare class CircuitRecorder {
56
+ #private;
57
+ private readonly filePath;
58
+ private readonly logger;
59
+ private isFirstCall;
60
+ private constructor();
61
+ /**
62
+ * Initializes a new circuit recording session.
63
+ * @param recordDir - Directory to store the recording
64
+ * @param input - Circuit input witness
65
+ * @param circuitBytecode - Compiled circuit bytecode
66
+ * @param circuitName - Name of the circuit
67
+ * @param functionName - Name of the circuit function (defaults to 'main'). This is meaningful only for
68
+ * contracts as protocol circuits artifacts always contain a single entrypoint function called 'main'.
69
+ * @returns A new CircuitRecorder instance
70
+ */
71
+ static start(recordDir: string, input: ACVMWitness, circuitBytecode: Buffer, circuitName: string, functionName?: string): Promise<CircuitRecorder>;
72
+ /**
73
+ * Wraps a callback to record all oracle/foreign calls.
74
+ * @param callback - The original callback to wrap, either a user circuit callback or protocol circuit callback.
75
+ * @returns A wrapped callback that records all oracle interactions.
76
+ */
77
+ wrapCallback(callback: ACIRCallback | ForeignCallHandler | undefined): ACIRCallback | ForeignCallHandler | undefined;
78
+ /**
79
+ * Finalizes the recording file by adding closing brackets. Without calling this method, the recording file is
80
+ * incomplete and it fails to parse.
81
+ */
82
+ finish(): Promise<void>;
83
+ /**
84
+ * Finalizes the recording file by adding the error and closing brackets. Without calling this method or `finish`,
85
+ * the recording file is incomplete and it fails to parse.
86
+ * @param error - The error that occurred during circuit execution
87
+ */
88
+ finishWithError(error: unknown): Promise<void>;
89
+ }
90
+ //# sourceMappingURL=circuit_recorder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circuit_recorder.d.ts","sourceRoot":"","sources":["../../../../src/private/providers/circuit_recording/circuit_recorder.ts"],"names":[],"mappings":";;AACA,OAAO,KAAK,EAAE,kBAAkB,EAAuC,MAAM,qBAAqB,CAAC;AAMnG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,qBAAa,eAAe;;IAIN,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAH7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;IACnE,OAAO,CAAC,WAAW,CAAQ;IAE3B,OAAO;IAEP;;;;;;;;;OASG;WACU,KAAK,CAChB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,WAAW,EAClB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,YAAY,GAAE,MAAe,GAC5B,OAAO,CAAC,eAAe,CAAC;IAsE3B;;;;OAIG;IACH,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,kBAAkB,GAAG,SAAS,GAAG,YAAY,GAAG,kBAAkB,GAAG,SAAS;IAkFpH;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ7B;;;;OAIG;IACG,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CASrD"}
@@ -0,0 +1,246 @@
1
+ import { createLogger } from '@aztec/foundation/log';
2
+ import { createHash } from 'crypto';
3
+ import fs from 'fs/promises';
4
+ import path from 'path';
5
+ import { Oracle } from '../../acvm/oracle/oracle.js';
6
+ /**
7
+ * Class responsible for recording circuit inputs necessary to replay the circuit. These inputs are the initial witness
8
+ * map and the oracle calls made during the circuit execution/witness generation.
9
+ *
10
+ * The recording is stored in a JSON file called `circuit_name_circuit_function_name_YYYY-MM-DD_N.json` where N is
11
+ * a counter to ensure unique filenames. The file is stored in the `recordDir` directory provided as a parameter to
12
+ * CircuitRecorder.start().
13
+ *
14
+ * Example recording file:
15
+ * ```json
16
+ * {
17
+ * "circuitName": "AMM",
18
+ * "functionName": "add_liquidity",
19
+ * "bytecodeMd5Hash": "b46c640ed38f20eac5f61a5e41d8dd1e",
20
+ * "timestamp": 1740691464360,
21
+ * "inputs": {
22
+ * "0": "0x1e89de1f0ad5204263733b7ddf65bec45b8f44714a4da85a46474dad677679ef",
23
+ * "1": "0x00f4d59c0ff773427bb0fed5b422557ca4dc5655abe53d31fa9408cb3c5a672f",
24
+ * "5": "0x000000000000000000000000000000000000000000000000000000000000000f"
25
+ * },
26
+ * "oracleCalls": [
27
+ * {
28
+ * "name": "loadCapsule",
29
+ * "inputs": [
30
+ * [
31
+ * "0x102422483bad6abd385948435667e144ac4c272576e325e7563608876cd446fd"
32
+ * ],
33
+ * [
34
+ * "0x000000000000000000000000000000000000000000000000000000000000004d"
35
+ * ],
36
+ * [
37
+ * "0x0000000000000000000000000000000000000000000000000000000000000001"
38
+ * ]
39
+ * ],
40
+ * "outputs": [
41
+ * "0x0000000000000000000000000000000000000000000000000000000000000000",
42
+ * [
43
+ * "0x0000000000000000000000000000000000000000000000000000000000000000"
44
+ * ]
45
+ * ]
46
+ * },
47
+ * {
48
+ * "name": "syncNotes",
49
+ * "inputs": []
50
+ * }
51
+ * ]
52
+ * }
53
+ * ```
54
+ */ export class CircuitRecorder {
55
+ filePath;
56
+ logger;
57
+ isFirstCall;
58
+ constructor(filePath){
59
+ this.filePath = filePath;
60
+ this.logger = createLogger('simulator:acvm:recording');
61
+ this.isFirstCall = true;
62
+ }
63
+ /**
64
+ * Initializes a new circuit recording session.
65
+ * @param recordDir - Directory to store the recording
66
+ * @param input - Circuit input witness
67
+ * @param circuitBytecode - Compiled circuit bytecode
68
+ * @param circuitName - Name of the circuit
69
+ * @param functionName - Name of the circuit function (defaults to 'main'). This is meaningful only for
70
+ * contracts as protocol circuits artifacts always contain a single entrypoint function called 'main'.
71
+ * @returns A new CircuitRecorder instance
72
+ */ static async start(recordDir, input, circuitBytecode, circuitName, functionName = 'main') {
73
+ const recording = {
74
+ circuitName: circuitName,
75
+ functionName: functionName,
76
+ bytecodeMd5Hash: createHash('md5').update(circuitBytecode).digest('hex'),
77
+ timestamp: Date.now(),
78
+ inputs: Object.fromEntries(input)
79
+ };
80
+ const recordingStringWithoutClosingBracket = JSON.stringify(recording, null, 2).slice(0, -2);
81
+ try {
82
+ // Check if the recording directory exists and is a directory
83
+ const stats = await fs.stat(recordDir);
84
+ if (!stats.isDirectory()) {
85
+ throw new Error(`Recording path ${recordDir} exists but is not a directory`);
86
+ }
87
+ } catch (err) {
88
+ if (err.code === 'ENOENT') {
89
+ // The directory does not exist so we create it
90
+ await fs.mkdir(recordDir, {
91
+ recursive: true
92
+ });
93
+ } else {
94
+ throw err;
95
+ }
96
+ }
97
+ const filePath = await CircuitRecorder.#computeFilePathAndStoreInitialRecording(recordDir, circuitName, functionName, recordingStringWithoutClosingBracket);
98
+ return new CircuitRecorder(filePath);
99
+ }
100
+ /**
101
+ * Computes a unique file path for the recording by trying different counter values.
102
+ * This is needed because multiple recordings of the same circuit could be happening simultaneously or an older
103
+ * recording might be present.
104
+ * @param recordDir - Directory to store the recording
105
+ * @param circuitName - Name of the circuit
106
+ * @param functionName - Name of the circuit function
107
+ * @param recordingContent - Initial recording content
108
+ * @returns A unique file path for the recording
109
+ */ static async #computeFilePathAndStoreInitialRecording(recordDir, circuitName, functionName, recordingContent) {
110
+ let counter = 0;
111
+ while(true){
112
+ try {
113
+ const filePath = getFilePath(recordDir, circuitName, functionName, counter);
114
+ // Write the initial recording content to the file
115
+ await fs.writeFile(filePath, recordingContent + ',\n "oracleCalls": [\n', {
116
+ flag: 'wx'
117
+ });
118
+ return filePath;
119
+ } catch (err) {
120
+ if (err.code === 'EEXIST') {
121
+ counter++;
122
+ continue;
123
+ }
124
+ throw err;
125
+ }
126
+ }
127
+ }
128
+ /**
129
+ * Wraps a callback to record all oracle/foreign calls.
130
+ * @param callback - The original callback to wrap, either a user circuit callback or protocol circuit callback.
131
+ * @returns A wrapped callback that records all oracle interactions.
132
+ */ wrapCallback(callback) {
133
+ if (!callback) {
134
+ return undefined;
135
+ }
136
+ if (this.#isACIRCallback(callback)) {
137
+ return this.#wrapUserCircuitCallback(callback);
138
+ }
139
+ return this.#wrapProtocolCircuitCallback(callback);
140
+ }
141
+ /**
142
+ * Type guard to check if a callback is an ACIRCallback.
143
+ */ #isACIRCallback(callback) {
144
+ return typeof callback === 'object' && callback !== null && !('call' in callback);
145
+ }
146
+ /**
147
+ * Wraps a user circuit callback to record all oracle calls.
148
+ * @param callback - The original circuit callback.
149
+ * @returns A wrapped callback that records all oracle interactions which is to be provided to the ACVM.
150
+ */ #wrapUserCircuitCallback(callback) {
151
+ const recordingCallback = {};
152
+ const oracleMethods = Object.getOwnPropertyNames(Oracle.prototype).filter((name)=>name !== 'constructor');
153
+ for (const name of oracleMethods){
154
+ const fn = callback[name];
155
+ if (!fn) {
156
+ throw new Error(`Oracle method ${name} not found when setting up recording callback`);
157
+ }
158
+ recordingCallback[name] = (...args)=>{
159
+ const result = fn.call(callback, ...args);
160
+ if (result instanceof Promise) {
161
+ return result.then(async (r)=>{
162
+ await this.#recordCall(name, args, r);
163
+ return r;
164
+ });
165
+ }
166
+ void this.#recordCall(name, args, result);
167
+ return result;
168
+ };
169
+ }
170
+ return recordingCallback;
171
+ }
172
+ /**
173
+ * Wraps a protocol circuit callback to record all oracle calls.
174
+ * @param callback - The original oracle circuit callback.
175
+ * @returns A wrapped handler that records all oracle interactions which is to be provided to the ACVM.
176
+ */ #wrapProtocolCircuitCallback(callback) {
177
+ return async (name, inputs)=>{
178
+ const result = await callback(name, inputs);
179
+ await this.#recordCall(name, inputs, result);
180
+ return result;
181
+ };
182
+ }
183
+ /**
184
+ * Records a single oracle/foreign call with its inputs and outputs.
185
+ * @param name - Name of the call
186
+ * @param inputs - Input arguments
187
+ * @param outputs - Output results
188
+ */ async #recordCall(name, inputs, outputs) {
189
+ try {
190
+ const entry = {
191
+ name,
192
+ inputs,
193
+ outputs
194
+ };
195
+ const prefix = this.isFirstCall ? ' ' : ' ,';
196
+ this.isFirstCall = false;
197
+ await fs.appendFile(this.filePath, prefix + JSON.stringify(entry) + '\n');
198
+ } catch (err) {
199
+ this.logger.error('Failed to log circuit call', {
200
+ error: err
201
+ });
202
+ }
203
+ }
204
+ /**
205
+ * Finalizes the recording file by adding closing brackets. Without calling this method, the recording file is
206
+ * incomplete and it fails to parse.
207
+ */ async finish() {
208
+ try {
209
+ await fs.appendFile(this.filePath, ' ]\n}\n');
210
+ } catch (err) {
211
+ this.logger.error('Failed to finalize recording file', {
212
+ error: err
213
+ });
214
+ }
215
+ }
216
+ /**
217
+ * Finalizes the recording file by adding the error and closing brackets. Without calling this method or `finish`,
218
+ * the recording file is incomplete and it fails to parse.
219
+ * @param error - The error that occurred during circuit execution
220
+ */ async finishWithError(error) {
221
+ try {
222
+ await fs.appendFile(this.filePath, ' ],\n');
223
+ await fs.appendFile(this.filePath, ` "error": ${JSON.stringify(error)}\n`);
224
+ await fs.appendFile(this.filePath, '}\n');
225
+ } catch (err) {
226
+ this.logger.error('Failed to finalize recording file with error', {
227
+ error: err
228
+ });
229
+ }
230
+ }
231
+ }
232
+ /**
233
+ * Generates a file path for storing circuit recordings. The format of the filename is:
234
+ * `circuit_name_circuit_function_name_YYYY-MM-DD_N.json` where N is a counter to ensure unique filenames.
235
+ * @param recordDir - Base directory for recordings
236
+ * @param circuitName - Name of the circuit
237
+ * @param functionName - Name of the circuit function
238
+ * @param counter - Counter to ensure unique filenames. This is expected to be incremented in a loop until there is no
239
+ * existing file with the same name.
240
+ * @returns A file path for the recording.
241
+ */ function getFilePath(recordDir, circuitName, functionName, counter) {
242
+ const date = new Date();
243
+ const formattedDate = date.toISOString().split('T')[0];
244
+ const filename = `${circuitName}_${functionName}_${formattedDate}_${counter}.json`;
245
+ return path.join(recordDir, filename);
246
+ }
@@ -0,0 +1,18 @@
1
+ import type { ForeignCallHandler } from '@aztec/noir-protocol-circuits-types/types';
2
+ import type { FunctionArtifactWithContractName } from '@aztec/stdlib/abi';
3
+ import type { NoirCompiledCircuitWithName } from '@aztec/stdlib/noir';
4
+ import type { ACIRCallback, ACIRExecutionResult } from '../../acvm/acvm.js';
5
+ import type { ACVMWitness } from '../../acvm/acvm_types.js';
6
+ import type { SimulationProvider } from '../simulation_provider.js';
7
+ /**
8
+ * Takes a simulation provider and wraps it in a circuit recorder. See CircuitRecorder for more details on how circuit
9
+ * recording works.
10
+ */
11
+ export declare class SimulationProviderRecorderWrapper implements SimulationProvider {
12
+ #private;
13
+ private simulator;
14
+ constructor(simulator: SimulationProvider);
15
+ executeProtocolCircuit(input: ACVMWitness, artifact: NoirCompiledCircuitWithName, callback: ForeignCallHandler | undefined): Promise<ACVMWitness>;
16
+ executeUserCircuit(input: ACVMWitness, artifact: FunctionArtifactWithContractName, callback: ACIRCallback): Promise<ACIRExecutionResult>;
17
+ }
18
+ //# sourceMappingURL=simulation_provider_recorder_wrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulation_provider_recorder_wrapper.d.ts","sourceRoot":"","sources":["../../../../src/private/providers/circuit_recording/simulation_provider_recorder_wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAGpE;;;GAGG;AACH,qBAAa,iCAAkC,YAAW,kBAAkB;;IAC9D,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,kBAAkB;IAEjD,sBAAsB,CACpB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,2BAA2B,EACrC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,GACvC,OAAO,CAAC,WAAW,CAAC;IAavB,kBAAkB,CAChB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,gCAAgC,EAC1C,QAAQ,EAAE,YAAY,GACrB,OAAO,CAAC,mBAAmB,CAAC;CA4ChC"}
@@ -0,0 +1,39 @@
1
+ import { CircuitRecorder } from './circuit_recorder.js';
2
+ /**
3
+ * Takes a simulation provider and wraps it in a circuit recorder. See CircuitRecorder for more details on how circuit
4
+ * recording works.
5
+ */ export class SimulationProviderRecorderWrapper {
6
+ simulator;
7
+ constructor(simulator){
8
+ this.simulator = simulator;
9
+ }
10
+ executeProtocolCircuit(input, artifact, callback) {
11
+ const bytecode = Buffer.from(artifact.bytecode, 'base64');
12
+ return this.#simulate((wrappedCallback)=>this.simulator.executeProtocolCircuit(input, artifact, wrappedCallback), input, bytecode, artifact.name, 'main', callback);
13
+ }
14
+ executeUserCircuit(input, artifact, callback) {
15
+ return this.#simulate((wrappedCallback)=>this.simulator.executeUserCircuit(input, artifact, wrappedCallback), input, artifact.bytecode, artifact.contractName, artifact.name, callback);
16
+ }
17
+ async #simulate(simulateFn, input, bytecode, contractName, functionName, callback) {
18
+ const recordDir = process.env.CIRCUIT_RECORD_DIR;
19
+ if (!recordDir) {
20
+ // Recording is not enabled so we just execute the circuit
21
+ return simulateFn(callback);
22
+ }
23
+ // Start recording circuit execution
24
+ const recorder = await CircuitRecorder.start(recordDir, input, bytecode, contractName, functionName);
25
+ // If callback was provided, we wrap it in a circuit recorder callback wrapper
26
+ const wrappedCallback = recorder.wrapCallback(callback);
27
+ let result;
28
+ try {
29
+ result = await simulateFn(wrappedCallback);
30
+ } catch (error) {
31
+ // If an error occurs, we finalize the recording file with the error
32
+ await recorder.finishWithError(error);
33
+ throw error;
34
+ }
35
+ // Witness generation is complete so we finish the circuit recorder
36
+ await recorder.finish();
37
+ return result;
38
+ }
39
+ }
@@ -1,16 +1,30 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- import type { ExecutionError } from '@aztec/noir-acvm_js';
4
- import type { WitnessMap } from '@aztec/noir-types';
5
- import type { NoirCompiledCircuit } from '@aztec/stdlib/noir';
1
+ import type { ExecutionError, ForeignCallHandler } from '@aztec/noir-acvm_js';
2
+ import type { FunctionArtifactWithContractName } from '@aztec/stdlib/abi';
3
+ import type { NoirCompiledCircuit, NoirCompiledCircuitWithName } from '@aztec/stdlib/noir';
6
4
  import { type ACIRCallback, type ACIRExecutionResult } from '../acvm/acvm.js';
7
5
  import type { ACVMWitness } from '../acvm/acvm_types.js';
8
6
  /**
9
7
  * Low level simulation interface
10
8
  */
11
9
  export interface SimulationProvider {
12
- executeProtocolCircuit(input: WitnessMap, compiledCircuit: NoirCompiledCircuit): Promise<WitnessMap>;
13
- executeUserCircuit(acir: Buffer, initialWitness: ACVMWitness, callback: ACIRCallback): Promise<ACIRExecutionResult>;
10
+ /**
11
+ * Execute a protocol circuit/generate a witness
12
+ * @param input - The initial witness map defining all of the inputs to `circuit`.
13
+ * @param artifact - ACIR circuit bytecode and its metadata.
14
+ * @param callback - A callback to process any foreign calls from the circuit. Can be undefined as for native
15
+ * ACVM simulator we don't process foreign calls.
16
+ * @returns The solved witness calculated by executing the circuit on the provided inputs.
17
+ */
18
+ executeProtocolCircuit(input: ACVMWitness, artifact: NoirCompiledCircuitWithName, callback: ForeignCallHandler | undefined): Promise<ACVMWitness>;
19
+ /**
20
+ * Execute a user circuit (smart contract function)/generate a witness
21
+ * @param input - The initial witness map defining all of the inputs to `circuit`.
22
+ * @param artifact - Contract function ACIR circuit bytecode and its metadata.
23
+ * @param callback - A callback to process any foreign calls from the circuit.
24
+ * @returns The solved witness calculated by executing the circuit on the provided inputs, as well as the return
25
+ * witness indices as specified by the circuit.
26
+ */
27
+ executeUserCircuit(input: ACVMWitness, artifact: FunctionArtifactWithContractName, callback: ACIRCallback): Promise<ACIRExecutionResult>;
14
28
  }
15
29
  export type DecodedError = ExecutionError & {
16
30
  decodedAssertionPayload?: any;
@@ -1 +1 @@
1
- {"version":3,"file":"simulation_provider.d.ts","sourceRoot":"","sources":["../../../src/private/providers/simulation_provider.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAoB,MAAM,iBAAiB,CAAC;AAChG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,sBAAsB,CAAC,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,mBAAmB,GAAG,OAAO,CAAC,UA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,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAIxG,wBAAgB,eAAe,CAAC,QAAQ,EAAE,mBAAmB,EAAE,aAAa,EAAE,cAAc,GAAG,YAAY,CA4C1G"}
@@ -1,5 +1,6 @@
1
- import type { FunctionCall } from '@aztec/stdlib/abi';
1
+ import type { AbiDecoded, FunctionCall } from '@aztec/stdlib/abi';
2
2
  import { FunctionSelector } from '@aztec/stdlib/abi';
3
+ import type { AuthWitness } from '@aztec/stdlib/auth-witness';
3
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
5
  import { PrivateExecutionResult, TxExecutionRequest } from '@aztec/stdlib/tx';
5
6
  import type { ExecutionDataProvider } from './execution_data_provider.js';
@@ -29,6 +30,6 @@ export declare class AcirSimulator {
29
30
  * @param contractAddress - The address of the contract.
30
31
  * @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
31
32
  */
32
- runUnconstrained(request: FunctionCall, contractAddress: AztecAddress, selector: FunctionSelector, scopes?: AztecAddress[]): Promise<import("@aztec/stdlib/abi").AbiDecoded>;
33
+ runUnconstrained(request: FunctionCall, contractAddress: AztecAddress, selector: FunctionSelector, authwits: AuthWitness[], scopes?: AztecAddress[]): Promise<AbiDecoded>;
33
34
  }
34
35
  //# sourceMappingURL=simulator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"simulator.d.ts","sourceRoot":"","sources":["../../src/private/simulator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAe,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG3F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAK1E,OAAO,KAAK,EAAE,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