@aztec/pxe 0.76.4 → 0.77.0-testnet-ignition.17

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 (113) hide show
  1. package/dest/bin/index.js +4 -6
  2. package/dest/config/index.d.ts +2 -2
  3. package/dest/config/index.d.ts.map +1 -1
  4. package/dest/config/index.js +20 -23
  5. package/dest/config/package_info.js +4 -2
  6. package/dest/contract_data_oracle/index.d.ts +10 -10
  7. package/dest/contract_data_oracle/index.d.ts.map +1 -1
  8. package/dest/contract_data_oracle/index.js +74 -89
  9. package/dest/contract_data_oracle/private_functions_tree.d.ts +5 -4
  10. package/dest/contract_data_oracle/private_functions_tree.d.ts.map +1 -1
  11. package/dest/contract_data_oracle/private_functions_tree.js +47 -51
  12. package/dest/database/contracts/contract_artifact_db.d.ts +2 -2
  13. package/dest/database/contracts/contract_artifact_db.d.ts.map +1 -1
  14. package/dest/database/contracts/contract_artifact_db.js +3 -2
  15. package/dest/database/contracts/contract_instance_db.d.ts +2 -1
  16. package/dest/database/contracts/contract_instance_db.d.ts.map +1 -1
  17. package/dest/database/contracts/contract_instance_db.js +3 -2
  18. package/dest/database/index.js +0 -1
  19. package/dest/database/kv_pxe_database.d.ts +9 -5
  20. package/dest/database/kv_pxe_database.d.ts.map +1 -1
  21. package/dest/database/kv_pxe_database.js +244 -257
  22. package/dest/database/note_dao.d.ts +13 -10
  23. package/dest/database/note_dao.d.ts.map +1 -1
  24. package/dest/database/note_dao.js +35 -48
  25. package/dest/database/outgoing_note_dao.d.ts +6 -3
  26. package/dest/database/outgoing_note_dao.d.ts.map +1 -1
  27. package/dest/database/outgoing_note_dao.js +25 -37
  28. package/dest/database/pxe_database.d.ts +12 -8
  29. package/dest/database/pxe_database.d.ts.map +1 -1
  30. package/dest/database/pxe_database.js +4 -2
  31. package/dest/database/pxe_database_test_suite.d.ts +1 -1
  32. package/dest/database/pxe_database_test_suite.d.ts.map +1 -1
  33. package/dest/database/pxe_database_test_suite.js +286 -147
  34. package/dest/index.d.ts +1 -6
  35. package/dest/index.d.ts.map +1 -1
  36. package/dest/index.js +1 -7
  37. package/dest/kernel_oracle/index.d.ts +20 -10
  38. package/dest/kernel_oracle/index.d.ts.map +1 -1
  39. package/dest/kernel_oracle/index.js +32 -9
  40. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +3 -3
  41. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
  42. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +71 -67
  43. package/dest/kernel_prover/hints/index.js +0 -1
  44. package/dest/kernel_prover/index.js +0 -1
  45. package/dest/kernel_prover/kernel_prover.d.ts +6 -4
  46. package/dest/kernel_prover/kernel_prover.d.ts.map +1 -1
  47. package/dest/kernel_prover/kernel_prover.js +95 -74
  48. package/dest/kernel_prover/proving_data_oracle.d.ts +15 -7
  49. package/dest/kernel_prover/proving_data_oracle.d.ts.map +1 -1
  50. package/dest/kernel_prover/proving_data_oracle.js +4 -2
  51. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +3 -2
  52. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +1 -1
  53. package/dest/note_decryption_utils/add_public_values_to_payload.js +11 -12
  54. package/dest/pxe_http/index.js +0 -1
  55. package/dest/pxe_http/pxe_http_server.d.ts +1 -1
  56. package/dest/pxe_http/pxe_http_server.d.ts.map +1 -1
  57. package/dest/pxe_http/pxe_http_server.js +9 -7
  58. package/dest/pxe_service/error_enriching.d.ts +3 -3
  59. package/dest/pxe_service/error_enriching.d.ts.map +1 -1
  60. package/dest/pxe_service/error_enriching.js +14 -17
  61. package/dest/pxe_service/index.d.ts +0 -1
  62. package/dest/pxe_service/index.d.ts.map +1 -1
  63. package/dest/pxe_service/index.js +0 -2
  64. package/dest/pxe_service/pxe_service.d.ts +21 -12
  65. package/dest/pxe_service/pxe_service.d.ts.map +1 -1
  66. package/dest/pxe_service/pxe_service.js +280 -331
  67. package/dest/pxe_service/test/pxe_test_suite.d.ts +1 -1
  68. package/dest/pxe_service/test/pxe_test_suite.d.ts.map +1 -1
  69. package/dest/pxe_service/test/pxe_test_suite.js +44 -28
  70. package/dest/simulator/index.d.ts +3 -3
  71. package/dest/simulator/index.d.ts.map +1 -1
  72. package/dest/simulator/index.js +1 -3
  73. package/dest/simulator_oracle/index.d.ts +18 -6
  74. package/dest/simulator_oracle/index.d.ts.map +1 -1
  75. package/dest/simulator_oracle/index.js +307 -235
  76. package/dest/simulator_oracle/tagging_utils.d.ts +2 -1
  77. package/dest/simulator_oracle/tagging_utils.d.ts.map +1 -1
  78. package/dest/simulator_oracle/tagging_utils.js +5 -7
  79. package/dest/synchronizer/index.js +0 -1
  80. package/dest/synchronizer/synchronizer.d.ts +7 -4
  81. package/dest/synchronizer/synchronizer.d.ts.map +1 -1
  82. package/dest/synchronizer/synchronizer.js +64 -43
  83. package/dest/utils/create_pxe_service.d.ts +2 -2
  84. package/dest/utils/create_pxe_service.d.ts.map +1 -1
  85. package/dest/utils/create_pxe_service.js +13 -11
  86. package/package.json +17 -18
  87. package/src/bin/index.ts +1 -1
  88. package/src/config/index.ts +3 -3
  89. package/src/contract_data_oracle/index.ts +20 -20
  90. package/src/contract_data_oracle/private_functions_tree.ts +6 -7
  91. package/src/database/contracts/contract_artifact_db.ts +2 -2
  92. package/src/database/contracts/contract_instance_db.ts +2 -1
  93. package/src/database/kv_pxe_database.ts +33 -32
  94. package/src/database/note_dao.ts +11 -8
  95. package/src/database/outgoing_note_dao.ts +7 -4
  96. package/src/database/pxe_database.ts +13 -15
  97. package/src/database/pxe_database_test_suite.ts +8 -11
  98. package/src/index.ts +1 -7
  99. package/src/kernel_oracle/index.ts +55 -22
  100. package/src/kernel_prover/hints/build_private_kernel_reset_private_inputs.ts +14 -11
  101. package/src/kernel_prover/kernel_prover.ts +70 -44
  102. package/src/kernel_prover/proving_data_oracle.ts +20 -20
  103. package/src/note_decryption_utils/add_public_values_to_payload.ts +5 -4
  104. package/src/pxe_http/pxe_http_server.ts +1 -1
  105. package/src/pxe_service/error_enriching.ts +6 -6
  106. package/src/pxe_service/index.ts +0 -1
  107. package/src/pxe_service/pxe_service.ts +120 -220
  108. package/src/pxe_service/test/pxe_test_suite.ts +6 -3
  109. package/src/simulator/index.ts +3 -3
  110. package/src/simulator_oracle/index.ts +77 -47
  111. package/src/simulator_oracle/tagging_utils.ts +2 -1
  112. package/src/synchronizer/synchronizer.ts +31 -12
  113. package/src/utils/create_pxe_service.ts +16 -4
