@aztec/world-state 0.0.1-commit.001888fc → 0.0.1-commit.017a351
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/native/ipc_world_state_instance.d.ts +45 -0
- package/dest/native/ipc_world_state_instance.d.ts.map +1 -0
- package/dest/native/ipc_world_state_instance.js +750 -0
- package/dest/native/merkle_trees_facade.d.ts +8 -4
- package/dest/native/merkle_trees_facade.d.ts.map +1 -1
- package/dest/native/merkle_trees_facade.js +34 -15
- package/dest/native/message.d.ts +7 -8
- package/dest/native/message.d.ts.map +1 -1
- package/dest/native/native_world_state.d.ts +19 -7
- package/dest/native/native_world_state.d.ts.map +1 -1
- package/dest/native/native_world_state.js +89 -24
- package/dest/native/native_world_state_instance.d.ts +21 -39
- package/dest/native/native_world_state_instance.d.ts.map +1 -1
- package/dest/native/native_world_state_instance.js +8 -202
- package/dest/native/world_state_ops_queue.js +5 -5
- package/dest/synchronizer/config.d.ts +1 -1
- package/dest/synchronizer/config.d.ts.map +1 -1
- package/dest/synchronizer/config.js +9 -10
- package/dest/synchronizer/factory.d.ts +4 -4
- package/dest/synchronizer/factory.d.ts.map +1 -1
- package/dest/synchronizer/factory.js +7 -6
- package/dest/synchronizer/server_world_state_synchronizer.d.ts +1 -1
- package/dest/synchronizer/server_world_state_synchronizer.d.ts.map +1 -1
- package/dest/synchronizer/server_world_state_synchronizer.js +40 -11
- package/dest/testing.d.ts +4 -3
- package/dest/testing.d.ts.map +1 -1
- package/dest/testing.js +10 -6
- package/package.json +13 -10
- package/src/native/ipc_world_state_instance.ts +863 -0
- package/src/native/merkle_trees_facade.ts +41 -19
- package/src/native/message.ts +6 -7
- package/src/native/native_world_state.ts +98 -35
- package/src/native/native_world_state_instance.ts +28 -276
- package/src/native/world_state_ops_queue.ts +5 -5
- package/src/synchronizer/config.ts +14 -10
- package/src/synchronizer/factory.ts +11 -10
- package/src/synchronizer/server_world_state_synchronizer.ts +35 -13
- package/src/testing.ts +8 -9
|
@@ -1,55 +1,72 @@
|
|
|
1
|
+
var _computedKey;
|
|
1
2
|
import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
2
3
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
4
|
import { fromEntries, padArrayEnd } from '@aztec/foundation/collection';
|
|
4
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
|
-
import { tryRmDir } from '@aztec/foundation/fs';
|
|
7
6
|
import { createLogger } from '@aztec/foundation/log';
|
|
8
7
|
import { DatabaseVersionManager } from '@aztec/stdlib/database-version/manager';
|
|
9
8
|
import { MerkleTreeId, NullifierLeaf, PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
10
|
-
import { BlockHeader, PartialStateReference, StateReference } from '@aztec/stdlib/tx';
|
|
11
|
-
import { WorldStateRevision } from '@aztec/stdlib/world-state';
|
|
9
|
+
import { BlockHeader, GlobalVariables, PartialStateReference, StateReference } from '@aztec/stdlib/tx';
|
|
10
|
+
import { EMPTY_GENESIS_DATA, WorldStateRevision } from '@aztec/stdlib/world-state';
|
|
12
11
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
13
12
|
import assert from 'assert/strict';
|
|
14
|
-
import { mkdtemp, rm } from 'fs/promises';
|
|
13
|
+
import { mkdir, mkdtemp, rm } from 'fs/promises';
|
|
15
14
|
import { tmpdir } from 'os';
|
|
16
15
|
import { join } from 'path';
|
|
17
16
|
import { WorldStateInstrumentation } from '../instrumentation/instrumentation.js';
|
|
17
|
+
import { IpcWorldState } from './ipc_world_state_instance.js';
|
|
18
18
|
import { MerkleTreesFacade, MerkleTreesForkFacade, serializeLeaf } from './merkle_trees_facade.js';
|
|
19
19
|
import { WorldStateMessageType, blockStateReference, sanitizeFullStatus, sanitizeSummary, treeStateReferenceToSnapshot } from './message.js';
|
|
20
|
-
import { NativeWorldState } from './native_world_state_instance.js';
|
|
21
20
|
// The current version of the world state database schema
|
|
22
21
|
// Increment this when making incompatible changes to the database schema
|
|
23
22
|
export const WORLD_STATE_DB_VERSION = 2; // The initial version
|
|
24
23
|
export const WORLD_STATE_DIR = 'world_state';
|
|
24
|
+
_computedKey = Symbol.asyncDispose;
|
|
25
25
|
export class NativeWorldStateService {
|
|
26
26
|
instance;
|
|
27
27
|
worldStateInstrumentation;
|
|
28
28
|
log;
|
|
29
|
+
genesis;
|
|
29
30
|
cleanup;
|
|
31
|
+
recreateInstance;
|
|
30
32
|
initialHeader;
|
|
31
33
|
// This is read heavily and only changes when data is persisted, so we cache it
|
|
32
34
|
cachedStatusSummary;
|
|
33
|
-
constructor(instance, worldStateInstrumentation, log, cleanup = ()=>Promise.resolve()){
|
|
35
|
+
constructor(instance, worldStateInstrumentation, log, genesis = EMPTY_GENESIS_DATA, cleanup = ()=>Promise.resolve(), /** Factory to recreate a fresh IpcWorldState after clear(). */ recreateInstance){
|
|
34
36
|
this.instance = instance;
|
|
35
37
|
this.worldStateInstrumentation = worldStateInstrumentation;
|
|
36
38
|
this.log = log;
|
|
39
|
+
this.genesis = genesis;
|
|
37
40
|
this.cleanup = cleanup;
|
|
41
|
+
this.recreateInstance = recreateInstance;
|
|
38
42
|
}
|
|
39
|
-
static async new(rollupAddress, dataDir, wsTreeMapSizes,
|
|
43
|
+
static async new(rollupAddress, dataDir, wsTreeMapSizes, genesis = EMPTY_GENESIS_DATA, instrumentation = new WorldStateInstrumentation(getTelemetryClient()), bindings, cleanup = ()=>Promise.resolve()) {
|
|
44
|
+
for (const [key, value] of Object.entries(wsTreeMapSizes)){
|
|
45
|
+
if (value <= 0) {
|
|
46
|
+
throw new Error(`Map size must be a positive number, got ${value} for ${key}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
40
49
|
const log = createLogger('world-state:database', bindings);
|
|
41
50
|
const worldStateDirectory = join(dataDir, WORLD_STATE_DIR);
|
|
42
|
-
// Create a version manager to handle versioning
|
|
43
51
|
const versionManager = new DatabaseVersionManager({
|
|
44
52
|
schemaVersion: WORLD_STATE_DB_VERSION,
|
|
45
53
|
rollupAddress,
|
|
46
54
|
dataDirectory: worldStateDirectory,
|
|
47
|
-
onOpen: (dir)=>
|
|
48
|
-
return Promise.resolve(new NativeWorldState(dir, wsTreeMapSizes, prefilledPublicData, instrumentation, bindings));
|
|
49
|
-
}
|
|
55
|
+
onOpen: (dir)=>IpcWorldState.spawn(dir, wsTreeMapSizes, genesis, instrumentation, bindings)
|
|
50
56
|
});
|
|
51
57
|
const [instance] = await versionManager.open();
|
|
52
|
-
const
|
|
58
|
+
const recreateInstance = async ()=>{
|
|
59
|
+
await rm(worldStateDirectory, {
|
|
60
|
+
recursive: true,
|
|
61
|
+
force: true,
|
|
62
|
+
maxRetries: 3
|
|
63
|
+
});
|
|
64
|
+
await mkdir(worldStateDirectory, {
|
|
65
|
+
recursive: true
|
|
66
|
+
});
|
|
67
|
+
return IpcWorldState.spawn(worldStateDirectory, wsTreeMapSizes, genesis, instrumentation, bindings);
|
|
68
|
+
};
|
|
69
|
+
const worldState = new this(instance, instrumentation, log, genesis, cleanup, recreateInstance);
|
|
53
70
|
try {
|
|
54
71
|
await worldState.init();
|
|
55
72
|
} catch (e) {
|
|
@@ -58,7 +75,7 @@ export class NativeWorldStateService {
|
|
|
58
75
|
}
|
|
59
76
|
return worldState;
|
|
60
77
|
}
|
|
61
|
-
static async tmp(
|
|
78
|
+
static async tmp(cleanupTmpDir = true, genesis = EMPTY_GENESIS_DATA, instrumentation = new WorldStateInstrumentation(getTelemetryClient()), bindings) {
|
|
62
79
|
const log = createLogger('world-state:database', bindings);
|
|
63
80
|
const dataDir = await mkdtemp(join(tmpdir(), 'aztec-world-state-'));
|
|
64
81
|
const dbMapSizeKb = 10 * 1024 * 1024;
|
|
@@ -70,7 +87,7 @@ export class NativeWorldStateService {
|
|
|
70
87
|
publicDataTreeMapSizeKb: dbMapSizeKb
|
|
71
88
|
};
|
|
72
89
|
log.debug(`Created temporary world state database at: ${dataDir} with tree map size: ${dbMapSizeKb}`);
|
|
73
|
-
|
|
90
|
+
const instance = await IpcWorldState.spawn(dataDir, worldStateTreeMapSizes, genesis, instrumentation, bindings);
|
|
74
91
|
const cleanup = async ()=>{
|
|
75
92
|
if (cleanupTmpDir) {
|
|
76
93
|
await rm(dataDir, {
|
|
@@ -83,7 +100,35 @@ export class NativeWorldStateService {
|
|
|
83
100
|
log.debug(`Leaving temporary world state database: ${dataDir}`);
|
|
84
101
|
}
|
|
85
102
|
};
|
|
86
|
-
|
|
103
|
+
const recreateInstance = async ()=>{
|
|
104
|
+
await rm(dataDir, {
|
|
105
|
+
recursive: true,
|
|
106
|
+
force: true,
|
|
107
|
+
maxRetries: 3
|
|
108
|
+
});
|
|
109
|
+
await mkdir(dataDir, {
|
|
110
|
+
recursive: true
|
|
111
|
+
});
|
|
112
|
+
return IpcWorldState.spawn(dataDir, worldStateTreeMapSizes, genesis, instrumentation, bindings);
|
|
113
|
+
};
|
|
114
|
+
const worldState = new this(instance, instrumentation, log, genesis, cleanup, recreateInstance);
|
|
115
|
+
try {
|
|
116
|
+
await worldState.init();
|
|
117
|
+
} catch (e) {
|
|
118
|
+
log.error(`Error initializing tmp world state: ${e}`);
|
|
119
|
+
throw e;
|
|
120
|
+
}
|
|
121
|
+
return worldState;
|
|
122
|
+
}
|
|
123
|
+
static ephemeral(genesis = EMPTY_GENESIS_DATA, instrumentation = new WorldStateInstrumentation(getTelemetryClient()), bindings) {
|
|
124
|
+
return this.tmp(/*cleanupTmpDir=*/ true, genesis, instrumentation, bindings);
|
|
125
|
+
}
|
|
126
|
+
static async fromIpc(wsdbBackend, instrumentation = new WorldStateInstrumentation(getTelemetryClient()), bindings, genesis = EMPTY_GENESIS_DATA, cleanup = ()=>Promise.resolve(), recreateInstance) {
|
|
127
|
+
const log = createLogger('world-state:database', bindings);
|
|
128
|
+
const instance = new IpcWorldState(wsdbBackend, instrumentation, bindings);
|
|
129
|
+
const worldState = new this(instance, instrumentation, log, genesis, cleanup, recreateInstance);
|
|
130
|
+
await worldState.init();
|
|
131
|
+
return worldState;
|
|
87
132
|
}
|
|
88
133
|
async init() {
|
|
89
134
|
const status = await this.getStatusSummary();
|
|
@@ -100,16 +145,27 @@ export class NativeWorldStateService {
|
|
|
100
145
|
// the initial header _must_ be the first element in the archive tree
|
|
101
146
|
// if this assertion fails, check that the hashing done in Header in yarn-project matches the initial header hash done in world_state.cpp
|
|
102
147
|
const indices = await committed.findLeafIndices(MerkleTreeId.ARCHIVE, [
|
|
103
|
-
|
|
148
|
+
await this.initialHeader.hash()
|
|
104
149
|
]);
|
|
105
150
|
const initialHeaderIndex = indices[0];
|
|
106
151
|
assert.strictEqual(initialHeaderIndex, 0n, 'Invalid initial archive state');
|
|
107
152
|
}
|
|
108
153
|
async clear() {
|
|
154
|
+
if (!this.recreateInstance) {
|
|
155
|
+
throw new Error('clear() is not available for externally-managed IPC backends');
|
|
156
|
+
}
|
|
157
|
+
this.log.warn('Clearing world state: shutting down WSDB, deleting data, and recreating');
|
|
109
158
|
await this.instance.close();
|
|
110
159
|
this.cachedStatusSummary = undefined;
|
|
111
|
-
|
|
112
|
-
|
|
160
|
+
this.instance = await this.recreateInstance();
|
|
161
|
+
await this.init();
|
|
162
|
+
this.log.info('World state cleared and reinitialized from genesis');
|
|
163
|
+
}
|
|
164
|
+
/** Returns the socket path of the underlying IPC backend, if available. */ getSocketPath() {
|
|
165
|
+
if (this.instance instanceof IpcWorldState) {
|
|
166
|
+
return this.instance.getSocketPath();
|
|
167
|
+
}
|
|
168
|
+
throw new Error('getSocketPath() is only available with IPC world state');
|
|
113
169
|
}
|
|
114
170
|
getCommitted() {
|
|
115
171
|
return new MerkleTreesFacade(this.instance, this.initialHeader, WorldStateRevision.empty());
|
|
@@ -123,7 +179,7 @@ export class NativeWorldStateService {
|
|
|
123
179
|
blockNumber: blockNumber ?? BlockNumber.ZERO,
|
|
124
180
|
canonical: true
|
|
125
181
|
});
|
|
126
|
-
return new MerkleTreesForkFacade(this.instance, this.initialHeader, new WorldStateRevision(/*forkId=*/ resp.forkId, /* blockNumber=*/
|
|
182
|
+
return new MerkleTreesForkFacade(this.instance, this.initialHeader, new WorldStateRevision(/*forkId=*/ resp.forkId, /* blockNumber=*/ WorldStateRevision.LATEST, /* includeUncommitted=*/ true), opts);
|
|
127
183
|
}
|
|
128
184
|
getInitialHeader() {
|
|
129
185
|
return this.initialHeader;
|
|
@@ -149,7 +205,7 @@ export class NativeWorldStateService {
|
|
|
149
205
|
try {
|
|
150
206
|
return await this.instance.call(WorldStateMessageType.SYNC_BLOCK, {
|
|
151
207
|
blockNumber: l2Block.number,
|
|
152
|
-
blockHeaderHash: await l2Block.hash(),
|
|
208
|
+
blockHeaderHash: (await l2Block.hash()).toBuffer(),
|
|
153
209
|
paddedL1ToL2Messages: paddedL1ToL2Messages.map(serializeLeaf),
|
|
154
210
|
paddedNoteHashes: paddedNoteHashes.map(serializeLeaf),
|
|
155
211
|
paddedNullifiers: paddedNullifiers.map(serializeLeaf),
|
|
@@ -163,13 +219,22 @@ export class NativeWorldStateService {
|
|
|
163
219
|
}
|
|
164
220
|
}
|
|
165
221
|
async close() {
|
|
166
|
-
|
|
167
|
-
|
|
222
|
+
try {
|
|
223
|
+
await this.instance.close();
|
|
224
|
+
} finally{
|
|
225
|
+
await this.cleanup();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async [_computedKey]() {
|
|
229
|
+
await this.close();
|
|
168
230
|
}
|
|
169
231
|
async buildInitialHeader() {
|
|
170
232
|
const state = await this.getInitialStateReference();
|
|
171
233
|
return BlockHeader.empty({
|
|
172
|
-
state
|
|
234
|
+
state,
|
|
235
|
+
globalVariables: GlobalVariables.empty({
|
|
236
|
+
timestamp: this.genesis.genesisTimestamp
|
|
237
|
+
})
|
|
173
238
|
});
|
|
174
239
|
}
|
|
175
240
|
sanitizeAndCacheSummaryFromFull(response) {
|
|
@@ -1,49 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
3
|
-
import type { WorldStateInstrumentation } from '../instrumentation/instrumentation.js';
|
|
4
|
-
import type { WorldStateTreeMapSizes } from '../synchronizer/factory.js';
|
|
5
|
-
import { WorldStateMessageType, type WorldStateRequest, type WorldStateRequestCategories, type WorldStateResponse } from './message.js';
|
|
6
|
-
export interface NativeWorldStateInstance {
|
|
7
|
-
call<T extends WorldStateMessageType>(messageType: T, body: WorldStateRequest[T] & WorldStateRequestCategories): Promise<WorldStateResponse[T]>;
|
|
8
|
-
getHandle(): any;
|
|
9
|
-
}
|
|
1
|
+
import type { WorldStateMessageType, WorldStateRequest, WorldStateRequestCategories, WorldStateResponse } from './message.js';
|
|
10
2
|
/**
|
|
11
|
-
*
|
|
3
|
+
* Backend-agnostic handle to a running aztec-wsdb world state, accessed by the TS layer.
|
|
4
|
+
*
|
|
5
|
+
* Two implementations exist:
|
|
6
|
+
* - {@link IpcWorldState} — talks to a standalone aztec-wsdb process over UDS or shared memory.
|
|
7
|
+
*
|
|
8
|
+
* The legacy in-process NAPI implementation has been removed; the C++ AVM (NAPI) now connects to
|
|
9
|
+
* the same aztec-wsdb process via UDS using the socket path returned by {@link getSocketPath}.
|
|
12
10
|
*/
|
|
13
|
-
export
|
|
14
|
-
private readonly dataDir;
|
|
15
|
-
private readonly wsTreeMapSizes;
|
|
16
|
-
private readonly prefilledPublicData;
|
|
17
|
-
private readonly instrumentation;
|
|
18
|
-
private readonly log;
|
|
19
|
-
private open;
|
|
20
|
-
private queues;
|
|
21
|
-
private instance;
|
|
22
|
-
/** Creates a new native WorldState instance */
|
|
23
|
-
constructor(dataDir: string, wsTreeMapSizes: WorldStateTreeMapSizes, prefilledPublicData: PublicDataTreeLeaf[] | undefined, instrumentation: WorldStateInstrumentation, bindings?: LoggerBindings, log?: Logger);
|
|
24
|
-
getDataDir(): string;
|
|
25
|
-
clone(): NativeWorldState;
|
|
11
|
+
export interface NativeWorldStateInstance {
|
|
26
12
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
13
|
+
* Send a typed msgpack message to the backing world state and await its response.
|
|
14
|
+
*
|
|
15
|
+
* @param responseHandler — optional pre-resolution hook executed on the per-fork queue, useful
|
|
16
|
+
* for caching responses while the queue still holds the fork lock.
|
|
17
|
+
* @param errorHandler — optional pre-rejection hook executed on the per-fork queue.
|
|
32
18
|
*/
|
|
33
|
-
|
|
19
|
+
call<T extends WorldStateMessageType>(messageType: T, body: WorldStateRequest[T] & WorldStateRequestCategories, responseHandler?: (response: WorldStateResponse[T]) => WorldStateResponse[T], errorHandler?: (error: string) => void): Promise<WorldStateResponse[T]>;
|
|
34
20
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* @param body - The message body
|
|
38
|
-
* @param responseHandler - A callback accepting the response, executed on the job queue
|
|
39
|
-
* @param errorHandler - A callback called on request error, executed on the job queue
|
|
40
|
-
* @returns The response to the message
|
|
21
|
+
* UDS path the underlying aztec-wsdb process listens on. The C++ AVM uses this to attach to the
|
|
22
|
+
* same world state instance the TS layer is using.
|
|
41
23
|
*/
|
|
42
|
-
|
|
24
|
+
getSocketPath(): string;
|
|
43
25
|
/**
|
|
44
|
-
*
|
|
26
|
+
* Shut down the world state instance. Cancels any in-flight queues, closes the IPC channel, and
|
|
27
|
+
* terminates the underlying aztec-wsdb process. Idempotent.
|
|
45
28
|
*/
|
|
46
29
|
close(): Promise<void>;
|
|
47
|
-
private _sendMessage;
|
|
48
30
|
}
|
|
49
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmF0aXZlX3dvcmxkX3N0YXRlX2luc3RhbmNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbmF0aXZlL25hdGl2ZV93b3JsZF9zdGF0ZV9pbnN0YW5jZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFDVixxQkFBcUIsRUFDckIsaUJBQWlCLEVBQ2pCLDJCQUEyQixFQUMzQixrQkFBa0IsRUFDbkIsTUFBTSxjQUFjLENBQUM7QUFFdEI7Ozs7Ozs7O0dBUUc7QUFDSCxNQUFNLFdBQVcsd0JBQXdCO0lBQ3ZDOzs7Ozs7T0FNRztJQUNILElBQUksQ0FBQyxDQUFDLFNBQVMscUJBQXFCLEVBQ2xDLFdBQVcsRUFBRSxDQUFDLEVBQ2QsSUFBSSxFQUFFLGlCQUFpQixDQUFDLENBQUMsQ0FBQyxHQUFHLDJCQUEyQixFQUN4RCxlQUFlLENBQUMsRUFBRSxDQUFDLFFBQVEsRUFBRSxrQkFBa0IsQ0FBQyxDQUFDLENBQUMsS0FBSyxrQkFBa0IsQ0FBQyxDQUFDLENBQUMsRUFDNUUsWUFBWSxDQUFDLEVBQUUsQ0FBQyxLQUFLLEVBQUUsTUFBTSxLQUFLLElBQUksR0FDckMsT0FBTyxDQUFDLGtCQUFrQixDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFFbEM7OztPQUdHO0lBQ0gsYUFBYSxJQUFJLE1BQU0sQ0FBQztJQUV4Qjs7O09BR0c7SUFDSCxLQUFLLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0NBQ3hCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native_world_state_instance.d.ts","sourceRoot":"","sources":["../../src/native/native_world_state_instance.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"native_world_state_instance.d.ts","sourceRoot":"","sources":["../../src/native/native_world_state_instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAEtB;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;OAMG;IACH,IAAI,CAAC,CAAC,SAAS,qBAAqB,EAClC,WAAW,EAAE,CAAC,EACd,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,2BAA2B,EACxD,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,EAC5E,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GACrC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAElC;;;OAGG;IACH,aAAa,IAAI,MAAM,CAAC;IAExB;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
|
|
@@ -1,203 +1,9 @@
|
|
|
1
|
-
import { ARCHIVE_HEIGHT, DomainSeparator, L1_TO_L2_MSG_TREE_HEIGHT, MAX_NULLIFIERS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, NOTE_HASH_TREE_HEIGHT, NULLIFIER_TREE_HEIGHT, PUBLIC_DATA_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import { NativeWorldState as BaseNativeWorldState, MsgpackChannel } from '@aztec/native';
|
|
4
|
-
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
5
|
-
import assert from 'assert';
|
|
6
|
-
import { cpus } from 'os';
|
|
7
|
-
import { WorldStateMessageType, isWithCanonical, isWithForkId, isWithRevision } from './message.js';
|
|
8
|
-
import { WorldStateOpsQueue } from './world_state_ops_queue.js';
|
|
9
|
-
const MAX_WORLD_STATE_THREADS = +(process.env.HARDWARE_CONCURRENCY || '16');
|
|
10
1
|
/**
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// We maintain a map of queue to fork
|
|
20
|
-
queues;
|
|
21
|
-
instance;
|
|
22
|
-
/** Creates a new native WorldState instance */ constructor(dataDir, wsTreeMapSizes, prefilledPublicData = [], instrumentation, bindings, log = createLogger('world-state:database', bindings)){
|
|
23
|
-
this.dataDir = dataDir;
|
|
24
|
-
this.wsTreeMapSizes = wsTreeMapSizes;
|
|
25
|
-
this.prefilledPublicData = prefilledPublicData;
|
|
26
|
-
this.instrumentation = instrumentation;
|
|
27
|
-
this.log = log;
|
|
28
|
-
this.open = true;
|
|
29
|
-
this.queues = new Map();
|
|
30
|
-
const threads = Math.min(cpus().length, MAX_WORLD_STATE_THREADS);
|
|
31
|
-
log.info(`Creating world state data store at directory ${dataDir} with map sizes ${JSON.stringify(wsTreeMapSizes)} and ${threads} threads.`);
|
|
32
|
-
const prefilledPublicDataBufferArray = prefilledPublicData.map((d)=>[
|
|
33
|
-
d.slot.toBuffer(),
|
|
34
|
-
d.value.toBuffer()
|
|
35
|
-
]);
|
|
36
|
-
const ws = new BaseNativeWorldState(dataDir, {
|
|
37
|
-
[MerkleTreeId.NULLIFIER_TREE]: NULLIFIER_TREE_HEIGHT,
|
|
38
|
-
[MerkleTreeId.NOTE_HASH_TREE]: NOTE_HASH_TREE_HEIGHT,
|
|
39
|
-
[MerkleTreeId.PUBLIC_DATA_TREE]: PUBLIC_DATA_TREE_HEIGHT,
|
|
40
|
-
[MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: L1_TO_L2_MSG_TREE_HEIGHT,
|
|
41
|
-
[MerkleTreeId.ARCHIVE]: ARCHIVE_HEIGHT
|
|
42
|
-
}, {
|
|
43
|
-
[MerkleTreeId.NULLIFIER_TREE]: 2 * MAX_NULLIFIERS_PER_TX,
|
|
44
|
-
[MerkleTreeId.PUBLIC_DATA_TREE]: 2 * MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX
|
|
45
|
-
}, prefilledPublicDataBufferArray, DomainSeparator.BLOCK_HEADER_HASH, {
|
|
46
|
-
[MerkleTreeId.NULLIFIER_TREE]: wsTreeMapSizes.nullifierTreeMapSizeKb,
|
|
47
|
-
[MerkleTreeId.NOTE_HASH_TREE]: wsTreeMapSizes.noteHashTreeMapSizeKb,
|
|
48
|
-
[MerkleTreeId.PUBLIC_DATA_TREE]: wsTreeMapSizes.publicDataTreeMapSizeKb,
|
|
49
|
-
[MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: wsTreeMapSizes.messageTreeMapSizeKb,
|
|
50
|
-
[MerkleTreeId.ARCHIVE]: wsTreeMapSizes.archiveTreeMapSizeKb
|
|
51
|
-
}, threads);
|
|
52
|
-
this.instance = new MsgpackChannel(ws);
|
|
53
|
-
// Manually create the queue for the canonical fork
|
|
54
|
-
this.queues.set(0, new WorldStateOpsQueue());
|
|
55
|
-
}
|
|
56
|
-
getDataDir() {
|
|
57
|
-
return this.dataDir;
|
|
58
|
-
}
|
|
59
|
-
clone() {
|
|
60
|
-
return new NativeWorldState(this.dataDir, this.wsTreeMapSizes, this.prefilledPublicData, this.instrumentation, this.log.getBindings(), this.log);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Gets the native WorldState handle from the underlying native instance.
|
|
64
|
-
* We call the getHandle() method on the native WorldState to get a NAPI External
|
|
65
|
-
* that wraps the underlying C++ WorldState pointer.
|
|
66
|
-
* @returns The NAPI External handle to the native WorldState instance,since
|
|
67
|
-
* the NAPI external type is opaque, we return any (we could also use an opaque symbol type)
|
|
68
|
-
*/ getHandle() {
|
|
69
|
-
const worldStateWrapper = this.instance.dest;
|
|
70
|
-
if (!worldStateWrapper) {
|
|
71
|
-
throw new Error('No WorldStateWrapper found');
|
|
72
|
-
}
|
|
73
|
-
if (typeof worldStateWrapper.getHandle !== 'function') {
|
|
74
|
-
throw new Error('WorldStateWrapper does not have getHandle method');
|
|
75
|
-
}
|
|
76
|
-
// Call getHandle() to get the NAPI External
|
|
77
|
-
try {
|
|
78
|
-
return worldStateWrapper.getHandle();
|
|
79
|
-
} catch (error) {
|
|
80
|
-
this.log.error('Failed to get native WorldState handle', error);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Sends a message to the native instance and returns the response.
|
|
85
|
-
* @param messageType - The type of message to send
|
|
86
|
-
* @param body - The message body
|
|
87
|
-
* @param responseHandler - A callback accepting the response, executed on the job queue
|
|
88
|
-
* @param errorHandler - A callback called on request error, executed on the job queue
|
|
89
|
-
* @returns The response to the message
|
|
90
|
-
*/ async call(messageType, body, // allows for the pre-processing of responses on the job queue before being passed back
|
|
91
|
-
responseHandler = (response)=>response, errorHandler = (_)=>{}) {
|
|
92
|
-
// Here we determine which fork the request is being executed against and whether it requires uncommitted data
|
|
93
|
-
// We use the fork Id to select the appropriate request queue and the uncommitted data flag to pass to the queue
|
|
94
|
-
let forkId = -1;
|
|
95
|
-
// We assume it includes uncommitted unless explicitly told otherwise
|
|
96
|
-
let committedOnly = false;
|
|
97
|
-
// Canonical requests ALWAYS go against the canonical fork
|
|
98
|
-
// These include things like block syncs/unwinds etc
|
|
99
|
-
// These requests don't contain a fork ID
|
|
100
|
-
if (isWithCanonical(body)) {
|
|
101
|
-
forkId = 0;
|
|
102
|
-
} else if (isWithForkId(body)) {
|
|
103
|
-
forkId = body.forkId;
|
|
104
|
-
} else if (isWithRevision(body)) {
|
|
105
|
-
forkId = body.revision.forkId;
|
|
106
|
-
committedOnly = body.revision.includeUncommitted === false;
|
|
107
|
-
} else {
|
|
108
|
-
const _ = body;
|
|
109
|
-
throw new Error(`Unable to determine forkId for message=${WorldStateMessageType[messageType]}`);
|
|
110
|
-
}
|
|
111
|
-
// Get the queue or create a new one
|
|
112
|
-
let requestQueue = this.queues.get(forkId);
|
|
113
|
-
if (requestQueue === undefined) {
|
|
114
|
-
requestQueue = new WorldStateOpsQueue();
|
|
115
|
-
this.queues.set(forkId, requestQueue);
|
|
116
|
-
}
|
|
117
|
-
// Enqueue the request and wait for the response
|
|
118
|
-
const response = await requestQueue.execute(async ()=>{
|
|
119
|
-
assert.notEqual(messageType, WorldStateMessageType.CLOSE, 'Use close() to close the native instance');
|
|
120
|
-
assert.equal(this.open, true, 'Native instance is closed');
|
|
121
|
-
let response;
|
|
122
|
-
try {
|
|
123
|
-
response = await this._sendMessage(messageType, body);
|
|
124
|
-
} catch (error) {
|
|
125
|
-
errorHandler(error.message);
|
|
126
|
-
throw error;
|
|
127
|
-
}
|
|
128
|
-
return responseHandler(response);
|
|
129
|
-
}, messageType, committedOnly);
|
|
130
|
-
// If the request was to delete the fork then we clean it up here
|
|
131
|
-
if (messageType === WorldStateMessageType.DELETE_FORK) {
|
|
132
|
-
await requestQueue.stop();
|
|
133
|
-
this.queues.delete(forkId);
|
|
134
|
-
}
|
|
135
|
-
return response;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Stops the native instance.
|
|
139
|
-
*/ async close() {
|
|
140
|
-
if (!this.open) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
this.open = false;
|
|
144
|
-
const queue = this.queues.get(0);
|
|
145
|
-
await queue.execute(async ()=>{
|
|
146
|
-
await this._sendMessage(WorldStateMessageType.CLOSE, {
|
|
147
|
-
canonical: true
|
|
148
|
-
});
|
|
149
|
-
}, WorldStateMessageType.CLOSE, false);
|
|
150
|
-
await queue.stop();
|
|
151
|
-
}
|
|
152
|
-
async _sendMessage(messageType, body) {
|
|
153
|
-
let logMetadata = {};
|
|
154
|
-
if (body) {
|
|
155
|
-
if ('treeId' in body) {
|
|
156
|
-
logMetadata['treeId'] = MerkleTreeId[body.treeId];
|
|
157
|
-
}
|
|
158
|
-
if ('revision' in body) {
|
|
159
|
-
logMetadata = {
|
|
160
|
-
...logMetadata,
|
|
161
|
-
...body.revision
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
if ('forkId' in body) {
|
|
165
|
-
logMetadata['forkId'] = body.forkId;
|
|
166
|
-
}
|
|
167
|
-
if ('blockNumber' in body) {
|
|
168
|
-
logMetadata['blockNumber'] = body.blockNumber;
|
|
169
|
-
}
|
|
170
|
-
if ('toBlockNumber' in body) {
|
|
171
|
-
logMetadata['toBlockNumber'] = body.toBlockNumber;
|
|
172
|
-
}
|
|
173
|
-
if ('leafIndex' in body) {
|
|
174
|
-
logMetadata['leafIndex'] = body.leafIndex;
|
|
175
|
-
}
|
|
176
|
-
if ('blockHeaderHash' in body) {
|
|
177
|
-
logMetadata['blockHeaderHash'] = '0x' + body.blockHeaderHash.toString('hex');
|
|
178
|
-
}
|
|
179
|
-
if ('leaves' in body) {
|
|
180
|
-
logMetadata['leavesCount'] = body.leaves.length;
|
|
181
|
-
}
|
|
182
|
-
// sync operation
|
|
183
|
-
if ('paddedNoteHashes' in body) {
|
|
184
|
-
logMetadata['notesCount'] = body.paddedNoteHashes.length;
|
|
185
|
-
logMetadata['nullifiersCount'] = body.paddedNullifiers.length;
|
|
186
|
-
logMetadata['l1ToL2MessagesCount'] = body.paddedL1ToL2Messages.length;
|
|
187
|
-
logMetadata['publicDataWritesCount'] = body.publicDataWrites.length;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
try {
|
|
191
|
-
const { duration, response } = await this.instance.sendMessage(messageType, body);
|
|
192
|
-
this.log.trace(`Call ${WorldStateMessageType[messageType]} took (ms)`, {
|
|
193
|
-
duration,
|
|
194
|
-
...logMetadata
|
|
195
|
-
});
|
|
196
|
-
this.instrumentation.recordRoundTrip(duration.totalUs, messageType);
|
|
197
|
-
return response;
|
|
198
|
-
} catch (error) {
|
|
199
|
-
this.log.error(`Call ${WorldStateMessageType[messageType]} failed: ${error}`, error, logMetadata);
|
|
200
|
-
throw error;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
2
|
+
* Backend-agnostic handle to a running aztec-wsdb world state, accessed by the TS layer.
|
|
3
|
+
*
|
|
4
|
+
* Two implementations exist:
|
|
5
|
+
* - {@link IpcWorldState} — talks to a standalone aztec-wsdb process over UDS or shared memory.
|
|
6
|
+
*
|
|
7
|
+
* The legacy in-process NAPI implementation has been removed; the C++ AVM (NAPI) now connects to
|
|
8
|
+
* the same aztec-wsdb process via UDS using the socket path returned by {@link getSocketPath}.
|
|
9
|
+
*/ export { };
|
|
@@ -67,7 +67,7 @@ export class WorldStateOpsQueue {
|
|
|
67
67
|
// then send the request immediately
|
|
68
68
|
// If a mutating request is in flight then we must wait
|
|
69
69
|
// If a mutating request is not in flight but something is queued then it must be a mutating request
|
|
70
|
-
if (this.inFlightMutatingCount
|
|
70
|
+
if (this.inFlightMutatingCount === 0 && this.requests.length === 0) {
|
|
71
71
|
this.sendEnqueuedRequest(op);
|
|
72
72
|
} else {
|
|
73
73
|
this.requests.push(op);
|
|
@@ -88,7 +88,7 @@ export class WorldStateOpsQueue {
|
|
|
88
88
|
}
|
|
89
89
|
--this.inFlightCount;
|
|
90
90
|
// If there are still requests in flight then do nothing further
|
|
91
|
-
if (this.inFlightCount
|
|
91
|
+
if (this.inFlightCount !== 0) {
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
// No requests in flight, send next queued requests
|
|
@@ -99,7 +99,7 @@ export class WorldStateOpsQueue {
|
|
|
99
99
|
while(this.requests.length > 0){
|
|
100
100
|
const next = this.requests[0];
|
|
101
101
|
if (next.mutating) {
|
|
102
|
-
if (this.inFlightCount
|
|
102
|
+
if (this.inFlightCount === 0) {
|
|
103
103
|
// send the mutating request
|
|
104
104
|
this.requests.shift();
|
|
105
105
|
this.sendEnqueuedRequest(next);
|
|
@@ -112,7 +112,7 @@ export class WorldStateOpsQueue {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
// If the queue is empty, there is nothing in flight and we have been told to stop, then resolve the stop promise
|
|
115
|
-
if (this.inFlightCount
|
|
115
|
+
if (this.inFlightCount === 0 && this.stopResolve !== undefined) {
|
|
116
116
|
this.stopResolve();
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -138,7 +138,7 @@ export class WorldStateOpsQueue {
|
|
|
138
138
|
this.stopResolve = resolve;
|
|
139
139
|
});
|
|
140
140
|
// If no outstanding requests then immediately resolve the promise
|
|
141
|
-
if (this.requests.length
|
|
141
|
+
if (this.requests.length === 0 && this.inFlightCount === 0 && this.stopResolve !== undefined) {
|
|
142
142
|
this.stopResolve();
|
|
143
143
|
}
|
|
144
144
|
return this.stopPromise;
|
|
@@ -28,4 +28,4 @@ export declare const worldStateConfigMappings: ConfigMappingsType<WorldStateConf
|
|
|
28
28
|
* @returns The configuration values for the world state synchronizer.
|
|
29
29
|
*/
|
|
30
30
|
export declare function getWorldStateConfigFromEnv(): WorldStateConfig;
|
|
31
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3luY2hyb25pemVyL2NvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsS0FBSyxrQkFBa0IsRUFJeEIsTUFBTSwwQkFBMEIsQ0FBQztBQUVsQyxxREFBcUQ7QUFDckQsTUFBTSxXQUFXLGdCQUFnQjtJQUMvQix1Q0FBdUM7SUFDdkMsOEJBQThCLEVBQUUsTUFBTSxDQUFDO0lBRXZDLDJGQUEyRjtJQUMzRiwrQkFBK0IsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUV6QyxtSkFBbUo7SUFDbkoscUJBQXFCLENBQUMsRUFBRSxNQUFNLENBQUM7SUFFL0IsMkpBQTJKO0lBQzNKLG9CQUFvQixDQUFDLEVBQUUsTUFBTSxDQUFDO0lBRTlCLDZKQUE2SjtJQUM3SixzQkFBc0IsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUVoQyw2SkFBNko7SUFDN0oscUJBQXFCLENBQUMsRUFBRSxNQUFNLENBQUM7SUFFL0IsMkpBQTJKO0lBQzNKLG9CQUFvQixDQUFDLEVBQUUsTUFBTSxDQUFDO0lBRTlCLCtKQUErSjtJQUMvSix1QkFBdUIsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUVqQywyR0FBMkc7SUFDM0csdUJBQXVCLENBQUMsRUFBRSxNQUFNLENBQUM7SUFFakMscUVBQXFFO0lBQ3JFLDJCQUEyQixFQUFFLE1BQU0sQ0FBQztDQUNyQztBQUVELGVBQU8sTUFBTSx3QkFBd0IsRUFBRSxrQkFBa0IsQ0FBQyxnQkFBZ0IsQ0F5RHpFLENBQUM7QUFFRjs7O0dBR0c7QUFDSCx3QkFBZ0IsMEJBQTBCLElBQUksZ0JBQWdCLENBRTdEIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/synchronizer/config.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/synchronizer/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,0BAA0B,CAAC;AAElC,qDAAqD;AACrD,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,8BAA8B,EAAE,MAAM,CAAC;IAEvC,2FAA2F;IAC3F,+BAA+B,CAAC,EAAE,MAAM,CAAC;IAEzC,mJAAmJ;IACnJ,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,2JAA2J;IAC3J,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,6JAA6J;IAC7J,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC,6JAA6J;IAC7J,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,2JAA2J;IAC3J,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,+JAA+J;IAC/J,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAEjC,2GAA2G;IAC3G,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAEjC,qEAAqE;IACrE,2BAA2B,EAAE,MAAM,CAAC;CACrC;AAED,eAAO,MAAM,wBAAwB,EAAE,kBAAkB,CAAC,gBAAgB,CAyDzE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,gBAAgB,CAE7D"}
|
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
import { getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config';
|
|
1
|
+
import { getConfigFromMappings, numberConfigHelper, optionalNumberConfigHelper } from '@aztec/foundation/config';
|
|
2
2
|
export const worldStateConfigMappings = {
|
|
3
3
|
worldStateBlockCheckIntervalMS: {
|
|
4
4
|
env: 'WS_BLOCK_CHECK_INTERVAL_MS',
|
|
5
|
-
|
|
6
|
-
defaultValue: 100,
|
|
5
|
+
...numberConfigHelper(100),
|
|
7
6
|
description: 'The frequency in which to check.'
|
|
8
7
|
},
|
|
9
8
|
worldStateBlockRequestBatchSize: {
|
|
10
9
|
env: 'WS_BLOCK_REQUEST_BATCH_SIZE',
|
|
11
|
-
|
|
10
|
+
...optionalNumberConfigHelper(),
|
|
12
11
|
description: 'Size of the batch for each get-blocks request from the synchronizer to the archiver.'
|
|
13
12
|
},
|
|
14
13
|
worldStateDbMapSizeKb: {
|
|
15
14
|
env: 'WS_DB_MAP_SIZE_KB',
|
|
16
|
-
|
|
15
|
+
...optionalNumberConfigHelper(),
|
|
17
16
|
description: 'The maximum possible size of the world state DB in KB. Overwrites the general dataStoreMapSizeKb.'
|
|
18
17
|
},
|
|
19
18
|
archiveTreeMapSizeKb: {
|
|
20
19
|
env: 'ARCHIVE_TREE_MAP_SIZE_KB',
|
|
21
|
-
|
|
20
|
+
...optionalNumberConfigHelper(),
|
|
22
21
|
description: 'The maximum possible size of the world state archive tree in KB. Overwrites the general worldStateDbMapSizeKb.'
|
|
23
22
|
},
|
|
24
23
|
nullifierTreeMapSizeKb: {
|
|
25
24
|
env: 'NULLIFIER_TREE_MAP_SIZE_KB',
|
|
26
|
-
|
|
25
|
+
...optionalNumberConfigHelper(),
|
|
27
26
|
description: 'The maximum possible size of the world state nullifier tree in KB. Overwrites the general worldStateDbMapSizeKb.'
|
|
28
27
|
},
|
|
29
28
|
noteHashTreeMapSizeKb: {
|
|
30
29
|
env: 'NOTE_HASH_TREE_MAP_SIZE_KB',
|
|
31
|
-
|
|
30
|
+
...optionalNumberConfigHelper(),
|
|
32
31
|
description: 'The maximum possible size of the world state note hash tree in KB. Overwrites the general worldStateDbMapSizeKb.'
|
|
33
32
|
},
|
|
34
33
|
messageTreeMapSizeKb: {
|
|
35
34
|
env: 'MESSAGE_TREE_MAP_SIZE_KB',
|
|
36
|
-
|
|
35
|
+
...optionalNumberConfigHelper(),
|
|
37
36
|
description: 'The maximum possible size of the world state message tree in KB. Overwrites the general worldStateDbMapSizeKb.'
|
|
38
37
|
},
|
|
39
38
|
publicDataTreeMapSizeKb: {
|
|
40
39
|
env: 'PUBLIC_DATA_TREE_MAP_SIZE_KB',
|
|
41
|
-
|
|
40
|
+
...optionalNumberConfigHelper(),
|
|
42
41
|
description: 'The maximum possible size of the world state public data tree in KB. Overwrites the general worldStateDbMapSizeKb.'
|
|
43
42
|
},
|
|
44
43
|
worldStateDataDirectory: {
|