@aztec/world-state 0.0.1-commit.24de95ac → 0.0.1-commit.2e2504e2

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 (57) hide show
  1. package/dest/index.d.ts +1 -1
  2. package/dest/instrumentation/instrumentation.d.ts +1 -1
  3. package/dest/instrumentation/instrumentation.d.ts.map +1 -1
  4. package/dest/instrumentation/instrumentation.js +17 -41
  5. package/dest/native/bench_metrics.d.ts +1 -1
  6. package/dest/native/bench_metrics.d.ts.map +1 -1
  7. package/dest/native/fork_checkpoint.d.ts +1 -1
  8. package/dest/native/fork_checkpoint.d.ts.map +1 -1
  9. package/dest/native/index.d.ts +1 -1
  10. package/dest/native/merkle_trees_facade.d.ts +12 -6
  11. package/dest/native/merkle_trees_facade.d.ts.map +1 -1
  12. package/dest/native/merkle_trees_facade.js +39 -8
  13. package/dest/native/message.d.ts +14 -12
  14. package/dest/native/message.d.ts.map +1 -1
  15. package/dest/native/message.js +14 -13
  16. package/dest/native/native_world_state.d.ts +15 -12
  17. package/dest/native/native_world_state.d.ts.map +1 -1
  18. package/dest/native/native_world_state.js +23 -18
  19. package/dest/native/native_world_state_instance.d.ts +12 -3
  20. package/dest/native/native_world_state_instance.d.ts.map +1 -1
  21. package/dest/native/native_world_state_instance.js +24 -3
  22. package/dest/native/world_state_ops_queue.d.ts +1 -1
  23. package/dest/native/world_state_ops_queue.d.ts.map +1 -1
  24. package/dest/synchronizer/config.d.ts +1 -3
  25. package/dest/synchronizer/config.d.ts.map +1 -1
  26. package/dest/synchronizer/config.js +1 -6
  27. package/dest/synchronizer/errors.d.ts +1 -1
  28. package/dest/synchronizer/errors.d.ts.map +1 -1
  29. package/dest/synchronizer/factory.d.ts +4 -3
  30. package/dest/synchronizer/factory.d.ts.map +1 -1
  31. package/dest/synchronizer/factory.js +5 -5
  32. package/dest/synchronizer/index.d.ts +1 -1
  33. package/dest/synchronizer/server_world_state_synchronizer.d.ts +10 -27
  34. package/dest/synchronizer/server_world_state_synchronizer.d.ts.map +1 -1
  35. package/dest/synchronizer/server_world_state_synchronizer.js +84 -72
  36. package/dest/test/index.d.ts +1 -1
  37. package/dest/test/utils.d.ts +12 -5
  38. package/dest/test/utils.d.ts.map +1 -1
  39. package/dest/test/utils.js +54 -50
  40. package/dest/testing.d.ts +2 -2
  41. package/dest/testing.d.ts.map +1 -1
  42. package/dest/testing.js +1 -1
  43. package/dest/world-state-db/index.d.ts +1 -1
  44. package/dest/world-state-db/merkle_tree_db.d.ts +9 -10
  45. package/dest/world-state-db/merkle_tree_db.d.ts.map +1 -1
  46. package/package.json +13 -12
  47. package/src/instrumentation/instrumentation.ts +17 -41
  48. package/src/native/merkle_trees_facade.ts +42 -8
  49. package/src/native/message.ts +25 -23
  50. package/src/native/native_world_state.ts +52 -28
  51. package/src/native/native_world_state_instance.ts +33 -3
  52. package/src/synchronizer/config.ts +1 -14
  53. package/src/synchronizer/factory.ts +7 -1
  54. package/src/synchronizer/server_world_state_synchronizer.ts +98 -98
  55. package/src/test/utils.ts +87 -92
  56. package/src/testing.ts +1 -1
  57. package/src/world-state-db/merkle_tree_db.ts +12 -9
@@ -1,8 +1,13 @@
1
1
  import { MAX_NULLIFIERS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX } from '@aztec/constants';
2
- import type { Fr } from '@aztec/foundation/fields';
2
+ import type { BlockNumber } from '@aztec/foundation/branded-types';
3
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
4
  import type { IndexedTreeSnapshot, TreeSnapshot } from '@aztec/merkle-tree';
4
5
  import type { L2Block } from '@aztec/stdlib/block';
5
- import type { ForkMerkleTreeOperations, MerkleTreeReadOperations } from '@aztec/stdlib/interfaces/server';
6
+ import type {
7
+ ForkMerkleTreeOperations,
8
+ MerkleTreeReadOperations,
9
+ ReadonlyWorldStateAccess,
10
+ } from '@aztec/stdlib/interfaces/server';
6
11
  import type { MerkleTreeId } from '@aztec/stdlib/trees';
7
12
 
8
13
  import type { WorldStateStatusFull, WorldStateStatusSummary } from '../native/message.js';
@@ -34,15 +39,13 @@ export type TreeSnapshots = {
34
39
  [MerkleTreeId.ARCHIVE]: TreeSnapshot<Fr>;
35
40
  };
36
41
 
37
- export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations {
42
+ export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations, ReadonlyWorldStateAccess {
38
43
  /**
39
44
  * Handles a single L2 block (i.e. Inserts the new note hashes into the merkle tree).
40
45
  * @param block - The L2 block to handle.
41
46
  * @param l1ToL2Messages - The L1 to L2 messages for the block.
42
- * @param isFirstBlock - Whether the block is the first block in a checkpoint. Temporary hack to only insert l1 to l2
43
- * messages for the first block in a checkpoint. TODO(#17027) Remove this.
44
47
  */
45
- handleL2BlockAndMessages(block: L2Block, l1ToL2Messages: Fr[], isFirstBlock?: boolean): Promise<WorldStateStatusFull>;
48
+ handleL2BlockAndMessages(block: L2Block, l1ToL2Messages: Fr[]): Promise<WorldStateStatusFull>;
46
49
 
47
50
  /**
48
51
  * Gets a handle that allows reading the latest committed state
@@ -54,21 +57,21 @@ export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations {
54
57
  * @param toBlockNumber The block number of the new oldest historical block
55
58
  * @returns The new WorldStateStatus
56
59
  */
57
- removeHistoricalBlocks(toBlockNumber: bigint): Promise<WorldStateStatusFull>;
60
+ removeHistoricalBlocks(toBlockNumber: BlockNumber): Promise<WorldStateStatusFull>;
58
61
 
59
62
  /**
60
63
  * Removes all pending blocks down to but not including the given block number
61
64
  * @param toBlockNumber The block number of the new tip of the pending chain,
62
65
  * @returns The new WorldStateStatus
63
66
  */
64
- unwindBlocks(toBlockNumber: bigint): Promise<WorldStateStatusFull>;
67
+ unwindBlocks(toBlockNumber: BlockNumber): Promise<WorldStateStatusFull>;
65
68
 
66
69
  /**
67
70
  * Advances the finalized block number to be the number provided
68
71
  * @param toBlockNumber The block number that is now the tip of the finalized chain
69
72
  * @returns The new WorldStateStatus
70
73
  */
71
- setFinalized(toBlockNumber: bigint): Promise<WorldStateStatusSummary>;
74
+ setFinalized(toBlockNumber: BlockNumber): Promise<WorldStateStatusSummary>;
72
75
 
73
76
  /**
74
77
  * Gets the current status summary of the database.