@aztec/pxe 0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2 → 0.75.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 (101) hide show
  1. package/dest/bin/index.d.ts +3 -0
  2. package/dest/bin/index.d.ts.map +1 -0
  3. package/dest/bin/index.js +5 -3
  4. package/dest/config/index.d.ts +46 -0
  5. package/dest/config/index.d.ts.map +1 -0
  6. package/dest/config/index.js +21 -18
  7. package/dest/config/package_info.d.ts +5 -0
  8. package/dest/config/package_info.d.ts.map +1 -0
  9. package/dest/config/package_info.js +2 -4
  10. package/dest/contract_data_oracle/index.d.ts +104 -0
  11. package/dest/contract_data_oracle/index.d.ts.map +1 -0
  12. package/dest/contract_data_oracle/index.js +79 -69
  13. package/dest/contract_data_oracle/private_functions_tree.d.ts +65 -0
  14. package/dest/contract_data_oracle/private_functions_tree.d.ts.map +1 -0
  15. package/dest/contract_data_oracle/private_functions_tree.js +50 -44
  16. package/dest/database/contracts/contract_artifact_db.d.ts +20 -0
  17. package/dest/database/contracts/contract_artifact_db.d.ts.map +1 -0
  18. package/dest/database/contracts/contract_artifact_db.js +2 -3
  19. package/dest/database/contracts/contract_instance_db.d.ts +19 -0
  20. package/dest/database/contracts/contract_instance_db.d.ts.map +1 -0
  21. package/dest/database/contracts/contract_instance_db.js +2 -3
  22. package/dest/database/index.d.ts +3 -0
  23. package/dest/database/index.d.ts.map +1 -0
  24. package/dest/database/index.js +1 -0
  25. package/dest/database/kv_pxe_database.d.ts +55 -0
  26. package/dest/database/kv_pxe_database.d.ts.map +1 -0
  27. package/dest/database/kv_pxe_database.js +259 -243
  28. package/dest/database/note_dao.d.ts +103 -0
  29. package/dest/database/note_dao.d.ts.map +1 -0
  30. package/dest/database/note_dao.js +43 -28
  31. package/dest/database/outgoing_note_dao.d.ts +73 -0
  32. package/dest/database/outgoing_note_dao.d.ts.map +1 -0
  33. package/dest/database/outgoing_note_dao.js +34 -20
  34. package/dest/database/pxe_database.d.ts +216 -0
  35. package/dest/database/pxe_database.d.ts.map +1 -0
  36. package/dest/database/pxe_database.js +2 -4
  37. package/dest/database/pxe_database_test_suite.d.ts +7 -0
  38. package/dest/database/pxe_database_test_suite.d.ts.map +1 -0
  39. package/dest/database/pxe_database_test_suite.js +151 -296
  40. package/dest/index.d.ts +15 -0
  41. package/dest/index.d.ts.map +1 -0
  42. package/dest/index.js +1 -0
  43. package/dest/kernel_oracle/index.d.ts +34 -0
  44. package/dest/kernel_oracle/index.d.ts.map +1 -0
  45. package/dest/kernel_oracle/index.js +6 -9
  46. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +28 -0
  47. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
  48. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +66 -68
  49. package/dest/kernel_prover/hints/index.d.ts +2 -0
  50. package/dest/kernel_prover/hints/index.d.ts.map +1 -0
  51. package/dest/kernel_prover/hints/index.js +1 -0
  52. package/dest/kernel_prover/index.d.ts +3 -0
  53. package/dest/kernel_prover/index.d.ts.map +1 -0
  54. package/dest/kernel_prover/index.js +1 -0
  55. package/dest/kernel_prover/kernel_prover.d.ts +38 -0
  56. package/dest/kernel_prover/kernel_prover.d.ts.map +1 -0
  57. package/dest/kernel_prover/kernel_prover.js +65 -60
  58. package/dest/kernel_prover/proving_data_oracle.d.ts +65 -0
  59. package/dest/kernel_prover/proving_data_oracle.d.ts.map +1 -0
  60. package/dest/kernel_prover/proving_data_oracle.js +2 -4
  61. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +10 -0
  62. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +1 -0
  63. package/dest/note_decryption_utils/add_public_values_to_payload.js +9 -8
  64. package/dest/pxe_http/index.d.ts +2 -0
  65. package/dest/pxe_http/index.d.ts.map +1 -0
  66. package/dest/pxe_http/index.js +1 -0
  67. package/dest/pxe_http/pxe_http_server.d.ts +16 -0
  68. package/dest/pxe_http/pxe_http_server.d.ts.map +1 -0
  69. package/dest/pxe_http/pxe_http_server.js +6 -8
  70. package/dest/pxe_service/error_enriching.d.ts +11 -0
  71. package/dest/pxe_service/error_enriching.d.ts.map +1 -0
  72. package/dest/pxe_service/error_enriching.js +13 -10
  73. package/dest/pxe_service/index.d.ts +4 -0
  74. package/dest/pxe_service/index.d.ts.map +1 -0
  75. package/dest/pxe_service/index.js +1 -0
  76. package/dest/pxe_service/pxe_service.d.ts +98 -0
  77. package/dest/pxe_service/pxe_service.d.ts.map +1 -0
  78. package/dest/pxe_service/pxe_service.js +290 -282
  79. package/dest/pxe_service/test/pxe_test_suite.d.ts +3 -0
  80. package/dest/pxe_service/test/pxe_test_suite.d.ts.map +1 -0
  81. package/dest/pxe_service/test/pxe_test_suite.js +27 -40
  82. package/dest/simulator/index.d.ts +10 -0
  83. package/dest/simulator/index.d.ts.map +1 -0
  84. package/dest/simulator/index.js +3 -1
  85. package/dest/simulator_oracle/index.d.ts +129 -0
  86. package/dest/simulator_oracle/index.d.ts.map +1 -0
  87. package/dest/simulator_oracle/index.js +231 -266
  88. package/dest/simulator_oracle/tagging_utils.d.ts +16 -0
  89. package/dest/simulator_oracle/tagging_utils.d.ts.map +1 -0
  90. package/dest/simulator_oracle/tagging_utils.js +6 -4
  91. package/dest/synchronizer/index.d.ts +2 -0
  92. package/dest/synchronizer/index.d.ts.map +1 -0
  93. package/dest/synchronizer/index.js +1 -0
  94. package/dest/synchronizer/synchronizer.d.ts +30 -0
  95. package/dest/synchronizer/synchronizer.d.ts.map +1 -0
  96. package/dest/synchronizer/synchronizer.js +42 -42
  97. package/dest/utils/create_pxe_service.d.ts +16 -0
  98. package/dest/utils/create_pxe_service.d.ts.map +1 -0
  99. package/dest/utils/create_pxe_service.js +9 -9
  100. package/package.json +15 -15
  101. package/src/pxe_service/pxe_service.ts +10 -5
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env -S node --no-warnings
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":""}
package/dest/bin/index.js CHANGED
@@ -8,12 +8,13 @@ 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
- */ async function main() {
11
+ */
12
+ async function main() {
12
13
  logger.info(`Setting up PXE...`);
13
14
  const pxeConfig = getPXEServiceConfig();
14
15
  const nodeRpcClient = createAztecNodeClient(AZTEC_NODE_URL);
15
16
  const pxeService = await createPXEService(nodeRpcClient, pxeConfig);
16
- const shutdown = ()=>{
17
+ const shutdown = () => {
17
18
  logger.info('Shutting down...');
18
19
  process.exit(0);
19
20
  };
@@ -22,7 +23,8 @@ const logger = createLogger('pxe:service');
22
23
  startPXEHttpServer(pxeService, PXE_PORT);
23
24
  logger.info(`PXE listening on port ${PXE_PORT}`);
24
25
  }
25
- main().catch((err)=>{
26
+ main().catch(err => {
26
27
  logger.error(err);
27
28
  process.exit(1);
28
29
  });
30
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYmluL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxPQUFPLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUM3RCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFckQsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDekQsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDMUQsT0FBTyxFQUFFLGdCQU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QUFDLEdBQUcsQ0FBQyxDQUFDO0lBQ2xCLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFDbEIsQ0FBQyxDQUFDLENBQUMifQ==
@@ -0,0 +1,46 @@
1
+ import { type ConfigMappingsType } from '@aztec/foundation/config';
2
+ import { type DataStoreConfig } from '@aztec/kv-store/config';
3
+ import { type Network } from '@aztec/types/network';
4
+ /**
5
+ * Temporary configuration until WASM can be used instead of native
6
+ */
7
+ export interface BBProverConfig {
8
+ bbWorkingDirectory?: string;
9
+ bbBinaryPath?: string;
10
+ bbSkipCleanup?: boolean;
11
+ }
12
+ /**
13
+ * Configuration settings for the prover factory
14
+ */
15
+ export interface KernelProverConfig {
16
+ /** Whether we are running with real proofs */
17
+ proverEnabled?: boolean;
18
+ }
19
+ /**
20
+ * Configuration settings for the PXE.
21
+ */
22
+ export interface PXEConfig {
23
+ /** L2 block to start scanning from for new accounts */
24
+ l2StartingBlock: number;
25
+ }
26
+ export type PXEServiceConfig = PXEConfig & KernelProverConfig & BBProverConfig & DataStoreConfig;
27
+ export type CliPXEOptions = {
28
+ /** External Aztec network to connect to. e.g. devnet */
29
+ network?: Network;
30
+ /** API Key required by the external network's node */
31
+ apiKey?: string;
32
+ /** Custom Aztec Node URL to connect to */
33
+ nodeUrl?: string;
34
+ };
35
+ export declare const pxeConfigMappings: ConfigMappingsType<PXEServiceConfig>;
36
+ /**
37
+ * Creates an instance of PXEServiceConfig out of environment variables using sensible defaults for integration testing if not set.
38
+ */
39
+ export declare function getPXEServiceConfig(): PXEServiceConfig;
40
+ export declare const pxeCliConfigMappings: ConfigMappingsType<CliPXEOptions>;
41
+ export declare const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions & PXEServiceConfig>;
42
+ /**
43
+ * Creates an instance of CliPxeOptions out of environment variables
44
+ */
45
+ export declare function getCliPXEOptions(): CliPXEOptions & PXEServiceConfig;
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@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L_L2_BLOCK_NUM } from '@aztec/circuits.js/constants';
2
- import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, parseBooleanEnv } from '@aztec/foundation/config';
2
+ import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, parseBooleanEnv, } from '@aztec/foundation/config';
3
3
  import { dataConfigMappings } from '@aztec/kv-store/config';
4
4
  export const pxeConfigMappings = {
5
5
  ...dataConfigMappings,
6
6
  l2StartingBlock: {
7
7
  env: 'PXE_L2_STARTING_BLOCK',
8
8
  ...numberConfigHelper(INITIAL_L2_BLOCK_NUM),
9
- description: 'L2 block to start scanning from for new accounts'
9
+ description: 'L2 block to start scanning from for new accounts',
10
10
  },
11
11
  bbBinaryPath: {
12
12
  env: 'BB_BINARY_PATH',
13
- description: 'Path to the BB binary'
13
+ description: 'Path to the BB binary',
14
14
  },
15
15
  bbWorkingDirectory: {
16
16
  env: 'BB_WORKING_DIRECTORY',
17
- description: 'Working directory for the BB binary'
17
+ description: 'Working directory for the BB binary',
18
18
  },
19
19
  bbSkipCleanup: {
20
20
  env: 'BB_SKIP_CLEANUP',
21
21
  description: 'True to skip cleanup of temporary files for debugging purposes',
22
- ...booleanConfigHelper()
22
+ ...booleanConfigHelper(),
23
23
  },
24
24
  proverEnabled: {
25
25
  env: 'PXE_PROVER_ENABLED',
26
26
  description: 'Enable real proofs',
27
- ...booleanConfigHelper()
28
- }
27
+ ...booleanConfigHelper(),
28
+ },
29
29
  };
