@aztec/pxe 0.74.0 → 0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2

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.js +3 -5
  2. package/dest/config/index.js +18 -21
  3. package/dest/config/package_info.js +4 -2
  4. package/dest/contract_data_oracle/index.js +69 -79
  5. package/dest/contract_data_oracle/private_functions_tree.js +44 -50
  6. package/dest/database/contracts/contract_artifact_db.js +3 -2
  7. package/dest/database/contracts/contract_instance_db.js +3 -2
  8. package/dest/database/index.js +0 -1
  9. package/dest/database/kv_pxe_database.js +243 -259
  10. package/dest/database/note_dao.js +28 -43
  11. package/dest/database/outgoing_note_dao.js +20 -34
  12. package/dest/database/pxe_database.js +4 -2
  13. package/dest/database/pxe_database_test_suite.js +296 -151
  14. package/dest/index.js +0 -1
  15. package/dest/kernel_oracle/index.js +9 -6
  16. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +68 -66
  17. package/dest/kernel_prover/hints/index.js +0 -1
  18. package/dest/kernel_prover/index.js +0 -1
  19. package/dest/kernel_prover/kernel_prover.js +60 -65
  20. package/dest/kernel_prover/proving_data_oracle.js +4 -2
  21. package/dest/note_decryption_utils/add_public_values_to_payload.js +8 -9
  22. package/dest/pxe_http/index.js +0 -1
  23. package/dest/pxe_http/pxe_http_server.js +8 -6
  24. package/dest/pxe_service/error_enriching.js +10 -13
  25. package/dest/pxe_service/index.js +0 -1
  26. package/dest/pxe_service/pxe_service.js +282 -290
  27. package/dest/pxe_service/test/pxe_test_suite.js +40 -27
  28. package/dest/simulator/index.js +1 -3
  29. package/dest/simulator_oracle/index.js +266 -231
  30. package/dest/simulator_oracle/tagging_utils.js +4 -6
  31. package/dest/synchronizer/index.js +0 -1
  32. package/dest/synchronizer/synchronizer.js +42 -42
  33. package/dest/utils/create_pxe_service.js +9 -9
  34. package/package.json +15 -15
  35. package/src/pxe_service/pxe_service.ts +6 -11
  36. package/dest/bin/index.d.ts +0 -3
  37. package/dest/bin/index.d.ts.map +0 -1
  38. package/dest/config/index.d.ts +0 -46
  39. package/dest/config/index.d.ts.map +0 -1
  40. package/dest/config/package_info.d.ts +0 -5
  41. package/dest/config/package_info.d.ts.map +0 -1
  42. package/dest/contract_data_oracle/index.d.ts +0 -104
  43. package/dest/contract_data_oracle/index.d.ts.map +0 -1
  44. package/dest/contract_data_oracle/private_functions_tree.d.ts +0 -65
  45. package/dest/contract_data_oracle/private_functions_tree.d.ts.map +0 -1
  46. package/dest/database/contracts/contract_artifact_db.d.ts +0 -20
  47. package/dest/database/contracts/contract_artifact_db.d.ts.map +0 -1
  48. package/dest/database/contracts/contract_instance_db.d.ts +0 -19
  49. package/dest/database/contracts/contract_instance_db.d.ts.map +0 -1
  50. package/dest/database/index.d.ts +0 -3
  51. package/dest/database/index.d.ts.map +0 -1
  52. package/dest/database/kv_pxe_database.d.ts +0 -55
  53. package/dest/database/kv_pxe_database.d.ts.map +0 -1
  54. package/dest/database/note_dao.d.ts +0 -103
  55. package/dest/database/note_dao.d.ts.map +0 -1
  56. package/dest/database/outgoing_note_dao.d.ts +0 -73
  57. package/dest/database/outgoing_note_dao.d.ts.map +0 -1
  58. package/dest/database/pxe_database.d.ts +0 -216
  59. package/dest/database/pxe_database.d.ts.map +0 -1
  60. package/dest/database/pxe_database_test_suite.d.ts +0 -7
  61. package/dest/database/pxe_database_test_suite.d.ts.map +0 -1
  62. package/dest/index.d.ts +0 -15
  63. package/dest/index.d.ts.map +0 -1
  64. package/dest/kernel_oracle/index.d.ts +0 -34
  65. package/dest/kernel_oracle/index.d.ts.map +0 -1
  66. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  67. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  68. package/dest/kernel_prover/hints/index.d.ts +0 -2
  69. package/dest/kernel_prover/hints/index.d.ts.map +0 -1
  70. package/dest/kernel_prover/index.d.ts +0 -3
  71. package/dest/kernel_prover/index.d.ts.map +0 -1
  72. package/dest/kernel_prover/kernel_prover.d.ts +0 -38
  73. package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
  74. package/dest/kernel_prover/proving_data_oracle.d.ts +0 -65
  75. package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
  76. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -10
  77. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
  78. package/dest/pxe_http/index.d.ts +0 -2
  79. package/dest/pxe_http/index.d.ts.map +0 -1
  80. package/dest/pxe_http/pxe_http_server.d.ts +0 -16
  81. package/dest/pxe_http/pxe_http_server.d.ts.map +0 -1
  82. package/dest/pxe_service/error_enriching.d.ts +0 -11
  83. package/dest/pxe_service/error_enriching.d.ts.map +0 -1
  84. package/dest/pxe_service/index.d.ts +0 -4
  85. package/dest/pxe_service/index.d.ts.map +0 -1
  86. package/dest/pxe_service/pxe_service.d.ts +0 -98
  87. package/dest/pxe_service/pxe_service.d.ts.map +0 -1
  88. package/dest/pxe_service/test/pxe_test_suite.d.ts +0 -3
  89. package/dest/pxe_service/test/pxe_test_suite.d.ts.map +0 -1
  90. package/dest/simulator/index.d.ts +0 -10
  91. package/dest/simulator/index.d.ts.map +0 -1
  92. package/dest/simulator_oracle/index.d.ts +0 -129
  93. package/dest/simulator_oracle/index.d.ts.map +0 -1
  94. package/dest/simulator_oracle/tagging_utils.d.ts +0 -16
  95. package/dest/simulator_oracle/tagging_utils.d.ts.map +0 -1
  96. package/dest/synchronizer/index.d.ts +0 -2
  97. package/dest/synchronizer/index.d.ts.map +0 -1
  98. package/dest/synchronizer/synchronizer.d.ts +0 -30
  99. package/dest/synchronizer/synchronizer.d.ts.map +0 -1
  100. package/dest/utils/create_pxe_service.d.ts +0 -16
  101. package/dest/utils/create_pxe_service.d.ts.map +0 -1
