@aztec/prover-client 3.0.0-nightly.20251023 → 3.0.0-nightly.20251025
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/block-factory/light.d.ts.map +1 -1
- package/dest/proving_broker/config.d.ts +8 -8
- package/dest/proving_broker/config.js +4 -4
- package/dest/proving_broker/factory.js +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +5 -5
- package/package.json +15 -15
- package/src/block-factory/light.ts +3 -1
- package/src/mocks/test_context.ts +3 -3
- package/src/orchestrator/block-building-helpers.ts +1 -1
- package/src/orchestrator/orchestrator.ts +1 -1
- package/src/proving_broker/config.ts +6 -6
- package/src/proving_broker/factory.ts +1 -1
- package/src/proving_broker/proving_broker_database/persisted.ts +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../src/block-factory/light.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEhG,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,yBAAyB,CAAC;AAQnF;;;;;;;;;;;GAWG;AACH,qBAAa,uBAAwB,YAAW,aAAa;IASzD,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,SAAS;IATnB,OAAO,CAAC,eAAe,CAAC,CAAkB;IAC1C,OAAO,CAAC,cAAc,CAAC,CAAO;IAC9B,OAAO,CAAC,eAAe,CAAC,CAAa;IACrC,OAAO,CAAC,GAAG,CAA4B;IAEvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6C;gBAG1D,EAAE,EAAE,yBAAyB,EAC7B,SAAS,GAAE,eAAsC;IAGrD,aAAa,CACjB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,EAAE,EAAE,EAEpB,eAAe,CAAC,EAAE,UAAU,EAE5B,YAAY,UAAO,GAClB,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../src/block-factory/light.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEhG,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,yBAAyB,CAAC;AAQnF;;;;;;;;;;;GAWG;AACH,qBAAa,uBAAwB,YAAW,aAAa;IASzD,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,SAAS;IATnB,OAAO,CAAC,eAAe,CAAC,CAAkB;IAC1C,OAAO,CAAC,cAAc,CAAC,CAAO;IAC9B,OAAO,CAAC,eAAe,CAAC,CAAa;IACrC,OAAO,CAAC,GAAG,CAA4B;IAEvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6C;gBAG1D,EAAE,EAAE,yBAAyB,EAC7B,SAAS,GAAE,eAAsC;IAGrD,aAAa,CACjB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,EAAE,EAAE,EAEpB,eAAe,CAAC,EAAE,UAAU,EAE5B,YAAY,UAAO,GAClB,OAAO,CAAC,IAAI,CAAC;IAYhB,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWzC,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;YAIvB,UAAU;CA2BzB;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,WAAW,EAAE,EAClB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,EAAE,EAAE,EACpB,EAAE,EAAE,yBAAyB,EAC7B,eAAe,CAAC,EAAE,UAAU,EAC5B,YAAY,UAAO,EACnB,SAAS,GAAE,eAAsC,oBAuBlD"}
|
|
@@ -14,9 +14,9 @@ export declare const ProverBrokerConfig: z.ZodObject<{
|
|
|
14
14
|
/** If starting a prover broker locally, the directory to store broker data */
|
|
15
15
|
dataDirectory: z.ZodOptional<z.ZodString>;
|
|
16
16
|
/** The size of the data store map */
|
|
17
|
-
|
|
18
|
-
/** The size of the prover broker's database. Will override the
|
|
19
|
-
|
|
17
|
+
dataStoreMapSizeKb: z.ZodNumber;
|
|
18
|
+
/** The size of the prover broker's database. Will override the dataStoreMapSizeKb if set. */
|
|
19
|
+
proverBrokerStoreMapSizeKb: z.ZodOptional<z.ZodNumber>;
|
|
20
20
|
/** The prover broker may batch jobs together before writing to the database */
|
|
21
21
|
proverBrokerBatchSize: z.ZodNumber;
|
|
22
22
|
/** How often the job batches get flushed */
|
|
@@ -27,24 +27,24 @@ export declare const ProverBrokerConfig: z.ZodObject<{
|
|
|
27
27
|
proverBrokerJobMaxRetries: number;
|
|
28
28
|
proverBrokerJobTimeoutMs: number;
|
|
29
29
|
proverBrokerPollIntervalMs: number;
|
|
30
|
-
|
|
30
|
+
dataStoreMapSizeKb: number;
|
|
31
31
|
proverBrokerBatchSize: number;
|
|
32
32
|
proverBrokerBatchIntervalMs: number;
|
|
33
33
|
proverBrokerMaxEpochsToKeepResultsFor: number;
|
|
34
34
|
dataDirectory?: string | undefined;
|
|
35
|
-
|
|
35
|
+
proverBrokerStoreMapSizeKb?: number | undefined;
|
|
36
36
|
}, {
|
|
37
37
|
proverBrokerJobMaxRetries: number;
|
|
38
38
|
proverBrokerJobTimeoutMs: number;
|
|
39
39
|
proverBrokerPollIntervalMs: number;
|
|
40
|
-
|
|
40
|
+
dataStoreMapSizeKb: number;
|
|
41
41
|
proverBrokerBatchSize: number;
|
|
42
42
|
proverBrokerBatchIntervalMs: number;
|
|
43
43
|
proverBrokerMaxEpochsToKeepResultsFor: number;
|
|
44
44
|
dataDirectory?: string | undefined;
|
|
45
|
-
|
|
45
|
+
proverBrokerStoreMapSizeKb?: number | undefined;
|
|
46
46
|
}>;
|
|
47
|
-
export type ProverBrokerConfig = z.infer<typeof ProverBrokerConfig> & Pick<DataStoreConfig, '
|
|
47
|
+
export type ProverBrokerConfig = z.infer<typeof ProverBrokerConfig> & Pick<DataStoreConfig, 'dataStoreMapSizeKb' | 'dataDirectory'> & L1ReaderConfig & Pick<ChainConfig, 'rollupVersion'>;
|
|
48
48
|
export declare const proverBrokerConfigMappings: ConfigMappingsType<ProverBrokerConfig>;
|
|
49
49
|
export declare const defaultProverBrokerConfig: ProverBrokerConfig;
|
|
50
50
|
export declare const ProverAgentConfig: z.ZodObject<{
|
|
@@ -10,8 +10,8 @@ export const ProverBrokerConfig = z.object({
|
|
|
10
10
|
/** If starting a prover broker locally, the time after which a job times out and gets assigned to a different agent */ proverBrokerJobTimeoutMs: z.number().int().nonnegative(),
|
|
11
11
|
/** If starting a prover broker locally, the interval the broker checks for timed out jobs */ proverBrokerPollIntervalMs: z.number().int().nonnegative(),
|
|
12
12
|
/** If starting a prover broker locally, the directory to store broker data */ dataDirectory: z.string().optional(),
|
|
13
|
-
/** The size of the data store map */
|
|
14
|
-
/** The size of the prover broker's database. Will override the
|
|
13
|
+
/** The size of the data store map */ dataStoreMapSizeKb: z.number().int().nonnegative(),
|
|
14
|
+
/** The size of the prover broker's database. Will override the dataStoreMapSizeKb if set. */ proverBrokerStoreMapSizeKb: z.number().int().nonnegative().optional(),
|
|
15
15
|
/** The prover broker may batch jobs together before writing to the database */ proverBrokerBatchSize: z.number().int().nonnegative(),
|
|
16
16
|
/** How often the job batches get flushed */ proverBrokerBatchIntervalMs: z.number().int().nonnegative(),
|
|
17
17
|
/** The maximum number of epochs to keep results for */ proverBrokerMaxEpochsToKeepResultsFor: z.number().int().nonnegative()
|
|
@@ -47,10 +47,10 @@ export const proverBrokerConfigMappings = {
|
|
|
47
47
|
description: 'The maximum number of epochs to keep results for',
|
|
48
48
|
...numberConfigHelper(1)
|
|
49
49
|
},
|
|
50
|
-
|
|
50
|
+
proverBrokerStoreMapSizeKb: {
|
|
51
51
|
env: 'PROVER_BROKER_STORE_MAP_SIZE_KB',
|
|
52
52
|
parseEnv: (val)=>val ? +val : undefined,
|
|
53
|
-
description: "The size of the prover broker's database. Will override the
|
|
53
|
+
description: "The size of the prover broker's database. Will override the dataStoreMapSizeKb if set."
|
|
54
54
|
},
|
|
55
55
|
...dataConfigMappings,
|
|
56
56
|
...l1ReaderConfigMappings,
|
|
@@ -4,7 +4,7 @@ import { KVBrokerDatabase } from './proving_broker_database/persisted.js';
|
|
|
4
4
|
export async function createAndStartProvingBroker(_config, client) {
|
|
5
5
|
const config = {
|
|
6
6
|
..._config,
|
|
7
|
-
|
|
7
|
+
dataStoreMapSizeKb: _config.proverBrokerStoreMapSizeKb ?? _config.dataStoreMapSizeKb
|
|
8
8
|
};
|
|
9
9
|
const database = config.dataDirectory ? await KVBrokerDatabase.new(config, client) : new InMemoryBrokerDatabase();
|
|
10
10
|
const broker = new ProvingBroker(database, config, client);
|
|
@@ -86,7 +86,7 @@ export class KVBrokerDatabase {
|
|
|
86
86
|
async estimateSize() {
|
|
87
87
|
const sizes = await Promise.all(Array.from(this.epochs.values()).map((x)=>x.estimateSize()));
|
|
88
88
|
return {
|
|
89
|
-
mappingSize: this.config.
|
|
89
|
+
mappingSize: this.config.dataStoreMapSizeKb,
|
|
90
90
|
physicalFileSize: sizes.reduce((prev, curr)=>prev + curr.physicalFileSize, 0),
|
|
91
91
|
numItems: sizes.reduce((prev, curr)=>prev + curr.numItems, 0),
|
|
92
92
|
actualSize: sizes.reduce((prev, curr)=>prev + curr.actualSize, 0)
|
|
@@ -109,8 +109,8 @@ export class KVBrokerDatabase {
|
|
|
109
109
|
logger.warn(`Found invalid epoch directory ${fullDirectory} when loading epoch databases, ignoring`);
|
|
110
110
|
continue;
|
|
111
111
|
}
|
|
112
|
-
logger.info(`Loading broker database for epoch ${epochNumber} from ${fullDirectory} with map size ${config.
|
|
113
|
-
const db = await openVersionedStoreAt(fullDirectory, SingleEpochDatabase.SCHEMA_VERSION, config.l1Contracts.rollupAddress, config.
|
|
112
|
+
logger.info(`Loading broker database for epoch ${epochNumber} from ${fullDirectory} with map size ${config.dataStoreMapSizeKb}KB`);
|
|
113
|
+
const db = await openVersionedStoreAt(fullDirectory, SingleEpochDatabase.SCHEMA_VERSION, config.l1Contracts.rollupAddress, config.dataStoreMapSizeKb);
|
|
114
114
|
const epochDb = new SingleEpochDatabase(db);
|
|
115
115
|
epochs.set(epochNumber, epochDb);
|
|
116
116
|
}
|
|
@@ -173,8 +173,8 @@ export class KVBrokerDatabase {
|
|
|
173
173
|
await mkdir(newEpochDirectory, {
|
|
174
174
|
recursive: true
|
|
175
175
|
});
|
|
176
|
-
this.logger.info(`Creating broker database for epoch ${epochNumber} at ${newEpochDirectory} with map size ${this.config.
|
|
177
|
-
const db = await openVersionedStoreAt(newEpochDirectory, SingleEpochDatabase.SCHEMA_VERSION, this.config.l1Contracts.rollupAddress, this.config.
|
|
176
|
+
this.logger.info(`Creating broker database for epoch ${epochNumber} at ${newEpochDirectory} with map size ${this.config.dataStoreMapSizeKb}`);
|
|
177
|
+
const db = await openVersionedStoreAt(newEpochDirectory, SingleEpochDatabase.SCHEMA_VERSION, this.config.l1Contracts.rollupAddress, this.config.dataStoreMapSizeKb);
|
|
178
178
|
epochDb = new SingleEpochDatabase(db);
|
|
179
179
|
this.epochs.set(epochNumber, epochDb);
|
|
180
180
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/prover-client",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251025",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -67,19 +67,19 @@
|
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
71
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
72
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
73
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
74
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
75
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
76
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
77
|
-
"@aztec/noir-types": "3.0.0-nightly.
|
|
78
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
79
|
-
"@aztec/simulator": "3.0.0-nightly.
|
|
80
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
81
|
-
"@aztec/telemetry-client": "3.0.0-nightly.
|
|
82
|
-
"@aztec/world-state": "3.0.0-nightly.
|
|
70
|
+
"@aztec/bb-prover": "3.0.0-nightly.20251025",
|
|
71
|
+
"@aztec/blob-lib": "3.0.0-nightly.20251025",
|
|
72
|
+
"@aztec/constants": "3.0.0-nightly.20251025",
|
|
73
|
+
"@aztec/ethereum": "3.0.0-nightly.20251025",
|
|
74
|
+
"@aztec/foundation": "3.0.0-nightly.20251025",
|
|
75
|
+
"@aztec/kv-store": "3.0.0-nightly.20251025",
|
|
76
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251025",
|
|
77
|
+
"@aztec/noir-types": "3.0.0-nightly.20251025",
|
|
78
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251025",
|
|
79
|
+
"@aztec/simulator": "3.0.0-nightly.20251025",
|
|
80
|
+
"@aztec/stdlib": "3.0.0-nightly.20251025",
|
|
81
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20251025",
|
|
82
|
+
"@aztec/world-state": "3.0.0-nightly.20251025",
|
|
83
83
|
"@google-cloud/storage": "^7.15.0",
|
|
84
84
|
"@iarna/toml": "^2.2.5",
|
|
85
85
|
"commander": "^12.1.0",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"zod": "^3.23.8"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
92
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20251025",
|
|
93
93
|
"@jest/globals": "^30.0.0",
|
|
94
94
|
"@types/jest": "^30.0.0",
|
|
95
95
|
"@types/node": "^22.15.17",
|
|
@@ -50,7 +50,9 @@ export class LightweightBlockFactory implements IBlockFactory {
|
|
|
50
50
|
): Promise<void> {
|
|
51
51
|
this.logger.debug('Starting new block', { globalVariables: globalVariables.toInspect(), l1ToL2Messages });
|
|
52
52
|
this.globalVariables = globalVariables;
|
|
53
|
-
this.l1ToL2Messages = isFirstBlock
|
|
53
|
+
this.l1ToL2Messages = isFirstBlock
|
|
54
|
+
? padArrayEnd<Fr, number>(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP)
|
|
55
|
+
: [];
|
|
54
56
|
this.startSpongeBlob = startSpongeBlob;
|
|
55
57
|
this.txs = undefined;
|
|
56
58
|
// Update L1 to L2 tree
|
|
@@ -213,7 +213,7 @@ export class TestContext {
|
|
|
213
213
|
const merkleTrees = await this.worldState.fork();
|
|
214
214
|
await merkleTrees.appendLeaves(
|
|
215
215
|
MerkleTreeId.L1_TO_L2_MESSAGE_TREE,
|
|
216
|
-
padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
|
|
216
|
+
padArrayEnd<Fr, number>(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
|
|
217
217
|
);
|
|
218
218
|
const newL1ToL2Snapshot = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, merkleTrees);
|
|
219
219
|
const txs = await timesParallel(numTxs, i =>
|
|
@@ -261,7 +261,7 @@ export class TestContext {
|
|
|
261
261
|
const merkleTrees = await this.worldState.fork();
|
|
262
262
|
await merkleTrees.appendLeaves(
|
|
263
263
|
MerkleTreeId.L1_TO_L2_MESSAGE_TREE,
|
|
264
|
-
padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
|
|
264
|
+
padArrayEnd<Fr, number>(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
|
|
265
265
|
);
|
|
266
266
|
const newL1ToL2Snapshot = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, merkleTrees);
|
|
267
267
|
|
|
@@ -330,7 +330,7 @@ export class TestContext {
|
|
|
330
330
|
const merkleTrees = await this.worldState.fork();
|
|
331
331
|
await merkleTrees.appendLeaves(
|
|
332
332
|
MerkleTreeId.L1_TO_L2_MESSAGE_TREE,
|
|
333
|
-
padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
|
|
333
|
+
padArrayEnd<Fr, number>(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
|
|
334
334
|
);
|
|
335
335
|
|
|
336
336
|
const processorFactory = new PublicProcessorFactory(
|
|
@@ -389,7 +389,7 @@ export const buildBlockHeaderFromTxs = runInSpan(
|
|
|
389
389
|
|
|
390
390
|
/** Computes the inHash for a block's ContentCommitment given its l1 to l2 messages. */
|
|
391
391
|
export async function computeInHashFromL1ToL2Messages(unpaddedL1ToL2Messages: Fr[]): Promise<Fr> {
|
|
392
|
-
const l1ToL2Messages = padArrayEnd(unpaddedL1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
392
|
+
const l1ToL2Messages = padArrayEnd<Fr, number>(unpaddedL1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
393
393
|
const hasher = (left: Buffer, right: Buffer) =>
|
|
394
394
|
Promise.resolve(sha256Trunc(Buffer.concat([left, right])) as Buffer<ArrayBuffer>);
|
|
395
395
|
const parityHeight = Math.ceil(Math.log2(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP));
|
|
@@ -601,7 +601,7 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
601
601
|
}
|
|
602
602
|
|
|
603
603
|
private async updateL1ToL2MessageTree(l1ToL2Messages: Fr[], db: MerkleTreeWriteOperations) {
|
|
604
|
-
const l1ToL2MessagesPadded = padArrayEnd(
|
|
604
|
+
const l1ToL2MessagesPadded = padArrayEnd<Fr, number>(
|
|
605
605
|
l1ToL2Messages,
|
|
606
606
|
Fr.ZERO,
|
|
607
607
|
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
|
|
@@ -22,9 +22,9 @@ export const ProverBrokerConfig = z.object({
|
|
|
22
22
|
/** If starting a prover broker locally, the directory to store broker data */
|
|
23
23
|
dataDirectory: z.string().optional(),
|
|
24
24
|
/** The size of the data store map */
|
|
25
|
-
|
|
26
|
-
/** The size of the prover broker's database. Will override the
|
|
27
|
-
|
|
25
|
+
dataStoreMapSizeKb: z.number().int().nonnegative(),
|
|
26
|
+
/** The size of the prover broker's database. Will override the dataStoreMapSizeKb if set. */
|
|
27
|
+
proverBrokerStoreMapSizeKb: z.number().int().nonnegative().optional(),
|
|
28
28
|
/** The prover broker may batch jobs together before writing to the database */
|
|
29
29
|
proverBrokerBatchSize: z.number().int().nonnegative(),
|
|
30
30
|
/** How often the job batches get flushed */
|
|
@@ -34,7 +34,7 @@ export const ProverBrokerConfig = z.object({
|
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
export type ProverBrokerConfig = z.infer<typeof ProverBrokerConfig> &
|
|
37
|
-
Pick<DataStoreConfig, '
|
|
37
|
+
Pick<DataStoreConfig, 'dataStoreMapSizeKb' | 'dataDirectory'> &
|
|
38
38
|
L1ReaderConfig &
|
|
39
39
|
Pick<ChainConfig, 'rollupVersion'>;
|
|
40
40
|
|
|
@@ -69,10 +69,10 @@ export const proverBrokerConfigMappings: ConfigMappingsType<ProverBrokerConfig>
|
|
|
69
69
|
description: 'The maximum number of epochs to keep results for',
|
|
70
70
|
...numberConfigHelper(1),
|
|
71
71
|
},
|
|
72
|
-
|
|
72
|
+
proverBrokerStoreMapSizeKb: {
|
|
73
73
|
env: 'PROVER_BROKER_STORE_MAP_SIZE_KB',
|
|
74
74
|
parseEnv: (val: string | undefined) => (val ? +val : undefined),
|
|
75
|
-
description: "The size of the prover broker's database. Will override the
|
|
75
|
+
description: "The size of the prover broker's database. Will override the dataStoreMapSizeKb if set.",
|
|
76
76
|
},
|
|
77
77
|
...dataConfigMappings,
|
|
78
78
|
...l1ReaderConfigMappings,
|
|
@@ -9,7 +9,7 @@ export async function createAndStartProvingBroker(
|
|
|
9
9
|
_config: ProverBrokerConfig,
|
|
10
10
|
client: TelemetryClient,
|
|
11
11
|
): Promise<ProvingBroker> {
|
|
12
|
-
const config = { ..._config,
|
|
12
|
+
const config = { ..._config, dataStoreMapSizeKb: _config.proverBrokerStoreMapSizeKb ?? _config.dataStoreMapSizeKb };
|
|
13
13
|
const database = config.dataDirectory ? await KVBrokerDatabase.new(config, client) : new InMemoryBrokerDatabase();
|
|
14
14
|
|
|
15
15
|
const broker = new ProvingBroker(database, config, client);
|
|
@@ -111,7 +111,7 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
111
111
|
private async estimateSize() {
|
|
112
112
|
const sizes = await Promise.all(Array.from(this.epochs.values()).map(x => x.estimateSize()));
|
|
113
113
|
return {
|
|
114
|
-
mappingSize: this.config.
|
|
114
|
+
mappingSize: this.config.dataStoreMapSizeKb,
|
|
115
115
|
physicalFileSize: sizes.reduce((prev, curr) => prev + curr.physicalFileSize, 0),
|
|
116
116
|
numItems: sizes.reduce((prev, curr) => prev + curr.numItems, 0),
|
|
117
117
|
actualSize: sizes.reduce((prev, curr) => prev + curr.actualSize, 0),
|
|
@@ -137,13 +137,13 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
137
137
|
continue;
|
|
138
138
|
}
|
|
139
139
|
logger.info(
|
|
140
|
-
`Loading broker database for epoch ${epochNumber} from ${fullDirectory} with map size ${config.
|
|
140
|
+
`Loading broker database for epoch ${epochNumber} from ${fullDirectory} with map size ${config.dataStoreMapSizeKb}KB`,
|
|
141
141
|
);
|
|
142
142
|
const db = await openVersionedStoreAt(
|
|
143
143
|
fullDirectory,
|
|
144
144
|
SingleEpochDatabase.SCHEMA_VERSION,
|
|
145
145
|
config.l1Contracts.rollupAddress,
|
|
146
|
-
config.
|
|
146
|
+
config.dataStoreMapSizeKb,
|
|
147
147
|
);
|
|
148
148
|
const epochDb = new SingleEpochDatabase(db);
|
|
149
149
|
epochs.set(epochNumber, epochDb);
|
|
@@ -202,13 +202,13 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
202
202
|
const newEpochDirectory = join(this.config.dataDirectory!, epochNumber.toString());
|
|
203
203
|
await mkdir(newEpochDirectory, { recursive: true });
|
|
204
204
|
this.logger.info(
|
|
205
|
-
`Creating broker database for epoch ${epochNumber} at ${newEpochDirectory} with map size ${this.config.
|
|
205
|
+
`Creating broker database for epoch ${epochNumber} at ${newEpochDirectory} with map size ${this.config.dataStoreMapSizeKb}`,
|
|
206
206
|
);
|
|
207
207
|
const db = await openVersionedStoreAt(
|
|
208
208
|
newEpochDirectory,
|
|
209
209
|
SingleEpochDatabase.SCHEMA_VERSION,
|
|
210
210
|
this.config.l1Contracts.rollupAddress,
|
|
211
|
-
this.config.
|
|
211
|
+
this.config.dataStoreMapSizeKb,
|
|
212
212
|
);
|
|
213
213
|
epochDb = new SingleEpochDatabase(db);
|
|
214
214
|
this.epochs.set(epochNumber, epochDb);
|