30
30
  /**
31
31
  * Creates an instance of PXEServiceConfig out of environment variables using sensible defaults for integration testing if not set.
32
- */ export function getPXEServiceConfig() {
32
+ */
33
+ export function getPXEServiceConfig() {
33
34
  return getConfigFromMappings(pxeConfigMappings);
34
35
  }
35
36
  export const pxeCliConfigMappings = {
36
37
  network: {
37
38
  env: 'NETWORK',
38
- parseEnv: (val)=>val,
39
- description: 'External Aztec network to connect to. e.g. devnet'
39
+ parseEnv: (val) => val,
40
+ description: 'External Aztec network to connect to. e.g. devnet',
40
41
  },
41
42
  apiKey: {
42
43
  env: 'API_KEY',
43
- description: "API Key required by the external network's node"
44
+ description: "API Key required by the external network's node",
44
45
  },
45
46
  nodeUrl: {
46
47
  env: 'AZTEC_NODE_URL',
47
- description: 'Custom Aztec Node URL to connect to'
48
- }
48
+ description: 'Custom Aztec Node URL to connect to',
49
+ },
49
50
  };
50
51
  export const allPxeConfigMappings = {
51
52
  ...pxeConfigMappings,
@@ -53,19 +54,21 @@ export const allPxeConfigMappings = {
53
54
  ...dataConfigMappings,
54
55
  proverEnabled: {
55
56
  env: 'PXE_PROVER_ENABLED',
56
- parseEnv: (val)=>parseBooleanEnv(val) || !!process.env.NETWORK,
57
+ parseEnv: (val) => parseBooleanEnv(val) || !!process.env.NETWORK,
57
58
  description: 'Enable real proofs',
58
- isBoolean: true
59
- }
59
+ isBoolean: true,
60
+ },
60
61
  };
