@aztec/world-state 4.0.0-nightly.20250907 → 4.0.0-nightly.20260107

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 (53) 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/native/bench_metrics.d.ts +1 -1
  5. package/dest/native/bench_metrics.d.ts.map +1 -1
  6. package/dest/native/fork_checkpoint.d.ts +1 -1
  7. package/dest/native/fork_checkpoint.d.ts.map +1 -1
  8. package/dest/native/index.d.ts +1 -1
  9. package/dest/native/merkle_trees_facade.d.ts +13 -5
  10. package/dest/native/merkle_trees_facade.d.ts.map +1 -1
  11. package/dest/native/merkle_trees_facade.js +29 -4
  12. package/dest/native/message.d.ts +13 -17
  13. package/dest/native/message.d.ts.map +1 -1
  14. package/dest/native/message.js +14 -20
  15. package/dest/native/native_world_state.d.ts +12 -9
  16. package/dest/native/native_world_state.d.ts.map +1 -1
  17. package/dest/native/native_world_state.js +17 -10
  18. package/dest/native/native_world_state_instance.d.ts +10 -1
  19. package/dest/native/native_world_state_instance.d.ts.map +1 -1
  20. package/dest/native/native_world_state_instance.js +21 -0
  21. package/dest/native/world_state_ops_queue.d.ts +1 -1
  22. package/dest/native/world_state_ops_queue.d.ts.map +1 -1
  23. package/dest/synchronizer/config.d.ts +2 -2
  24. package/dest/synchronizer/config.js +1 -1
  25. package/dest/synchronizer/errors.d.ts +1 -1
  26. package/dest/synchronizer/errors.d.ts.map +1 -1
  27. package/dest/synchronizer/factory.d.ts +2 -2
  28. package/dest/synchronizer/factory.js +6 -6
  29. package/dest/synchronizer/index.d.ts +1 -1
  30. package/dest/synchronizer/server_world_state_synchronizer.d.ts +9 -25
  31. package/dest/synchronizer/server_world_state_synchronizer.d.ts.map +1 -1
  32. package/dest/synchronizer/server_world_state_synchronizer.js +34 -50
  33. package/dest/test/index.d.ts +1 -1
  34. package/dest/test/utils.d.ts +16 -9
  35. package/dest/test/utils.d.ts.map +1 -1
  36. package/dest/test/utils.js +56 -52
  37. package/dest/testing.d.ts +2 -2
  38. package/dest/testing.d.ts.map +1 -1
  39. package/dest/testing.js +1 -1
  40. package/dest/world-state-db/index.d.ts +1 -1
  41. package/dest/world-state-db/merkle_tree_db.d.ts +10 -9
  42. package/dest/world-state-db/merkle_tree_db.d.ts.map +1 -1
  43. package/package.json +13 -12
  44. package/src/native/merkle_trees_facade.ts +34 -5
  45. package/src/native/message.ts +24 -39
  46. package/src/native/native_world_state.ts +44 -16
  47. package/src/native/native_world_state_instance.ts +28 -0
  48. package/src/synchronizer/config.ts +2 -2
  49. package/src/synchronizer/factory.ts +7 -7
  50. package/src/synchronizer/server_world_state_synchronizer.ts +60 -74
  51. package/src/test/utils.ts +89 -94
  52. package/src/testing.ts +1 -1
  53. package/src/world-state-db/merkle_tree_db.ts +13 -8
@@ -1,76 +1,70 @@
1
1
  import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, NULLIFIER_SUBTREE_HEIGHT, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
2
+ import { asyncMap } from '@aztec/foundation/async-map';
3
+ import { BlockNumber } from '@aztec/foundation/branded-types';
2
4
  import { padArrayEnd } from '@aztec/foundation/collection';
