@aztec/simulator 0.78.1 → 0.80.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 (34) hide show
  1. package/dest/client.d.ts +1 -1
  2. package/dest/client.d.ts.map +1 -1
  3. package/dest/common/errors.d.ts +1 -1
  4. package/dest/common/errors.d.ts.map +1 -1
  5. package/dest/common/errors.js +1 -1
  6. package/dest/private/acvm/acvm.d.ts +1 -1
  7. package/dest/private/acvm/acvm.d.ts.map +1 -1
  8. package/dest/private/acvm/acvm.js +1 -1
  9. package/dest/private/acvm/acvm_types.d.ts +1 -1
  10. package/dest/private/acvm/acvm_types.d.ts.map +1 -1
  11. package/dest/private/providers/acvm_native.d.ts +1 -1
  12. package/dest/private/providers/acvm_native.d.ts.map +1 -1
  13. package/dest/private/providers/acvm_wasm.d.ts +1 -1
  14. package/dest/private/providers/acvm_wasm.d.ts.map +1 -1
  15. package/dest/private/providers/acvm_wasm.js +4 -4
  16. package/dest/private/providers/acvm_wasm_with_blobs.d.ts +1 -1
  17. package/dest/private/providers/acvm_wasm_with_blobs.d.ts.map +1 -1
  18. package/dest/private/providers/acvm_wasm_with_blobs.js +3 -3
  19. package/dest/private/providers/simulation_provider.d.ts +6 -5
  20. package/dest/private/providers/simulation_provider.d.ts.map +1 -1
  21. package/dest/private/providers/simulation_provider.js +25 -4
  22. package/dest/public/avm/fixtures/index.d.ts +2 -2
  23. package/dest/public/avm/fixtures/index.d.ts.map +1 -1
  24. package/dest/public/avm/fixtures/index.js +13 -12
  25. package/package.json +16 -16
  26. package/src/client.ts +1 -1
  27. package/src/common/errors.ts +2 -3
  28. package/src/private/acvm/acvm.ts +3 -4
  29. package/src/private/acvm/acvm_types.ts +1 -1
  30. package/src/private/providers/acvm_native.ts +1 -1
  31. package/src/private/providers/acvm_wasm.ts +5 -6
  32. package/src/private/providers/acvm_wasm_with_blobs.ts +4 -5
  33. package/src/private/providers/simulation_provider.ts +31 -10
  34. package/src/public/avm/fixtures/index.ts +22 -14
package/dest/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './private/index.js';
2
2
  export { WASMSimulator } from './private/providers/acvm_wasm.js';
3
- export { type SimulationProvider } from './private/providers/simulation_provider.js';
3
+ export { type SimulationProvider, type DecodedError } from './private/providers/simulation_provider.js';
4
4
  export * from './common/index.js';
5
5
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AACrF,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,4CAA4C,CAAC;AACxG,cAAc,mBAAmB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { Fr } from '@aztec/foundation/fields';
2
+ import type { RawAssertionPayload } from '@aztec/noir-acvm_js';
2
3
  import type { BrilligFunctionId, FunctionAbi, FunctionDebugMetadata, OpcodeLocation } from '@aztec/stdlib/abi';
3
4
  import { type FailingFunction, type NoirCallStack, SimulationError, type SourceCodeLocation } from '@aztec/stdlib/errors';