@@ -3,8 +3,8 @@ import { IndexedTaggingSecret } from '@aztec/circuits.js';
3
3
  export const WINDOW_HALF_SIZE = 10;
4
4
  export function getIndexedTaggingSecretsForTheWindow(secretsAndWindows) {
5
5
  const secrets = [];
6
- for (const secretAndWindow of secretsAndWindows) {
7
- for (let i = secretAndWindow.leftMostIndex; i <= secretAndWindow.rightMostIndex; i++) {
6
+ for (const secretAndWindow of secretsAndWindows){
7
+ for(let i = secretAndWindow.leftMostIndex; i <= secretAndWindow.rightMostIndex; i++){
8
8
  secrets.push(new IndexedTaggingSecret(secretAndWindow.appTaggingSecret, i));
9
9
  }
10
10
  }
@@ -14,12 +14,10 @@ export function getIndexedTaggingSecretsForTheWindow(secretsAndWindows) {
14
14
  * Creates a map from app tagging secret to initial index.
15
15
  * @param indexedTaggingSecrets - The indexed tagging secrets to get the initial indexes from.
16
16
  * @returns The map from app tagging secret to initial index.
17
- */
18
- export function getInitialIndexesMap(indexedTaggingSecrets) {
17
+ */ export function getInitialIndexesMap(indexedTaggingSecrets) {
19
18
  const initialIndexes = {};
20
- for (const indexedTaggingSecret of indexedTaggingSecrets) {
19
+ for (const indexedTaggingSecret of indexedTaggingSecrets){
21
20
  initialIndexes[indexedTaggingSecret.appTaggingSecret.toString()] = indexedTaggingSecret.index;
22
21
  }
23
22
  return initialIndexes;
24
23
  }
25
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFnZ2luZ191dGlscy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zaW11bGF0b3Jfb3JhY2xlL3RhZ2dpbmdfdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFXLG9CQUFvQixFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFbkUsd0VBQXdFO0FBQ3hFLE1BQU0sQ0FBQyxNQUFNLGdCQUFnQixHQUFHLEVBQUUsQ0FBQztBQUVuQyxNQUFNLFVBQVUsb0NBQW9DLENBQ2xELGlCQUE0RjtJQUU1RixNQUFNLE9BQU8sR0FBMkIsRUFBRSxDQUFDO0lBQzNDLEtBQUssTUFBTSxlQUFlLElBQUksaUJBQWlCLEVBQUUsQ0FBQztRQUNoRCxLQUFLLElBQUksQ0FBQyxHQUFHLGVBQWUsQ0FBQyxhQUFhLEVBQUUsQ0FBQyxJQUFJLGVBQWUsQ0FBQyxjQUFjLEVBQUUsQ0FBQyxFQUFFLEVBQUUsQ0FBQztZQUNyRixPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksb0JBQW9CLENBQUMsZUFBZSxDQUFDLGdCQUFnQixFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDOUUsQ0FBQztJQUNILENBQUM7SUFDRCxPQUFPLE9BQU8sQ0FBQztBQUNqQixDQUFDO0FBRUQ7Ozs7R0FJRztBQUNILE1BQU0sVUFBVSxvQkFBb0IsQ0FBQyxxQkFBNkM7SUFDaEYsTUFBTSxjQUFjLEdBQTRCLEVBQUUsQ0FBQztJQUVuRCxLQUFLLE1BQU0sb0JBQW9CLElBQUkscUJBQXFCLEVBQUUsQ0FBQztRQUN6RCxjQUFjLENBQUMsb0JBQW9CLENBQUMsZ0JBQWdCLENBQUMsUUFBUSxFQUFFLENBQUMsR0FBRyxvQkFBb0IsQ0FBQyxLQUFLLENBQUM7SUFDaEcsQ0FBQztJQUVELE9BQU8sY0FBYyxDQUFDO0FBQ3hCLENBQUMifQ==
@@ -1,2 +1 @@
1
1
  export * from './synchronizer.js';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3luY2hyb25pemVyL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsbUJBQW1CLENBQUMifQ==
@@ -1,4 +1,4 @@
1
- import { L2BlockStream, } from '@aztec/circuit-types';
1
+ import { L2BlockStream } from '@aztec/circuit-types';
2
2
  import { INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  /**
@@ -6,62 +6,63 @@ import { createLogger } from '@aztec/foundation/log';
6
6
  * latest block header and handle reorgs.
7
7
  * It provides methods to trigger a sync and get the block number we are syncec to
8
8
  * details, and fetch transactions by hash.
9
- */
10
- export class Synchronizer {
11
- constructor(node, db, l2TipsStore, config = {}, loggerOrSuffix) {
9
+ */ export class Synchronizer {
10
+ node;
11
+ db;
12
+ l2TipsStore;
13
+ initialSyncBlockNumber;
14
+ log;
15
+ blockStream;
16
+ constructor(node, db, l2TipsStore, config = {}, loggerOrSuffix){
12
17
  this.node = node;
13
18
  this.db = db;
14
19
  this.l2TipsStore = l2TipsStore;
15
20
  this.initialSyncBlockNumber = INITIAL_L2_BLOCK_NUM - 1;
16
- this.log =
17
- !loggerOrSuffix || typeof loggerOrSuffix === 'string'
18
- ? createLogger(loggerOrSuffix ? `pxe:synchronizer:${loggerOrSuffix}` : `pxe:synchronizer`)
19
- : loggerOrSuffix;
21
+ this.log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:synchronizer:${loggerOrSuffix}` : `pxe:synchronizer`) : loggerOrSuffix;
20
22
  this.blockStream = this.createBlockStream(config);
21
23
  }
22
24
  createBlockStream(config) {
23
25
  return new L2BlockStream(this.node, this.l2TipsStore, this, createLogger('pxe:block_stream'), {
24
- startingBlock: config.l2StartingBlock,
26
+ startingBlock: config.l2StartingBlock
25
27
  });
26
28
  }
27
- /** Handle events emitted by the block stream. */
28
- async handleBlockStreamEvent(event) {
29
+ /** Handle events emitted by the block stream. */ async handleBlockStreamEvent(event) {
29
30
  await this.l2TipsStore.handleBlockStreamEvent(event);
30
- switch (event.type) {
31
- case 'blocks-added': {
32
- const lastBlock = event.blocks.at(-1);
33
- this.log.verbose(`Updated pxe last block to ${lastBlock.number}`, {
34
- blockHash: lastBlock.hash(),
35
- archive: lastBlock.archive.root.toString(),
36
- header: lastBlock.header.toInspect(),
37
- });
38
- await this.db.setHeader(lastBlock.header);
39
- break;
40
- }
41
- case 'chain-pruned': {
42
- this.log.warn(`Pruning data after block ${event.blockNumber} due to reorg`);
43
- // We first unnullify and then remove so that unnullified notes that were created after the block number end up deleted.
44
- await this.db.unnullifyNotesAfter(event.blockNumber);
45
- await this.db.removeNotesAfter(event.blockNumber);
46
- // Remove all note tagging indexes to force a full resync. This is suboptimal, but unless we track the
47
- // block number in which each index is used it's all we can do.
48
- await this.db.resetNoteSyncData();
49
- // Update the header to the last block.
50
- await this.db.setHeader(await this.node.getBlockHeader(event.blockNumber));
51
- break;
52
- }
31
+ switch(event.type){
32
+ case 'blocks-added':
33
+ {
34
+ const lastBlock = event.blocks.at(-1);
35
+ this.log.verbose(`Updated pxe last block to ${lastBlock.number}`, {
36
+ blockHash: lastBlock.hash(),
37
+ archive: lastBlock.archive.root.toString(),
38
+ header: lastBlock.header.toInspect()
39
+ });
40
+ await this.db.setHeader(lastBlock.header);
41
+ break;
42
+ }
43
+ case 'chain-pruned':
44
+ {
45
+ this.log.warn(`Pruning data after block ${event.blockNumber} due to reorg`);
46
+ // We first unnullify and then remove so that unnullified notes that were created after the block number end up deleted.
47
+ await this.db.unnullifyNotesAfter(event.blockNumber);
48
+ await this.db.removeNotesAfter(event.blockNumber);
49
+ // Remove all note tagging indexes to force a full resync. This is suboptimal, but unless we track the
50
+ // block number in which each index is used it's all we can do.
51
+ await this.db.resetNoteSyncData();
52
+ // Update the header to the last block.
53
+ await this.db.setHeader(await this.node.getBlockHeader(event.blockNumber));
54
+ break;
55
+ }
53
56
  }
54
57
  }
55
58
  /**
56
- * Syncs PXE and the node by dowloading the metadata of the latest blocks, allowing simulations to use
57
- * recent data (e.g. notes), and handling any reorgs that might have occurred.
58
- */
59
- async sync() {
59
+ * Syncs PXE and the node by dowloading the metadata of the latest blocks, allowing simulations to use
60
+ * recent data (e.g. notes), and handling any reorgs that might have occurred.
61
+ */ async sync() {
60
62
  let currentHeader;
61
63
  try {
62
64
  currentHeader = await this.db.getBlockHeader();
63
- }
64
- catch (e) {
65
+ } catch (e) {
65
66
  this.log.debug('Header is not set, requesting from the node');
66
67
  }
67
68
  if (!currentHeader) {
@@ -71,7 +72,6 @@ export class Synchronizer {
71
72
  await this.blockStream.sync();
72
73
  }
73
74
  async getSynchedBlockNumber() {
74
- return (await this.db.getBlockNumber()) ?? this.initialSyncBlockNumber;
75
+ return await this.db.getBlockNumber() ?? this.initialSyncBlockNumber;
75
76
  }
76
77
  }
77
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY2hyb25pemVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3N5bmNocm9uaXplci9zeW5jaHJvbml6ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUVMLGFBQWEsR0FHZCxNQUFNLHNCQUFzQixDQUFDO0FBQzlCLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQzFELE9BQU8sRUFBZSxZQUFZLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQU1sRTs7Ozs7R0FLRztBQUNILE1BQU0sT0FBTyxZQUFZO0lBS3ZCLFlBQ1UsSUFBZSxFQUNmLEVBQWUsRUFDZixXQUF3QixFQUNoQyxTQUFzRCxFQUFFLEVBQ3hELGNBQWdDO1FBSnhCLFNBQUksR0FBSixJQUFJLENBQVc7UUFDZixPQUFFLEdBQUYsRUFBRSxDQUFhO1FBQ2YsZ0JBQVcsR0FBWCxXQUFXLENBQWE7UUFQMUIsMkJBQXNCLEdBQUcsb0JBQW9CLEdBQUcsQ0FBQyxDQUFDO1FBV3hELElBQUksQ0FBQyxHQUFHO1lBQ04sQ0FBQyxjQUFjLElBQUksT0FBTyxjQUFjLEtBQUssUUFBUTtnQkFD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8sQ0FBQyxFQUFFLENBQUM7WUFDWCxJQUFJLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyw2Q0FBNkMsQ0FBQyxDQUFDO1FBQ2hFLENBQUM7UUFDRCxJQUFJLENBQUMsYUFBYSxFQUFFLENBQUM7WUFDbkIsdUdBQXVHO1lBQ3ZHLE1BQU0sSUFBSSxDQUFDLEVBQUUsQ0FBQyxTQUFTLENBQUMsTUFBTSxJQUFJLENBQUMsSUFBSSxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzdELENBQUM7UUFDRCxNQUFNLElBQUksQ0FBQyxXQUFXLENBQUMsSUFBSSxFQUFFLENBQUM7SUFDaEMsQ0FBQztJQUVNLEtBQUssQ0FBQyxxQkFBcUI7UUFDaEMsT0FBTyxDQUFDLE1BQU0sSUFBSSxDQUFDLEVBQUUsQ0FBQyxjQUFjLEVBQUUsQ0FBQyxJQUFJLElBQUksQ0FBQyxzQkFBc0IsQ0FBQztJQUN6RSxDQUFDO0NBQ0YifQ==
@@ -18,20 +18,19 @@ import { PXEService } from '../pxe_service/pxe_service.js';
18
18
  * @param options - (Optional) Optional information for creating an PXEService.
19
19
  * @param proofCreator - An optional proof creator to use in place of any other configuration
20
20
  * @returns A Promise that resolves to the started PXEService instance.
21
- */
22
- export async function createPXEService(aztecNode, config, useLogSuffix = undefined, proofCreator) {
23
- const logSuffix = typeof useLogSuffix === 'boolean' ? (useLogSuffix ? randomBytes(3).toString('hex') : undefined) : useLogSuffix;
21
+ */ export async function createPXEService(aztecNode, config, useLogSuffix = undefined, proofCreator) {
22
+ const logSuffix = typeof useLogSuffix === 'boolean' ? useLogSuffix ? randomBytes(3).toString('hex') : undefined : useLogSuffix;
24
23
  const l1Contracts = await aztecNode.getL1ContractAddresses();
25
24
  const configWithContracts = {
26
25
  ...config,
27
- l1Contracts,
26
+ l1Contracts
28
27
  };
29
28
  const keyStore = new KeyStore(await createStore('pxe_key_store', configWithContracts, createLogger('pxe:keystore:lmdb')));
30
29
  const store = await createStore('pxe_data', configWithContracts, createLogger('pxe:data:lmdb'));
31
30
  const db = await KVPxeDatabase.create(store);
32
31
  const tips = new L2TipsStore(store, 'pxe');
33
32
  const simulationProvider = new WASMSimulator();
34
- const prover = proofCreator ?? (await createProver(config, simulationProvider, logSuffix));
33
+ const prover = proofCreator ?? await createProver(config, simulationProvider, logSuffix);
35
34
  const pxe = new PXEService(keyStore, aztecNode, db, tips, prover, simulationProvider, config, logSuffix);
36
35
  await pxe.init();
37
36
  return pxe;
@@ -39,11 +38,12 @@ export async function createPXEService(aztecNode, config, useLogSuffix = undefin
39
38
  function createProver(config, simulationProvider, logSuffix) {
40
39
  if (!config.bbBinaryPath || !config.bbWorkingDirectory) {
41
40
  return new BBWASMBundlePrivateKernelProver(simulationProvider, 16);
42
- }
43
- else {
41
+ } else {
44
42
  const bbConfig = config;
45
43
  const log = createLogger('pxe:bb-native-prover' + (logSuffix ? `:${logSuffix}` : ''));
46
- return BBNativePrivateKernelProver.new({ bbSkipCleanup: false, ...bbConfig }, simulationProvider, log);
44
+ return BBNativePrivateKernelProver.new({
45
+ bbSkipCleanup: false,
46
+ ...bbConfig
47
+ }, simulationProvider, log);
47
48
  }
48
49
  }
49
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlX3B4ZV9zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL2NyZWF0ZV9weGVfc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUMvRCxPQUFPLEVBQUUsK0JBQStCLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUUvRSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDdkQsT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UFNLEdBQUcsR0FBRyxZQUFZLENBQUMsc0JBQXNCLEdBQUcsQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLElBQUksU0FBUyxFQUFFLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUM7UUFDdEYsT0FBTywyQkFBMkIsQ0FBQyxHQUFHLENBQUMsRUFBRSxhQUFhLEVBQUUsS0FBSyxFQUFFLEdBQUcsUUFBUSxFQUFFLEVBQUUsa0JBQWtCLEVBQUUsR0FBRyxDQUFDLENBQUM7SUFDekcsQ0FBQztBQUNILENBQUMifQ==
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.74.0",
3
+ "version": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -23,7 +23,7 @@
23
23
  "clean": "rm -rf ./dest .tsbuildinfo ./src/config/package_info.ts",
24
24
  "formatting": "run -T prettier --check ./src && run -T eslint ./src",
25
25
  "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
26
- "test": "HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-16} RAYON_NUM_THREADS=${RAYON_NUM_THREADS:-4} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
26
+ "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
27
27
  "start": "LOG_LEVEL=${LOG_LEVEL:-debug} && node ./dest/bin/index.js",
28
28
  "generate": "node ./scripts/generate_package_info.js"
29
29
  },
@@ -66,19 +66,19 @@
66
66
  ]
67
67
  },
68
68
  "dependencies": {
69
- "@aztec/bb-prover": "0.74.0",
70
- "@aztec/bb.js": "0.74.0",
71
- "@aztec/builder": "0.74.0",
72
- "@aztec/circuit-types": "0.74.0",
73
- "@aztec/circuits.js": "0.74.0",
74
- "@aztec/ethereum": "0.74.0",
75
- "@aztec/foundation": "0.74.0",
76
- "@aztec/key-store": "0.74.0",
77
- "@aztec/kv-store": "0.74.0",
78
- "@aztec/noir-protocol-circuits-types": "0.74.0",
79
- "@aztec/protocol-contracts": "0.74.0",
80
- "@aztec/simulator": "0.74.0",
81
- "@aztec/types": "0.74.0",
69
+ "@aztec/bb-prover": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
70
+ "@aztec/bb.js": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
71
+ "@aztec/builder": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
72
+ "@aztec/circuit-types": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
73
+ "@aztec/circuits.js": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
74
+ "@aztec/ethereum": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
75
+ "@aztec/foundation": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
76
+ "@aztec/key-store": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
77
+ "@aztec/kv-store": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
78
+ "@aztec/noir-protocol-circuits-types": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
79
+ "@aztec/protocol-contracts": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
80
+ "@aztec/simulator": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
81
+ "@aztec/types": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
82
82
  "@msgpack/msgpack": "^3.0.0-beta2",
83
83
  "@noir-lang/types": "workspace:*",
84
84
  "koa": "^2.14.2",
@@ -42,11 +42,7 @@ import type {
42
42
  PartialAddress,
43
43
  PrivateKernelTailCircuitPublicInputs,
44
44
  } from '@aztec/circuits.js';
45
- import {
46
- computeContractAddressFromInstance,
47
- computeContractClassId,
48
- getContractClassFromArtifact,
49
- } from '@aztec/circuits.js/contract';
45
+ import { computeContractAddressFromInstance, getContractClassFromArtifact } from '@aztec/circuits.js/contract';
50
46
  import { computeNoteHashNonce, siloNullifier } from '@aztec/circuits.js/hash';
51
47
  import { computeAddressSecret } from '@aztec/circuits.js/keys';
52
48
  import {
@@ -240,7 +236,7 @@ export class PXEService implements PXE {
240
236
  }
241
237
 
242
238
  public async registerContractClass(artifact: ContractArtifact): Promise<void> {
243
- const contractClassId = await computeContractClassId(await getContractClassFromArtifact(artifact));
239
+ const { id: contractClassId } = await getContractClassFromArtifact(artifact);
244
240
  await this.db.addContractArtifact(contractClassId, artifact);
245
241
  this.log.info(`Added contract class ${artifact.name} with id ${contractClassId}`);
246
242
  }
@@ -252,10 +248,9 @@ export class PXEService implements PXE {
252
248
  if (artifact) {
253
249
  // If the user provides an artifact, validate it against the expected class id and register it
254
250
  const contractClass = await getContractClassFromArtifact(artifact);
255
- const contractClassId = await computeContractClassId(contractClass);
256
- if (!contractClassId.equals(instance.contractClassId)) {
251
+ if (!contractClass.id.equals(instance.contractClassId)) {
257
252
  throw new Error(
258
- `Artifact does not match expected class id (computed ${contractClassId} but instance refers to ${instance.contractClassId})`,
253
+ `Artifact does not match expected class id (computed ${contractClass.id} but instance refers to ${instance.contractClassId})`,
259
254
  );
260
255
  }
261
256
  const computedAddress = await computeContractAddressFromInstance(instance);
@@ -263,7 +258,7 @@ export class PXEService implements PXE {
263
258
  throw new Error('Added a contract in which the address does not match the contract instance.');
264
259
  }
265
260
 
266
- await this.db.addContractArtifact(contractClassId, artifact);
261
+ await this.db.addContractArtifact(contractClass.id, artifact);
267
262
 
268
263
  const publicFunctionSignatures = artifact.functions
269
264
  .filter(fn => fn.functionType === FunctionType.PUBLIC)
@@ -657,7 +652,7 @@ export class PXEService implements PXE {
657
652
  const contract = await this.db.getContract(to);
658
653
  if (!contract) {
659
654
  throw new Error(
660
- `Unknown contract ${to}: add it to PXE Service by calling server.addContracts(...).\nSee docs for context: https://docs.aztec.network/reference/common_errors/aztecnr-errors#unknown-contract-0x0-add-it-to-pxe-by-calling-serveraddcontracts`,
655
+ `Unknown contract ${to}: add it to PXE Service by calling server.addContracts(...).\nSee docs for context: https://docs.aztec.network/developers/reference/debugging/aztecnr-errors#unknown-contract-0x0-add-it-to-pxe-by-calling-serveraddcontracts`,
661
656
  );
662
657
  }
663
658
 
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env -S node --no-warnings
2
- export {};
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":""}
@@ -1,46 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AACA,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;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,CAAC;AAEjG,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,CAyBlE,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,5 +0,0 @@
1
- export declare function getPackageInfo(): {
2
- version: string;
3
- name: string;
4
- };
5
- //# sourceMappingURL=package_info.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package_info.d.ts","sourceRoot":"","sources":["../../src/config/package_info.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc;;;EAE7B"}
@@ -1,104 +0,0 @@
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
@@ -1 +0,0 @@
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,qBA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E,YAAY;IAKlD,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB;IAO3F;;;;;;;;;OASG;YACW,iBAAiB;IAY/B;;;;;;;;;OASG;YACW,iBAAiB;CAIhC"}
@@ -1,65 +0,0 @@
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
@@ -1 +0,0 @@
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,20 +0,0 @@
1
- import { type ContractArtifact } from '@aztec/foundation/abi';
2
- import { type Fr } from '@aztec/foundation/fields';
3
- /**
4
- * PXE database for managing contract artifacts.
5
- */
6
- export interface ContractArtifactDatabase {
7
- /**
8
- * Adds a new contract artifact to the database or updates an existing one.
9
- * @param id - Id of the corresponding contract class.
10
- * @param contract - Contract artifact to add.
11
- * @throws - If there are duplicate private function selectors.
12
- */
13
- addContractArtifact(id: Fr, contract: ContractArtifact): Promise<void>;
14
- /**
15
- * Gets a contract artifact given its resulting contract class id.
16
- * @param id - Contract class id for the given artifact.
17
- */
18
- getContractArtifact(id: Fr): Promise<ContractArtifact | undefined>;
19
- }
20
- //# sourceMappingURL=contract_artifact_db.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contract_artifact_db.d.ts","sourceRoot":"","sources":["../../../src/database/contracts/contract_artifact_db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvE;;;OAGG;IACH,mBAAmB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;CACpE"}
@@ -1,19 +0,0 @@
1
- import { type AztecAddress, type ContractInstanceWithAddress } from '@aztec/circuits.js';
2
- /**
3
- * PXE database for managing contract instances.
4
- */
5
- export interface ContractInstanceDatabase {
6
- /**
7
- * Adds a new contract to the db or updates an existing one.
8
- * @param contract - Contract to insert.
9
- */
10
- addContractInstance(contract: ContractInstanceWithAddress): Promise<void>;
11
- /**
12
- * Gets a contract given its address.
13
- * @param address - Address of the contract.
14
- */
15
- getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
16
- /** Returns the addresses all contract instances registered in the DB. */
17
- getContractsAddresses(): Promise<AztecAddress[]>;
18
- }
19
- //# sourceMappingURL=contract_instance_db.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contract_instance_db.d.ts","sourceRoot":"","sources":["../../../src/database/contracts/contract_instance_db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEzF;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,mBAAmB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC,CAAC;IAE7F,yEAAyE;IACzE,qBAAqB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;CAClD"}
@@ -1,3 +0,0 @@
1
- export * from './pxe_database.js';
2
- export * from './kv_pxe_database.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/database/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}