3
- import { Fr } from '@aztec/foundation/fields';
4
- import { L2Block } from '@aztec/stdlib/block';
5
+ import { Fr } from '@aztec/foundation/curves/bn254';
6
+ import { L2BlockNew } from '@aztec/stdlib/block';
7
+ import { mockCheckpointAndMessages, mockL1ToL2Messages } from '@aztec/stdlib/testing';
5
8
  import { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
6
- export async function mockBlock(blockNum, size, fork, maxEffects = undefined) {
7
- const l2Block = await L2Block.random(blockNum, size, maxEffects);
8
- const l1ToL2Messages = Array(16).fill(0).map(Fr.random);
9
- {
10
- const insertData = async (treeId, data, subTreeHeight, fork)=>{
11
- for (const dataBatch of data){
12
- await fork.batchInsert(treeId, dataBatch, subTreeHeight);
13
- }
14
- };
15
- const publicDataInsert = insertData(MerkleTreeId.PUBLIC_DATA_TREE, l2Block.body.txEffects.map((txEffect)=>txEffect.publicDataWrites.map((write)=>write.toBuffer())), 0, fork);
16
- const nullifierInsert = insertData(MerkleTreeId.NULLIFIER_TREE, l2Block.body.txEffects.map((txEffect)=>padArrayEnd(txEffect.nullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX).map((nullifier)=>nullifier.toBuffer())), NULLIFIER_SUBTREE_HEIGHT, fork);
17
- const noteHashesPadded = l2Block.body.txEffects.flatMap((txEffect)=>padArrayEnd(txEffect.noteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX));
18
- const l1ToL2MessagesPadded = padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
19
- const noteHashInsert = fork.appendLeaves(MerkleTreeId.NOTE_HASH_TREE, noteHashesPadded);
20
- const messageInsert = fork.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, l1ToL2MessagesPadded);
21
- await Promise.all([
22
- publicDataInsert,
23
- nullifierInsert,
24
- noteHashInsert,
25
- messageInsert
26
- ]);
27
- }
9
+ import { BlockHeader } from '@aztec/stdlib/tx';
10
+ export async function updateBlockState(block, l1ToL2Messages, fork) {
11
+ const insertData = async (treeId, data, subTreeHeight, fork)=>{
12
+ for (const dataBatch of data){
13
+ await fork.batchInsert(treeId, dataBatch, subTreeHeight);
14
+ }
15
+ };
16
+ const publicDataInsert = insertData(MerkleTreeId.PUBLIC_DATA_TREE, block.body.txEffects.map((txEffect)=>txEffect.publicDataWrites.map((write)=>write.toBuffer())), 0, fork);
17
+ const nullifierInsert = insertData(MerkleTreeId.NULLIFIER_TREE, block.body.txEffects.map((txEffect)=>padArrayEnd(txEffect.nullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX).map((nullifier)=>nullifier.toBuffer())), NULLIFIER_SUBTREE_HEIGHT, fork);
18
+ const noteHashesPadded = block.body.txEffects.flatMap((txEffect)=>padArrayEnd(txEffect.noteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX));
19
+ const l1ToL2MessagesPadded = block.indexWithinCheckpoint === 0 ? padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP) : l1ToL2Messages;
20
+ const noteHashInsert = fork.appendLeaves(MerkleTreeId.NOTE_HASH_TREE, noteHashesPadded);
21
+ const messageInsert = fork.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, l1ToL2MessagesPadded);
22
+ await Promise.all([
23
+ publicDataInsert,
24
+ nullifierInsert,
25
+ noteHashInsert,
26
+ messageInsert
27
+ ]);
28
28
  const state = await fork.getStateReference();
29
- l2Block.header.state = state;
30
- await fork.updateArchive(l2Block.header);
29
+ block.header = BlockHeader.from({
30
+ ...block.header,
31
+ state
32
+ });
33
+ await fork.updateArchive(block.header);
31
34
  const archiveState = await fork.getTreeInfo(MerkleTreeId.ARCHIVE);
32
- l2Block.archive = new AppendOnlyTreeSnapshot(Fr.fromBuffer(archiveState.root), Number(archiveState.size));
35
+ block.archive = new AppendOnlyTreeSnapshot(Fr.fromBuffer(archiveState.root), Number(archiveState.size));
36
+ }
37
+ export async function mockBlock(blockNum, size, fork, maxEffects = 1000, numL1ToL2Messages = NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, isFirstBlockInCheckpoint = true) {
38
+ const block = await L2BlockNew.random(blockNum, {
39
+ indexWithinCheckpoint: isFirstBlockInCheckpoint ? 0 : 1,
40
+ txsPerBlock: size,
41
+ txOptions: {
42
+ maxEffects
43
+ }
44
+ });
45
+ const l1ToL2Messages = mockL1ToL2Messages(numL1ToL2Messages);
46
+ await updateBlockState(block, l1ToL2Messages, fork);
33
47
  return {
34
- block: l2Block,
48
+ block,
35
49
  messages: l1ToL2Messages
36
50
  };
37
51
  }
