@aztec/world-state 0.0.1-commit.24de95ac → 0.0.1-commit.2606882
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 +1 -1
- package/dest/instrumentation/instrumentation.d.ts.map +1 -1
- package/dest/instrumentation/instrumentation.js +17 -41
- package/dest/native/bench_metrics.d.ts +1 -1
- package/dest/native/bench_metrics.d.ts.map +1 -1
- package/dest/native/fork_checkpoint.d.ts +7 -1
- package/dest/native/fork_checkpoint.d.ts.map +1 -1
- package/dest/native/fork_checkpoint.js +15 -3
- package/dest/native/index.d.ts +1 -1
- package/dest/native/merkle_trees_facade.d.ts +19 -10
- package/dest/native/merkle_trees_facade.d.ts.map +1 -1
- package/dest/native/merkle_trees_facade.js +68 -17
- package/dest/native/message.d.ts +24 -15
- package/dest/native/message.d.ts.map +1 -1
- package/dest/native/message.js +14 -13
- package/dest/native/native_world_state.d.ts +42 -13
- package/dest/native/native_world_state.d.ts.map +1 -1
- package/dest/native/native_world_state.js +93 -35
- package/dest/native/native_world_state_instance.d.ts +15 -5
- package/dest/native/native_world_state_instance.d.ts.map +1 -1
- package/dest/native/native_world_state_instance.js +54 -26
- 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 +5 -5
- package/dest/synchronizer/config.d.ts +3 -5
- package/dest/synchronizer/config.d.ts.map +1 -1
- package/dest/synchronizer/config.js +15 -18
- package/dest/synchronizer/errors.d.ts +1 -1
- package/dest/synchronizer/errors.d.ts.map +1 -1
- package/dest/synchronizer/factory.d.ts +6 -5
- package/dest/synchronizer/factory.d.ts.map +1 -1
- package/dest/synchronizer/factory.js +7 -6
- package/dest/synchronizer/index.d.ts +1 -1
- package/dest/synchronizer/server_world_state_synchronizer.d.ts +11 -28
- package/dest/synchronizer/server_world_state_synchronizer.d.ts.map +1 -1
- package/dest/synchronizer/server_world_state_synchronizer.js +165 -81
- package/dest/test/index.d.ts +1 -1
- package/dest/test/utils.d.ts +12 -5
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +54 -50
- package/dest/testing.d.ts +5 -4
- package/dest/testing.d.ts.map +1 -1
- package/dest/testing.js +11 -7
- package/dest/world-state-db/index.d.ts +1 -1
- package/dest/world-state-db/merkle_tree_db.d.ts +9 -19
- package/dest/world-state-db/merkle_tree_db.d.ts.map +1 -1
- package/package.json +15 -13
- package/src/instrumentation/instrumentation.ts +17 -41
- package/src/native/fork_checkpoint.ts +19 -3
- package/src/native/merkle_trees_facade.ts +79 -20
- package/src/native/message.ts +37 -26
- package/src/native/native_world_state.ts +136 -48
- package/src/native/native_world_state_instance.ts +72 -32
- package/src/native/world_state_ops_queue.ts +5 -5
- package/src/synchronizer/config.ts +16 -23
- package/src/synchronizer/factory.ts +19 -11
- package/src/synchronizer/server_world_state_synchronizer.ts +181 -106
- package/src/test/utils.ts +87 -92
- package/src/testing.ts +9 -10
- package/src/world-state-db/merkle_tree_db.ts +12 -19
package/dest/testing.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
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';
|
|
6
|
-
async function generateGenesisValues(
|
|
7
|
-
if (!prefilledPublicData.length) {
|
|
6
|
+
async function generateGenesisValues(genesis) {
|
|
7
|
+
if (!genesis.prefilledPublicData.length && genesis.genesisTimestamp === 0n) {
|
|
8
8
|
return {
|
|
9
9
|
genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT)
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
// Create a temporary world state to compute the genesis values.
|
|
13
|
-
const ws = await NativeWorldStateService.tmp(undefined /* rollupAddress */ , true,
|
|
13
|
+
const ws = await NativeWorldStateService.tmp(undefined /* rollupAddress */ , true, genesis);
|
|
14
14
|
const genesisArchiveRoot = new Fr((await ws.getCommitted().getTreeInfo(MerkleTreeId.ARCHIVE)).root);
|
|
15
15
|
await ws.close();
|
|
16
16
|
return {
|
|
@@ -18,16 +18,20 @@ async function generateGenesisValues(prefilledPublicData) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
export const defaultInitialAccountFeeJuice = new Fr(10n ** 22n);
|
|
21
|
-
export async function getGenesisValues(initialAccounts, initialAccountFeeJuice = defaultInitialAccountFeeJuice, genesisPublicData = []) {
|
|
21
|
+
export async function getGenesisValues(initialAccounts, initialAccountFeeJuice = defaultInitialAccountFeeJuice, genesisPublicData = [], genesisTimestamp = 0n) {
|
|
22
22
|
// Top up the accounts with fee juice.
|
|
23
23
|
let prefilledPublicData = await Promise.all(initialAccounts.map(async (address)=>new PublicDataTreeLeaf(await computeFeePayerBalanceLeafSlot(address), initialAccountFeeJuice)));
|
|
24
24
|
// Add user-defined public data
|
|
25
25
|
prefilledPublicData = prefilledPublicData.concat(genesisPublicData);
|
|
26
26
|
prefilledPublicData.sort((a, b)=>b.slot.lt(a.slot) ? 1 : -1);
|
|
27
|
-
const
|
|
27
|
+
const genesis = {
|
|
28
|
+
prefilledPublicData,
|
|
29
|
+
genesisTimestamp
|
|
30
|
+
};
|
|
31
|
+
const { genesisArchiveRoot } = await generateGenesisValues(genesis);
|
|
28
32
|
return {
|
|
29
33
|
genesisArchiveRoot,
|
|
30
|
-
|
|
34
|
+
genesis,
|
|
31
35
|
fundingNeeded: BigInt(initialAccounts.length) * initialAccountFeeJuice.toBigInt()
|
|
32
36
|
};
|
|
33
37
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './merkle_tree_db.js';
|
|
2
2
|
export type { MerkleTreeReadOperations } from '@aztec/stdlib/interfaces/server';
|
|
3
|
-
//# sourceMappingURL=
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy93b3JsZC1zdGF0ZS1kYi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHFCQUFxQixDQUFDO0FBRXBDLFlBQVksRUFBRSx3QkFBd0IsRUFBRSxNQUFNLGlDQUFpQyxDQUFDIn0=
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import type { L2Block } from '@aztec/stdlib/block';
|
|
4
|
-
import type { ForkMerkleTreeOperations, MerkleTreeReadOperations } from '@aztec/stdlib/interfaces/server';
|
|
5
|
-
import type { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
4
|
+
import type { ForkMerkleTreeOperations, MerkleTreeReadOperations, ReadonlyWorldStateAccess } from '@aztec/stdlib/interfaces/server';
|
|
6
5
|
import type { WorldStateStatusFull, WorldStateStatusSummary } from '../native/message.js';
|
|
7
6
|
/**
|
|
8
7
|
*
|
|
@@ -21,22 +20,13 @@ import type { WorldStateStatusFull, WorldStateStatusSummary } from '../native/me
|
|
|
21
20
|
*/
|
|
22
21
|
export declare const INITIAL_NULLIFIER_TREE_SIZE: number;
|
|
23
22
|
export declare const INITIAL_PUBLIC_DATA_TREE_SIZE: number;
|
|
24
|
-
export
|
|
25
|
-
[MerkleTreeId.NULLIFIER_TREE]: IndexedTreeSnapshot;
|
|
26
|
-
[MerkleTreeId.NOTE_HASH_TREE]: TreeSnapshot<Fr>;
|
|
27
|
-
[MerkleTreeId.PUBLIC_DATA_TREE]: IndexedTreeSnapshot;
|
|
28
|
-
[MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: TreeSnapshot<Fr>;
|
|
29
|
-
[MerkleTreeId.ARCHIVE]: TreeSnapshot<Fr>;
|
|
30
|
-
};
|
|
31
|
-
export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations {
|
|
23
|
+
export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations, ReadonlyWorldStateAccess {
|
|
32
24
|
/**
|
|
33
25
|
* Handles a single L2 block (i.e. Inserts the new note hashes into the merkle tree).
|
|
34
26
|
* @param block - The L2 block to handle.
|
|
35
27
|
* @param l1ToL2Messages - The L1 to L2 messages for the block.
|
|
36
|
-
* @param isFirstBlock - Whether the block is the first block in a checkpoint. Temporary hack to only insert l1 to l2
|
|
37
|
-
* messages for the first block in a checkpoint. TODO(#17027) Remove this.
|
|
38
28
|
*/
|
|
39
|
-
handleL2BlockAndMessages(block: L2Block, l1ToL2Messages: Fr[]
|
|
29
|
+
handleL2BlockAndMessages(block: L2Block, l1ToL2Messages: Fr[]): Promise<WorldStateStatusFull>;
|
|
40
30
|
/**
|
|
41
31
|
* Gets a handle that allows reading the latest committed state
|
|
42
32
|
*/
|
|
@@ -46,19 +36,19 @@ export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations {
|
|
|
46
36
|
* @param toBlockNumber The block number of the new oldest historical block
|
|
47
37
|
* @returns The new WorldStateStatus
|
|
48
38
|
*/
|
|
49
|
-
removeHistoricalBlocks(toBlockNumber:
|
|
39
|
+
removeHistoricalBlocks(toBlockNumber: BlockNumber): Promise<WorldStateStatusFull>;
|
|
50
40
|
/**
|
|
51
41
|
* Removes all pending blocks down to but not including the given block number
|
|
52
42
|
* @param toBlockNumber The block number of the new tip of the pending chain,
|
|
53
43
|
* @returns The new WorldStateStatus
|
|
54
44
|
*/
|
|
55
|
-
unwindBlocks(toBlockNumber:
|
|
45
|
+
unwindBlocks(toBlockNumber: BlockNumber): Promise<WorldStateStatusFull>;
|
|
56
46
|
/**
|
|
57
47
|
* Advances the finalized block number to be the number provided
|
|
58
48
|
* @param toBlockNumber The block number that is now the tip of the finalized chain
|
|
59
49
|
* @returns The new WorldStateStatus
|
|
60
50
|
*/
|
|
61
|
-
setFinalized(toBlockNumber:
|
|
51
|
+
setFinalized(toBlockNumber: BlockNumber): Promise<WorldStateStatusSummary>;
|
|
62
52
|
/**
|
|
63
53
|
* Gets the current status summary of the database.
|
|
64
54
|
* @returns The current WorldStateStatus.
|
|
@@ -69,4 +59,4 @@ export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations {
|
|
|
69
59
|
/** Deletes the db. */
|
|
70
60
|
clear(): Promise<void>;
|
|
71
61
|
}
|
|
72
|
-
//# sourceMappingURL=
|
|
62
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVya2xlX3RyZWVfZGIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy93b3JsZC1zdGF0ZS1kYi9tZXJrbGVfdHJlZV9kYi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxPQUFPLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNuRCxPQUFPLEtBQUssRUFDVix3QkFBd0IsRUFDeEIsd0JBQXdCLEVBQ3hCLHdCQUF3QixFQUN6QixNQUFNLGlDQUFpQyxDQUFDO0FBRXpDLE9BQU8sS0FBSyxFQUFFLG9CQUFvQixFQUFFLHVCQUF1QixFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFFMUY7Ozs7Ozs7Ozs7Ozs7O0dBY0c7QUFDSCxlQUFPLE1BQU0sMkJBQTJCLFFBQTRCLENBQUM7QUFFckUsZUFBTyxNQUFNLDZCQUE2QixRQUFtRCxDQUFDO0FBRTlGLE1BQU0sV0FBVyx1QkFBd0IsU0FBUSx3QkFBd0IsRUFBRSx3QkFBd0I7SUFDakc7Ozs7T0FJRztJQUNILHdCQUF3QixDQUFDLEtBQUssRUFBRSxPQUFPLEVBQUUsY0FBYyxFQUFFLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxvQkFBb0IsQ0FBQyxDQUFDO0lBRTlGOztPQUVHO0lBQ0gsWUFBWSxJQUFJLHdCQUF3QixDQUFDO0lBRXpDOzs7O09BSUc7SUFDSCxzQkFBc0IsQ0FBQyxhQUFhLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxvQkFBb0IsQ0FBQyxDQUFDO0lBRWxGOzs7O09BSUc7SUFDSCxZQUFZLENBQUMsYUFBYSxFQUFFLFdBQVcsR0FBRyxPQUFPLENBQUMsb0JBQW9CLENBQUMsQ0FBQztJQUV4RTs7OztPQUlHO0lBQ0gsWUFBWSxDQUFDLGFBQWEsRUFBRSxXQUFXLEdBQUcsT0FBTyxDQUFDLHVCQUF1QixDQUFDLENBQUM7SUFFM0U7OztPQUdHO0lBQ0gsZ0JBQWdCLElBQUksT0FBTyxDQUFDLHVCQUF1QixDQUFDLENBQUM7SUFFckQseUJBQXlCO0lBQ3pCLEtBQUssSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7SUFFdkIsc0JBQXNCO0lBQ3RCLEtBQUssSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7Q0FDeEIifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merkle_tree_db.d.ts","sourceRoot":"","sources":["../../src/world-state-db/merkle_tree_db.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"merkle_tree_db.d.ts","sourceRoot":"","sources":["../../src/world-state-db/merkle_tree_db.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE1F;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,2BAA2B,QAA4B,CAAC;AAErE,eAAO,MAAM,6BAA6B,QAAmD,CAAC;AAE9F,MAAM,WAAW,uBAAwB,SAAQ,wBAAwB,EAAE,wBAAwB;IACjG;;;;OAIG;IACH,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAE9F;;OAEG;IACH,YAAY,IAAI,wBAAwB,CAAC;IAEzC;;;;OAIG;IACH,sBAAsB,CAAC,aAAa,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAElF;;;;OAIG;IACH,YAAY,CAAC,aAAa,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAExE;;;;OAIG;IACH,YAAY,CAAC,aAAa,EAAE,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAE3E;;;OAGG;IACH,gBAAgB,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAErD,yBAAyB;IACzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB,sBAAsB;IACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/world-state",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.2606882",
|
|
4
4
|
"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
|
|
22
|
-
"build:dev": "tsc
|
|
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,24 @@
|
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@aztec/
|
|
68
|
-
"@aztec/
|
|
69
|
-
"@aztec/
|
|
70
|
-
"@aztec/
|
|
71
|
-
"@aztec/native": "0.0.1-commit.
|
|
72
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
73
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
74
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
67
|
+
"@aztec/bb.js": "0.0.1-commit.2606882",
|
|
68
|
+
"@aztec/constants": "0.0.1-commit.2606882",
|
|
69
|
+
"@aztec/foundation": "0.0.1-commit.2606882",
|
|
70
|
+
"@aztec/kv-store": "0.0.1-commit.2606882",
|
|
71
|
+
"@aztec/native": "0.0.1-commit.2606882",
|
|
72
|
+
"@aztec/protocol-contracts": "0.0.1-commit.2606882",
|
|
73
|
+
"@aztec/stdlib": "0.0.1-commit.2606882",
|
|
74
|
+
"@aztec/telemetry-client": "0.0.1-commit.2606882",
|
|
75
|
+
"msgpackr": "^1.11.2",
|
|
75
76
|
"tslib": "^2.4.0",
|
|
76
|
-
"zod": "^
|
|
77
|
+
"zod": "^4"
|
|
77
78
|
},
|
|
78
79
|
"devDependencies": {
|
|
79
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
80
|
+
"@aztec/archiver": "0.0.1-commit.2606882",
|
|
80
81
|
"@jest/globals": "^30.0.0",
|
|
81
82
|
"@types/jest": "^30.0.0",
|
|
82
83
|
"@types/node": "^22.15.17",
|
|
84
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
83
85
|
"jest": "^30.0.0",
|
|
84
86
|
"jest-mock-extended": "^4.0.0",
|
|
85
87
|
"ts-node": "^10.9.1",
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Metrics,
|
|
8
8
|
type TelemetryClient,
|
|
9
9
|
type UpDownCounter,
|
|
10
|
-
|
|
10
|
+
createUpDownCounterWithDefault,
|
|
11
11
|
} from '@aztec/telemetry-client';
|
|
12
12
|
|
|
13
13
|
import {
|
|
@@ -46,55 +46,31 @@ export class WorldStateInstrumentation {
|
|
|
46
46
|
private log: Logger = createLogger('world-state:instrumentation'),
|
|
47
47
|
) {
|
|
48
48
|
const meter = telemetry.getMeter('World State');
|
|
49
|
-
this.dbMapSize = meter.createGauge(Metrics.WORLD_STATE_DB_MAP_SIZE
|
|
50
|
-
description: `The current configured map size for each merkle tree`,
|
|
51
|
-
valueType: ValueType.INT,
|
|
52
|
-
});
|
|
49
|
+
this.dbMapSize = meter.createGauge(Metrics.WORLD_STATE_DB_MAP_SIZE);
|
|
53
50
|
|
|
54
|
-
this.dbPhysicalSize = meter.createGauge(Metrics.WORLD_STATE_DB_PHYSICAL_SIZE
|
|
55
|
-
description: `The current physical disk space used for each database`,
|
|
56
|
-
valueType: ValueType.INT,
|
|
57
|
-
});
|
|
51
|
+
this.dbPhysicalSize = meter.createGauge(Metrics.WORLD_STATE_DB_PHYSICAL_SIZE);
|
|
58
52
|
|
|
59
|
-
this.treeSize = meter.createGauge(Metrics.WORLD_STATE_TREE_SIZE
|
|
60
|
-
description: `The current number of leaves in each merkle tree`,
|
|
61
|
-
valueType: ValueType.INT,
|
|
62
|
-
});
|
|
53
|
+
this.treeSize = meter.createGauge(Metrics.WORLD_STATE_TREE_SIZE);
|
|
63
54
|
|
|
64
|
-
this.unfinalizedHeight = meter.createGauge(Metrics.WORLD_STATE_UNFINALIZED_HEIGHT
|
|
65
|
-
description: `The unfinalized block height of each merkle tree`,
|
|
66
|
-
valueType: ValueType.INT,
|
|
67
|
-
});
|
|
55
|
+
this.unfinalizedHeight = meter.createGauge(Metrics.WORLD_STATE_UNFINALIZED_HEIGHT);
|
|
68
56
|
|
|
69
|
-
this.finalizedHeight = meter.createGauge(Metrics.WORLD_STATE_FINALIZED_HEIGHT
|
|
70
|
-
description: `The finalized block height of each merkle tree`,
|
|
71
|
-
valueType: ValueType.INT,
|
|
72
|
-
});
|
|
57
|
+
this.finalizedHeight = meter.createGauge(Metrics.WORLD_STATE_FINALIZED_HEIGHT);
|
|
73
58
|
|
|
74
|
-
this.oldestBlock = meter.createGauge(Metrics.WORLD_STATE_OLDEST_BLOCK
|
|
75
|
-
description: `The oldest historical block of each merkle tree`,
|
|
76
|
-
valueType: ValueType.INT,
|
|
77
|
-
});
|
|
59
|
+
this.oldestBlock = meter.createGauge(Metrics.WORLD_STATE_OLDEST_BLOCK);
|
|
78
60
|
|
|
79
|
-
this.dbUsedSize = meter.createGauge(Metrics.WORLD_STATE_DB_USED_SIZE
|
|
80
|
-
description: `The current used database size for each db of each merkle tree`,
|
|
81
|
-
valueType: ValueType.INT,
|
|
82
|
-
});
|
|
61
|
+
this.dbUsedSize = meter.createGauge(Metrics.WORLD_STATE_DB_USED_SIZE);
|
|
83
62
|
|
|
84
|
-
this.dbNumItems = meter.createGauge(Metrics.WORLD_STATE_DB_NUM_ITEMS
|
|
85
|
-
description: `The current number of items in each database of each merkle tree`,
|
|
86
|
-
valueType: ValueType.INT,
|
|
87
|
-
});
|
|
63
|
+
this.dbNumItems = meter.createGauge(Metrics.WORLD_STATE_DB_NUM_ITEMS);
|
|
88
64
|
|
|
89
|
-
this.requestHistogram = meter.createHistogram(Metrics.WORLD_STATE_REQUEST_TIME
|
|
90
|
-
description: 'The round trip time of world state requests',
|
|
91
|
-
unit: 'us',
|
|
92
|
-
valueType: ValueType.INT,
|
|
93
|
-
});
|
|
65
|
+
this.requestHistogram = meter.createHistogram(Metrics.WORLD_STATE_REQUEST_TIME);
|
|
94
66
|
|
|
95
|
-
this.criticalErrors = meter
|
|
96
|
-
|
|
97
|
-
|
|
67
|
+
this.criticalErrors = createUpDownCounterWithDefault(meter, Metrics.WORLD_STATE_CRITICAL_ERROR_COUNT, {
|
|
68
|
+
[Attributes.ERROR_TYPE]: [
|
|
69
|
+
'synch_pending_block',
|
|
70
|
+
'finalize_block',
|
|
71
|
+
'prune_pending_block',
|
|
72
|
+
'prune_historical_block',
|
|
73
|
+
],
|
|
98
74
|
});
|
|
99
75
|
}
|
|
100
76
|
|
|
@@ -3,11 +3,14 @@ import type { MerkleTreeCheckpointOperations } from '@aztec/stdlib/interfaces/se
|
|
|
3
3
|
export class ForkCheckpoint {
|
|
4
4
|
private completed = false;
|
|
5
5
|
|
|
6
|
-
private constructor(
|
|
6
|
+
private constructor(
|
|
7
|
+
private readonly fork: MerkleTreeCheckpointOperations,
|
|
8
|
+
public readonly depth: number,
|
|
9
|
+
) {}
|
|
7
10
|
|
|
8
11
|
static async new(fork: MerkleTreeCheckpointOperations): Promise<ForkCheckpoint> {
|
|
9
|
-
await fork.createCheckpoint();
|
|
10
|
-
return new ForkCheckpoint(fork);
|
|
12
|
+
const depth = await fork.createCheckpoint();
|
|
13
|
+
return new ForkCheckpoint(fork, depth);
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
async commit(): Promise<void> {
|
|
@@ -27,4 +30,17 @@ export class ForkCheckpoint {
|
|
|
27
30
|
await this.fork.revertCheckpoint();
|
|
28
31
|
this.completed = true;
|
|
29
32
|
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Reverts this checkpoint and any nested checkpoints created on top of it,
|
|
36
|
+
* leaving the checkpoint depth at the level it was before this checkpoint was created.
|
|
37
|
+
*/
|
|
38
|
+
async revertToCheckpoint(): Promise<void> {
|
|
39
|
+
if (this.completed) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
await this.fork.revertAllCheckpointsTo(this.depth - 1);
|
|
44
|
+
this.completed = true;
|
|
45
|
+
}
|
|
30
46
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
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';
|
|
7
|
+
import { BlockHash } from '@aztec/stdlib/block';
|
|
4
8
|
import type {
|
|
5
9
|
BatchInsertionResult,
|
|
6
10
|
IndexedTreeId,
|
|
@@ -18,7 +22,7 @@ import {
|
|
|
18
22
|
PublicDataTreeLeafPreimage,
|
|
19
23
|
} from '@aztec/stdlib/trees';
|
|
20
24
|
import { type BlockHeader, PartialStateReference, StateReference } from '@aztec/stdlib/tx';
|
|
21
|
-
import type
|
|
25
|
+
import { type WorldStateRevision, WorldStateRevisionWithHandle } from '@aztec/stdlib/world-state';
|
|
22
26
|
|
|
23
27
|
import assert from 'assert';
|
|
24
28
|
|
|
@@ -42,8 +46,8 @@ export class MerkleTreesFacade implements MerkleTreeReadOperations {
|
|
|
42
46
|
return this.initialHeader;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
|
-
getRevision():
|
|
46
|
-
return this.revision;
|
|
49
|
+
getRevision(): WorldStateRevisionWithHandle {
|
|
50
|
+
return WorldStateRevisionWithHandle.fromWorldStateRevision(this.revision, this.instance.getHandle());
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
findLeafIndices(treeId: MerkleTreeId, values: MerkleTreeLeafType<MerkleTreeId>[]): Promise<(bigint | undefined)[]> {
|
|
@@ -115,7 +119,7 @@ export class MerkleTreesFacade implements MerkleTreeReadOperations {
|
|
|
115
119
|
|
|
116
120
|
const leaf = deserializeLeafValue(resp);
|
|
117
121
|
if (leaf instanceof Fr) {
|
|
118
|
-
return leaf as any;
|
|
122
|
+
return treeId === MerkleTreeId.ARCHIVE ? (new BlockHash(leaf) as any) : (leaf as any);
|
|
119
123
|
} else {
|
|
120
124
|
return leaf.toBuffer() as any;
|
|
121
125
|
}
|
|
@@ -191,19 +195,27 @@ export class MerkleTreesFacade implements MerkleTreeReadOperations {
|
|
|
191
195
|
async getBlockNumbersForLeafIndices<ID extends MerkleTreeId>(
|
|
192
196
|
treeId: ID,
|
|
193
197
|
leafIndices: bigint[],
|
|
194
|
-
): Promise<(
|
|
198
|
+
): Promise<(BlockNumber | undefined)[]> {
|
|
195
199
|
const response = await this.instance.call(WorldStateMessageType.GET_BLOCK_NUMBERS_FOR_LEAF_INDICES, {
|
|
196
200
|
treeId,
|
|
197
201
|
revision: this.revision,
|
|
198
202
|
leafIndices,
|
|
199
203
|
});
|
|
200
204
|
|
|
201
|
-
return response.blockNumbers.map(x => (x === undefined || x === null ? undefined :
|
|
205
|
+
return response.blockNumbers.map(x => (x === undefined || x === null ? undefined : BlockNumber(Number(x))));
|
|
202
206
|
}
|
|
203
207
|
}
|
|
204
208
|
|
|
205
209
|
export class MerkleTreesForkFacade extends MerkleTreesFacade implements MerkleTreeWriteOperations {
|
|
206
|
-
|
|
210
|
+
private log = createLogger('world-state:merkle-trees-fork-facade');
|
|
211
|
+
private closePromise: Promise<void> | undefined;
|
|
212
|
+
|
|
213
|
+
constructor(
|
|
214
|
+
instance: NativeWorldStateInstance,
|
|
215
|
+
initialHeader: BlockHeader,
|
|
216
|
+
revision: WorldStateRevision,
|
|
217
|
+
private opts: { closeDelayMs?: number },
|
|
218
|
+
) {
|
|
207
219
|
assert.notEqual(revision.forkId, 0, 'Fork ID must be set');
|
|
208
220
|
assert.equal(revision.includeUncommitted, true, 'Fork must include uncommitted data');
|
|
209
221
|
super(instance, initialHeader, revision);
|
|
@@ -218,7 +230,7 @@ export class MerkleTreesForkFacade extends MerkleTreesFacade implements MerkleTr
|
|
|
218
230
|
|
|
219
231
|
async appendLeaves<ID extends MerkleTreeId>(treeId: ID, leaves: MerkleTreeLeafType<ID>[]): Promise<void> {
|
|
220
232
|
await this.instance.call(WorldStateMessageType.APPEND_LEAVES, {
|
|
221
|
-
leaves: leaves.map(leaf => leaf as any),
|
|
233
|
+
leaves: leaves.map(leaf => serializeLeaf(hydrateLeaf(treeId, leaf as any))),
|
|
222
234
|
forkId: this.revision.forkId,
|
|
223
235
|
treeId,
|
|
224
236
|
});
|
|
@@ -280,14 +292,51 @@ export class MerkleTreesForkFacade extends MerkleTreesFacade implements MerkleTr
|
|
|
280
292
|
};
|
|
281
293
|
}
|
|
282
294
|
|
|
283
|
-
public
|
|
295
|
+
public close(): Promise<void> {
|
|
284
296
|
assert.notEqual(this.revision.forkId, 0, 'Fork ID must be set');
|
|
285
|
-
|
|
297
|
+
// Share the in-flight close promise across duplicate dispose calls so DELETE_FORK is sent at most once.
|
|
298
|
+
if (this.closePromise) {
|
|
299
|
+
return this.closePromise;
|
|
300
|
+
}
|
|
301
|
+
this.closePromise = this.doClose();
|
|
302
|
+
return this.closePromise;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
private async doClose(): Promise<void> {
|
|
306
|
+
try {
|
|
307
|
+
await this.instance.call(WorldStateMessageType.DELETE_FORK, { forkId: this.revision.forkId });
|
|
308
|
+
} catch (err: any) {
|
|
309
|
+
// Ignore errors due to native instance being closed during shutdown.
|
|
310
|
+
// This can happen when validators are still processing block proposals while the node is stopping.
|
|
311
|
+
if (err?.message === 'Native instance is closed') {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
// Ignore "Fork not found": the native fork was already destroyed by a pending-chain unwind or a
|
|
315
|
+
// historical prune (both call C++ remove_forks_for_block). Fork IDs are monotonic and never reused,
|
|
316
|
+
// so swallowing this on close cannot mask a deletion of a different fork.
|
|
317
|
+
if (err?.message === 'Fork not found') {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
throw err;
|
|
321
|
+
}
|
|
286
322
|
}
|
|
287
323
|
|
|
288
|
-
|
|
324
|
+
async [Symbol.asyncDispose](): Promise<void> {
|
|
325
|
+
if (this.opts.closeDelayMs) {
|
|
326
|
+
void sleep(this.opts.closeDelayMs)
|
|
327
|
+
.then(() => this.close())
|
|
328
|
+
.catch(err => {
|
|
329
|
+
this.log.warn('Error closing MerkleTreesForkFacade after delay', { err });
|
|
330
|
+
});
|
|
331
|
+
} else {
|
|
332
|
+
await this.close();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
public async createCheckpoint(): Promise<number> {
|
|
289
337
|
assert.notEqual(this.revision.forkId, 0, 'Fork ID must be set');
|
|
290
|
-
await this.instance.call(WorldStateMessageType.CREATE_CHECKPOINT, { forkId: this.revision.forkId });
|
|
338
|
+
const resp = await this.instance.call(WorldStateMessageType.CREATE_CHECKPOINT, { forkId: this.revision.forkId });
|
|
339
|
+
return resp.depth;
|
|
291
340
|
}
|
|
292
341
|
|
|
293
342
|
public async commitCheckpoint(): Promise<void> {
|
|
@@ -300,20 +349,28 @@ export class MerkleTreesForkFacade extends MerkleTreesFacade implements MerkleTr
|
|
|
300
349
|
await this.instance.call(WorldStateMessageType.REVERT_CHECKPOINT, { forkId: this.revision.forkId });
|
|
301
350
|
}
|
|
302
351
|
|
|
303
|
-
public async
|
|
352
|
+
public async commitAllCheckpointsTo(depth: number): Promise<void> {
|
|
304
353
|
assert.notEqual(this.revision.forkId, 0, 'Fork ID must be set');
|
|
305
|
-
await this.instance.call(WorldStateMessageType.COMMIT_ALL_CHECKPOINTS, {
|
|
354
|
+
await this.instance.call(WorldStateMessageType.COMMIT_ALL_CHECKPOINTS, {
|
|
355
|
+
forkId: this.revision.forkId,
|
|
356
|
+
depth,
|
|
357
|
+
});
|
|
306
358
|
}
|
|
307
359
|
|
|
308
|
-
public async
|
|
360
|
+
public async revertAllCheckpointsTo(depth: number): Promise<void> {
|
|
309
361
|
assert.notEqual(this.revision.forkId, 0, 'Fork ID must be set');
|
|
310
|
-
await this.instance.call(WorldStateMessageType.REVERT_ALL_CHECKPOINTS, {
|
|
362
|
+
await this.instance.call(WorldStateMessageType.REVERT_ALL_CHECKPOINTS, {
|
|
363
|
+
forkId: this.revision.forkId,
|
|
364
|
+
depth,
|
|
365
|
+
});
|
|
311
366
|
}
|
|
312
367
|
}
|
|
313
368
|
|
|
314
|
-
function hydrateLeaf
|
|
369
|
+
function hydrateLeaf(treeId: MerkleTreeId, leaf: Fr | BlockHash | Buffer) {
|
|
315
370
|
if (leaf instanceof Fr) {
|
|
316
371
|
return leaf;
|
|
372
|
+
} else if (leaf instanceof BlockHash) {
|
|
373
|
+
return leaf.toFr();
|
|
317
374
|
} else if (treeId === MerkleTreeId.NULLIFIER_TREE) {
|
|
318
375
|
return NullifierLeaf.fromBuffer(leaf);
|
|
319
376
|
} else if (treeId === MerkleTreeId.PUBLIC_DATA_TREE) {
|
|
@@ -323,8 +380,10 @@ function hydrateLeaf<ID extends MerkleTreeId>(treeId: ID, leaf: Fr | Buffer) {
|
|
|
323
380
|
}
|
|
324
381
|
}
|
|
325
382
|
|
|
326
|
-
export function serializeLeaf(leaf: Fr | NullifierLeaf | PublicDataTreeLeaf): SerializedLeafValue {
|
|
327
|
-
if (leaf instanceof
|
|
383
|
+
export function serializeLeaf(leaf: Fr | BlockHash | NullifierLeaf | PublicDataTreeLeaf): SerializedLeafValue {
|
|
384
|
+
if (leaf instanceof BlockHash) {
|
|
385
|
+
return leaf.toBuffer();
|
|
386
|
+
} else if (leaf instanceof Fr) {
|
|
328
387
|
return leaf.toBuffer();
|
|
329
388
|
} else if (leaf instanceof NullifierLeaf) {
|
|
330
389
|
return { nullifier: leaf.nullifier.toBuffer() };
|
package/src/native/message.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
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';
|
|
@@ -56,11 +57,11 @@ interface WithTreeId {
|
|
|
56
57
|
|
|
57
58
|
export interface WorldStateStatusSummary {
|
|
58
59
|
/** Last block number that can still be unwound. */
|
|
59
|
-
unfinalizedBlockNumber:
|
|
60
|
+
unfinalizedBlockNumber: BlockNumber;
|
|
60
61
|
/** Last block number that is finalized and cannot be unwound. */
|
|
61
|
-
finalizedBlockNumber:
|
|
62
|
+
finalizedBlockNumber: BlockNumber;
|
|
62
63
|
/** Oldest block still available for historical queries and forks. */
|
|
63
|
-
oldestHistoricalBlock:
|
|
64
|
+
oldestHistoricalBlock: BlockNumber;
|
|
64
65
|
/** Whether the trees are in sync with each other */
|
|
65
66
|
treesAreSynched: boolean;
|
|
66
67
|
}
|
|
@@ -81,11 +82,11 @@ export interface TreeMeta {
|
|
|
81
82
|
/** The tree's initial root value */
|
|
82
83
|
initialRoot: Fr;
|
|
83
84
|
/** The current oldest historical block number of the tree */
|
|
84
|
-
oldestHistoricBlock:
|
|
85
|
+
oldestHistoricBlock: BlockNumber;
|
|
85
86
|
/** The current unfinalized block number of the tree */
|
|
86
|
-
unfinalizedBlockHeight:
|
|
87
|
+
unfinalizedBlockHeight: BlockNumber;
|
|
87
88
|
/** The current finalized block number of the tree */
|
|
88
|
-
finalizedBlockHeight:
|
|
89
|
+
finalizedBlockHeight: BlockNumber;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
export interface DBStats {
|
|
@@ -173,9 +174,9 @@ export function buildEmptyTreeMeta() {
|
|
|
173
174
|
depth: 0,
|
|
174
175
|
size: 0n,
|
|
175
176
|
committedSize: 0n,
|
|
176
|
-
unfinalizedBlockHeight:
|
|
177
|
-
finalizedBlockHeight:
|
|
178
|
-
oldestHistoricBlock:
|
|
177
|
+
unfinalizedBlockHeight: BlockNumber.ZERO,
|
|
178
|
+
finalizedBlockHeight: BlockNumber.ZERO,
|
|
179
|
+
oldestHistoricBlock: BlockNumber.ZERO,
|
|
179
180
|
root: Fr.ZERO,
|
|
180
181
|
initialRoot: Fr.ZERO,
|
|
181
182
|
initialSize: 0n,
|
|
@@ -204,9 +205,9 @@ export function buildEmptyWorldStateDBStats() {
|
|
|
204
205
|
|
|
205
206
|
export function buildEmptyWorldStateSummary() {
|
|
206
207
|
return {
|
|
207
|
-
unfinalizedBlockNumber:
|
|
208
|
-
finalizedBlockNumber:
|
|
209
|
-
oldestHistoricalBlock:
|
|
208
|
+
unfinalizedBlockNumber: BlockNumber.ZERO,
|
|
209
|
+
finalizedBlockNumber: BlockNumber.ZERO,
|
|
210
|
+
oldestHistoricalBlock: BlockNumber.ZERO,
|
|
210
211
|
treesAreSynched: true,
|
|
211
212
|
} as WorldStateStatusSummary;
|
|
212
213
|
}
|
|
@@ -220,9 +221,9 @@ export function buildEmptyWorldStateStatusFull() {
|
|
|
220
221
|
}
|
|
221
222
|
|
|
222
223
|
export function sanitizeSummary(summary: WorldStateStatusSummary) {
|
|
223
|
-
summary.finalizedBlockNumber = BigInt(summary.finalizedBlockNumber);
|
|
224
|
-
summary.unfinalizedBlockNumber = BigInt(summary.unfinalizedBlockNumber);
|
|
225
|
-
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));
|
|
226
227
|
return summary;
|
|
227
228
|
}
|
|
228
229
|
|
|
@@ -234,11 +235,11 @@ export function sanitizeDBStats(stats: DBStats) {
|
|
|
234
235
|
|
|
235
236
|
export function sanitizeMeta(meta: TreeMeta) {
|
|
236
237
|
meta.committedSize = BigInt(meta.committedSize);
|
|
237
|
-
meta.finalizedBlockHeight = BigInt(meta.finalizedBlockHeight);
|
|
238
|
+
meta.finalizedBlockHeight = BlockNumber.fromBigInt(BigInt(meta.finalizedBlockHeight));
|
|
238
239
|
meta.initialSize = BigInt(meta.initialSize);
|
|
239
|
-
meta.oldestHistoricBlock = BigInt(meta.oldestHistoricBlock);
|
|
240
|
+
meta.oldestHistoricBlock = BlockNumber.fromBigInt(BigInt(meta.oldestHistoricBlock));
|
|
240
241
|
meta.size = BigInt(meta.size);
|
|
241
|
-
meta.unfinalizedBlockHeight = BigInt(meta.unfinalizedBlockHeight);
|
|
242
|
+
meta.unfinalizedBlockHeight = BlockNumber.fromBigInt(BigInt(meta.unfinalizedBlockHeight));
|
|
242
243
|
return meta;
|
|
243
244
|
}
|
|
244
245
|
|
|
@@ -282,6 +283,16 @@ interface WithForkId {
|
|
|
282
283
|
forkId: number;
|
|
283
284
|
}
|
|
284
285
|
|
|
286
|
+
interface CreateCheckpointResponse {
|
|
287
|
+
depth: number;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** Request to commit/revert all checkpoints down to a target depth. The resulting depth after the operation equals the given depth. */
|
|
291
|
+
interface CheckpointDepthRequest extends WithForkId {
|
|
292
|
+
/** The target depth after the operation. All checkpoints above this depth are committed/reverted. */
|
|
293
|
+
depth: number;
|
|
294
|
+
}
|
|
295
|
+
|
|
285
296
|
interface WithWorldStateRevision {
|
|
286
297
|
revision: WorldStateRevision;
|
|
287
298
|
}
|
|
@@ -310,7 +321,7 @@ interface WithLeafValues {
|
|
|
310
321
|
}
|
|
311
322
|
|
|
312
323
|
interface BlockShiftRequest extends WithCanonicalForkId {
|
|
313
|
-
toBlockNumber:
|
|
324
|
+
toBlockNumber: BlockNumber;
|
|
314
325
|
}
|
|
315
326
|
|
|
316
327
|
interface WithLeaves {
|
|
@@ -409,9 +420,9 @@ interface UpdateArchiveRequest extends WithForkId {
|
|
|
409
420
|
}
|
|
410
421
|
|
|
411
422
|
interface SyncBlockRequest extends WithCanonicalForkId {
|
|
412
|
-
blockNumber:
|
|
423
|
+
blockNumber: BlockNumber;
|
|
413
424
|
blockStateRef: BlockStateReference;
|
|
414
|
-
blockHeaderHash:
|
|
425
|
+
blockHeaderHash: Buffer;
|
|
415
426
|
paddedNoteHashes: readonly SerializedLeafValue[];
|
|
416
427
|
paddedL1ToL2Messages: readonly SerializedLeafValue[];
|
|
417
428
|
paddedNullifiers: readonly SerializedLeafValue[];
|
|
@@ -420,7 +431,7 @@ interface SyncBlockRequest extends WithCanonicalForkId {
|
|
|
420
431
|
|
|
421
432
|
interface CreateForkRequest extends WithCanonicalForkId {
|
|
422
433
|
latest: boolean;
|
|
423
|
-
blockNumber:
|
|
434
|
+
blockNumber: BlockNumber;
|
|
424
435
|
}
|
|
425
436
|
|
|
426
437
|
interface CreateForkResponse {
|
|
@@ -485,8 +496,8 @@ export type WorldStateRequest = {
|
|
|
485
496
|
[WorldStateMessageType.CREATE_CHECKPOINT]: WithForkId;
|
|
486
497
|
[WorldStateMessageType.COMMIT_CHECKPOINT]: WithForkId;
|
|
487
498
|
[WorldStateMessageType.REVERT_CHECKPOINT]: WithForkId;
|
|
488
|
-
[WorldStateMessageType.COMMIT_ALL_CHECKPOINTS]:
|
|
489
|
-
[WorldStateMessageType.REVERT_ALL_CHECKPOINTS]:
|
|
499
|
+
[WorldStateMessageType.COMMIT_ALL_CHECKPOINTS]: CheckpointDepthRequest;
|
|
500
|
+
[WorldStateMessageType.REVERT_ALL_CHECKPOINTS]: CheckpointDepthRequest;
|
|
490
501
|
|
|
491
502
|
[WorldStateMessageType.COPY_STORES]: CopyStoresRequest;
|
|
492
503
|
|
|
@@ -527,7 +538,7 @@ export type WorldStateResponse = {
|
|
|
527
538
|
|
|
528
539
|
[WorldStateMessageType.GET_STATUS]: WorldStateStatusSummary;
|
|
529
540
|
|
|
530
|
-
[WorldStateMessageType.CREATE_CHECKPOINT]:
|
|
541
|
+
[WorldStateMessageType.CREATE_CHECKPOINT]: CreateCheckpointResponse;
|
|
531
542
|
[WorldStateMessageType.COMMIT_CHECKPOINT]: void;
|
|
532
543
|
[WorldStateMessageType.REVERT_CHECKPOINT]: void;
|
|
533
544
|
[WorldStateMessageType.COMMIT_ALL_CHECKPOINTS]: void;
|