@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.
- package/dest/index.d.ts +1 -1
- package/dest/instrumentation/instrumentation.d.ts +6 -4
- package/dest/instrumentation/instrumentation.d.ts.map +1 -1
- package/dest/instrumentation/instrumentation.js +16 -8
- package/dest/native/bench_metrics.d.ts +23 -0
- package/dest/native/bench_metrics.d.ts.map +1 -0
- package/dest/native/bench_metrics.js +81 -0
- package/dest/native/fork_checkpoint.d.ts +1 -1
- package/dest/native/fork_checkpoint.d.ts.map +1 -1
- package/dest/native/index.d.ts +1 -1
- package/dest/native/merkle_trees_facade.d.ts +10 -4
- package/dest/native/merkle_trees_facade.d.ts.map +1 -1
- package/dest/native/merkle_trees_facade.js +39 -7
- package/dest/native/message.d.ts +65 -45
- package/dest/native/message.d.ts.map +1 -1
- package/dest/native/message.js +55 -56
- package/dest/native/native_world_state.d.ts +20 -15
- package/dest/native/native_world_state.d.ts.map +1 -1
- package/dest/native/native_world_state.js +90 -33
- package/dest/native/native_world_state_instance.d.ts +20 -4
- package/dest/native/native_world_state_instance.d.ts.map +1 -1
- package/dest/native/native_world_state_instance.js +42 -3
- package/dest/native/world_state_ops_queue.d.ts +1 -1
- package/dest/native/world_state_ops_queue.d.ts.map +1 -1
- package/dest/native/world_state_ops_queue.js +1 -1
- package/dest/synchronizer/config.d.ts +12 -2
- package/dest/synchronizer/config.d.ts.map +1 -1
- package/dest/synchronizer/config.js +26 -1
- package/dest/synchronizer/errors.d.ts +4 -0
- package/dest/synchronizer/errors.d.ts.map +1 -0
- package/dest/synchronizer/errors.js +5 -0
- package/dest/synchronizer/factory.d.ts +9 -2
- package/dest/synchronizer/factory.d.ts.map +1 -1
- package/dest/synchronizer/factory.js +9 -4
- package/dest/synchronizer/index.d.ts +1 -1
- package/dest/synchronizer/server_world_state_synchronizer.d.ts +14 -18
- package/dest/synchronizer/server_world_state_synchronizer.d.ts.map +1 -1
- package/dest/synchronizer/server_world_state_synchronizer.js +78 -38
- package/dest/test/index.d.ts +1 -1
- package/dest/test/utils.d.ts +2 -2
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +21 -18
- package/dest/testing.d.ts +2 -2
- package/dest/testing.d.ts.map +1 -1
- package/dest/testing.js +6 -10
- package/dest/world-state-db/index.d.ts +1 -1
- package/dest/world-state-db/merkle_tree_db.d.ts +10 -6
- package/dest/world-state-db/merkle_tree_db.d.ts.map +1 -1
- package/package.json +24 -24
- package/src/instrumentation/instrumentation.ts +22 -10
- package/src/native/bench_metrics.ts +91 -0
- package/src/native/merkle_trees_facade.ts +44 -13
- package/src/native/message.ts +81 -63
- package/src/native/native_world_state.ts +99 -43
- package/src/native/native_world_state_instance.ts +59 -8
- package/src/native/world_state_ops_queue.ts +1 -1
- package/src/synchronizer/config.ts +47 -2
- package/src/synchronizer/errors.ts +5 -0
- package/src/synchronizer/factory.ts +31 -8
- package/src/synchronizer/server_world_state_synchronizer.ts +93 -40
- package/src/test/utils.ts +46 -31
- package/src/testing.ts +3 -7
- 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
|
|
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 {
|
|
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(
|
|
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
|
|
66
|
-
* @param toBlockNumber The block number that is now the tip of the
|
|
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
|
-
|
|
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
|
}
|