38
52
  export async function mockEmptyBlock(blockNum, fork) {
39
- const l2Block = L2Block.empty();
53
+ const l2Block = L2BlockNew.empty();
40
54
  const l1ToL2Messages = Array(16).fill(0).map(Fr.zero);
41
55
  l2Block.header.globalVariables.blockNumber = blockNum;
42
- // Sync the append only trees
43
- {
44
- const noteHashesPadded = l2Block.body.txEffects.flatMap((txEffect)=>padArrayEnd(txEffect.noteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX));
45
- await fork.appendLeaves(MerkleTreeId.NOTE_HASH_TREE, noteHashesPadded);
46
- const l1ToL2MessagesPadded = padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
47
- await fork.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, l1ToL2MessagesPadded);
48
- }
49
- // Sync the indexed trees
50
- {
51
- // We insert the public data tree leaves with one batch per tx to avoid updating the same key twice
52
- for (const txEffect of l2Block.body.txEffects){
53
- await fork.batchInsert(MerkleTreeId.PUBLIC_DATA_TREE, txEffect.publicDataWrites.map((write)=>write.toBuffer()), 0);
54
- const nullifiersPadded = padArrayEnd(txEffect.nullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX);
55
- await fork.batchInsert(MerkleTreeId.NULLIFIER_TREE, nullifiersPadded.map((nullifier)=>nullifier.toBuffer()), NULLIFIER_SUBTREE_HEIGHT);
56
- }
57
- }
58
- const state = await fork.getStateReference();
59
- l2Block.header.state = state;
60
- await fork.updateArchive(l2Block.header);
61
- const archiveState = await fork.getTreeInfo(MerkleTreeId.ARCHIVE);
62
- l2Block.archive = new AppendOnlyTreeSnapshot(Fr.fromBuffer(archiveState.root), Number(archiveState.size));
56
+ await updateBlockState(l2Block, l1ToL2Messages, fork);
63
57
  return {
64
58
  block: l2Block,
65
59
  messages: l1ToL2Messages
66
60
  };
67
61
  }
68
62
  export async function mockBlocks(from, count, numTxs, worldState) {
69
- const tempFork = await worldState.fork(from - 1);
63
+ const tempFork = await worldState.fork(BlockNumber(from - 1));
70
64
  const blocks = [];
71
65
  const messagesArray = [];
72
66
  for(let blockNumber = from; blockNumber < from + count; blockNumber++){
73
- const { block, messages } = await mockBlock(blockNumber, numTxs, tempFork);
67
+ const { block, messages } = await mockBlock(BlockNumber(blockNumber), numTxs, tempFork);
74
68
  blocks.push(block);
75
69
  messagesArray.push(messages);
76
70
  }
@@ -80,6 +74,16 @@ export async function mockBlocks(from, count, numTxs, worldState) {
80
74
  messages: messagesArray
81
75
  };
82
76
  }
