@aztec/world-state 0.0.0-test.0 → 0.0.1-commit.21caa21

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 (63) hide show
  1. package/dest/index.d.ts +1 -1
  2. package/dest/instrumentation/instrumentation.d.ts +6 -4
  3. package/dest/instrumentation/instrumentation.d.ts.map +1 -1
  4. package/dest/instrumentation/instrumentation.js +16 -8
  5. package/dest/native/bench_metrics.d.ts +23 -0
  6. package/dest/native/bench_metrics.d.ts.map +1 -0
  7. package/dest/native/bench_metrics.js +81 -0
  8. package/dest/native/fork_checkpoint.d.ts +1 -1
  9. package/dest/native/fork_checkpoint.d.ts.map +1 -1
  10. package/dest/native/index.d.ts +1 -1
  11. package/dest/native/merkle_trees_facade.d.ts +10 -4
  12. package/dest/native/merkle_trees_facade.d.ts.map +1 -1
  13. package/dest/native/merkle_trees_facade.js +39 -7
  14. package/dest/native/message.d.ts +65 -45
  15. package/dest/native/message.d.ts.map +1 -1
  16. package/dest/native/message.js +55 -56
  17. package/dest/native/native_world_state.d.ts +20 -15
  18. package/dest/native/native_world_state.d.ts.map +1 -1
  19. package/dest/native/native_world_state.js +90 -33
  20. package/dest/native/native_world_state_instance.d.ts +20 -4
  21. package/dest/native/native_world_state_instance.d.ts.map +1 -1
  22. package/dest/native/native_world_state_instance.js +42 -3
  23. package/dest/native/world_state_ops_queue.d.ts +1 -1
  24. package/dest/native/world_state_ops_queue.d.ts.map +1 -1
  25. package/dest/native/world_state_ops_queue.js +1 -1
  26. package/dest/synchronizer/config.d.ts +12 -2
  27. package/dest/synchronizer/config.d.ts.map +1 -1
  28. package/dest/synchronizer/config.js +26 -1
  29. package/dest/synchronizer/errors.d.ts +4 -0
  30. package/dest/synchronizer/errors.d.ts.map +1 -0
  31. package/dest/synchronizer/errors.js +5 -0
  32. package/dest/synchronizer/factory.d.ts +9 -2
  33. package/dest/synchronizer/factory.d.ts.map +1 -1
  34. package/dest/synchronizer/factory.js +9 -4
  35. package/dest/synchronizer/index.d.ts +1 -1
  36. package/dest/synchronizer/server_world_state_synchronizer.d.ts +14 -18
  37. package/dest/synchronizer/server_world_state_synchronizer.d.ts.map +1 -1
  38. package/dest/synchronizer/server_world_state_synchronizer.js +78 -38
  39. package/dest/test/index.d.ts +1 -1
  40. package/dest/test/utils.d.ts +2 -2
  41. package/dest/test/utils.d.ts.map +1 -1
  42. package/dest/test/utils.js +21 -18
  43. package/dest/testing.d.ts +2 -2
  44. package/dest/testing.d.ts.map +1 -1
  45. package/dest/testing.js +6 -10
  46. package/dest/world-state-db/index.d.ts +1 -1
  47. package/dest/world-state-db/merkle_tree_db.d.ts +10 -6
  48. package/dest/world-state-db/merkle_tree_db.d.ts.map +1 -1
  49. package/package.json +24 -24
  50. package/src/instrumentation/instrumentation.ts +22 -10
  51. package/src/native/bench_metrics.ts +91 -0
  52. package/src/native/merkle_trees_facade.ts +44 -13
  53. package/src/native/message.ts +81 -63
  54. package/src/native/native_world_state.ts +99 -43
  55. package/src/native/native_world_state_instance.ts +59 -8
  56. package/src/native/world_state_ops_queue.ts +1 -1
  57. package/src/synchronizer/config.ts +47 -2
  58. package/src/synchronizer/errors.ts +5 -0
  59. package/src/synchronizer/factory.ts +31 -8
  60. package/src/synchronizer/server_world_state_synchronizer.ts +93 -40
  61. package/src/test/utils.ts +46 -31
  62. package/src/testing.ts +3 -7
  63. package/src/world-state-db/merkle_tree_db.ts +14 -5