package/dest/bin/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env -S node --no-warnings
2
- import { createAztecNodeClient } from '@aztec/circuit-types';
3
2
  import { createLogger } from '@aztec/foundation/log';
3
+ import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
4
4
  import { getPXEServiceConfig } from '../config/index.js';
5
5
  import { startPXEHttpServer } from '../pxe_http/index.js';
6
6
  import { createPXEService } from '../utils/create_pxe_service.js';
@@ -8,13 +8,12 @@ const { PXE_PORT = 8080, AZTEC_NODE_URL = 'http://localhost:8079' } = process.en
8
8
  const logger = createLogger('pxe:service');
9
9
  /**
10
10
  * Create and start a new PXE HTTP Server
11
- */
12
- async function main() {
11
+ */ async function main() {
13
12
  logger.info(`Setting up PXE...`);
14
13
  const pxeConfig = getPXEServiceConfig();
15
14
  const nodeRpcClient = createAztecNodeClient(AZTEC_NODE_URL, {});
16
15
  const pxeService = await createPXEService(nodeRpcClient, pxeConfig);
17
- const shutdown = () => {
16
+ const shutdown = ()=>{
18
17
  logger.info('Shutting down...');
19
18
  process.exit(0);
20
19
  };
@@ -23,8 +22,7 @@ async function main() {
23
22
  startPXEHttpServer(pxeService, PXE_PORT);
24
23
  logger.info(`PXE listening on port ${PXE_PORT}`);
25
24
  }
26
- main().catch(err => {
25
+ main().catch((err)=>{
27
26
  logger.error(err);
28
27
  process.exit(1);
29
28
  });
30
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uI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FBQyxDQUFDO0lBQ2xCLENBQUMsQ0FBQztJQUVGLE9BQU8sQ0FBQyxJQUFJLENBQUMsUUFBUSxFQUFFLFFBQVEsQ0FBQyxDQUFDO0lBQ2pDLE9BQU8sQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFLFFBQVEsQ0FBQyxDQUFDO0lBRWxDLGtCQUFrQixDQUFDLFVBQVUsRUFBRSxRQUFRLENBQUMsQ0FBQztJQUN6QyxNQUFNLENBQUMsSUFBSSxDQUFDLHlCQUF5QixRQUFRLEVBQUUsQ0FBQyxDQUFDO0FBQ25ELENBQUM7QUFFRCxJQUFJLEVBQUUsQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLEVBQUU7SUFDakIsTUFBTSxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUNsQixPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBQ2xCLENBQUMsQ0FBQyxDQUFDIn0=
@@ -1,7 +1,7 @@
1
- import { type ChainConfig } from '@aztec/circuit-types/config';
2
1
  import { type ConfigMappingsType } from '@aztec/foundation/config';
3
2
  import { type DataStoreConfig } from '@aztec/kv-store/config';
4
- import { type Network } from '@aztec/types/network';
3
+ import { type ChainConfig } from '@aztec/stdlib/config';
4
+ import type { Network } from '@aztec/stdlib/network';
5
5
  /**
6
6
  * Temporary configuration until WASM can be used instead of native
7
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,6BAA6B,CAAC;AAEpF,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,cAAc;I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AErD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8CAA8C;IAC9C,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AACD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,uDAAuD;IACvD,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,kBAAkB,GAAG,cAAc,GAAG,eAAe,GAAG,WAAW,CAAC;AAE/G,MAAM,MAAM,aAAa,GAAG;IAC1B,wDAAwD;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,kBAAkB,CAAC,gBAAgB,CA0BlE,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,CAEtD;AAED,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,aAAa,CAclE,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,aAAa,GAAG,gBAAgB,CAUrF,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,GAAG,gBAAgB,CAQnE"}
@@ -1,54 +1,53 @@
1
- import { chainConfigMappings } from '@aztec/circuit-types/config';
2
- import { INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js/constants';
3
- import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, parseBooleanEnv, } from '@aztec/foundation/config';
1
+ import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
2
+ import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, parseBooleanEnv } from '@aztec/foundation/config';
4
3
  import { dataConfigMappings } from '@aztec/kv-store/config';
4
+ import { chainConfigMappings } from '@aztec/stdlib/config';
5
5
  export const pxeConfigMappings = {
6
6
  ...dataConfigMappings,
7
7
  ...chainConfigMappings,
8
8
  l2StartingBlock: {
9
9
  env: 'PXE_L2_STARTING_BLOCK',
10
10
  ...numberConfigHelper(INITIAL_L2_BLOCK_NUM),
11
- description: 'L2 block to start scanning from for new accounts',
11
+ description: 'L2 block to start scanning from for new accounts'
12
12
  },
13
13
  bbBinaryPath: {
14
14
  env: 'BB_BINARY_PATH',
15
- description: 'Path to the BB binary',
15
+ description: 'Path to the BB binary'
16
16
  },
17
17
  bbWorkingDirectory: {
18
18
  env: 'BB_WORKING_DIRECTORY',
19
- description: 'Working directory for the BB binary',
19
+ description: 'Working directory for the BB binary'
20
20
  },
21
21
  bbSkipCleanup: {
22
22
  env: 'BB_SKIP_CLEANUP',
23
23
  description: 'True to skip cleanup of temporary files for debugging purposes',
24
- ...booleanConfigHelper(),
24
+ ...booleanConfigHelper()
25
25
  },
26
26
  proverEnabled: {
27
27
  env: 'PXE_PROVER_ENABLED',
28
28
  description: 'Enable real proofs',
29
- ...booleanConfigHelper(),
30
- },
29
+ ...booleanConfigHelper()
30
+ }
31
31
  };
32
32
  /**
33
33
  * Creates an instance of PXEServiceConfig out of environment variables using sensible defaults for integration testing if not set.
34
- */
35
- export function getPXEServiceConfig() {
34
+ */ export function getPXEServiceConfig() {
36
35
  return getConfigFromMappings(pxeConfigMappings);
37
36
  }
38
37
  export const pxeCliConfigMappings = {
39
38
  network: {
40
39
  env: 'NETWORK',
41
- parseEnv: (val) => val,
42
- description: 'External Aztec network to connect to. e.g. devnet',
40
+ parseEnv: (val)=>val,
41
+ description: 'External Aztec network to connect to. e.g. devnet'
43
42
  },
44
43
  apiKey: {
45
44
  env: 'API_KEY',
46
- description: "API Key required by the external network's node",
45
+ description: "API Key required by the external network's node"
47
46
  },
48
47
  nodeUrl: {
49
48
  env: 'AZTEC_NODE_URL',
50
- description: 'Custom Aztec Node URL to connect to',
51
- },
49
+ description: 'Custom Aztec Node URL to connect to'
50
+ }
52
51
  };
53
52
  export const allPxeConfigMappings = {
54
53
  ...pxeConfigMappings,
@@ -56,21 +55,19 @@ export const allPxeConfigMappings = {
56
55
  ...dataConfigMappings,
57
56
  proverEnabled: {
58
57
  env: 'PXE_PROVER_ENABLED',
59
- parseEnv: (val) => parseBooleanEnv(val) || !!process.env.NETWORK,
58
+ parseEnv: (val)=>parseBooleanEnv(val) || !!process.env.NETWORK,
60
59
  description: 'Enable real proofs',
61
- isBoolean: true,
62
- },
60
+ isBoolean: true
61
+ }
63
62
  };
64
63
  /**
65
64
  * Creates an instance of CliPxeOptions out of environment variables
66
- */
67
- export function getCliPXEOptions() {
65
+ */ export function getCliPXEOptions() {
68
66
  const pxeConfig = getPXEServiceConfig();
69
67
  const cliOptions = getConfigFromMappings(pxeCliConfigMappings);
70
68
  return {
71
69
  ...pxeConfig,
72
70
  ...cliOptions,
73
- proverEnabled: pxeConfig.proverEnabled || !!cliOptions.network,
71
+ proverEnabled: pxeConfig.proverEnabled || !!cliOptions.network
74
72
  };
75
73
  }
76
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uZmlnL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBb0IsbUJBQW1CLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNwRixPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUNwRSxPQUFPLEVBRUwsbUJBQW1CLEVBQ25CLHFCQUFxQixFQUNyQixrQkFBa0IsRUFDbEIsZUFBZSxHQUNoQixNQUFNLDBCQUEwQixDQUFDO0FBQ2xDLE9BQU8sRUFBd0Isa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W9uIjozLCJmaWxlIjoicGFja2FnZV9pbmZvLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbmZpZy9wYWNrYWdlX2luZm8udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxVQUFVLGNBQWM7SUFDNUIsT0FBTyxFQUFFLE9BQU8sRUFBRSxPQUFPLEVBQUUsSUFBSSxFQUFFLFlBQVksRUFBRSxDQUFDO0FBQ2xELENBQUMifQ==
@@ -1,10 +1,12 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
- import { type AztecAddress, type ContractClass, type ContractInstance } from '@aztec/circuits.js';
4
- import { type ContractArtifact, type FunctionArtifact, type FunctionDebugMetadata, type FunctionSelector } from '@aztec/foundation/abi';
5
- import { type Fr } from '@aztec/foundation/fields';
6
- import { type ContractArtifactDatabase } from '../database/contracts/contract_artifact_db.js';
7
- import { type ContractInstanceDatabase } from '../database/contracts/contract_instance_db.js';
3
+ import type { Fr } from '@aztec/foundation/fields';
4
+ import type { MembershipWitness } from '@aztec/foundation/trees';
5
+ import { type ContractArtifact, type FunctionArtifact, type FunctionDebugMetadata, type FunctionSelector } from '@aztec/stdlib/abi';
6
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
+ import type { ContractClass, ContractInstance } from '@aztec/stdlib/contract';
8
+ import type { ContractArtifactDatabase } from '../database/contracts/contract_artifact_db.js';
9
+ import type { ContractInstanceDatabase } from '../database/contracts/contract_instance_db.js';
8
10
  /**
9
11
  * ContractDataOracle serves as a data manager and retriever for Aztec.nr contracts.
10
12
  * It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
@@ -16,8 +18,6 @@ export declare class ContractDataOracle {
16
18
  private db;
17
19
  /** Map from contract class id to private function tree. */
18
20
  private contractClasses;
19
- /** Map from address to contract instance. */
20
- private contractInstances;
21
21
  constructor(db: ContractArtifactDatabase & ContractInstanceDatabase);
22
22
  /** Returns a contract instance for a given address. Throws if not found. */
23
23
  getContractInstance(contractAddress: AztecAddress): Promise<ContractInstance>;
@@ -67,15 +67,15 @@ export declare class ContractDataOracle {
67
67
  */
68
68
  getBytecode(contractAddress: AztecAddress, selector: FunctionSelector): Promise<Buffer>;
69
69
  /**
70
- * Retrieve the function membership witness for the given contract address and function selector.
70
+ * Retrieve the function membership witness for the given contract class and function selector.
71
71
  * The function membership witness represents a proof that the function belongs to the specified contract.
72
72
  * Throws an error if the contract address or function selector is unknown.
73
73
  *
74
- * @param contractAddress - The contract address.
74
+ * @param contractClassId - The id of the class.
75
75
  * @param selector - The function selector.
76
76
  * @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
77
77
  */
78
- getFunctionMembershipWitness(contractAddress: AztecAddress, selector: FunctionSelector): Promise<import("@aztec/circuits.js").MembershipWitness<5>>;
78
+ getFunctionMembershipWitness(contractClassId: Fr, selector: FunctionSelector): Promise<MembershipWitness<5>>;
79
79
  getDebugContractName(contractAddress: AztecAddress): Promise<string>;
80
80
  getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
81
81
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract_data_oracle/index.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EAEtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAGnD,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAG9F;;;;;;GAMG;AACH,q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ASG;IACU,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB;IAKlF;;;;;;;;OAQG;IACU,4BAA4B,CACvC,eAAe,EAAE,EAAE,EACnB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAKnB,oBAAoB,CAAC,eAAe,EAAE,YAAY;IAKlD,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB;IAO3F;;;;;;;;;OASG;YACW,iBAAiB;IAY/B;;;;;;;;;OASG;YACW,iBAAiB;CAIhC"}
@@ -1,5 +1,5 @@
1
- import { getFunctionDebugMetadata, } from '@aztec/foundation/abi';
2
1
  import { ContractClassNotFoundError, ContractNotFoundError } from '@aztec/simulator/client';
2
+ import { getFunctionDebugMetadata } from '@aztec/stdlib/abi';
3
3
  import { PrivateFunctionsTree } from './private_functions_tree.js';
4
4
  /**
5
5
  * ContractDataOracle serves as a data manager and retriever for Aztec.nr contracts.
@@ -7,28 +7,21 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
7
7
  * from a given contract address and function selector. The class maintains a cache of ContractTree instances
8
8
  * to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch
9
9
  * the required information and facilitate cryptographic proof generation.
10
- */
11
- export class ContractDataOracle {
12
- constructor(db) {
10
+ */ export class ContractDataOracle {
11
+ db;
12
+ /** Map from contract class id to private function tree. */ contractClasses;
13
+ constructor(db){
13
14
  this.db = db;
14
- /** Map from contract class id to private function tree. */
15
15
  this.contractClasses = new Map();
16
- /** Map from address to contract instance. */
17
- this.contractInstances = new Map();
18
16
  }
19
- /** Returns a contract instance for a given address. Throws if not found. */
20
- async getContractInstance(contractAddress) {
21
- if (!this.contractInstances.has(contractAddress.toString())) {
22
- const instance = await this.db.getContractInstance(contractAddress);
23
- if (!instance) {
24
- throw new ContractNotFoundError(contractAddress.toString());
25
- }
26
- this.contractInstances.set(contractAddress.toString(), instance);
17
+ /** Returns a contract instance for a given address. Throws if not found. */ async getContractInstance(contractAddress) {
18
+ const instance = await this.db.getContractInstance(contractAddress);
19
+ if (!instance) {
20
+ throw new ContractNotFoundError(contractAddress.toString());
27
21
  }
28
- return this.contractInstances.get(contractAddress.toString());
22
+ return instance;
29
23
  }
30
- /** Returns a contract class for a given class id. Throws if not found. */
31
- async getContractClass(contractClassId) {
24
+ /** Returns a contract class for a given class id. Throws if not found. */ async getContractClass(contractClassId) {
32
25
  const tree = await this.getTreeForClassId(contractClassId);
33
26
  return tree.getContractClass();
34
27
  }
@@ -37,71 +30,66 @@ export class ContractDataOracle {
37
30
  return tree.getArtifact();
38
31
  }
39
32
  /**
40
- * Retrieves the artifact of a specified function within a given contract.
41
- * The function is identified by its selector, which is a unique code generated from the function's signature.
42
- * Throws an error if the contract address or function selector are invalid or not found.
43
- *
44
- * @param contractAddress - The AztecAddress representing the contract containing the function.
45
- * @param selector - The function selector.
46
- * @returns The corresponding function's artifact as an object.
47
- */
48
- async getFunctionArtifact(contractAddress, selector) {
33
+ * Retrieves the artifact of a specified function within a given contract.
34
+ * The function is identified by its selector, which is a unique code generated from the function's signature.
35
+ * Throws an error if the contract address or function selector are invalid or not found.
36
+ *
37
+ * @param contractAddress - The AztecAddress representing the contract containing the function.
38
+ * @param selector - The function selector.
39
+ * @returns The corresponding function's artifact as an object.
40
+ */ async getFunctionArtifact(contractAddress, selector) {
49
41
  const tree = await this.getTreeForAddress(contractAddress);
50
42
  return tree.getFunctionArtifact(selector);
51
43
  }
52
44
  /**
53
- * Retrieves the artifact of a specified function within a given contract.
54
- * The function is identified by its name, which is unique within a contract.
55
- * Throws if the contract has not been added to the database.
56
- *
57
- * @param contractAddress - The AztecAddress representing the contract containing the function.
58
- * @param functionName - The name of the function.
59
- * @returns The corresponding function's artifact as an object
60
- */
61
- async getFunctionArtifactByName(contractAddress, functionName) {
45
+ * Retrieves the artifact of a specified function within a given contract.
46
+ * The function is identified by its name, which is unique within a contract.
47
+ * Throws if the contract has not been added to the database.
48
+ *
49
+ * @param contractAddress - The AztecAddress representing the contract containing the function.
50
+ * @param functionName - The name of the function.
51
+ * @returns The corresponding function's artifact as an object
52
+ */ async getFunctionArtifactByName(contractAddress, functionName) {
62
53
  const tree = await this.getTreeForAddress(contractAddress);
63
- return tree.getArtifact().functions.find(f => f.name === functionName);
54
+ return tree.getArtifact().functions.find((f)=>f.name === functionName);
64
55
  }
65
56
  /**
66
- * Retrieves the debug metadata of a specified function within a given contract.
67
- * The function is identified by its selector, which is a unique code generated from the function's signature.
68
- * Returns undefined if the debug metadata for the given function is not found.
69
- * Throws if the contract has not been added to the database.
70
- *
71
- * @param contractAddress - The AztecAddress representing the contract containing the function.
72
- * @param selector - The function selector.
73
- * @returns The corresponding function's artifact as an object.
74
- */
75
- async getFunctionDebugMetadata(contractAddress, selector) {
57
+ * Retrieves the debug metadata of a specified function within a given contract.
58
+ * The function is identified by its selector, which is a unique code generated from the function's signature.
59
+ * Returns undefined if the debug metadata for the given function is not found.
60
+ * Throws if the contract has not been added to the database.
61
+ *
62
+ * @param contractAddress - The AztecAddress representing the contract containing the function.
63
+ * @param selector - The function selector.
64
+ * @returns The corresponding function's artifact as an object.
65
+ */ async getFunctionDebugMetadata(contractAddress, selector) {
76
66
  const tree = await this.getTreeForAddress(contractAddress);
77
67
  const artifact = await tree.getFunctionArtifact(selector);
78
68
  return getFunctionDebugMetadata(tree.getArtifact(), artifact);
79
69
  }
80
70
  /**
81
- * Retrieve the bytecode of a specific function in a contract at the given address.
82
- * The returned bytecode is required for executing and verifying the function's behavior
83
- * in the Aztec network. Throws an error if the contract or function cannot be found.
84
- *
85
- * @param contractAddress - The contract's address.
86
- * @param selector - The function selector.
87
- * @returns A Promise that resolves to a Buffer containing the bytecode of the specified function.
88
- * @throws Error if the contract address is unknown or not found.
89
- */
90
- async getBytecode(contractAddress, selector) {
71
+ * Retrieve the bytecode of a specific function in a contract at the given address.
72
+ * The returned bytecode is required for executing and verifying the function's behavior
73
+ * in the Aztec network. Throws an error if the contract or function cannot be found.
74
+ *
75
+ * @param contractAddress - The contract's address.
76
+ * @param selector - The function selector.
77
+ * @returns A Promise that resolves to a Buffer containing the bytecode of the specified function.
78
+ * @throws Error if the contract address is unknown or not found.
79
+ */ async getBytecode(contractAddress, selector) {
91
80
  const tree = await this.getTreeForAddress(contractAddress);
92
81
  return tree.getBytecode(selector);
93
82
  }
94
83
  /**
95
- * Retrieve the function membership witness for the given contract address and function selector.
96
- * The function membership witness represents a proof that the function belongs to the specified contract.
97
- * Throws an error if the contract address or function selector is unknown.
98
- *
99
- * @param contractAddress - The contract address.
100
- * @param selector - The function selector.
101
- * @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
102
- */
103
- async getFunctionMembershipWitness(contractAddress, selector) {
104
- const tree = await this.getTreeForAddress(contractAddress);
84
+ * Retrieve the function membership witness for the given contract class and function selector.
85
+ * The function membership witness represents a proof that the function belongs to the specified contract.
86
+ * Throws an error if the contract address or function selector is unknown.
87
+ *
88
+ * @param contractClassId - The id of the class.
89
+ * @param selector - The function selector.
90
+ * @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
91
+ */ async getFunctionMembershipWitness(contractClassId, selector) {
92
+ const tree = await this.getTreeForClassId(contractClassId);
105
93
  return tree.getFunctionMembershipWitness(selector);
106
94
  }
107
95
  async getDebugContractName(contractAddress) {
@@ -115,16 +103,15 @@ export class ContractDataOracle {
115
103
  return `${contractName}:${functionName}`;
116
104
  }
117
105
  /**
118
- * Retrieve or create a ContractTree instance based on the provided class id.
119
- * If an existing tree with the same class id is found in the cache, it will be returned.
120
- * Otherwise, a new ContractTree instance will be created using the contract data from the database
121
- * and added to the cache before returning.
122
- *
123
- * @param classId - The class id of the contract for which the ContractTree is required.
124
- * @returns A ContractTree instance associated with the specified contract address.
125
- * @throws An Error if the contract is not found in the ContractDatabase.
126
- */
127
- async getTreeForClassId(classId) {
106
+ * Retrieve or create a ContractTree instance based on the provided class id.
107
+ * If an existing tree with the same class id is found in the cache, it will be returned.
108
+ * Otherwise, a new ContractTree instance will be created using the contract data from the database
109
+ * and added to the cache before returning.
110
+ *
111
+ * @param classId - The class id of the contract for which the ContractTree is required.
112
+ * @returns A ContractTree instance associated with the specified contract address.
113
+ * @throws An Error if the contract is not found in the ContractDatabase.
114
+ */ async getTreeForClassId(classId) {
128
115
  if (!this.contractClasses.has(classId.toString())) {
129
116
  const artifact = await this.db.getContractArtifact(classId);
130
117
  if (!artifact) {
@@ -136,18 +123,16 @@ export class ContractDataOracle {
136
123
  return this.contractClasses.get(classId.toString());
137
124
  }
138
125
  /**
139
- * Retrieve or create a ContractTree instance based on the provided AztecAddress.
140
- * If an existing tree with the same contract address is found in the cache, it will be returned.
141
- * Otherwise, a new ContractTree instance will be created using the contract data from the database
142
- * and added to the cache before returning.
143
- *
144
- * @param contractAddress - The AztecAddress of the contract for which the ContractTree is required.
145
- * @returns A ContractTree instance associated with the specified contract address.
146
- * @throws An Error if the contract is not found in the ContractDatabase.
147
- */
148
- async getTreeForAddress(contractAddress) {
126
+ * Retrieve or create a ContractTree instance based on the provided AztecAddress.
127
+ * If an existing tree with the same contract address is found in the cache, it will be returned.
128
+ * Otherwise, a new ContractTree instance will be created using the contract data from the database
129
+ * and added to the cache before returning.
130
+ *
131
+ * @param contractAddress - The AztecAddress of the contract for which the ContractTree is required.
132
+ * @returns A ContractTree instance associated with the specified contract address.
133
+ * @throws An Error if the contract is not found in the ContractDatabase.
134
+ */ async getTreeForAddress(contractAddress) {
149
135
  const instance = await this.getContractInstance(contractAddress);
150
- return this.getTreeForClassId(instance.contractClassId);
136
+ return this.getTreeForClassId(instance.currentContractClassId);
151
137
  }
152
138
  }
153
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3RfZGF0YV9vcmFjbGUvaW5kZXgudHMiXSwibmFtZXMi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BZSxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsUUFBUSxFQUFFLENBQUUsQ0FBQztJQUN2RCxDQUFDO0lBRUQ7Ozs7Ozs7OztPQVNHO0lBQ0ssS0FBSyxDQUFDLGlCQUFpQixDQUFDLGVBQTZCO1FBQzNELE1BQU0sUUFBUSxHQUFHLE1BQU0sSUFBSSxDQUFDLG1CQUFtQixDQUFDLGVBQWUsQ0FBQyxDQUFDO1FBQ2pFLE9BQU8sSUFBSSxDQUFDLGlCQUFpQixDQUFDLFFBQVEsQ0FBQyxlQUFlLENBQUMsQ0FBQztJQUMxRCxDQUFDO0NBQ0YifQ==
@@ -1,9 +1,10 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
- import { type ContractClassWithId, FUNCTION_TREE_HEIGHT, MembershipWitness } from '@aztec/circuits.js';
4
- import { type MerkleTree } from '@aztec/circuits.js/merkle';
5
- import { type ContractArtifact, FunctionSelector } from '@aztec/foundation/abi';
3
+ import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
6
4
  import { Fr } from '@aztec/foundation/fields';
5
+ import { MembershipWitness, type MerkleTree } from '@aztec/foundation/trees';
6
+ import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
7
+ import { type ContractClassWithId } from '@aztec/stdlib/contract';
7
8
  /**
8
9
  * Represents a Merkle tree of functions for a particular Contract Class.
9
10
  * It manages the construction of the function tree, computes its root, and generates membership witnesses
@@ -24,7 +25,7 @@ export declare class PrivateFunctionsTree {
24
25
  * @param selector - The function selector.
25
26
  * @returns The artifact object containing relevant information about the targeted function.
26
27
  */
27
- getFunctionArtifact(selector: FunctionSelector): Promise<import("@aztec/foundation/abi").FunctionArtifact>;
28
+ getFunctionArtifact(selector: FunctionSelector): Promise<import("@aztec/stdlib/abi").FunctionArtifact>;
28
29
  /**
29
30
  * Retrieve the bytecode of a function in the contract by its function selector.
30
31
  * The function selector is a unique identifier for each function in a contract.
@@ -1 +1 @@
1
- {"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../src/contract_data_oracle/private_functions_tree.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,KAAK,mBAAmB,EACxB,oBAAoB,EACpB,iBAAiB,EAIlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C;;;;;GAKG;AACH,qBAAa,oBAAoB;IAGX,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAAoB,OAAO,CAAC,aAAa;IAFtF,OAAO,CAAC,IAAI,CAAC,CAAa;IAE1B,OAAO;WAEM,MAAM,CAAC,QAAQ,EAAE,gBAAgB;IAK9C;;;;;;;OAOG;IACU,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB;IAkB3D;;;;;;;OAOG;IACU,WAAW,CAAC,QAAQ,EAAE,gBAAgB;IAKnD;;;;;;OAMG;IACI,mBAAmB;IAI1B,yCAAyC;IAClC,gBAAgB;IAIvB,qCAAqC;IAC9B,WAAW;IAIlB;;OAEG;IACI,kBAAkB;IAIzB;;;;;;;;OAQG;IACU,4BAA4B,CACvC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC;YAiB5C,OAAO;CAOtB"}
1
+ {"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../src/contract_data_oracle/private_functions_tree.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAA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