77
+ export async function mockCheckpoint(checkpointNumber, fork, options = {}) {
78
+ const { checkpoint, messages } = await mockCheckpointAndMessages(checkpointNumber, options);
79
+ await asyncMap(checkpoint.blocks, async (block, i)=>{
80
+ await updateBlockState(block, i === 0 ? messages : [], fork);
81
+ });
82
+ return {
83
+ checkpoint,
84
+ messages
85
+ };
86
+ }
83
87
  export async function assertSameState(forkA, forkB) {
84
88
  const nativeStateRef = await forkA.getStateReference();
85
89
  const nativeArchive = await forkA.getTreeInfo(MerkleTreeId.ARCHIVE);
package/dest/testing.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
3
  import { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
4
4
  export declare const defaultInitialAccountFeeJuice: Fr;
@@ -7,4 +7,4 @@ export declare function getGenesisValues(initialAccounts: AztecAddress[], initia
7
7
  prefilledPublicData: PublicDataTreeLeaf[];
8
8
  fundingNeeded: bigint;
9
9
  }>;
10
- //# sourceMappingURL=testing.d.ts.map
10
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3Rlc3RpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBRXBELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sRUFBZ0Isa0JBQWtCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQXlCdkUsZUFBTyxNQUFNLDZCQUE2QixJQUFxQixDQUFDO0FBRWhFLHdCQUFzQixnQkFBZ0IsQ0FDcEMsZUFBZSxFQUFFLFlBQVksRUFBRSxFQUMvQixzQkFBc0IsS0FBZ0MsRUFDdEQsaUJBQWlCLEdBQUUsa0JBQWtCLEVBQU87Ozs7R0FxQjdDIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAgB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAyBvE,eAAO,MAAM,6BAA6B,IAAqB,CAAC;AAEhE,wBAAsB,gBAAgB,CACpC,eAAe,EAAE,YAAY,EAAE,EAC/B,sBAAsB,KAAgC,EACtD,iBAAiB,GAAE,kBAAkB,EAAO;;;;GAqB7C"}
1
+ {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAgB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAyBvE,eAAO,MAAM,6BAA6B,IAAqB,CAAC;AAEhE,wBAAsB,gBAAgB,CACpC,eAAe,EAAE,YAAY,EAAE,EAC/B,sBAAsB,KAAgC,EACtD,iBAAiB,GAAE,kBAAkB,EAAO;;;;GAqB7C"}
package/dest/testing.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
2
- import { Fr } from '@aztec/foundation/fields';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { computeFeePayerBalanceLeafSlot } from '@aztec/protocol-contracts/fee-juice';
4
4
  import { MerkleTreeId, PublicDataTreeLeaf } from '@aztec/stdlib/trees';
5
5
  import { NativeWorldStateService } from './native/index.js';
@@ -1,3 +1,3 @@
1
1
  export * from './merkle_tree_db.js';
2
2
  export type { MerkleTreeReadOperations } from '@aztec/stdlib/interfaces/server';
3
- //# sourceMappingURL=index.d.ts.map
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy93b3JsZC1zdGF0ZS1kYi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHFCQUFxQixDQUFDO0FBRXBDLFlBQVksRUFBRSx3QkFBd0IsRUFBRSxNQUFNLGlDQUFpQyxDQUFDIn0=
@@ -1,7 +1,8 @@
1
- import type { Fr } from '@aztec/foundation/fields';
1
+ import type { BlockNumber } from '@aztec/foundation/branded-types';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
3
  import type { IndexedTreeSnapshot, TreeSnapshot } from '@aztec/merkle-tree';
3
- import type { L2Block } from '@aztec/stdlib/block';
4
- import type { ForkMerkleTreeOperations, MerkleTreeReadOperations } from '@aztec/stdlib/interfaces/server';
4
+ import type { L2BlockNew } from '@aztec/stdlib/block';
5
+ import type { ForkMerkleTreeOperations, MerkleTreeReadOperations, ReadonlyWorldStateAccess } from '@aztec/stdlib/interfaces/server';
5
6
  import type { MerkleTreeId } from '@aztec/stdlib/trees';
6
7
  import type { WorldStateStatusFull, WorldStateStatusSummary } from '../native/message.js';
7
8
  /**
@@ -28,13 +29,13 @@ export type TreeSnapshots = {
28
29
  [MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: TreeSnapshot<Fr>;
29
30
  [MerkleTreeId.ARCHIVE]: TreeSnapshot<Fr>;
30
31
  };
31
- export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations {
32
+ export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations, ReadonlyWorldStateAccess {
32
33
  /**
33
34
  * Handles a single L2 block (i.e. Inserts the new note hashes into the merkle tree).
34
35
  * @param block - The L2 block to handle.
35
36
  * @param l1ToL2Messages - The L1 to L2 messages for the block.
36
37
  */
37
- handleL2BlockAndMessages(block: L2Block, l1ToL2Messages: Fr[]): Promise<WorldStateStatusFull>;
38
+ handleL2BlockAndMessages(block: L2BlockNew, l1ToL2Messages: Fr[]): Promise<WorldStateStatusFull>;
38
39
  /**
39
40
  * Gets a handle that allows reading the latest committed state
40
41
  */
@@ -44,19 +45,19 @@ export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations {
44
45
  * @param toBlockNumber The block number of the new oldest historical block
45
46
  * @returns The new WorldStateStatus
46
47
  */
47
- removeHistoricalBlocks(toBlockNumber: bigint): Promise<WorldStateStatusFull>;
48
+ removeHistoricalBlocks(toBlockNumber: BlockNumber): Promise<WorldStateStatusFull>;
48
49
  /**
49
50
  * Removes all pending blocks down to but not including the given block number
50
51
  * @param toBlockNumber The block number of the new tip of the pending chain,
51
52
  * @returns The new WorldStateStatus
52
53
  */
53
- unwindBlocks(toBlockNumber: bigint): Promise<WorldStateStatusFull>;
54
+ unwindBlocks(toBlockNumber: BlockNumber): Promise<WorldStateStatusFull>;
54
55
  /**
55
56
  * Advances the finalized block number to be the number provided
56
57
  * @param toBlockNumber The block number that is now the tip of the finalized chain
57
58
  * @returns The new WorldStateStatus
58
59
  */
59
- setFinalized(toBlockNumber: bigint): Promise<WorldStateStatusSummary>;
60
+ setFinalized(toBlockNumber: BlockNumber): Promise<WorldStateStatusSummary>;
60
61
  /**
61
62
  * Gets the current status summary of the database.
62
63
  * @returns The current WorldStateStatus.
@@ -67,4 +68,4 @@ export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations {
67
68
  /** Deletes the db. */
68
69
  clear(): Promise<void>;
69
70
  }
70
- //# sourceMappingURL=merkle_tree_db.d.ts.map
71
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVya2xlX3RyZWVfZGIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy93b3JsZC1zdGF0ZS1kYi9tZXJrbGVfdHJlZV9kYi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxtQkFBbUIsRUFBRSxZQUFZLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUM1RSxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUN0RCxPQUFPLEtBQUssRUFDVix3QkFBd0IsRUFDeEIsd0JBQXdCLEVBQ3hCLHdCQUF3QixFQUN6QixNQUFNLGlDQUFpQyxDQUFDO0FBQ3pDLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRXhELE9BQU8sS0FBSyxFQUFFLG9CQUFvQixFQUFFLHVCQUF1QixFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFFMUY7Ozs7Ozs7Ozs7Ozs7O0dBY0c7QUFDSCxlQUFPLE1BQU0sMkJBQTJCLFFBQTRCLENBQUM7QUFFckUsZUFBTyxNQUFNLDZCQUE2QixRQUFtRCxDQUFDO0FBRTlGLE1BQU0sTUF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
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -18,8 +18,8 @@
18
18
  "tsconfig": "./tsconfig.json"
19
19
  },
20
20
  "scripts": {
21
- "build": "yarn clean && tsc -b",
22
- "build:dev": "tsc -b --watch",
21
+ "build": "yarn clean && ../scripts/tsc.sh",
22
+ "build:dev": "../scripts/tsc.sh --watch",
23
23
  "clean": "rm -rf ./dest .tsbuildinfo",
24
24
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
25
25
  },
@@ -64,22 +64,23 @@
64
64
  ]
65
65
  },
