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

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 -6
  46. package/dest/kernel_prover/kernel_prover.d.ts.map +1 -1
  47. package/dest/kernel_prover/kernel_prover.js +98 -81
  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 +279 -333
  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 +18 -19
  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 +89 -69
  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 +121 -224
  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
@@ -1,4 +1,5 @@
1
- import { type Fr, IndexedTaggingSecret } from '@aztec/circuits.js';
1
+ import type { Fr } from '@aztec/foundation/fields';
2
+ import { IndexedTaggingSecret } from '@aztec/stdlib/logs';
2
3
  export declare const WINDOW_HALF_SIZE = 10;
3
4
  export declare function getIndexedTaggingSecretsForTheWindow(secretsAndWindows: {
4
5
  appTaggingSecret: Fr;
@@ -1 +1 @@
1
- {"version":3,"file":"tagging_utils.d.ts","sourceRoot":"","sources":["../../src/simulator_oracle/tagging_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAGnE,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,wBAAgB,oCAAoC,CAClD,iBAAiB,EAAE;IAAE,gBAAgB,EAAE,EAAE,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,EAAE,GAC3F,oBAAoB,EAAE,CAQxB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,qBAAqB,EAAE,oBAAoB,EAAE,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAQ3G"}
1
+ {"version":3,"file":"tagging_utils.d.ts","sourceRoot":"","sources":["../../src/simulator_oracle/tagging_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG1D,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,wBAAgB,oCAAoC,CAClD,iBAAiB,EAAE;IAAE,gBAAgB,EAAE,EAAE,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,EAAE,GAC3F,oBAAoB,EAAE,CAQxB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,qBAAqB,EAAE,oBAAoB,EAAE,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAQ3G"}
@@ -1,10 +1,10 @@
1
- import { IndexedTaggingSecret } from '@aztec/circuits.js';
1
+ import { IndexedTaggingSecret } from '@aztec/stdlib/logs';
2
2
  // Half the size of the window we slide over the tagging secret indexes.
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,8 +1,9 @@
1
- import { type AztecNode, L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/circuit-types';
2
1
  import { type Logger } from '@aztec/foundation/log';
3
- import { type L2TipsStore } from '@aztec/kv-store/stores';
4
- import { type PXEConfig } from '../config/index.js';
5
- import { type PxeDatabase } from '../database/index.js';
2
+ import type { L2TipsStore } from '@aztec/kv-store/stores';
3
+ import { L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
4
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
5
+ import type { PXEConfig } from '../config/index.js';
6
+ import type { PxeDatabase } from '../database/index.js';
6
7
  /**
7
8
  * The Synchronizer class manages the synchronization with the aztec node, allowing PXE to retrieve the
8
9
  * latest block header and handle reorgs.
@@ -15,6 +16,7 @@ export declare class Synchronizer implements L2BlockStreamEventHandler {
15
16
  private l2TipsStore;
16
17
  private initialSyncBlockNumber;
17
18
  private log;
19
+ private isSyncing;
18
20
  protected readonly blockStream: L2BlockStream;
19
21
  constructor(node: AztecNode, db: PxeDatabase, l2TipsStore: L2TipsStore, config?: Partial<Pick<PXEConfig, 'l2StartingBlock'>>, loggerOrSuffix?: string | Logger);
20
22
  protected createBlockStream(config: Partial<Pick<PXEConfig, 'l2StartingBlock'>>): L2BlockStream;
@@ -25,6 +27,7 @@ export declare class Synchronizer implements L2BlockStreamEventHandler {
25
27
  * recent data (e.g. notes), and handling any reorgs that might have occurred.
26
28
  */
27
29
  sync(): Promise<void>;
30
+ private doSync;
28
31
  getSynchedBlockNumber(): Promise<number>;
29
32
  }
30
33
  //# sourceMappingURL=synchronizer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"synchronizer.d.ts","sourceRoot":"","sources":["../../src/synchronizer/synchronizer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;GAKG;AACH,qBAAa,YAAa,YAAW,yBAAyB;IAM1D,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,WAAW;IAPrB,OAAO,CAAC,sBAAsB,CAA4B;IAC1D,OAAO,CAAC,GAAG,CAAS;IACpB,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;gBAGpC,IAAI,EAAE,SAAS,EACf,EAAE,EAAE,WAAW,EACf,WAAW,EAAE,WAAW,EAChC,MAAM,GAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAM,EACxD,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM;IASlC,SAAS,CAAC,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB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B,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC7E;;;OAGG;IACU,IAAI;YAiBH,MAAM;IAeP,qBAAqB;CAGnC"}
@@ -1,67 +1,89 @@
1
- import { L2BlockStream, } from '@aztec/circuit-types';
2
- import { INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js';
1
+ import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
3
2
  import { createLogger } from '@aztec/foundation/log';
3
+ import { L2BlockStream } from '@aztec/stdlib/block';
4
4
  /**
5
5
  * The Synchronizer class manages the synchronization with the aztec node, allowing PXE to retrieve the
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
+ isSyncing;
16
+ blockStream;
17
+ constructor(node, db, l2TipsStore, config = {}, loggerOrSuffix){
12
18
  this.node = node;
13
19
  this.db = db;
14
20
  this.l2TipsStore = l2TipsStore;
15
21
  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;
22
+ this.log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:synchronizer:${loggerOrSuffix}` : `pxe:synchronizer`) : loggerOrSuffix;
20
23
  this.blockStream = this.createBlockStream(config);
21
24
  }
22
25
  createBlockStream(config) {
23
26
  return new L2BlockStream(this.node, this.l2TipsStore, this, createLogger('pxe:block_stream'), {
24
- startingBlock: config.l2StartingBlock,
27
+ startingBlock: config.l2StartingBlock
25
28
  });
26
29
  }
27
- /** Handle events emitted by the block stream. */
28
- async handleBlockStreamEvent(event) {
30
+ /** Handle events emitted by the block stream. */ async handleBlockStreamEvent(event) {
29
31
  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
- }
32
+ switch(event.type){
33
+ case 'blocks-added':
34
+ {
35
+ const lastBlock = event.blocks.at(-1);
36
+ this.log.verbose(`Updated pxe last block to ${lastBlock.number}`, {
37
+ blockHash: lastBlock.hash(),
38
+ archive: lastBlock.archive.root.toString(),
39
+ header: lastBlock.header.toInspect()
40
+ });
41
+ await this.db.setHeader(lastBlock.header);
42
+ break;
43
+ }
44
+ case 'chain-pruned':
45
+ {
46
+ this.log.warn(`Pruning data after block ${event.blockNumber} due to reorg`);
47
+ // We first unnullify and then remove so that unnullified notes that were created after the block number end up deleted.
48
+ await this.db.unnullifyNotesAfter(event.blockNumber);
49
+ await this.db.removeNotesAfter(event.blockNumber);
50
+ // Remove all note tagging indexes to force a full resync. This is suboptimal, but unless we track the
51
+ // block number in which each index is used it's all we can do.
52
+ await this.db.resetNoteSyncData();
53
+ // Update the header to the last block.
54
+ const newHeader = await this.node.getBlockHeader(event.blockNumber);
55
+ if (!newHeader) {
56
+ this.log.error(`Block header not found for block number ${event.blockNumber} during chain prune`);
57
+ } else {
58
+ await this.db.setHeader(newHeader);
59
+ }
60
+ break;
61
+ }
53
62
  }
54
63
  }
55
64
  /**
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() {
65
+ * Syncs PXE and the node by dowloading the metadata of the latest blocks, allowing simulations to use
66
+ * recent data (e.g. notes), and handling any reorgs that might have occurred.
67
+ */ async sync() {
68
+ if (this.isSyncing !== undefined) {
69
+ this.log.debug(`Waiting for the ongoing sync to finish`);
70
+ await this.isSyncing;
71
+ return;
72
+ }
73
+ this.log.debug(`Syncing PXE with the node`);
74
+ const isSyncing = this.doSync();
75
+ this.isSyncing = isSyncing;
76
+ try {
77
+ await isSyncing;
78
+ } finally{
79
+ this.isSyncing = undefined;
80
+ }
81
+ }
82
+ async doSync() {
60
83
  let currentHeader;
61
84
  try {
62
85
  currentHeader = await this.db.getBlockHeader();
63
- }
64
- catch (e) {
86
+ } catch (e) {
65
87
  this.log.debug('Header is not set, requesting from the node');
66
88
  }
67
89
  if (!currentHeader) {
@@ -71,7 +93,6 @@ export class Synchronizer {
71
93
  await this.blockStream.sync();
72
94
  }
73
95
  async getSynchedBlockNumber() {
74
- return (await this.db.getBlockNumber()) ?? this.initialSyncBlockNumber;
96
+ return await this.db.getBlockNumber() ?? this.initialSyncBlockNumber;
75
97
  }
76
98
  }
77
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY2hyb25pemVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3N5bmNocm9uaXplci9zeW5jaHJvbml6ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUVMLGFBQWEsR0FHZCxNQUFNLHNCQUFzQixDQUFDO0FBQzlCL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 -1,5 +1,5 @@
1
- import { type AztecNode, type PrivateKernelProver } from '@aztec/circuit-types';
2
- import { type PXEServiceConfig } from '../config/index.js';
1
+ import type { AztecNode, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
2
+ import type { PXEServiceConfig } from '../config/index.js';
3
3
  import { PXEService } from '../pxe_service/pxe_service.js';
4
4
  /**
5
5
  * Create and start an PXEService instance with the given AztecNode.
@@ -1 +1 @@
1
- {"version":3,"file":"create_pxe_service.d.ts","sourceRoot":"","sources":["../../src/utils/create_pxe_service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAQhF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,EACxB,YAAY,GAAE,MAAM,GAAG,OAAO,GAAG,SAAqB,EACtD,YAAY,CAAC,EAAE,mBAAmB,uBAwBnC"}
1
+ {"version":3,"file":"create_pxe_service.d.ts","sourceRoot":"","sources":["../../src/utils/create_pxe_service.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,EACxB,YAAY,GAAE,MAAM,GAAG,OAAO,GAAG,SAAqB,EACtD,YAAY,CAAC,EAAE,mBAAmB,uBAmCnC"}
@@ -3,8 +3,9 @@ import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/wasm/bundle';
3
3
  import { randomBytes } from '@aztec/foundation/crypto';
4
4
  import { createLogger } from '@aztec/foundation/log';
5
5
  import { KeyStore } from '@aztec/key-store';
6
- import { createStore } from '@aztec/kv-store/lmdb';
6
+ import { createStore } from '@aztec/kv-store/lmdb-v2';
7
7
  import { L2TipsStore } from '@aztec/kv-store/stores';
8
+ import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
8
9
  import { WASMSimulator } from '@aztec/simulator/client';
9
10
  import { KVPxeDatabase } from '../database/kv_pxe_database.js';
10
11
  import { PXEService } from '../pxe_service/pxe_service.js';
@@ -18,32 +19,33 @@ import { PXEService } from '../pxe_service/pxe_service.js';
18
19
  * @param options - (Optional) Optional information for creating an PXEService.
19
20
  * @param proofCreator - An optional proof creator to use in place of any other configuration
20
21
  * @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;
22
+ */ export async function createPXEService(aztecNode, config, useLogSuffix = undefined, proofCreator) {
23
+ const logSuffix = typeof useLogSuffix === 'boolean' ? useLogSuffix ? randomBytes(3).toString('hex') : undefined : useLogSuffix;
24
24
  const l1Contracts = await aztecNode.getL1ContractAddresses();
25
25
  const configWithContracts = {
26
26
  ...config,
27
- l1Contracts,
27
+ l1Contracts
28
28
  };
29
29
  const keyStore = new KeyStore(await createStore('pxe_key_store', configWithContracts, createLogger('pxe:keystore:lmdb')));
30
30
  const store = await createStore('pxe_data', configWithContracts, createLogger('pxe:data:lmdb'));
31
31
  const db = await KVPxeDatabase.create(store);
32
32
  const tips = new L2TipsStore(store, 'pxe');
33
33
  const simulationProvider = new WASMSimulator();
34
- const prover = proofCreator ?? (await createProver(config, simulationProvider, logSuffix));
35
- const pxe = new PXEService(keyStore, aztecNode, db, tips, prover, simulationProvider, config, logSuffix);
34
+ const prover = proofCreator ?? await createProver(config, simulationProvider, logSuffix);
35
+ const protocolContractsProvider = new BundledProtocolContractsProvider();
36
+ const pxe = new PXEService(keyStore, aztecNode, db, tips, prover, simulationProvider, protocolContractsProvider, config, logSuffix);
36
37
  await pxe.init();
37
38
  return pxe;
38
39
  }
39
40
  function createProver(config, simulationProvider, logSuffix) {
40
41
  if (!config.bbBinaryPath || !config.bbWorkingDirectory) {
41
42
  return new BBWASMBundlePrivateKernelProver(simulationProvider, 16);
42
- }
43
- else {
43
+ } else {
44
44
  const bbConfig = config;
45
45
  const log = createLogger('pxe:bb-native-prover' + (logSuffix ? `:${logSuffix}` : ''));
46
- return BBNativePrivateKernelProver.new({ bbSkipCleanup: false, ...bbConfig }, simulationProvider, log);
46
+ return BBNativePrivateKernelProver.new({
47
+ bbSkipCleanup: false,
48
+ ...bbConfig
49
+ }, simulationProvider, log);
47
50
  }
48
51
  }
49
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlX3B4ZV9zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL2NyZWF0ZV9weGVfc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUMvRCxPQUFPLEVBQUUsK0JBQStCLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUUvRSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDdkQsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ3JELE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUM1QyxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDbkQ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sQ0FBQyxHQUFHLENBQUMsRUFBRSxhQUFhLEVBQUUsS0FBSyxFQUFFLEdBQUcsUUFBUSxFQUFFLEVBQUUsa0JBQWtCLEVBQUUsR0FBRyxDQUFDLENBQUM7SUFDekcsQ0FBQztBQUNILENBQUMifQ==
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.76.4",
3
+ "version": "0.77.0-testnet-ignition.21",
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
  },
@@ -60,36 +60,35 @@
60
60
  "reporters": [
61
61
  "default"
62
62
  ],
63
- "testTimeout": 30000,
63
+ "testTimeout": 120000,
64
64
  "setupFiles": [
65
65
  "../../foundation/src/jest/setup.mjs"
66
66
  ]
67
67
  },
68
68
  "dependencies": {
69
- "@aztec/bb-prover": "0.76.4",
70
- "@aztec/bb.js": "0.76.4",
71
- "@aztec/builder": "0.76.4",
72
- "@aztec/circuit-types": "0.76.4",
73
- "@aztec/circuits.js": "0.76.4",
74
- "@aztec/ethereum": "0.76.4",
75
- "@aztec/foundation": "0.76.4",
76
- "@aztec/key-store": "0.76.4",
77
- "@aztec/kv-store": "0.76.4",
78
- "@aztec/noir-protocol-circuits-types": "0.76.4",
79
- "@aztec/protocol-contracts": "0.76.4",
80
- "@aztec/simulator": "0.76.4",
81
- "@aztec/types": "0.76.4",
69
+ "@aztec/bb-prover": "0.77.0-testnet-ignition.21",
70
+ "@aztec/bb.js": "0.77.0-testnet-ignition.21",
71
+ "@aztec/builder": "0.77.0-testnet-ignition.21",
72
+ "@aztec/constants": "0.77.0-testnet-ignition.21",
73
+ "@aztec/ethereum": "0.77.0-testnet-ignition.21",
74
+ "@aztec/foundation": "0.77.0-testnet-ignition.21",
75
+ "@aztec/key-store": "0.77.0-testnet-ignition.21",
76
+ "@aztec/kv-store": "0.77.0-testnet-ignition.21",
77
+ "@aztec/noir-protocol-circuits-types": "0.77.0-testnet-ignition.21",
78
+ "@aztec/protocol-contracts": "0.77.0-testnet-ignition.21",
79
+ "@aztec/simulator": "0.77.0-testnet-ignition.21",
80
+ "@aztec/stdlib": "0.77.0-testnet-ignition.21",
82
81
  "@msgpack/msgpack": "^3.0.0-beta2",
83
- "@noir-lang/types": "1.0.0-beta.1",
84
82
  "koa": "^2.14.2",
85
83
  "koa-router": "^12.0.0",
86
84
  "lodash.omit": "^4.5.0",
87
85
  "sha3": "^2.1.4",
88
86
  "tslib": "^2.4.0",
89
- "viem": "2.22.8"
87
+ "viem": "2.22.8",
88
+ "@aztec/noir-types": "0.77.0-testnet-ignition.21"
90
89
  },
91
90
  "devDependencies": {
92
- "@aztec/noir-contracts.js": "workspace:^",
91
+ "@aztec/noir-contracts.js": "0.77.0-testnet-ignition.21",
93
92
  "@jest/globals": "^29.5.0",
94
93
  "@types/jest": "^29.5.0",
95
94
  "@types/lodash.omit": "^4.5.7",
package/src/bin/index.ts 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
 
5
5
  import { getPXEServiceConfig } from '../config/index.js';
6
6
  import { startPXEHttpServer } from '../pxe_http/index.js';
@@ -1,5 +1,4 @@
1
- import { type ChainConfig, chainConfigMappings } from '@aztec/circuit-types/config';
2
- import { INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js/constants';
1
+ import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
3
2
  import {
4
3
  type ConfigMappingsType,
5
4
  booleanConfigHelper,
@@ -8,7 +7,8 @@ import {
8
7
  parseBooleanEnv,
9
8
  } from '@aztec/foundation/config';
10
9
  import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
11
- import { type Network } from '@aztec/types/network';
10
+ import { type ChainConfig, chainConfigMappings } from '@aztec/stdlib/config';
11
+ import type { Network } from '@aztec/stdlib/network';
12
12
 
13
13
  /**
14
14
  * Temporary configuration until WASM can be used instead of native
@@ -1,16 +1,18 @@
1
- import { type AztecAddress, type ContractClass, type ContractInstance } from '@aztec/circuits.js';
1
+ import type { Fr } from '@aztec/foundation/fields';
2
+ import type { MembershipWitness } from '@aztec/foundation/trees';
3
+ import { ContractClassNotFoundError, ContractNotFoundError } from '@aztec/simulator/client';
2
4
  import {
3
5
  type ContractArtifact,
4
6
  type FunctionArtifact,
5
7
  type FunctionDebugMetadata,
6
8
  type FunctionSelector,
7
9
  getFunctionDebugMetadata,
8
- } from '@aztec/foundation/abi';
9
- import { type Fr } from '@aztec/foundation/fields';
10
- import { ContractClassNotFoundError, ContractNotFoundError } from '@aztec/simulator/client';
10
+ } from '@aztec/stdlib/abi';
11
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
12
+ import type { ContractClass, ContractInstance } from '@aztec/stdlib/contract';
11
13
 
12
- import { type ContractArtifactDatabase } from '../database/contracts/contract_artifact_db.js';
13
- import { type ContractInstanceDatabase } from '../database/contracts/contract_instance_db.js';
14
+ import type { ContractArtifactDatabase } from '../database/contracts/contract_artifact_db.js';
15
+ import type { ContractInstanceDatabase } from '../database/contracts/contract_instance_db.js';
14
16
  import { PrivateFunctionsTree } from './private_functions_tree.js';
15
17
 
16
18
  /**
@@ -23,21 +25,16 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
23
25
  export class ContractDataOracle {
24
26
  /** Map from contract class id to private function tree. */
25
27
  private contractClasses: Map<string, PrivateFunctionsTree> = new Map();
26
- /** Map from address to contract instance. */
27
- private contractInstances: Map<string, ContractInstance> = new Map();
28
28
 
29
29
  constructor(private db: ContractArtifactDatabase & ContractInstanceDatabase) {}
30
30
 
31
31
  /** Returns a contract instance for a given address. Throws if not found. */
32
32
  public async getContractInstance(contractAddress: AztecAddress): Promise<ContractInstance> {
33
- if (!this.contractInstances.has(contractAddress.toString())) {
34
- const instance = await this.db.getContractInstance(contractAddress);
35
- if (!instance) {
36
- throw new ContractNotFoundError(contractAddress.toString());
37
- }
38
- this.contractInstances.set(contractAddress.toString(), instance);
33
+ const instance = await this.db.getContractInstance(contractAddress);
34
+ if (!instance) {
35
+ throw new ContractNotFoundError(contractAddress.toString());
39
36
  }
40
- return this.contractInstances.get(contractAddress.toString())!;
37
+ return instance;
41
38
  }
42
39
 
43
40
  /** Returns a contract class for a given class id. Throws if not found. */
@@ -117,16 +114,19 @@ export class ContractDataOracle {
117
114
  }
118
115
 
119
116
  /**
120
- * Retrieve the function membership witness for the given contract address and function selector.
117
+ * Retrieve the function membership witness for the given contract class and function selector.
121
118
  * The function membership witness represents a proof that the function belongs to the specified contract.
122
119
  * Throws an error if the contract address or function selector is unknown.
123
120
  *
124
- * @param contractAddress - The contract address.
121
+ * @param contractClassId - The id of the class.
125
122
  * @param selector - The function selector.
126
123
  * @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
127
124
  */
128
- public async getFunctionMembershipWitness(contractAddress: AztecAddress, selector: FunctionSelector) {
129
- const tree = await this.getTreeForAddress(contractAddress);
125
+ public async getFunctionMembershipWitness(
126
+ contractClassId: Fr,
127
+ selector: FunctionSelector,
128
+ ): Promise<MembershipWitness<5>> {
129
+ const tree = await this.getTreeForClassId(contractClassId);
130
130
  return tree.getFunctionMembershipWitness(selector);
131
131
  }
132
132
 
@@ -176,6 +176,6 @@ export class ContractDataOracle {
176
176
  */
177
177
  private async getTreeForAddress(contractAddress: AztecAddress): Promise<PrivateFunctionsTree> {
178
178
  const instance = await this.getContractInstance(contractAddress);
179
- return this.getTreeForClassId(instance.contractClassId);
179
+ return this.getTreeForClassId(instance.currentContractClassId);
180
180
  }
181
181
  }
@@ -1,15 +1,14 @@
1
+ import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
2
+ import { Fr } from '@aztec/foundation/fields';
3
+ import { assertLength } from '@aztec/foundation/serialize';
4
+ import { MembershipWitness, type MerkleTree } from '@aztec/foundation/trees';
5
+ import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
1
6
  import {
2
7
  type ContractClassWithId,
3
- FUNCTION_TREE_HEIGHT,
4
- MembershipWitness,
5
8
  computePrivateFunctionLeaf,
6
9
  computePrivateFunctionsTree,
7
10
  getContractClassFromArtifact,
8
- } from '@aztec/circuits.js';
9
- import { type MerkleTree } from '@aztec/circuits.js/merkle';
10
- import { type ContractArtifact, FunctionSelector } from '@aztec/foundation/abi';
11
- import { Fr } from '@aztec/foundation/fields';
12
- import { assertLength } from '@aztec/foundation/serialize';
11
+ } from '@aztec/stdlib/contract';
13
12
 
14
13
  /**
15
14
  * Represents a Merkle tree of functions for a particular Contract Class.
@@ -1,5 +1,5 @@
1
- import { type ContractArtifact } from '@aztec/foundation/abi';
2
- import { type Fr } from '@aztec/foundation/fields';
1
+ import type { Fr } from '@aztec/foundation/fields';
2
+ import type { ContractArtifact } from '@aztec/stdlib/abi';
3
3
 
4
4
  /**
5
5
  * PXE database for managing contract artifacts.
@@ -1,4 +1,5 @@
1
- import { type AztecAddress, type ContractInstanceWithAddress } from '@aztec/circuits.js';
1
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
2
3
 
3
4
  /**
4
5
  * PXE database for managing contract instances.