4
- import type { RawAssertionPayload } from '@noir-lang/acvm_js';
5
5
  /**
6
6
  * An error that occurred during the execution of a function.
7
7
  * @param message - the error message
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/common/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK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AgB,gCAAgC,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,GAAG,MAAM,CAMrF"}
@@ -1,6 +1,6 @@
1
1
  import { jsonStringify } from '@aztec/foundation/json-rpc';
2
+ import { abiDecodeError } from '@aztec/noir-noirc_abi';
2
3
  import { SimulationError } from '@aztec/stdlib/errors';
3
- import { abiDecodeError } from '@noir-lang/noirc_abi';
4
4
  /**
5
5
  * An error that occurred during the execution of a function.
6
6
  * @param message - the error message
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
+ import { type ExecutionError, type ForeignCallInput, type ForeignCallOutput } from '@aztec/noir-acvm_js';
3
4
  import type { FunctionDebugMetadata } from '@aztec/stdlib/abi';
4
5
  import type { NoirCallStack } from '@aztec/stdlib/errors';
5
- import { type ExecutionError, type ForeignCallInput, type ForeignCallOutput } from '@noir-lang/acvm_js';
6
6
  import type { ACVMWitness } from './acvm_types.js';
7
7
  import type { ORACLE_NAMES } from './oracle/index.js';
8
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"acvm.d.ts","sourceRoot":"","sources":["../../../src/private/acvm/acvm.ts"],"names":[],"mappings":";;AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EAEvB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAC/B,YAAY,EACZ,CACE,GAAG,IAAI,EAAE,gBAAgB,EAAE,KAEzB,IAAI,GACJ,OAAO,CAAC,IAAI,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AM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,cAAc,EAAE,WAAW,CAAC;IAC5B,aAAa,EAAE,WAAW,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAsB,IAAI,CACxB,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,WAAW,EAC3B,QAAQ,EAAE,YAAY,GACrB,OAAO,CAAC,mBAAmB,CAAC,CAkD9B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,GAAG,cAAc,EAC7B,KAAK,CAAC,EAAE,qBAAqB,GAC5B,aAAa,GAAG,SAAS,CAc3B"}
@@ -1,5 +1,5 @@
1
1
  import { createLogger } from '@aztec/foundation/log';
2
- import { executeCircuitWithReturnWitness } from '@noir-lang/acvm_js';
2
+ import { executeCircuitWithReturnWitness } from '@aztec/noir-acvm_js';
3
3
  import { resolveOpcodeLocations, traverseCauseChain } from '../../common/errors.js';
4
4
  /**
5
5
  * The function call that executes an ACIR.
@@ -1,4 +1,4 @@
1
- import type { WitnessMap } from '@noir-lang/acvm_js';
1
+ import type { WitnessMap } from '@aztec/noir-acvm_js';
2
2
  /**
3
3
  * ACVMField
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"acvm_types.d.ts","sourceRoot":"","sources":["../../../src/private/acvm/acvm_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC"}
1
+ {"version":3,"file":"acvm_types.d.ts","sourceRoot":"","sources":["../../../src/private/acvm/acvm_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
+ import type { WitnessMap } from '@aztec/noir-types';
3
4
  import type { NoirCompiledCircuit } from '@aztec/stdlib/noir';
4
- import type { WitnessMap } from '@noir-lang/types';
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';
@@ -1 +1 @@
1
- {"version":3,"file":"acvm_native.d.ts","sourceRoot":"","sources":["../../../src/private/providers/acvm_native.ts"],"names":[],"mappings":";;AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAInD,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAInE,oBAAY,WAAW;IACrB,OAAO,IAAA;IACP,OAAO,IAAA;CACR;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC;AAmBnD;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,UAAU,EACxB,QAAQ,EAAE,MAAM,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C;IAC5B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC;AAmBnD;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,UAAU,EACxB,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,UAAU,CAAC,CAqErB;AAED,qBAAa,mBAAoB,YAAW,kBAAkB;IAChD,OAAO,CAAC,gBAAgB;IAAU,OAAO,CAAC,UAAU;IAAU,OAAO,CAAC,eAAe,CAAC;gBAA9E,gBAAgB,EAAE,MAAM,EAAU,UAAU,EAAE,MAAM,EAAU,eAAe,CAAC,oBAAQ;IACpG,sBAAsB,CAAC,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IAyB1G,kBAAkB,CAChB,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,WAAW,EAC5B,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,mBAAmB,CAAC;CAGhC"}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
+ import type { WitnessMap } from '@aztec/noir-types';
3
4
  import type { NoirCompiledCircuit } from '@aztec/stdlib/noir';
4
- import type { WitnessMap } from '@noir-lang/types';
5
5
  import { type ACIRCallback } from '../acvm/acvm.js';
6
6
  import type { ACVMWitness } from '../acvm/acvm_types.js';
7
7
  import { type SimulationProvider } from './simulation_provider.js';
@@ -1 +1 @@
1
- {"version":3,"file":"acvm_wasm.d.ts","sourceRoot":"","sources":["../../../src/private/providers/acvm_wasm.ts"],"names":[],"mappings":";;AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAI9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM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@@
1
1
  import { createLogger } from '@aztec/foundation/log';
2
+ import initACVM, { executeCircuit } from '@aztec/noir-acvm_js';
3
+ import initAbi from '@aztec/noir-noirc_abi';
2
4
  import { foreignCallHandler } from '@aztec/noir-protocol-circuits-types/client';
3
- import initACVM, { executeCircuit } from '@noir-lang/acvm_js';
4
- import initAbi from '@noir-lang/noirc_abi';
5
5
  import { acvm } from '../acvm/acvm.js';
6
- import { parseErrorPayload } from './simulation_provider.js';
6
+ import { enrichNoirError } from './simulation_provider.js';
7
7
  export class WASMSimulator {
8
8
  log;
9
9
  constructor(log = createLogger('wasm-simulator')){
@@ -40,7 +40,7 @@ export class WASMSimulator {
40
40
  } catch (err) {
41
41
  // Typescript types catched errors as unknown or any, so we need to narrow its type to check if it has raw assertion payload.
42
42
  if (typeof err === 'object' && err !== null && 'rawAssertionPayload' in err) {
43
- const parsed = parseErrorPayload(compiledCircuit.abi, err);
43
+ const parsed = enrichNoirError(compiledCircuit, err);
44
44
  this.log.debug('execution failed', {
45
45
  hash: compiledCircuit.hash,
46
46
  error: parsed,
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
+ import type { WitnessMap } from '@aztec/noir-types';
3
4
  import type { NoirCompiledCircuit } from '@aztec/stdlib/noir';
4
- import type { WitnessMap } from '@noir-lang/types';
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';
@@ -1 +1 @@
1
- {"version":3,"file":"acvm_wasm_with_blobs.d.ts","sourceRoot":"","sources":["../../../src/private/providers/acvm_wasm_with_blobs.ts"],"names":[],"mappings":";;AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,kBAAkB,EAAqB,MAAM,0BAA0B,CAAC;AAEtF;;;;;;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":";;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,6 +1,6 @@
1
+ import { executeCircuit } from '@aztec/noir-acvm_js';
1
2
  import { foreignCallHandler } from '@aztec/noir-protocol-circuits-types/server';
2
- import { executeCircuit } from '@noir-lang/acvm_js';
3
- import { parseErrorPayload } from './simulation_provider.js';
3
+ import { enrichNoirError } from './simulation_provider.js';
4
4
  /**
5
5
  * A simulation provider that uses the WASM simulator with the ability to handle blobs via the foreign call handler.
6
6
  * This class is temporary while brillig cannot handle the blob math, and it is kept separate
@@ -21,7 +21,7 @@ import { parseErrorPayload } from './simulation_provider.js';
21
21
  } catch (err) {
22
22
  // Typescript types catched errors as unknown or any, so we need to narrow its type to check if it has raw assertion payload.
23
23
  if (typeof err === 'object' && err !== null && 'rawAssertionPayload' in err) {
24
- throw parseErrorPayload(compiledCircuit.abi, err);
24
+ throw enrichNoirError(compiledCircuit, err);
25
25
  }
26
26
  throw new Error(`Circuit execution failed: ${err}`);
27
27
  }
@@ -1,9 +1,9 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
+ import type { ExecutionError } from '@aztec/noir-acvm_js';
4
+ import type { WitnessMap } from '@aztec/noir-types';
3
5
  import type { NoirCompiledCircuit } from '@aztec/stdlib/noir';
4
- import type { ExecutionError } from '@noir-lang/acvm_js';
5
- import type { Abi, WitnessMap } from '@noir-lang/types';
6
- import type { ACIRCallback, ACIRExecutionResult } from '../acvm/acvm.js';
6
+ import { type ACIRCallback, type ACIRExecutionResult } from '../acvm/acvm.js';
7
7
  import type { ACVMWitness } from '../acvm/acvm_types.js';
8
8
  /**
9
9
  * Low level simulation interface
@@ -12,8 +12,9 @@ export interface SimulationProvider {
12
12
  executeProtocolCircuit(input: WitnessMap, compiledCircuit: NoirCompiledCircuit): Promise<WitnessMap>;
13
13
  executeUserCircuit(acir: Buffer, initialWitness: ACVMWitness, callback: ACIRCallback): Promise<ACIRExecutionResult>;
14
14
  }
15
- export type ErrorWithPayload = ExecutionError & {
15
+ export type DecodedError = ExecutionError & {
16
16
  decodedAssertionPayload?: any;
17
+ noirCallStack?: string[];
17
18
  };
18
- export declare function parseErrorPayload(abi: Abi, originalError: ExecutionError): Error;
19
+ export declare function enrichNoirError(artifact: NoirCompiledCircuit, originalError: ExecutionError): DecodedError;
19
20
  //# sourceMappingURL=simulation_provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"simulation_provider.d.ts","sourceRoot":"","sources":["../../../src/private/providers/simulation_provider.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACzE,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,UAAU,CAAC,CAAC;IACrG,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACrH;AAED,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG;IAAE,uBAAuB,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC;AAIlF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,aAAa,EAAE,cAAc,GAAG,KAAK,CAuBhF"}
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,UAAU,CAAC,CAAC;IACrG,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACrH;AAED,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG;IAAE,uBAAuB,CAAC,EAAE,GAAG,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,7 +1,9 @@
1
- import { abiDecodeError } from '@noir-lang/noirc_abi';
2
- // Error handling taken from noir/noir-repo/tooling/noir_js/src/witness_generation.ts.
1
+ import { abiDecodeError } from '@aztec/noir-noirc_abi';
2
+ import { parseDebugSymbols } from '@aztec/stdlib/abi';
3
+ import { extractCallStack } from '../acvm/acvm.js';
4
+ // Payload parsing taken from noir/noir-repo/tooling/noir_js/src/witness_generation.ts.
3
5
  // TODO: import this in isolation without having to import noir_js in its entirety.
4
- export function parseErrorPayload(abi, originalError) {
6
+ export function enrichNoirError(artifact, originalError) {
5
7
  const payload = originalError.rawAssertionPayload;
6
8
  if (!payload) {
7
9
  return originalError;
@@ -9,7 +11,7 @@ export function parseErrorPayload(abi, originalError) {
9
11
  const enrichedError = originalError;
10
12
  try {
11
13
  // Decode the payload
12
- const decodedPayload = abiDecodeError(abi, payload);
14
+ const decodedPayload = abiDecodeError(artifact.abi, payload);
13
15
  if (typeof decodedPayload === 'string') {
14
16
  // If it's a string, just add it to the error message
15
17
  enrichedError.message = `Circuit execution failed: ${decodedPayload}`;
@@ -20,5 +22,24 @@ export function parseErrorPayload(abi, originalError) {
20
22
  } catch (_errorDecoding) {
21
23
  // Ignore errors decoding the payload
22
24
  }
25
+ try {
26
+ // Decode the callstack
27
+ const callStack = extractCallStack(originalError, {
28
+ // TODO(https://github.com/AztecProtocol/aztec-packages/issues/5813)
29
+ // We only support handling debug info for the circuit entry point.
30
+ // So for now we simply index into the first debug info.
31
+ debugSymbols: parseDebugSymbols(artifact.debug_symbols)[0],
32
+ files: artifact.file_map
33
+ });
34
+ enrichedError.noirCallStack = callStack?.map((errorLocation)=>{
35
+ if (typeof errorLocation === 'string') {
36
+ return `at opcode ${errorLocation}`;
37
+ } else {
38
+ return `at ${errorLocation.locationText} (${errorLocation.filePath}:${errorLocation.line}:${errorLocation.column})`;
39
+ }
40
+ });
41
+ } catch (_errorResolving) {
42
+ // Ignore errors resolving the callstack
43
+ }
23
44
  return enrichedError;
24
45
  }
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
3
  import { Fr } from '@aztec/foundation/fields';
4
- import { type ContractArtifact, type FunctionArtifact, FunctionSelector } from '@aztec/stdlib/abi';
4
+ import { type ContractArtifact, type FunctionAbi, type FunctionArtifact, FunctionSelector } from '@aztec/stdlib/abi';
5
5
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
6
6
  import { type ContractClassPublic, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
7
7
  import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
@@ -56,7 +56,7 @@ export declare function randomMemoryUint32s(length: number): Uint32[];
56
56
  export declare function randomMemoryUint64s(length: number): Uint64[];
57
57
  export declare function randomMemoryFields(length: number): Field[];
58
58
  export declare function getFunctionSelector(functionName: string, contractArtifact: ContractArtifact): Promise<FunctionSelector>;
59
- export declare function getContractFunctionArtifact(functionName: string, contractArtifact: ContractArtifact): FunctionArtifact | undefined;
59
+ export declare function getContractFunctionArtifact(functionName: string, contractArtifact: ContractArtifact): FunctionArtifact | FunctionAbi | undefined;
60
60
  export declare function resolveContractAssertionMessage(functionName: string, revertReason: AvmRevertReason, output: Fr[], contractArtifact: ContractArtifact): string | undefined;
61
61
  export declare function getAvmTestContractFunctionSelector(functionName: string): Promise<FunctionSelector>;
62
62
  export declare function getAvmGadgetsTestContractFunctionSelector(functionName: string): Promise<FunctionSelector>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/fixtures/index.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAEjC,MAAM,wBAAwB,CAAC;AAIhC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAOnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CA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AS,CAEpB;AAED,wBAAgB,6CAA6C,CAC3D,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,eAAe,EAC7B,MAAM,EAAE,EAAE,EAAE,GACX,MAAM,GAAG,SAAS,CAWpB;AAED;;;;;;;;;GASG;AACH,wBAAsB,8BAA8B,CAClD,eAAe,EAAE,GAAG,EAAE,EACtB,QAAQ,EAAE,YAAY,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,SAAI,EACR,uBAAuB,CAAC,EAAE,EAAE,GAC3B,OAAO,CAAC;IACT,aAAa,EAAE,mBAAmB,CAAC;IACnC,gBAAgB,EAAE,2BAA2B,CAAC;IAC9C,wBAAwB,EAAE,EAAE,CAAC;CAC9B,CAAC,CA4BD"}
@@ -1,9 +1,9 @@
1
1
  import { DEPLOYER_CONTRACT_ADDRESS, MAX_L2_GAS_PER_TX_PUBLIC_PORTION, PUBLIC_DISPATCH_SELECTOR } from '@aztec/constants';
2
2
  import { EthAddress } from '@aztec/foundation/eth-address';
3
3
  import { Fr } from '@aztec/foundation/fields';
4
- import { AvmGadgetsTestContractArtifact } from '@aztec/noir-contracts.js/AvmGadgetsTest';
5
- import { AvmTestContractArtifact } from '@aztec/noir-contracts.js/AvmTest';
6
- import { FunctionSelector } from '@aztec/stdlib/abi';
4
+ import { AvmGadgetsTestContract } from '@aztec/noir-contracts.js/AvmGadgetsTest';
5
+ import { AvmTestContract } from '@aztec/noir-contracts.js/AvmTest';
6
+ import { FunctionSelector, getAllFunctionAbis } from '@aztec/stdlib/abi';
7
7
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
8
8
  import { computeInitializationHash } from '@aztec/stdlib/contract';
9
9
  import { isNoirCallStackUnresolved } from '@aztec/stdlib/errors';
@@ -79,7 +79,7 @@ export function randomMemoryFields(length) {
79
79
  ].map((_)=>new Field(Fr.random()));
80
80
  }
81
81
  export function getFunctionSelector(functionName, contractArtifact) {
82
- const fnArtifact = contractArtifact.functions.find((f)=>f.name === functionName);
82
+ const fnArtifact = getAllFunctionAbis(contractArtifact).find((f)=>f.name === functionName);
83
83
  assert(!!fnArtifact, `Function ${functionName} not found in ${contractArtifact.name}`);
84
84
  const params = fnArtifact.parameters;
85
85
  return FunctionSelector.fromNameAndParameters(fnArtifact.name, params);
@@ -87,7 +87,8 @@ export function getFunctionSelector(functionName, contractArtifact) {
87
87
  export function getContractFunctionArtifact(functionName, contractArtifact) {
88
88
  const artifact = contractArtifact.functions.find((f)=>f.name === functionName);
89
89
  if (!artifact) {
90
- return undefined;
90
+ const abi = getAllFunctionAbis(contractArtifact).find((f)=>f.name === functionName);
91
+ return abi || undefined;
91
92
  }
92
93
  return artifact;
93
94
  }
@@ -95,28 +96,28 @@ export function resolveContractAssertionMessage(functionName, revertReason, outp
95
96
  traverseCauseChain(revertReason, (cause)=>{
96
97
  revertReason = cause;
97
98
  });
98
- const functionArtifact = contractArtifact.functions.find((f)=>f.name === functionName);
99
+ const functionArtifact = getAllFunctionAbis(contractArtifact).find((f)=>f.name === functionName);
99
100
  if (!functionArtifact || !revertReason.noirCallStack || !isNoirCallStackUnresolved(revertReason.noirCallStack)) {
100
101
  return undefined;
101
102
  }
102
103
  return resolveAssertionMessageFromRevertData(output, functionArtifact);
103
104
  }
104
105
  export function getAvmTestContractFunctionSelector(functionName) {
105
- return getFunctionSelector(functionName, AvmTestContractArtifact);
106
+ return getFunctionSelector(functionName, AvmTestContract.artifactForPublic);
106
107
  }
107
108
  export function getAvmGadgetsTestContractFunctionSelector(functionName) {
108
- const artifact = AvmGadgetsTestContractArtifact.functions.find((f)=>f.name === functionName);
109
+ const artifact = getAllFunctionAbis(AvmGadgetsTestContract.artifactForPublic).find((f)=>f.name === functionName);
109
110
  assert(!!artifact, `Function ${functionName} not found in AvmGadgetsTestContractArtifact`);
110
111
  const params = artifact.parameters;
111
112
  return FunctionSelector.fromNameAndParameters(artifact.name, params);
112
113
  }
113
114
  export function getAvmTestContractArtifact(functionName) {
114
- const artifact = getContractFunctionArtifact(functionName, AvmTestContractArtifact);
115
+ const artifact = getContractFunctionArtifact(functionName, AvmTestContract.artifactForPublic);
115
116
  assert(!!artifact?.bytecode, `No bytecode found for function ${functionName}. Try re-running bootstrap.sh on the repository root.`);
116
117
  return artifact;
117
118
  }
118
119
  export function getAvmGadgetsTestContractArtifact(functionName) {
119
- const artifact = AvmGadgetsTestContractArtifact.functions.find((f)=>f.name === functionName);
120
+ const artifact = AvmGadgetsTestContract.artifactForPublic.functions.find((f)=>f.name === functionName);
120
121
  assert(!!artifact?.bytecode, `No bytecode found for function ${functionName}. Try re-running bootstrap.sh on the repository root.`);
121
122
  return artifact;
122
123
  }
@@ -129,13 +130,13 @@ export function getAvmGadgetsTestContractBytecode(functionName) {
129
130
  return artifact.bytecode;
130
131
  }
131
132
  export function resolveAvmTestContractAssertionMessage(functionName, revertReason, output) {
132
- return resolveContractAssertionMessage(functionName, revertReason, output, AvmTestContractArtifact);
133
+ return resolveContractAssertionMessage(functionName, revertReason, output, AvmTestContract.artifactForPublic);
133
134
  }
134
135
  export function resolveAvmGadgetsTestContractAssertionMessage(functionName, revertReason, output) {
135
136
  traverseCauseChain(revertReason, (cause)=>{
136
137
  revertReason = cause;
137
138
  });
138
- const functionArtifact = AvmGadgetsTestContractArtifact.functions.find((f)=>f.name === functionName);
139
+ const functionArtifact = AvmGadgetsTestContract.artifactForPublic.functions.find((f)=>f.name === functionName);
139
140
  if (!functionArtifact || !revertReason.noirCallStack || !isNoirCallStackUnresolved(revertReason.noirCallStack)) {
140
141
  return undefined;
141
142
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/simulator",
3
- "version": "0.78.1",
3
+ "version": "0.80.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./server": "./dest/server.js",
@@ -59,26 +59,26 @@
59
59
  ]
60
60
  },
61
61
  "dependencies": {
62
- "@aztec/constants": "0.78.1",
63
- "@aztec/foundation": "0.78.1",
64
- "@aztec/noir-protocol-circuits-types": "0.78.1",
65
- "@aztec/protocol-contracts": "0.78.1",
66
- "@aztec/stdlib": "0.78.1",
67
- "@aztec/telemetry-client": "0.78.1",
68
- "@aztec/world-state": "0.78.1",
62
+ "@aztec/constants": "0.80.0",
63
+ "@aztec/foundation": "0.80.0",
64
+ "@aztec/noir-acvm_js": "0.80.0",
65
+ "@aztec/noir-noirc_abi": "0.80.0",
66
+ "@aztec/noir-protocol-circuits-types": "0.80.0",
67
+ "@aztec/noir-types": "0.80.0",
68
+ "@aztec/protocol-contracts": "0.80.0",
69
+ "@aztec/stdlib": "0.80.0",
70
+ "@aztec/telemetry-client": "0.80.0",
71
+ "@aztec/world-state": "0.80.0",
69
72
  "levelup": "^5.1.1",
70
73
  "lodash.clonedeep": "^4.5.0",
71
74
  "lodash.merge": "^4.6.2",
72
75
  "memdown": "^6.1.1",
73
- "tslib": "^2.4.0",
74
- "@aztec/noir-acvm_js": "0.78.1",
75
- "@aztec/noir-noirc_abi": "0.78.1",
76
- "@aztec/noir-types": "0.78.1"
76
+ "tslib": "^2.4.0"
77
77
  },
78
78
  "devDependencies": {
79
- "@aztec/kv-store": "0.78.1",
80
- "@aztec/merkle-tree": "0.78.1",
81
- "@aztec/noir-contracts.js": "0.78.1",
79
+ "@aztec/kv-store": "0.80.0",
80
+ "@aztec/merkle-tree": "0.80.0",
81
+ "@aztec/noir-contracts.js": "0.80.0",
82
82
  "@jest/globals": "^29.5.0",
83
83
  "@types/jest": "^29.5.0",
84
84
  "@types/levelup": "^5.1.3",
@@ -90,7 +90,7 @@
90
90
  "jest-mock-extended": "^3.0.4",
91
91
  "ts-node": "^10.9.1",
92
92
  "typescript": "^5.0.4",
93
- "viem": "2.22.8"
93
+ "viem": "2.23.7"
94
94
  },
95
95
  "files": [
96
96
  "dest",
package/src/client.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './private/index.js';
2
2
  export { WASMSimulator } from './private/providers/acvm_wasm.js';
3
- export { type SimulationProvider } from './private/providers/simulation_provider.js';
3
+ export { type SimulationProvider, type DecodedError } from './private/providers/simulation_provider.js';
4
4
  export * from './common/index.js';
@@ -1,5 +1,7 @@
1
1
  import type { Fr } from '@aztec/foundation/fields';
2
2
  import { jsonStringify } from '@aztec/foundation/json-rpc';
3
+ import type { RawAssertionPayload } from '@aztec/noir-acvm_js';
4
+ import { abiDecodeError } from '@aztec/noir-noirc_abi';
3
5
  import type { BrilligFunctionId, FunctionAbi, FunctionDebugMetadata, OpcodeLocation } from '@aztec/stdlib/abi';
4
6
  import {
5
7
  type FailingFunction,
@@ -8,9 +10,6 @@ import {
8
10
  type SourceCodeLocation,
9
11
  } from '@aztec/stdlib/errors';
10
12
 
11
- import type { RawAssertionPayload } from '@noir-lang/acvm_js';
12
- import { abiDecodeError } from '@noir-lang/noirc_abi';
13
-
14
13
  /**
15
14
  * An error that occurred during the execution of a function.
16
15
  * @param message - the error message
@@ -1,13 +1,12 @@
1
1
  import { createLogger } from '@aztec/foundation/log';
2
- import type { FunctionDebugMetadata } from '@aztec/stdlib/abi';
3
- import type { NoirCallStack } from '@aztec/stdlib/errors';
4
-
5
2
  import {
6
3
  type ExecutionError,
7
4
  type ForeignCallInput,
8
5
  type ForeignCallOutput,
9
6
  executeCircuitWithReturnWitness,
10
- } from '@noir-lang/acvm_js';
7
+ } from '@aztec/noir-acvm_js';
8
+ import type { FunctionDebugMetadata } from '@aztec/stdlib/abi';
9
+ import type { NoirCallStack } from '@aztec/stdlib/errors';
11
10
 
12
11
  import { resolveOpcodeLocations, traverseCauseChain } from '../../common/errors.js';
13
12
  import type { ACVMWitness } from './acvm_types.js';
@@ -1,4 +1,4 @@
1
- import type { WitnessMap } from '@noir-lang/acvm_js';
1
+ import type { WitnessMap } from '@aztec/noir-acvm_js';
2
2
 
3
3
  /**
4
4
  * ACVMField
@@ -1,9 +1,9 @@
1
1
  import { runInDirectory } from '@aztec/foundation/fs';
2
2
  import { createLogger } from '@aztec/foundation/log';
3
3
  import { Timer } from '@aztec/foundation/timer';
4
+ import type { WitnessMap } from '@aztec/noir-types';
4
5
  import type { NoirCompiledCircuit } from '@aztec/stdlib/noir';
5
6
 
6
- import type { WitnessMap } from '@noir-lang/types';
7
7
  import * as proc from 'child_process';
8
8
  import { promises as fs } from 'fs';
9
9
 
@@ -1,14 +1,13 @@
1
1
  import { createLogger } from '@aztec/foundation/log';
2
+ import initACVM, { type ExecutionError, executeCircuit } from '@aztec/noir-acvm_js';
3
+ import initAbi from '@aztec/noir-noirc_abi';
2
4
  import { foreignCallHandler } from '@aztec/noir-protocol-circuits-types/client';
5
+ import type { WitnessMap } from '@aztec/noir-types';
3
6
  import type { NoirCompiledCircuit } from '@aztec/stdlib/noir';
4
7
 
5
- import initACVM, { type ExecutionError, executeCircuit } from '@noir-lang/acvm_js';
6
- import initAbi from '@noir-lang/noirc_abi';
7
- import type { WitnessMap } from '@noir-lang/types';
8
-
9
8
  import { type ACIRCallback, acvm } from '../acvm/acvm.js';
10
9
  import type { ACVMWitness } from '../acvm/acvm_types.js';
11
- import { type SimulationProvider, parseErrorPayload } from './simulation_provider.js';
10
+ import { type SimulationProvider, enrichNoirError } from './simulation_provider.js';
12
11
 
13
12
  export class WASMSimulator implements SimulationProvider {
14
13
  constructor(protected log = createLogger('wasm-simulator')) {}
@@ -43,7 +42,7 @@ export class WASMSimulator implements SimulationProvider {
43
42
  } catch (err) {
44
43
  // Typescript types catched errors as unknown or any, so we need to narrow its type to check if it has raw assertion payload.
45
44
  if (typeof err === 'object' && err !== null && 'rawAssertionPayload' in err) {
46
- const parsed = parseErrorPayload(compiledCircuit.abi, err as ExecutionError);
45
+ const parsed = enrichNoirError(compiledCircuit, err as ExecutionError);
47
46
  this.log.debug('execution failed', {
48
47
  hash: compiledCircuit.hash,
49
48
  error: parsed,
@@ -1,12 +1,11 @@
1
+ import { type ExecutionError, executeCircuit } from '@aztec/noir-acvm_js';
1
2
  import { foreignCallHandler } from '@aztec/noir-protocol-circuits-types/server';
3
+ import type { WitnessMap } from '@aztec/noir-types';
2
4
  import type { NoirCompiledCircuit } from '@aztec/stdlib/noir';
3
5
 
4
- import { type ExecutionError, executeCircuit } from '@noir-lang/acvm_js';
5
- import type { WitnessMap } from '@noir-lang/types';
6
-
7
6
  import type { ACIRCallback, ACIRExecutionResult } from '../acvm/acvm.js';
8
7
  import type { ACVMWitness } from '../acvm/acvm_types.js';
9
- import { type SimulationProvider, parseErrorPayload } from './simulation_provider.js';
8
+ import { type SimulationProvider, enrichNoirError } from './simulation_provider.js';
10
9
 
11
10
  /**
12
11
  * A simulation provider that uses the WASM simulator with the ability to handle blobs via the foreign call handler.
@@ -34,7 +33,7 @@ export class WASMSimulatorWithBlobs implements SimulationProvider {
34
33
  } catch (err) {
35
34
  // Typescript types catched errors as unknown or any, so we need to narrow its type to check if it has raw assertion payload.
36
35
  if (typeof err === 'object' && err !== null && 'rawAssertionPayload' in err) {
37
- throw parseErrorPayload(compiledCircuit.abi, err as ExecutionError);
36
+ throw enrichNoirError(compiledCircuit, err as ExecutionError);
38
37
  }
39
38
  throw new Error(`Circuit execution failed: ${err}`);
40
39
  }
@@ -1,10 +1,10 @@
1
+ import type { ExecutionError } from '@aztec/noir-acvm_js';
2
+ import { abiDecodeError } from '@aztec/noir-noirc_abi';
3
+ import type { WitnessMap } from '@aztec/noir-types';
4
+ import { parseDebugSymbols } from '@aztec/stdlib/abi';
1
5
  import type { NoirCompiledCircuit } from '@aztec/stdlib/noir';
2
6
 
3
- import type { ExecutionError } from '@noir-lang/acvm_js';
4
- import { abiDecodeError } from '@noir-lang/noirc_abi';
5
- import type { Abi, WitnessMap } from '@noir-lang/types';
6
-
7
- import type { ACIRCallback, ACIRExecutionResult } from '../acvm/acvm.js';
7
+ import { type ACIRCallback, type ACIRExecutionResult, extractCallStack } from '../acvm/acvm.js';
8
8
  import type { ACVMWitness } from '../acvm/acvm_types.js';
9
9
 
10
10
  /**
@@ -15,20 +15,20 @@ export interface SimulationProvider {
15
15
  executeUserCircuit(acir: Buffer, initialWitness: ACVMWitness, callback: ACIRCallback): Promise<ACIRExecutionResult>;
16
16
  }
17
17
 
18
- export type ErrorWithPayload = ExecutionError & { decodedAssertionPayload?: any };
18
+ export type DecodedError = ExecutionError & { decodedAssertionPayload?: any; noirCallStack?: string[] };
19
19
 
20
- // Error handling taken from noir/noir-repo/tooling/noir_js/src/witness_generation.ts.
20
+ // Payload parsing taken from noir/noir-repo/tooling/noir_js/src/witness_generation.ts.
21
21
  // TODO: import this in isolation without having to import noir_js in its entirety.
22
- export function parseErrorPayload(abi: Abi, originalError: ExecutionError): Error {
22
+ export function enrichNoirError(artifact: NoirCompiledCircuit, originalError: ExecutionError): DecodedError {
23
23
  const payload = originalError.rawAssertionPayload;
24
24
  if (!payload) {
25
25
  return originalError;
26
26
  }
27
- const enrichedError = originalError as ErrorWithPayload;
27
+ const enrichedError = originalError as DecodedError;
28
28
 
29
29
  try {
30
30
  // Decode the payload
31
- const decodedPayload = abiDecodeError(abi, payload);
31
+ const decodedPayload = abiDecodeError(artifact.abi, payload);
32
32
 
33
33
  if (typeof decodedPayload === 'string') {
34
34
  // If it's a string, just add it to the error message
@@ -41,5 +41,26 @@ export function parseErrorPayload(abi: Abi, originalError: ExecutionError): Erro
41
41
  // Ignore errors decoding the payload
42
42
  }
43
43
 
44
+ try {
45
+ // Decode the callstack
46
+ const callStack = extractCallStack(originalError, {
47
+ // TODO(https://github.com/AztecProtocol/aztec-packages/issues/5813)
48
+ // We only support handling debug info for the circuit entry point.
49
+ // So for now we simply index into the first debug info.
50
+ debugSymbols: parseDebugSymbols(artifact.debug_symbols)[0],
51
+ files: artifact.file_map,
52
+ });
53
+
54
+ enrichedError.noirCallStack = callStack?.map(errorLocation => {
55
+ if (typeof errorLocation === 'string') {
56
+ return `at opcode ${errorLocation}`;
57
+ } else {
58
+ return `at ${errorLocation.locationText} (${errorLocation.filePath}:${errorLocation.line}:${errorLocation.column})`;
59
+ }
60
+ });
61
+ } catch (_errorResolving) {
62
+ // Ignore errors resolving the callstack
63
+ }
64
+
44
65
  return enrichedError;
45
66
  }
@@ -5,9 +5,15 @@ import {
5
5
  } from '@aztec/constants';
6
6
  import { EthAddress } from '@aztec/foundation/eth-address';
7
7
  import { Fr } from '@aztec/foundation/fields';
8
- import { AvmGadgetsTestContractArtifact } from '@aztec/noir-contracts.js/AvmGadgetsTest';
9
- import { AvmTestContractArtifact } from '@aztec/noir-contracts.js/AvmTest';
10
- import { type ContractArtifact, type FunctionArtifact, FunctionSelector } from '@aztec/stdlib/abi';
8
+ import { AvmGadgetsTestContract } from '@aztec/noir-contracts.js/AvmGadgetsTest';
9
+ import { AvmTestContract } from '@aztec/noir-contracts.js/AvmTest';
10
+ import {
11
+ type ContractArtifact,
12
+ type FunctionAbi,
13
+ type FunctionArtifact,
14
+ FunctionSelector,
15
+ getAllFunctionAbis,
16
+ } from '@aztec/stdlib/abi';
11
17
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
12
18
  import {
13
19
  type ContractClassPublic,
@@ -147,7 +153,7 @@ export function getFunctionSelector(
147
153
  functionName: string,
148
154
  contractArtifact: ContractArtifact,
149
155
  ): Promise<FunctionSelector> {
150
- const fnArtifact = contractArtifact.functions.find(f => f.name === functionName)!;
156
+ const fnArtifact = getAllFunctionAbis(contractArtifact).find(f => f.name === functionName)!;
151
157
  assert(!!fnArtifact, `Function ${functionName} not found in ${contractArtifact.name}`);
152
158
  const params = fnArtifact.parameters;
153
159
  return FunctionSelector.fromNameAndParameters(fnArtifact.name, params);
@@ -156,10 +162,11 @@ export function getFunctionSelector(
156
162
  export function getContractFunctionArtifact(
157
163
  functionName: string,
158
164
  contractArtifact: ContractArtifact,
159
- ): FunctionArtifact | undefined {
165
+ ): FunctionArtifact | FunctionAbi | undefined {
160
166
  const artifact = contractArtifact.functions.find(f => f.name === functionName)!;
161
167
  if (!artifact) {
162
- return undefined;
168
+ const abi = getAllFunctionAbis(contractArtifact).find(f => f.name === functionName);
169
+ return abi || undefined;
163
170
  }
164
171
  return artifact;
165
172
  }
@@ -174,7 +181,7 @@ export function resolveContractAssertionMessage(
174
181
  revertReason = cause as AvmRevertReason;
175
182
  });
176
183
 
177
- const functionArtifact = contractArtifact.functions.find(f => f.name === functionName);
184
+ const functionArtifact = getAllFunctionAbis(contractArtifact).find(f => f.name === functionName);
178
185
  if (!functionArtifact || !revertReason.noirCallStack || !isNoirCallStackUnresolved(revertReason.noirCallStack)) {
179
186
  return undefined;
180
187
  }
@@ -183,18 +190,18 @@ export function resolveContractAssertionMessage(
183
190
  }
184
191
 
185
192
  export function getAvmTestContractFunctionSelector(functionName: string): Promise<FunctionSelector> {
186
- return getFunctionSelector(functionName, AvmTestContractArtifact);
193
+ return getFunctionSelector(functionName, AvmTestContract.artifactForPublic);
187
194
  }
188
195
 
189
196
  export function getAvmGadgetsTestContractFunctionSelector(functionName: string): Promise<FunctionSelector> {
190
- const artifact = AvmGadgetsTestContractArtifact.functions.find(f => f.name === functionName)!;
197
+ const artifact = getAllFunctionAbis(AvmGadgetsTestContract.artifactForPublic).find(f => f.name === functionName)!;
191
198
  assert(!!artifact, `Function ${functionName} not found in AvmGadgetsTestContractArtifact`);
192
199
  const params = artifact.parameters;
193
200
  return FunctionSelector.fromNameAndParameters(artifact.name, params);
194
201
  }
195
202
 
196
203
  export function getAvmTestContractArtifact(functionName: string): FunctionArtifact {
197
- const artifact = getContractFunctionArtifact(functionName, AvmTestContractArtifact);
204
+ const artifact = getContractFunctionArtifact(functionName, AvmTestContract.artifactForPublic) as FunctionArtifact;
198
205
  assert(
199
206
  !!artifact?.bytecode,
200
207
  `No bytecode found for function ${functionName}. Try re-running bootstrap.sh on the repository root.`,
@@ -203,7 +210,7 @@ export function getAvmTestContractArtifact(functionName: string): FunctionArtifa
203
210
  }
204
211
 
205
212
  export function getAvmGadgetsTestContractArtifact(functionName: string): FunctionArtifact {
206
- const artifact = AvmGadgetsTestContractArtifact.functions.find(f => f.name === functionName)!;
213
+ const artifact = AvmGadgetsTestContract.artifactForPublic.functions.find(f => f.name === functionName)!;
207
214
  assert(
208
215
  !!artifact?.bytecode,
209
216
  `No bytecode found for function ${functionName}. Try re-running bootstrap.sh on the repository root.`,
@@ -226,7 +233,7 @@ export function resolveAvmTestContractAssertionMessage(
226
233
  revertReason: AvmRevertReason,
227
234
  output: Fr[],
228
235
  ): string | undefined {
229
- return resolveContractAssertionMessage(functionName, revertReason, output, AvmTestContractArtifact);
236
+ return resolveContractAssertionMessage(functionName, revertReason, output, AvmTestContract.artifactForPublic);
230
237
  }
231
238
 
232
239
  export function resolveAvmGadgetsTestContractAssertionMessage(
@@ -238,7 +245,7 @@ export function resolveAvmGadgetsTestContractAssertionMessage(
238
245
  revertReason = cause as AvmRevertReason;
239
246
  });
240
247
 
241
- const functionArtifact = AvmGadgetsTestContractArtifact.functions.find(f => f.name === functionName);
248
+ const functionArtifact = AvmGadgetsTestContract.artifactForPublic.functions.find(f => f.name === functionName);
242
249
  if (!functionArtifact || !revertReason.noirCallStack || !isNoirCallStackUnresolved(revertReason.noirCallStack)) {
243
250
  return undefined;
244
251
  }
@@ -267,7 +274,8 @@ export async function createContractClassAndInstance(
267
274
  contractInstance: ContractInstanceWithAddress;
268
275
  contractAddressNullifier: Fr;
269
276
  }> {
270
- const bytecode = getContractFunctionArtifact(PUBLIC_DISPATCH_FN_NAME, contractArtifact)!.bytecode;
277
+ const bytecode = (getContractFunctionArtifact(PUBLIC_DISPATCH_FN_NAME, contractArtifact) as FunctionArtifact)!
278
+ .bytecode;
271
279
  const contractClass = await makeContractClassPublic(
272
280
  seed,
273
281
  /*publicDispatchFunction=*/ { bytecode, selector: new FunctionSelector(PUBLIC_DISPATCH_SELECTOR) },