66
66
  "dependencies": {
67
- "@aztec/constants": "4.0.0-nightly.20250907",
68
- "@aztec/foundation": "4.0.0-nightly.20250907",
69
- "@aztec/kv-store": "4.0.0-nightly.20250907",
70
- "@aztec/merkle-tree": "4.0.0-nightly.20250907",
71
- "@aztec/native": "4.0.0-nightly.20250907",
72
- "@aztec/protocol-contracts": "4.0.0-nightly.20250907",
73
- "@aztec/stdlib": "4.0.0-nightly.20250907",
74
- "@aztec/telemetry-client": "4.0.0-nightly.20250907",
67
+ "@aztec/constants": "4.0.0-nightly.20260107",
68
+ "@aztec/foundation": "4.0.0-nightly.20260107",
69
+ "@aztec/kv-store": "4.0.0-nightly.20260107",
70
+ "@aztec/merkle-tree": "4.0.0-nightly.20260107",
71
+ "@aztec/native": "4.0.0-nightly.20260107",
72
+ "@aztec/protocol-contracts": "4.0.0-nightly.20260107",
73
+ "@aztec/stdlib": "4.0.0-nightly.20260107",
74
+ "@aztec/telemetry-client": "4.0.0-nightly.20260107",
75
75
  "tslib": "^2.4.0",
76
76
  "zod": "^3.23.8"
77
77
  },