package/src/testing.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { GENESIS_ARCHIVE_ROOT, GENESIS_BLOCK_HASH } from '@aztec/constants';
1
+ import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  import { computeFeePayerBalanceLeafSlot } from '@aztec/protocol-contracts/fee-juice';
4
4
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -10,7 +10,6 @@ async function generateGenesisValues(prefilledPublicData: PublicDataTreeLeaf[])
10
10
  if (!prefilledPublicData.length) {
11
11
  return {
12
12
  genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT),
13
- genesisBlockHash: new Fr(GENESIS_BLOCK_HASH),
14
13
  };
15
14
  }
16
15
 
@@ -20,14 +19,11 @@ async function generateGenesisValues(prefilledPublicData: PublicDataTreeLeaf[])
20
19
  true /* cleanupTmpDir */,
21
20
  prefilledPublicData,
22
21
  );
23
- const initialHeader = ws.getInitialHeader();
24
- const genesisBlockHash = await initialHeader.hash();
25
22
  const genesisArchiveRoot = new Fr((await ws.getCommitted().getTreeInfo(MerkleTreeId.ARCHIVE)).root);
26
23
  await ws.close();
27
24
 
28
25
  return {
29
26
  genesisArchiveRoot,
30
- genesisBlockHash,
31
27
  };
32
28
  }
33
29
 
@@ -50,11 +46,11 @@ export async function getGenesisValues(
50
46
 
51
47
  prefilledPublicData.sort((a, b) => (b.slot.lt(a.slot) ? 1 : -1));
52
48
 
53
- const { genesisBlockHash, genesisArchiveRoot } = await generateGenesisValues(prefilledPublicData);
49
+ const { genesisArchiveRoot } = await generateGenesisValues(prefilledPublicData);
54
50
 
55
51
  return {
56
52
  genesisArchiveRoot,
57
- genesisBlockHash,
58
53
  prefilledPublicData,
54
+ fundingNeeded: BigInt(initialAccounts.length) * initialAccountFeeJuice.toBigInt(),
59
55
  };
60
56
  }
@@ -1,7 +1,7 @@
1
1
  import { MAX_NULLIFIERS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX } from '@aztec/constants';
2
2
  import type { Fr } from '@aztec/foundation/fields';
3
3
  import type { IndexedTreeSnapshot, TreeSnapshot } from '@aztec/merkle-tree';
4
- import type { L2Block } from '@aztec/stdlib/block';
4
+ import type { L2Block, L2BlockNew } from '@aztec/stdlib/block';
5
5
  import type { ForkMerkleTreeOperations, MerkleTreeReadOperations } from '@aztec/stdlib/interfaces/server';
6
6
  import type { MerkleTreeId } from '@aztec/stdlib/trees';
7
7
 
@@ -39,8 +39,14 @@ export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations {
39
39
  * Handles a single L2 block (i.e. Inserts the new note hashes into the merkle tree).
40
40
  * @param block - The L2 block to handle.
41
41
  * @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.
42
44
  */
43
- handleL2BlockAndMessages(block: L2Block, l1ToL2Messages: Fr[]): Promise<WorldStateStatusFull>;
45
+ handleL2BlockAndMessages(
46
+ block: L2Block | L2BlockNew,
47
+ l1ToL2Messages: Fr[],
48
+ isFirstBlock?: boolean,
49
+ ): Promise<WorldStateStatusFull>;
44
50
 
45
51
  /**
46
52
  * Gets a handle that allows reading the latest committed state
@@ -62,11 +68,11 @@ export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations {
62
68
  unwindBlocks(toBlockNumber: bigint): Promise<WorldStateStatusFull>;
63
69
 
64
70
  /**
65
- * Advances the finalised block number to be the number provided
66
- * @param toBlockNumber The block number that is now the tip of the finalised chain
71
+ * Advances the finalized block number to be the number provided
72
+ * @param toBlockNumber The block number that is now the tip of the finalized chain
67
73
  * @returns The new WorldStateStatus
68
74
  */
69
- setFinalised(toBlockNumber: bigint): Promise<WorldStateStatusSummary>;
75
+ setFinalized(toBlockNumber: bigint): Promise<WorldStateStatusSummary>;
70
76
 
71
77
  /**
72
78
  * Gets the current status summary of the database.
@@ -76,4 +82,7 @@ export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations {
76
82
 
77
83
  /** Stops the database */
78
84
  close(): Promise<void>;
85
+
86
+ /** Deletes the db. */
87
+ clear(): Promise<void>;
79
88
  }