61
62
  /**
62
63
  * Creates an instance of CliPxeOptions out of environment variables
63
- */ export function getCliPXEOptions() {
64
+ */
65
+ export function getCliPXEOptions() {
64
66
  const pxeConfig = getPXEServiceConfig();
65
67
  const cliOptions = getConfigFromMappings(pxeCliConfigMappings);
66
68
  return {
67
69
  ...pxeConfig,
68
70
  ...cliOptions,
69
- proverEnabled: pxeConfig.proverEnabled || !!cliOptions.network
71
+ proverEnabled: pxeConfig.proverEnabled || !!cliOptions.network,
70
72
  };
71
73
  }
74
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uZmlnL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLDhCQUE4QixDQUFDO0FBQ3BFLE9BQU8sRUFFTCxtQkFBbUIsRUFDbkIscUJBQXFCLEVBQ3JCLGtCQUFrQixFQUNsQixlQUFlLEdBQ2hCLE1BQU0sMEJBQTBCLENBQU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QUcsRUFBRSxTQUFTO1FBQ2QsV0FBVyxFQUFFLGlEQUFpRDtLQUMvRDtJQUNELE9BQU8sRUFBRTtRQUNQLEdBQUcsRUFBRSxnQkFBZ0I7UUFDckIsV0FBVyxFQUFFLHFDQUFxQztLQUNuRDtDQUNGLENBQUM7QUFFRixNQUFNLENBQUMsTUFBTSxvQkFBb0IsR0FBeUQ7SUFDeEYsR0FBRyxpQkFBaUI7SUFDcEIsR0FBRyxvQkFBb0I7SUFDdkIsR0FBRyxrQkFBa0I7SUFDckIsYUFBYSxFQUFFO1FBQ2IsR0FBRyxFQUFFLG9CQUFvQjtRQUN6QixRQUFRLEVBQUUsQ0FBQyxHQUFXLEVBQUUsRUFBRSxDQUFDLGVBQWUsQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPO1FBQ3hFLFdBQVcsRUFBRSxvQkFBb0I7UUFDakMsU0FBUyxFQUFFLElBQUk7S0FDaEI7Q0FDRixDQUFDO0FBRUY7O0dBRUc7QUFDSCxNQUFNLFVBQVUsZ0JBQWdCO0lBQzlCLE1BQU0sU0FBUyxHQUFHLG1CQUFtQixFQUFFLENBQUM7SUFDeEMsTUFBTSxVQUFVLEdBQUcscUJBQXFCLENBQWdCLG9CQUFvQixDQUFDLENBQUM7SUFDOUUsT0FBTztRQUNMLEdBQUcsU0FBUztRQUNaLEdBQUcsVUFBVTtRQUNiLGFBQWEsRUFBRSxTQUFTLENBQUMsYUFBYSxJQUFJLENBQUMsQ0FBQyxVQUFVLENBQUMsT0FBTztLQUMvRCxDQUFDO0FBQ0osQ0FBQyJ9
@@ -0,0 +1,5 @@
1
+ export declare function getPackageInfo(): {
2
+ version: string;
3
+ name: string;
4
+ };
5
+ //# sourceMappingURL=package_info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package_info.d.ts","sourceRoot":"","sources":["../../src/config/package_info.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc;;;EAE7B"}
@@ -1,6 +1,4 @@
1
1
  export function getPackageInfo() {
2
- return {
3
- version: '0.1.0',
4
- name: '@aztec/pxe'
5
- };
2
+ return { version: '0.1.0', name: '@aztec/pxe' };
6
3
  }
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFja2FnZV9pbmZvLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbmZpZy9wYWNrYWdlX2luZm8udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxVQUFVLGNBQWM7SUFDNUIsT0FBTyxFQUFFLE9BQU8sRUFBRSxPQUFPLEVBQUUsSUFBSSxFQUFFLFlBQVksRUFBRSxDQUFDO0FBQ2xELENBQUMifQ==
@@ -0,0 +1,104 @@
1
+ /// <reference types="node" resolution-mode="require"/>
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';
8
+ /**
9
+ * ContractDataOracle serves as a data manager and retriever for Aztec.nr contracts.
10
+ * It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
11
+ * from a given contract address and function selector. The class maintains a cache of ContractTree instances
12
+ * to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch
13
+ * the required information and facilitate cryptographic proof generation.
14
+ */
15
+ export declare class ContractDataOracle {
16
+ private db;
17
+ /** Map from contract class id to private function tree. */
18
+ private contractClasses;
19
+ /** Map from address to contract instance. */
20
+ private contractInstances;
21
+ constructor(db: ContractArtifactDatabase & ContractInstanceDatabase);
22
+ /** Returns a contract instance for a given address. Throws if not found. */
23
+ getContractInstance(contractAddress: AztecAddress): Promise<ContractInstance>;
24
+ /** Returns a contract class for a given class id. Throws if not found. */
25
+ getContractClass(contractClassId: Fr): Promise<ContractClass>;
26
+ getContractArtifact(contractClassId: Fr): Promise<ContractArtifact>;
27
+ /**
28
+ * Retrieves the artifact of a specified function within a given contract.
29
+ * The function is identified by its selector, which is a unique code generated from the function's signature.
30
+ * Throws an error if the contract address or function selector are invalid or not found.
31
+ *
32
+ * @param contractAddress - The AztecAddress representing the contract containing the function.
33
+ * @param selector - The function selector.
34
+ * @returns The corresponding function's artifact as an object.
35
+ */
36
+ getFunctionArtifact(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionArtifact>;
37
+ /**
38
+ * Retrieves the artifact of a specified function within a given contract.
39
+ * The function is identified by its name, which is unique within a contract.
40
+ * Throws if the contract has not been added to the database.
41
+ *
42
+ * @param contractAddress - The AztecAddress representing the contract containing the function.
43
+ * @param functionName - The name of the function.
44
+ * @returns The corresponding function's artifact as an object
45
+ */
46
+ getFunctionArtifactByName(contractAddress: AztecAddress, functionName: string): Promise<FunctionArtifact | undefined>;
47
+ /**
48
+ * Retrieves the debug metadata of a specified function within a given contract.
49
+ * The function is identified by its selector, which is a unique code generated from the function's signature.
50
+ * Returns undefined if the debug metadata for the given function is not found.
51
+ * Throws if the contract has not been added to the database.
52
+ *
53
+ * @param contractAddress - The AztecAddress representing the contract containing the function.
54
+ * @param selector - The function selector.
55
+ * @returns The corresponding function's artifact as an object.
56
+ */
57
+ getFunctionDebugMetadata(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionDebugMetadata | undefined>;
58
+ /**
59
+ * Retrieve the bytecode of a specific function in a contract at the given address.
60
+ * The returned bytecode is required for executing and verifying the function's behavior
61
+ * in the Aztec network. Throws an error if the contract or function cannot be found.
62
+ *
63
+ * @param contractAddress - The contract's address.
64
+ * @param selector - The function selector.
65
+ * @returns A Promise that resolves to a Buffer containing the bytecode of the specified function.
66
+ * @throws Error if the contract address is unknown or not found.
67
+ */
68
+ getBytecode(contractAddress: AztecAddress, selector: FunctionSelector): Promise<Buffer>;
69
+ /**
70
+ * Retrieve the function membership witness for the given contract address and function selector.
71
+ * The function membership witness represents a proof that the function belongs to the specified contract.
72
+ * Throws an error if the contract address or function selector is unknown.
73
+ *
74
+ * @param contractAddress - The contract address.
75
+ * @param selector - The function selector.
76
+ * @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
77
+ */
78
+ getFunctionMembershipWitness(contractAddress: AztecAddress, selector: FunctionSelector): Promise<import("@aztec/circuits.js").MembershipWitness<5>>;
79
+ getDebugContractName(contractAddress: AztecAddress): Promise<string>;
80
+ getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
81
+ /**
82
+ * Retrieve or create a ContractTree instance based on the provided class id.
83
+ * If an existing tree with the same class id is found in the cache, it will be returned.
84
+ * Otherwise, a new ContractTree instance will be created using the contract data from the database
85
+ * and added to the cache before returning.
86
+ *
87
+ * @param classId - The class id of the contract for which the ContractTree is required.
88
+ * @returns A ContractTree instance associated with the specified contract address.
89
+ * @throws An Error if the contract is not found in the ContractDatabase.
90
+ */
91
+ private getTreeForClassId;
92
+ /**
93
+ * Retrieve or create a ContractTree instance based on the provided AztecAddress.
94
+ * If an existing tree with the same contract address is found in the cache, it will be returned.
95
+ * Otherwise, a new ContractTree instance will be created using the contract data from the database
96
+ * and added to the cache before returning.
97
+ *
98
+ * @param contractAddress - The AztecAddress of the contract for which the ContractTree is required.
99
+ * @returns A ContractTree instance associated with the specified contract address.
100
+ * @throws An Error if the contract is not found in the ContractDatabase.
101
+ */
102
+ private getTreeForAddress;
103
+ }
104
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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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;OAQG;IACU,4BAA4B,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB;IAKtF,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,4 +1,4 @@
1
- import { getFunctionDebugMetadata } from '@aztec/foundation/abi';
1
+ import { getFunctionDebugMetadata, } from '@aztec/foundation/abi';
2
2
  import { ContractClassNotFoundError, ContractNotFoundError } from '@aztec/simulator/client';
3
3
  import { PrivateFunctionsTree } from './private_functions_tree.js';
4
4
  /**
@@ -7,16 +7,17 @@ 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
- */ export class ContractDataOracle {
11
- db;
12
- /** Map from contract class id to private function tree. */ contractClasses;
13
- /** Map from address to contract instance. */ contractInstances;
14
- constructor(db){
10
+ */
11
+ export class ContractDataOracle {
12
+ constructor(db) {
15
13
  this.db = db;
14
+ /** Map from contract class id to private function tree. */
16
15
  this.contractClasses = new Map();
16
+ /** Map from address to contract instance. */
17
17
  this.contractInstances = new Map();
18
18
  }
19
- /** Returns a contract instance for a given address. Throws if not found. */ async getContractInstance(contractAddress) {
19
+ /** Returns a contract instance for a given address. Throws if not found. */
20
+ async getContractInstance(contractAddress) {
20
21
  if (!this.contractInstances.has(contractAddress.toString())) {
21
22
  const instance = await this.db.getContractInstance(contractAddress);
22
23
  if (!instance) {
@@ -26,7 +27,8 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
26
27
  }
27
28
  return this.contractInstances.get(contractAddress.toString());
28
29
  }
29
- /** Returns a contract class for a given class id. Throws if not found. */ async getContractClass(contractClassId) {
30
+ /** Returns a contract class for a given class id. Throws if not found. */
31
+ async getContractClass(contractClassId) {
30
32
  const tree = await this.getTreeForClassId(contractClassId);
31
33
  return tree.getContractClass();
32
34
  }
@@ -35,65 +37,70 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
35
37
  return tree.getArtifact();
36
38
  }
37
39
  /**
38
- * Retrieves the artifact of a specified function within a given contract.
39
- * The function is identified by its selector, which is a unique code generated from the function's signature.
40
- * Throws an error if the contract address or function selector are invalid or not found.
41
- *
42
- * @param contractAddress - The AztecAddress representing the contract containing the function.
43
- * @param selector - The function selector.
44
- * @returns The corresponding function's artifact as an object.
45
- */ async getFunctionArtifact(contractAddress, selector) {
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) {
46
49
  const tree = await this.getTreeForAddress(contractAddress);
47
50
  return tree.getFunctionArtifact(selector);
48
51
  }
49
52
  /**
50
- * Retrieves the artifact of a specified function within a given contract.
51
- * The function is identified by its name, which is unique within a contract.
52
- * Throws if the contract has not been added to the database.
53
- *
54
- * @param contractAddress - The AztecAddress representing the contract containing the function.
55
- * @param functionName - The name of the function.
56
- * @returns The corresponding function's artifact as an object
57
- */ async getFunctionArtifactByName(contractAddress, functionName) {
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) {
58
62
  const tree = await this.getTreeForAddress(contractAddress);
59
- return tree.getArtifact().functions.find((f)=>f.name === functionName);
63
+ return tree.getArtifact().functions.find(f => f.name === functionName);
60
64
  }
61
65
  /**
62
- * Retrieves the debug metadata of a specified function within a given contract.
63
- * The function is identified by its selector, which is a unique code generated from the function's signature.
64
- * Returns undefined if the debug metadata for the given function is not found.
65
- * Throws if the contract has not been added to the database.
66
- *
67
- * @param contractAddress - The AztecAddress representing the contract containing the function.
68
- * @param selector - The function selector.
69
- * @returns The corresponding function's artifact as an object.
70
- */ async getFunctionDebugMetadata(contractAddress, selector) {
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) {
71
76
  const tree = await this.getTreeForAddress(contractAddress);
72
77
  const artifact = await tree.getFunctionArtifact(selector);
73
78
  return getFunctionDebugMetadata(tree.getArtifact(), artifact);
74
79
  }
75
80
  /**
76
- * Retrieve the bytecode of a specific function in a contract at the given address.
77
- * The returned bytecode is required for executing and verifying the function's behavior
78
- * in the Aztec network. Throws an error if the contract or function cannot be found.
79
- *
80
- * @param contractAddress - The contract's address.
81
- * @param selector - The function selector.
82
- * @returns A Promise that resolves to a Buffer containing the bytecode of the specified function.
83
- * @throws Error if the contract address is unknown or not found.
84
- */ async getBytecode(contractAddress, selector) {
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) {
85
91
  const tree = await this.getTreeForAddress(contractAddress);
86
92
  return tree.getBytecode(selector);
87
93
  }
88
94
  /**
89
- * Retrieve the function membership witness for the given contract address and function selector.
90
- * The function membership witness represents a proof that the function belongs to the specified contract.
91
- * Throws an error if the contract address or function selector is unknown.
92
- *
93
- * @param contractAddress - The contract address.
94
- * @param selector - The function selector.
95
- * @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
96
- */ async getFunctionMembershipWitness(contractAddress, selector) {
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) {
97
104
  const tree = await this.getTreeForAddress(contractAddress);
98
105
  return tree.getFunctionMembershipWitness(selector);
99
106
  }
@@ -108,15 +115,16 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
108
115
  return `${contractName}:${functionName}`;
109
116
  }
110
117
  /**
111
- * Retrieve or create a ContractTree instance based on the provided class id.
112
- * If an existing tree with the same class id is found in the cache, it will be returned.
113
- * Otherwise, a new ContractTree instance will be created using the contract data from the database
114
- * and added to the cache before returning.
115
- *
116
- * @param classId - The class id of the contract for which the ContractTree is required.
117
- * @returns A ContractTree instance associated with the specified contract address.
118
- * @throws An Error if the contract is not found in the ContractDatabase.
119
- */ async getTreeForClassId(classId) {
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) {
120
128
  if (!this.contractClasses.has(classId.toString())) {
121
129
  const artifact = await this.db.getContractArtifact(classId);
122
130
  if (!artifact) {
@@ -128,16 +136,18 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
128
136
  return this.contractClasses.get(classId.toString());
129
137
  }
130
138
  /**
131
- * Retrieve or create a ContractTree instance based on the provided AztecAddress.
132
- * If an existing tree with the same contract address is found in the cache, it will be returned.
133
- * Otherwise, a new ContractTree instance will be created using the contract data from the database
134
- * and added to the cache before returning.
135
- *
136
- * @param contractAddress - The AztecAddress of the contract for which the ContractTree is required.
137
- * @returns A ContractTree instance associated with the specified contract address.
138
- * @throws An Error if the contract is not found in the ContractDatabase.
139
- */ async getTreeForAddress(contractAddress) {
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) {
140
149
  const instance = await this.getContractInstance(contractAddress);
141
150
  return this.getTreeForClassId(instance.contractClassId);
142
151
  }
143
152
  }
153
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3RfZGF0YV9vcmFjbGUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUtMLHdCQUF3QixHQUN6QixNQUFNLHVCQUF1QixDQUFDO0FBRS9CLE9BQU8sRUFBRSwwQkFBMEIsRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBSTVGLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBRW5FOzs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yxDQUFDO1FBQ2pFLE9BQU8sSUFBSSxDQUFDLGlCQUFpQixDQUFDLFFBQVEsQ0FBQyxlQUFlLENBQUMsQ0FBQztJQUMxRCxDQUFDO0NBQ0YifQ==
@@ -0,0 +1,65 @@
1
+ /// <reference types="node" resolution-mode="require"/>
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';
6
+ import { Fr } from '@aztec/foundation/fields';
7
+ /**
8
+ * Represents a Merkle tree of functions for a particular Contract Class.
9
+ * It manages the construction of the function tree, computes its root, and generates membership witnesses
10
+ * for constrained functions. This class also enables lookup of specific function artifact using selectors.
11
+ * It is used in combination with the AztecNode to compute various data for executing private transactions.
12
+ */
13
+ export declare class PrivateFunctionsTree {
14
+ private readonly artifact;
15
+ private contractClass;
16
+ private tree?;
17
+ private constructor();
18
+ static create(artifact: ContractArtifact): Promise<PrivateFunctionsTree>;
19
+ /**
20
+ * Retrieve the artifact of a given function.
21
+ * The function is identified by its selector, which represents a unique identifier for the function's signature.
22
+ * Throws an error if the function with the provided selector is not found in the contract.
23
+ *
24
+ * @param selector - The function selector.
25
+ * @returns The artifact object containing relevant information about the targeted function.
26
+ */
27
+ getFunctionArtifact(selector: FunctionSelector): Promise<import("@aztec/foundation/abi").FunctionArtifact>;
28
+ /**
29
+ * Retrieve the bytecode of a function in the contract by its function selector.
30
+ * The function selector is a unique identifier for each function in a contract.
31
+ * Throws an error if the function with the given selector is not found in the contract.
32
+ *
33
+ * @param selector - The selector of a function to get bytecode for.
34
+ * @returns The bytecode of the function as a string.
35
+ */
36
+ getBytecode(selector: FunctionSelector): Promise<Buffer>;
37
+ /**
38
+ * Calculate and return the root of the function tree for the current contract.
39
+ * This root is a cryptographic commitment to the set of constrained functions within the contract,
40
+ * which is used in the Aztec node's proof system. The root will be cached after the first call.
41
+ *
42
+ * @returns A promise that resolves to the Fr (finite field element) representation of the function tree root.
43
+ */
44
+ getFunctionTreeRoot(): Promise<MerkleTree>;
45
+ /** Returns the contract class object. */
46
+ getContractClass(): ContractClassWithId;
47
+ /** Returns the contract artifact. */
48
+ getArtifact(): ContractArtifact;
49
+ /**
50
+ * Returns the contract class identifier for the given artifact.
51
+ */
52
+ getContractClassId(): Fr;
53
+ /**
54
+ * Retrieve the membership witness of a function within a contract's function tree.
55
+ * A membership witness represents the position and authentication path of a target function
56
+ * in the Merkle tree of constrained functions. It is required to prove the existence of the
57
+ * function within the contract during execution. Throws if fn does not exist or is not private.
58
+ *
59
+ * @param selector - The function selector.
60
+ * @returns A MembershipWitness instance representing the position and authentication path of the function in the function tree.
61
+ */
62
+ getFunctionMembershipWitness(selector: FunctionSelector): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT>>;
63
+ private getTree;
64
+ }
65
+ //# sourceMappingURL=private_functions_tree.d.ts.map
@@ -0,0 +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"}