78
78
  "devDependencies": {
79
- "@aztec/archiver": "4.0.0-nightly.20250907",
79
+ "@aztec/archiver": "4.0.0-nightly.20260107",
80
80
  "@jest/globals": "^30.0.0",
81
81
  "@types/jest": "^30.0.0",
82
82
  "@types/node": "^22.15.17",
83
+ "@typescript/native-preview": "7.0.0-dev.20251126.1",
83
84
  "jest": "^30.0.0",
84
85
  "jest-mock-extended": "^4.0.0",
85
86
  "ts-node": "^10.9.1",
@@ -1,5 +1,8 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { BlockNumber } from '@aztec/foundation/branded-types';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import { createLogger } from '@aztec/foundation/log';
2
4
  import { serializeToBuffer } from '@aztec/foundation/serialize';
5
+ import { sleep } from '@aztec/foundation/sleep';
3
6
  import { type IndexedTreeLeafPreimage, SiblingPath } from '@aztec/foundation/trees';
4
7
  import type {
5
8
  BatchInsertionResult,
@@ -18,6 +21,7 @@ import {
18
21
  PublicDataTreeLeafPreimage,
19
22
  } from '@aztec/stdlib/trees';
20
23
  import { type BlockHeader, PartialStateReference, StateReference } from '@aztec/stdlib/tx';
24
+ import { type WorldStateRevision, WorldStateRevisionWithHandle } from '@aztec/stdlib/world-state';
21
25
 
22
26
  import assert from 'assert';
23
27
 
@@ -25,7 +29,6 @@ import {
25
29
  type SerializedIndexedLeaf,
26
30
  type SerializedLeafValue,
27
31
  WorldStateMessageType,
28
- type WorldStateRevision,
29
32
  blockStateReference,
30
33
  treeStateReferenceToSnapshot,
31
34
  } from './message.js';
@@ -42,6 +45,10 @@ export class MerkleTreesFacade implements MerkleTreeReadOperations {
42
45
  return this.initialHeader;
43
46
  }
44
47
 
48
+ getRevision(): WorldStateRevisionWithHandle {
49
+ return WorldStateRevisionWithHandle.fromWorldStateRevision(this.revision, this.instance.getHandle());
50
+ }
51
+
45
52
  findLeafIndices(treeId: MerkleTreeId, values: MerkleTreeLeafType<MerkleTreeId>[]): Promise<(bigint | undefined)[]> {
46
53
  return this.findLeafIndicesAfter(treeId, values, 0n);
47
54
  }
@@ -187,19 +194,26 @@ export class MerkleTreesFacade implements MerkleTreeReadOperations {
187
194
  async getBlockNumbersForLeafIndices<ID extends MerkleTreeId>(
188
195
  treeId: ID,
189
196
  leafIndices: bigint[],
190
- ): Promise<(bigint | undefined)[]> {
197
+ ): Promise<(BlockNumber | undefined)[]> {
191
198
  const response = await this.instance.call(WorldStateMessageType.GET_BLOCK_NUMBERS_FOR_LEAF_INDICES, {
192
199
  treeId,
193
200
  revision: this.revision,
194
201
  leafIndices,
195
202
  });
196
203
 
197
- return response.blockNumbers.map(x => (x === undefined || x === null ? undefined : BigInt(x)));
204
+ return response.blockNumbers.map(x => (x === undefined || x === null ? undefined : BlockNumber(Number(x))));
198
205
  }
199
206
  }
200
207
 
201
208
  export class MerkleTreesForkFacade extends MerkleTreesFacade implements MerkleTreeWriteOperations {
202
- constructor(instance: NativeWorldStateInstance, initialHeader: BlockHeader, revision: WorldStateRevision) {
209
+ private log = createLogger('world-state:merkle-trees-fork-facade');
210
+
211
+ constructor(
212
+ instance: NativeWorldStateInstance,
213
+ initialHeader: BlockHeader,
214
+ revision: WorldStateRevision,
215
+ private opts: { closeDelayMs?: number },
216
+ ) {
203
217
  assert.notEqual(revision.forkId, 0, 'Fork ID must be set');
204
218
  assert.equal(revision.includeUncommitted, true, 'Fork must include uncommitted data');
205
219
  super(instance, initialHeader, revision);
@@ -281,6 +295,21 @@ export class MerkleTreesForkFacade extends MerkleTreesFacade implements MerkleTr
281
295
  await this.instance.call(WorldStateMessageType.DELETE_FORK, { forkId: this.revision.forkId });
282
296
  }
283
297
 
298
+ async [Symbol.dispose](): Promise<void> {
299
+ if (this.opts.closeDelayMs) {
300
+ void sleep(this.opts.closeDelayMs)
301
+ .then(() => this.close())
302
+ .catch(err => {
303
+ if (err && 'message' in err && err.message === 'Native instance is closed') {
304
+ return; // Ignore errors due to native instance being closed
305
+ }
306
+ this.log.warn('Error closing MerkleTreesForkFacade after delay', { err });
307
+ });
308
+ } else {
309
+ await this.close();
310
+ }
311
+ }
312
+
284
313
  public async createCheckpoint(): Promise<void> {
285
314
  assert.notEqual(this.revision.forkId, 0, 'Fork ID must be set');
286
315
  await this.instance.call(WorldStateMessageType.CREATE_CHECKPOINT, { forkId: this.revision.forkId });
@@ -1,8 +1,10 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { BlockNumber } from '@aztec/foundation/branded-types';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
3
  import type { Tuple } from '@aztec/foundation/serialize';
3
4
  import { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
4
5
  import type { StateReference } from '@aztec/stdlib/tx';
5
6
  import type { UInt32 } from '@aztec/stdlib/types';
7
+ import type { WorldStateRevision } from '@aztec/stdlib/world-state';
6
8
 
7
9
  export enum WorldStateMessageType {
8
10
  GET_TREE_INFO = 100,
@@ -55,11 +57,11 @@ interface WithTreeId {
55
57
 
56
58
  export interface WorldStateStatusSummary {
57
59
  /** Last block number that can still be unwound. */
58
- unfinalizedBlockNumber: bigint;
60
+ unfinalizedBlockNumber: BlockNumber;
59
61
  /** Last block number that is finalized and cannot be unwound. */
60
- finalizedBlockNumber: bigint;
62
+ finalizedBlockNumber: BlockNumber;
61
63
  /** Oldest block still available for historical queries and forks. */
62
- oldestHistoricalBlock: bigint;
64
+ oldestHistoricalBlock: BlockNumber;
63
65
  /** Whether the trees are in sync with each other */
64
66
  treesAreSynched: boolean;
65
67
  }
@@ -80,11 +82,11 @@ export interface TreeMeta {
80
82
  /** The tree's initial root value */
81
83
  initialRoot: Fr;
82
84
  /** The current oldest historical block number of the tree */
83
- oldestHistoricBlock: bigint;
85
+ oldestHistoricBlock: BlockNumber;
84
86
  /** The current unfinalized block number of the tree */
85
- unfinalizedBlockHeight: bigint;
87
+ unfinalizedBlockHeight: BlockNumber;
86
88
  /** The current finalized block number of the tree */
87
- finalizedBlockHeight: bigint;
89
+ finalizedBlockHeight: BlockNumber;
88
90
  }
89
91
 
90
92
  export interface DBStats {
@@ -172,9 +174,9 @@ export function buildEmptyTreeMeta() {
172
174
  depth: 0,
173
175
  size: 0n,
174
176
  committedSize: 0n,
175
- unfinalizedBlockHeight: 0n,
176
- finalizedBlockHeight: 0n,
177
- oldestHistoricBlock: 0n,
177
+ unfinalizedBlockHeight: BlockNumber.ZERO,
178
+ finalizedBlockHeight: BlockNumber.ZERO,
179
+ oldestHistoricBlock: BlockNumber.ZERO,
178
180
  root: Fr.ZERO,
179
181
  initialRoot: Fr.ZERO,
180
182
  initialSize: 0n,
@@ -203,9 +205,9 @@ export function buildEmptyWorldStateDBStats() {
203
205
 
204
206
  export function buildEmptyWorldStateSummary() {
205
207
  return {
206
- unfinalizedBlockNumber: 0n,
207
- finalizedBlockNumber: 0n,
208
- oldestHistoricalBlock: 0n,
208
+ unfinalizedBlockNumber: BlockNumber.ZERO,
209
+ finalizedBlockNumber: BlockNumber.ZERO,
210
+ oldestHistoricalBlock: BlockNumber.ZERO,
209
211
  treesAreSynched: true,
210
212
  } as WorldStateStatusSummary;
211
213
  }
@@ -219,9 +221,9 @@ export function buildEmptyWorldStateStatusFull() {
219
221
  }
220
222
 
221
223
  export function sanitizeSummary(summary: WorldStateStatusSummary) {
222
- summary.finalizedBlockNumber = BigInt(summary.finalizedBlockNumber);
223
- summary.unfinalizedBlockNumber = BigInt(summary.unfinalizedBlockNumber);
224
- summary.oldestHistoricalBlock = BigInt(summary.oldestHistoricalBlock);
224
+ summary.finalizedBlockNumber = BlockNumber.fromBigInt(BigInt(summary.finalizedBlockNumber));
225
+ summary.unfinalizedBlockNumber = BlockNumber.fromBigInt(BigInt(summary.unfinalizedBlockNumber));
226
+ summary.oldestHistoricalBlock = BlockNumber.fromBigInt(BigInt(summary.oldestHistoricalBlock));
225
227
  return summary;
226
228
  }
227
229
 
@@ -233,11 +235,11 @@ export function sanitizeDBStats(stats: DBStats) {
233
235
 
234
236
  export function sanitizeMeta(meta: TreeMeta) {
235
237
  meta.committedSize = BigInt(meta.committedSize);
236
- meta.finalizedBlockHeight = BigInt(meta.finalizedBlockHeight);
238
+ meta.finalizedBlockHeight = BlockNumber.fromBigInt(BigInt(meta.finalizedBlockHeight));
237
239
  meta.initialSize = BigInt(meta.initialSize);
238
- meta.oldestHistoricBlock = BigInt(meta.oldestHistoricBlock);
240
+ meta.oldestHistoricBlock = BlockNumber.fromBigInt(BigInt(meta.oldestHistoricBlock));
239
241
  meta.size = BigInt(meta.size);
240
- meta.unfinalizedBlockHeight = BigInt(meta.unfinalizedBlockHeight);
242
+ meta.unfinalizedBlockHeight = BlockNumber.fromBigInt(BigInt(meta.unfinalizedBlockHeight));
241
243
  return meta;
242
244
  }
243
245
 
@@ -309,7 +311,7 @@ interface WithLeafValues {
309
311
  }
310
312
 
311
313
  interface BlockShiftRequest extends WithCanonicalForkId {
312
- toBlockNumber: bigint;
314
+ toBlockNumber: BlockNumber;
313
315
  }
314
316
 
315
317
  interface WithLeaves {
@@ -408,7 +410,7 @@ interface UpdateArchiveRequest extends WithForkId {
408
410
  }
409
411
 
410
412
  interface SyncBlockRequest extends WithCanonicalForkId {
411
- blockNumber: number;
413
+ blockNumber: BlockNumber;
412
414
  blockStateRef: BlockStateReference;
413
415
  blockHeaderHash: Fr;
414
416
  paddedNoteHashes: readonly SerializedLeafValue[];
@@ -419,7 +421,7 @@ interface SyncBlockRequest extends WithCanonicalForkId {
419
421
 
420
422
  interface CreateForkRequest extends WithCanonicalForkId {
421
423
  latest: boolean;
422
- blockNumber: number;
424
+ blockNumber: BlockNumber;
423
425
  }
424
426
 
425
427
  interface CreateForkResponse {
@@ -537,23 +539,6 @@ export type WorldStateResponse = {
537
539
  [WorldStateMessageType.CLOSE]: void;
538
540
  };
539
541
 
540
- export type WorldStateRevision = {
541
- forkId: number;
542
- blockNumber: number;
543
- includeUncommitted: boolean;
544
- };
545
- export function worldStateRevision(
546
- includeUncommitted: boolean,
547
- forkId: number | undefined,
548
- blockNumber: number | undefined,
549
- ): WorldStateRevision {
550
- return {
551
- forkId: forkId ?? 0,
552
- blockNumber: blockNumber ?? 0,
553
- includeUncommitted,
554
- };
555
- }
556
-
557
542
  type TreeStateReference = readonly [Buffer, number | bigint];
558
543
  type BlockStateReference = Map<Exclude<MerkleTreeId, MerkleTreeId.ARCHIVE>, TreeStateReference>;
559
544