@aztec/world-state 0.0.1-commit.b655e406 → 0.0.1-commit.b9865e97
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 +4 -3
- package/dest/instrumentation/instrumentation.d.ts.map +1 -1
- package/dest/instrumentation/instrumentation.js +21 -50
- 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/ipc_world_state_instance.d.ts +87 -0
- package/dest/native/ipc_world_state_instance.d.ts.map +1 -0
- package/dest/native/ipc_world_state_instance.js +660 -0
- package/dest/native/merkle_trees_facade.d.ts +18 -8
- package/dest/native/merkle_trees_facade.d.ts.map +1 -1
- package/dest/native/merkle_trees_facade.js +90 -111
- package/dest/native/message.d.ts +22 -228
- package/dest/native/message.d.ts.map +1 -1
- package/dest/native/message.js +14 -55
- package/dest/native/native_world_state.d.ts +30 -15
- package/dest/native/native_world_state.d.ts.map +1 -1
- package/dest/native/native_world_state.js +126 -66
- package/dest/native/native_world_state_instance.d.ts +58 -32
- package/dest/native/native_world_state_instance.d.ts.map +1 -1
- package/dest/native/native_world_state_instance.js +5 -181
- package/dest/native/world_state_operation.d.ts +7 -0
- package/dest/native/world_state_operation.d.ts.map +1 -0
- package/dest/native/world_state_operation.js +5 -0
- 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 +17 -13
- package/src/instrumentation/instrumentation.ts +23 -59
- package/src/native/fork_checkpoint.ts +19 -3
- package/src/native/ipc_world_state_instance.ts +830 -0
- package/src/native/merkle_trees_facade.ts +118 -104
- package/src/native/message.ts +33 -305
- package/src/native/native_world_state.ts +164 -108
- package/src/native/native_world_state_instance.ts +96 -250
- package/src/native/world_state_operation.ts +33 -0
- package/src/synchronizer/config.ts +16 -23
- package/src/synchronizer/factory.ts +18 -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/native/world_state_ops_queue.d.ts +0 -19
- package/dest/native/world_state_ops_queue.d.ts.map +0 -1
- package/dest/native/world_state_ops_queue.js +0 -146
- package/src/native/world_state_ops_queue.ts +0 -190
package/src/native/message.ts
CHANGED
|
@@ -1,66 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
|
|
4
4
|
import type { StateReference } from '@aztec/stdlib/tx';
|
|
5
|
-
import type { UInt32 } from '@aztec/stdlib/types';
|
|
6
|
-
import type { WorldStateRevision } from '@aztec/stdlib/world-state';
|
|
7
|
-
|
|
8
|
-
export enum WorldStateMessageType {
|
|
9
|
-
GET_TREE_INFO = 100,
|
|
10
|
-
GET_STATE_REFERENCE,
|
|
11
|
-
GET_INITIAL_STATE_REFERENCE,
|
|
12
|
-
|
|
13
|
-
GET_LEAF_VALUE,
|
|
14
|
-
GET_LEAF_PREIMAGE,
|
|
15
|
-
GET_SIBLING_PATH,
|
|
16
|
-
GET_BLOCK_NUMBERS_FOR_LEAF_INDICES,
|
|
17
|
-
|
|
18
|
-
FIND_LEAF_INDICES,
|
|
19
|
-
FIND_LOW_LEAF,
|
|
20
|
-
FIND_SIBLING_PATHS,
|
|
21
|
-
|
|
22
|
-
APPEND_LEAVES,
|
|
23
|
-
BATCH_INSERT,
|
|
24
|
-
SEQUENTIAL_INSERT,
|
|
25
|
-
|
|
26
|
-
UPDATE_ARCHIVE,
|
|
27
|
-
|
|
28
|
-
COMMIT,
|
|
29
|
-
ROLLBACK,
|
|
30
|
-
|
|
31
|
-
SYNC_BLOCK,
|
|
32
|
-
|
|
33
|
-
CREATE_FORK,
|
|
34
|
-
DELETE_FORK,
|
|
35
|
-
|
|
36
|
-
FINALIZE_BLOCKS,
|
|
37
|
-
UNWIND_BLOCKS,
|
|
38
|
-
REMOVE_HISTORICAL_BLOCKS,
|
|
39
|
-
|
|
40
|
-
GET_STATUS,
|
|
41
|
-
|
|
42
|
-
CREATE_CHECKPOINT,
|
|
43
|
-
COMMIT_CHECKPOINT,
|
|
44
|
-
REVERT_CHECKPOINT,
|
|
45
|
-
COMMIT_ALL_CHECKPOINTS,
|
|
46
|
-
REVERT_ALL_CHECKPOINTS,
|
|
47
|
-
|
|
48
|
-
COPY_STORES,
|
|
49
|
-
|
|
50
|
-
CLOSE = 999,
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
interface WithTreeId {
|
|
54
|
-
treeId: MerkleTreeId;
|
|
55
|
-
}
|
|
56
5
|
|
|
57
6
|
export interface WorldStateStatusSummary {
|
|
58
7
|
/** Last block number that can still be unwound. */
|
|
59
|
-
unfinalizedBlockNumber:
|
|
8
|
+
unfinalizedBlockNumber: BlockNumber;
|
|
60
9
|
/** Last block number that is finalized and cannot be unwound. */
|
|
61
|
-
finalizedBlockNumber:
|
|
10
|
+
finalizedBlockNumber: BlockNumber;
|
|
62
11
|
/** Oldest block still available for historical queries and forks. */
|
|
63
|
-
oldestHistoricalBlock:
|
|
12
|
+
oldestHistoricalBlock: BlockNumber;
|
|
64
13
|
/** Whether the trees are in sync with each other */
|
|
65
14
|
treesAreSynched: boolean;
|
|
66
15
|
}
|
|
@@ -81,11 +30,11 @@ export interface TreeMeta {
|
|
|
81
30
|
/** The tree's initial root value */
|
|
82
31
|
initialRoot: Fr;
|
|
83
32
|
/** The current oldest historical block number of the tree */
|
|
84
|
-
oldestHistoricBlock:
|
|
33
|
+
oldestHistoricBlock: BlockNumber;
|
|
85
34
|
/** The current unfinalized block number of the tree */
|
|
86
|
-
unfinalizedBlockHeight:
|
|
35
|
+
unfinalizedBlockHeight: BlockNumber;
|
|
87
36
|
/** The current finalized block number of the tree */
|
|
88
|
-
finalizedBlockHeight:
|
|
37
|
+
finalizedBlockHeight: BlockNumber;
|
|
89
38
|
}
|
|
90
39
|
|
|
91
40
|
export interface DBStats {
|
|
@@ -173,9 +122,9 @@ export function buildEmptyTreeMeta() {
|
|
|
173
122
|
depth: 0,
|
|
174
123
|
size: 0n,
|
|
175
124
|
committedSize: 0n,
|
|
176
|
-
unfinalizedBlockHeight:
|
|
177
|
-
finalizedBlockHeight:
|
|
178
|
-
oldestHistoricBlock:
|
|
125
|
+
unfinalizedBlockHeight: BlockNumber.ZERO,
|
|
126
|
+
finalizedBlockHeight: BlockNumber.ZERO,
|
|
127
|
+
oldestHistoricBlock: BlockNumber.ZERO,
|
|
179
128
|
root: Fr.ZERO,
|
|
180
129
|
initialRoot: Fr.ZERO,
|
|
181
130
|
initialSize: 0n,
|
|
@@ -204,9 +153,9 @@ export function buildEmptyWorldStateDBStats() {
|
|
|
204
153
|
|
|
205
154
|
export function buildEmptyWorldStateSummary() {
|
|
206
155
|
return {
|
|
207
|
-
unfinalizedBlockNumber:
|
|
208
|
-
finalizedBlockNumber:
|
|
209
|
-
oldestHistoricalBlock:
|
|
156
|
+
unfinalizedBlockNumber: BlockNumber.ZERO,
|
|
157
|
+
finalizedBlockNumber: BlockNumber.ZERO,
|
|
158
|
+
oldestHistoricalBlock: BlockNumber.ZERO,
|
|
210
159
|
treesAreSynched: true,
|
|
211
160
|
} as WorldStateStatusSummary;
|
|
212
161
|
}
|
|
@@ -220,9 +169,9 @@ export function buildEmptyWorldStateStatusFull() {
|
|
|
220
169
|
}
|
|
221
170
|
|
|
222
171
|
export function sanitizeSummary(summary: WorldStateStatusSummary) {
|
|
223
|
-
summary.finalizedBlockNumber = BigInt(summary.finalizedBlockNumber);
|
|
224
|
-
summary.unfinalizedBlockNumber = BigInt(summary.unfinalizedBlockNumber);
|
|
225
|
-
summary.oldestHistoricalBlock = BigInt(summary.oldestHistoricalBlock);
|
|
172
|
+
summary.finalizedBlockNumber = BlockNumber.fromBigInt(BigInt(summary.finalizedBlockNumber));
|
|
173
|
+
summary.unfinalizedBlockNumber = BlockNumber.fromBigInt(BigInt(summary.unfinalizedBlockNumber));
|
|
174
|
+
summary.oldestHistoricalBlock = BlockNumber.fromBigInt(BigInt(summary.oldestHistoricalBlock));
|
|
226
175
|
return summary;
|
|
227
176
|
}
|
|
228
177
|
|
|
@@ -234,11 +183,11 @@ export function sanitizeDBStats(stats: DBStats) {
|
|
|
234
183
|
|
|
235
184
|
export function sanitizeMeta(meta: TreeMeta) {
|
|
236
185
|
meta.committedSize = BigInt(meta.committedSize);
|
|
237
|
-
meta.finalizedBlockHeight = BigInt(meta.finalizedBlockHeight);
|
|
186
|
+
meta.finalizedBlockHeight = BlockNumber.fromBigInt(BigInt(meta.finalizedBlockHeight));
|
|
238
187
|
meta.initialSize = BigInt(meta.initialSize);
|
|
239
|
-
meta.oldestHistoricBlock = BigInt(meta.oldestHistoricBlock);
|
|
188
|
+
meta.oldestHistoricBlock = BlockNumber.fromBigInt(BigInt(meta.oldestHistoricBlock));
|
|
240
189
|
meta.size = BigInt(meta.size);
|
|
241
|
-
meta.unfinalizedBlockHeight = BigInt(meta.unfinalizedBlockHeight);
|
|
190
|
+
meta.unfinalizedBlockHeight = BlockNumber.fromBigInt(BigInt(meta.unfinalizedBlockHeight));
|
|
242
191
|
return meta;
|
|
243
192
|
}
|
|
244
193
|
|
|
@@ -278,22 +227,6 @@ export function sanitizeFullStatus(status: WorldStateStatusFull) {
|
|
|
278
227
|
return status;
|
|
279
228
|
}
|
|
280
229
|
|
|
281
|
-
interface WithForkId {
|
|
282
|
-
forkId: number;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
interface WithWorldStateRevision {
|
|
286
|
-
revision: WorldStateRevision;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
interface WithCanonicalForkId {
|
|
290
|
-
canonical: true;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
interface WithLeafIndex {
|
|
294
|
-
leafIndex: bigint;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
230
|
export type SerializedLeafValue =
|
|
298
231
|
| Buffer // Fr
|
|
299
232
|
| { nullifier: Buffer } // NullifierLeaf
|
|
@@ -305,241 +238,36 @@ export type SerializedIndexedLeaf = {
|
|
|
305
238
|
nextKey: Buffer; // Fr
|
|
306
239
|
};
|
|
307
240
|
|
|
308
|
-
interface
|
|
309
|
-
leaves: SerializedLeafValue[];
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
interface BlockShiftRequest extends WithCanonicalForkId {
|
|
313
|
-
toBlockNumber: bigint;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
interface WithLeaves {
|
|
317
|
-
leaves: SerializedLeafValue[];
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
interface GetTreeInfoRequest extends WithTreeId, WithWorldStateRevision {}
|
|
321
|
-
interface GetTreeInfoResponse {
|
|
322
|
-
treeId: MerkleTreeId;
|
|
323
|
-
depth: UInt32;
|
|
324
|
-
size: bigint | number;
|
|
325
|
-
root: Buffer;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
interface GetBlockNumbersForLeafIndicesRequest extends WithTreeId, WithWorldStateRevision {
|
|
329
|
-
leafIndices: bigint[];
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
interface GetBlockNumbersForLeafIndicesResponse {
|
|
333
|
-
blockNumbers: bigint[];
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
interface GetSiblingPathRequest extends WithTreeId, WithLeafIndex, WithWorldStateRevision {}
|
|
337
|
-
type GetSiblingPathResponse = Buffer[];
|
|
338
|
-
|
|
339
|
-
interface GetStateReferenceRequest extends WithWorldStateRevision {}
|
|
340
|
-
interface GetStateReferenceResponse {
|
|
341
|
-
state: Record<MerkleTreeId, TreeStateReference>;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
interface GetLeafRequest extends WithTreeId, WithWorldStateRevision, WithLeafIndex {}
|
|
345
|
-
type GetLeafResponse = SerializedLeafValue | undefined;
|
|
346
|
-
|
|
347
|
-
interface GetLeafPreImageRequest extends WithTreeId, WithLeafIndex, WithWorldStateRevision {}
|
|
348
|
-
type GetLeafPreImageResponse = SerializedIndexedLeaf | undefined;
|
|
349
|
-
|
|
350
|
-
interface FindLeafIndicesRequest extends WithTreeId, WithLeafValues, WithWorldStateRevision {
|
|
351
|
-
startIndex: bigint;
|
|
352
|
-
}
|
|
353
|
-
interface FindLeafIndicesResponse {
|
|
354
|
-
indices: bigint[];
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
interface FindSiblingPathsRequest extends WithTreeId, WithLeafValues, WithWorldStateRevision {}
|
|
358
|
-
|
|
359
|
-
interface SiblingPathAndIndex {
|
|
241
|
+
export interface SerializedSiblingPathAndIndex {
|
|
360
242
|
index: bigint;
|
|
361
243
|
path: Buffer[];
|
|
362
244
|
}
|
|
363
|
-
interface FindSiblingPathsResponse {
|
|
364
|
-
paths: (SiblingPathAndIndex | undefined)[];
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
interface FindLowLeafRequest extends WithTreeId, WithWorldStateRevision {
|
|
368
|
-
key: Fr;
|
|
369
|
-
}
|
|
370
|
-
interface FindLowLeafResponse {
|
|
371
|
-
index: bigint | number;
|
|
372
|
-
alreadyPresent: boolean;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
interface AppendLeavesRequest extends WithTreeId, WithForkId, WithLeaves {}
|
|
376
245
|
|
|
377
|
-
interface
|
|
378
|
-
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
interface BatchInsertResponse {
|
|
382
|
-
low_leaf_witness_data: ReadonlyArray<{
|
|
246
|
+
export interface SerializedBatchInsertionResult {
|
|
247
|
+
lowLeafWitnessData: ReadonlyArray<{
|
|
383
248
|
leaf: SerializedIndexedLeaf;
|
|
384
249
|
index: bigint | number;
|
|
385
|
-
path:
|
|
250
|
+
path: Buffer[];
|
|
386
251
|
}>;
|
|
387
|
-
|
|
388
|
-
|
|
252
|
+
sortedLeaves: ReadonlyArray<readonly [SerializedLeafValue, number]>;
|
|
253
|
+
subtreePath: Buffer[];
|
|
389
254
|
}
|
|
390
255
|
|
|
391
|
-
interface
|
|
392
|
-
|
|
393
|
-
interface SequentialInsertResponse {
|
|
394
|
-
low_leaf_witness_data: ReadonlyArray<{
|
|
256
|
+
export interface SerializedSequentialInsertionResult {
|
|
257
|
+
lowLeafWitnessData: ReadonlyArray<{
|
|
395
258
|
leaf: SerializedIndexedLeaf;
|
|
396
259
|
index: bigint | number;
|
|
397
|
-
path:
|
|
260
|
+
path: Buffer[];
|
|
398
261
|
}>;
|
|
399
|
-
|
|
262
|
+
insertionWitnessData: ReadonlyArray<{
|
|
400
263
|
leaf: SerializedIndexedLeaf;
|
|
401
264
|
index: bigint | number;
|
|
402
|
-
path:
|
|
265
|
+
path: Buffer[];
|
|
403
266
|
}>;
|
|
404
267
|
}
|
|
405
268
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
blockHeaderHash: Buffer;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
interface SyncBlockRequest extends WithCanonicalForkId {
|
|
412
|
-
blockNumber: number;
|
|
413
|
-
blockStateRef: BlockStateReference;
|
|
414
|
-
blockHeaderHash: Fr;
|
|
415
|
-
paddedNoteHashes: readonly SerializedLeafValue[];
|
|
416
|
-
paddedL1ToL2Messages: readonly SerializedLeafValue[];
|
|
417
|
-
paddedNullifiers: readonly SerializedLeafValue[];
|
|
418
|
-
publicDataWrites: readonly SerializedLeafValue[];
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
interface CreateForkRequest extends WithCanonicalForkId {
|
|
422
|
-
latest: boolean;
|
|
423
|
-
blockNumber: number;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
interface CreateForkResponse {
|
|
427
|
-
forkId: number;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
interface DeleteForkRequest extends WithForkId {}
|
|
431
|
-
|
|
432
|
-
interface CopyStoresRequest extends WithCanonicalForkId {
|
|
433
|
-
dstPath: string;
|
|
434
|
-
compact: boolean;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
export type WorldStateRequestCategories = WithForkId | WithWorldStateRevision | WithCanonicalForkId;
|
|
438
|
-
|
|
439
|
-
export function isWithForkId(body: WorldStateRequestCategories): body is WithForkId {
|
|
440
|
-
return body && 'forkId' in body;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
export function isWithRevision(body: WorldStateRequestCategories): body is WithWorldStateRevision {
|
|
444
|
-
return body && 'revision' in body;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
export function isWithCanonical(body: WorldStateRequestCategories): body is WithCanonicalForkId {
|
|
448
|
-
return body && 'canonical' in body;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
export type WorldStateRequest = {
|
|
452
|
-
[WorldStateMessageType.GET_TREE_INFO]: GetTreeInfoRequest;
|
|
453
|
-
[WorldStateMessageType.GET_STATE_REFERENCE]: GetStateReferenceRequest;
|
|
454
|
-
[WorldStateMessageType.GET_INITIAL_STATE_REFERENCE]: WithCanonicalForkId;
|
|
455
|
-
|
|
456
|
-
[WorldStateMessageType.GET_LEAF_VALUE]: GetLeafRequest;
|
|
457
|
-
[WorldStateMessageType.GET_LEAF_PREIMAGE]: GetLeafPreImageRequest;
|
|
458
|
-
[WorldStateMessageType.GET_SIBLING_PATH]: GetSiblingPathRequest;
|
|
459
|
-
[WorldStateMessageType.GET_BLOCK_NUMBERS_FOR_LEAF_INDICES]: GetBlockNumbersForLeafIndicesRequest;
|
|
460
|
-
|
|
461
|
-
[WorldStateMessageType.FIND_LEAF_INDICES]: FindLeafIndicesRequest;
|
|
462
|
-
[WorldStateMessageType.FIND_LOW_LEAF]: FindLowLeafRequest;
|
|
463
|
-
[WorldStateMessageType.FIND_SIBLING_PATHS]: FindSiblingPathsRequest;
|
|
464
|
-
|
|
465
|
-
[WorldStateMessageType.APPEND_LEAVES]: AppendLeavesRequest;
|
|
466
|
-
[WorldStateMessageType.BATCH_INSERT]: BatchInsertRequest;
|
|
467
|
-
[WorldStateMessageType.SEQUENTIAL_INSERT]: SequentialInsertRequest;
|
|
468
|
-
|
|
469
|
-
[WorldStateMessageType.UPDATE_ARCHIVE]: UpdateArchiveRequest;
|
|
470
|
-
|
|
471
|
-
[WorldStateMessageType.COMMIT]: WithCanonicalForkId;
|
|
472
|
-
[WorldStateMessageType.ROLLBACK]: WithCanonicalForkId;
|
|
473
|
-
|
|
474
|
-
[WorldStateMessageType.SYNC_BLOCK]: SyncBlockRequest;
|
|
475
|
-
|
|
476
|
-
[WorldStateMessageType.CREATE_FORK]: CreateForkRequest;
|
|
477
|
-
[WorldStateMessageType.DELETE_FORK]: DeleteForkRequest;
|
|
478
|
-
|
|
479
|
-
[WorldStateMessageType.REMOVE_HISTORICAL_BLOCKS]: BlockShiftRequest;
|
|
480
|
-
[WorldStateMessageType.UNWIND_BLOCKS]: BlockShiftRequest;
|
|
481
|
-
[WorldStateMessageType.FINALIZE_BLOCKS]: BlockShiftRequest;
|
|
482
|
-
|
|
483
|
-
[WorldStateMessageType.GET_STATUS]: WithCanonicalForkId;
|
|
484
|
-
|
|
485
|
-
[WorldStateMessageType.CREATE_CHECKPOINT]: WithForkId;
|
|
486
|
-
[WorldStateMessageType.COMMIT_CHECKPOINT]: WithForkId;
|
|
487
|
-
[WorldStateMessageType.REVERT_CHECKPOINT]: WithForkId;
|
|
488
|
-
[WorldStateMessageType.COMMIT_ALL_CHECKPOINTS]: WithForkId;
|
|
489
|
-
[WorldStateMessageType.REVERT_ALL_CHECKPOINTS]: WithForkId;
|
|
490
|
-
|
|
491
|
-
[WorldStateMessageType.COPY_STORES]: CopyStoresRequest;
|
|
492
|
-
|
|
493
|
-
[WorldStateMessageType.CLOSE]: WithCanonicalForkId;
|
|
494
|
-
};
|
|
495
|
-
|
|
496
|
-
export type WorldStateResponse = {
|
|
497
|
-
[WorldStateMessageType.GET_TREE_INFO]: GetTreeInfoResponse;
|
|
498
|
-
[WorldStateMessageType.GET_STATE_REFERENCE]: GetStateReferenceResponse;
|
|
499
|
-
[WorldStateMessageType.GET_INITIAL_STATE_REFERENCE]: GetStateReferenceResponse;
|
|
500
|
-
|
|
501
|
-
[WorldStateMessageType.GET_LEAF_VALUE]: GetLeafResponse;
|
|
502
|
-
[WorldStateMessageType.GET_LEAF_PREIMAGE]: GetLeafPreImageResponse;
|
|
503
|
-
[WorldStateMessageType.GET_SIBLING_PATH]: GetSiblingPathResponse;
|
|
504
|
-
[WorldStateMessageType.GET_BLOCK_NUMBERS_FOR_LEAF_INDICES]: GetBlockNumbersForLeafIndicesResponse;
|
|
505
|
-
|
|
506
|
-
[WorldStateMessageType.FIND_LEAF_INDICES]: FindLeafIndicesResponse;
|
|
507
|
-
[WorldStateMessageType.FIND_LOW_LEAF]: FindLowLeafResponse;
|
|
508
|
-
[WorldStateMessageType.FIND_SIBLING_PATHS]: FindSiblingPathsResponse;
|
|
509
|
-
|
|
510
|
-
[WorldStateMessageType.APPEND_LEAVES]: void;
|
|
511
|
-
[WorldStateMessageType.BATCH_INSERT]: BatchInsertResponse;
|
|
512
|
-
[WorldStateMessageType.SEQUENTIAL_INSERT]: SequentialInsertResponse;
|
|
513
|
-
|
|
514
|
-
[WorldStateMessageType.UPDATE_ARCHIVE]: void;
|
|
515
|
-
|
|
516
|
-
[WorldStateMessageType.COMMIT]: void;
|
|
517
|
-
[WorldStateMessageType.ROLLBACK]: void;
|
|
518
|
-
|
|
519
|
-
[WorldStateMessageType.SYNC_BLOCK]: WorldStateStatusFull;
|
|
520
|
-
|
|
521
|
-
[WorldStateMessageType.CREATE_FORK]: CreateForkResponse;
|
|
522
|
-
[WorldStateMessageType.DELETE_FORK]: void;
|
|
523
|
-
|
|
524
|
-
[WorldStateMessageType.REMOVE_HISTORICAL_BLOCKS]: WorldStateStatusFull;
|
|
525
|
-
[WorldStateMessageType.UNWIND_BLOCKS]: WorldStateStatusFull;
|
|
526
|
-
[WorldStateMessageType.FINALIZE_BLOCKS]: WorldStateStatusSummary;
|
|
527
|
-
|
|
528
|
-
[WorldStateMessageType.GET_STATUS]: WorldStateStatusSummary;
|
|
529
|
-
|
|
530
|
-
[WorldStateMessageType.CREATE_CHECKPOINT]: void;
|
|
531
|
-
[WorldStateMessageType.COMMIT_CHECKPOINT]: void;
|
|
532
|
-
[WorldStateMessageType.REVERT_CHECKPOINT]: void;
|
|
533
|
-
[WorldStateMessageType.COMMIT_ALL_CHECKPOINTS]: void;
|
|
534
|
-
[WorldStateMessageType.REVERT_ALL_CHECKPOINTS]: void;
|
|
535
|
-
|
|
536
|
-
[WorldStateMessageType.COPY_STORES]: void;
|
|
537
|
-
|
|
538
|
-
[WorldStateMessageType.CLOSE]: void;
|
|
539
|
-
};
|
|
540
|
-
|
|
541
|
-
type TreeStateReference = readonly [Buffer, number | bigint];
|
|
542
|
-
type BlockStateReference = Map<Exclude<MerkleTreeId, MerkleTreeId.ARCHIVE>, TreeStateReference>;
|
|
269
|
+
export type TreeStateReference = readonly [Buffer, number | bigint];
|
|
270
|
+
export type BlockStateReference = Map<Exclude<MerkleTreeId, MerkleTreeId.ARCHIVE>, TreeStateReference>;
|
|
543
271
|
|
|
544
272
|
export function treeStateReferenceToSnapshot([root, size]: TreeStateReference): AppendOnlyTreeSnapshot {
|
|
545
273
|
return new AppendOnlyTreeSnapshot(Fr.fromBuffer(root), Number(size));
|