@aztec/prover-client 0.0.1-commit.7b97ef96e → 0.0.1-commit.7cbc774
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/config.d.ts +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +16 -2
- package/dest/light/lightweight_checkpoint_builder.d.ts +6 -2
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -1
- package/dest/light/lightweight_checkpoint_builder.js +40 -11
- package/dest/mocks/test_context.d.ts +3 -1
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +14 -8
- package/dest/orchestrator/block-building-helpers.d.ts +1 -1
- package/dest/orchestrator/checkpoint-proving-state.d.ts +8 -1
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-proving-state.js +10 -1
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts +107 -0
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts.map +1 -0
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.js +151 -0
- package/dest/orchestrator/epoch-proving-context.d.ts +51 -0
- package/dest/orchestrator/epoch-proving-context.d.ts.map +1 -0
- package/dest/orchestrator/epoch-proving-context.js +81 -0
- package/dest/orchestrator/epoch-proving-state.d.ts +1 -1
- package/dest/orchestrator/index.d.ts +4 -1
- package/dest/orchestrator/index.d.ts.map +1 -1
- package/dest/orchestrator/index.js +3 -0
- package/dest/orchestrator/orchestrator.d.ts +15 -25
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +33 -154
- package/dest/orchestrator/proving-scheduler.d.ts +72 -0
- package/dest/orchestrator/proving-scheduler.d.ts.map +1 -0
- package/dest/orchestrator/proving-scheduler.js +117 -0
- package/dest/orchestrator/top-tree-orchestrator.d.ts +83 -0
- package/dest/orchestrator/top-tree-orchestrator.d.ts.map +1 -0
- package/dest/orchestrator/top-tree-orchestrator.js +182 -0
- package/dest/orchestrator/top-tree-proving-scheduler.d.ts +62 -0
- package/dest/orchestrator/top-tree-proving-scheduler.d.ts.map +1 -0
- package/dest/orchestrator/top-tree-proving-scheduler.js +73 -0
- package/dest/orchestrator/top-tree-proving-state.d.ts +61 -0
- package/dest/orchestrator/top-tree-proving-state.d.ts.map +1 -0
- package/dest/orchestrator/top-tree-proving-state.js +185 -0
- package/dest/prover-client/prover-client.d.ts +62 -3
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +50 -2
- package/dest/proving_broker/broker_prover_facade.d.ts +1 -1
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +13 -19
- package/dest/proving_broker/config.d.ts +9 -73
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +3 -3
- package/dest/proving_broker/index.d.ts +2 -1
- package/dest/proving_broker/index.d.ts.map +1 -1
- package/dest/proving_broker/index.js +1 -0
- package/dest/proving_broker/proving_broker.d.ts +2 -2
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +39 -10
- package/dest/proving_broker/proving_broker_database/persisted.js +2 -2
- package/dest/proving_broker/proving_broker_instrumentation.d.ts +3 -1
- package/dest/proving_broker/proving_broker_instrumentation.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_instrumentation.js +7 -0
- package/dest/proving_broker/rpc.d.ts +3 -1
- package/dest/proving_broker/rpc.d.ts.map +1 -1
- package/dest/proving_broker/rpc.js +80 -24
- package/dest/test/mock_prover.d.ts +3 -3
- package/package.json +18 -19
- package/src/config.ts +18 -2
- package/src/light/lightweight_checkpoint_builder.ts +46 -20
- package/src/mocks/test_context.ts +12 -9
- package/src/orchestrator/checkpoint-proving-state.ts +14 -1
- package/src/orchestrator/checkpoint-sub-tree-orchestrator.ts +271 -0
- package/src/orchestrator/epoch-proving-context.ts +101 -0
- package/src/orchestrator/index.ts +8 -0
- package/src/orchestrator/orchestrator.ts +46 -210
- package/src/orchestrator/proving-scheduler.ts +156 -0
- package/src/orchestrator/top-tree-orchestrator.ts +314 -0
- package/src/orchestrator/top-tree-proving-scheduler.ts +154 -0
- package/src/orchestrator/top-tree-proving-state.ts +220 -0
- package/src/prover-client/prover-client.ts +127 -2
- package/src/proving_broker/broker_prover_facade.ts +17 -20
- package/src/proving_broker/config.ts +3 -2
- package/src/proving_broker/index.ts +1 -0
- package/src/proving_broker/proving_broker.ts +34 -7
- package/src/proving_broker/proving_broker_database/persisted.ts +2 -2
- package/src/proving_broker/proving_broker_instrumentation.ts +9 -0
- package/src/proving_broker/rpc.ts +36 -24
|
@@ -239,18 +239,27 @@ import { ProvingBrokerInstrumentation } from './proving_broker_instrumentation.j
|
|
|
239
239
|
this.logger.info(`Cancelling job id=${id}`, {
|
|
240
240
|
provingJobId: id
|
|
241
241
|
});
|
|
242
|
-
await this.#reportProvingJobError(id, 'Aborted', false);
|
|
242
|
+
await this.#reportProvingJobError(id, 'Aborted', false, undefined, true);
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
cleanUpProvingJobState(ids) {
|
|
246
|
+
const idsToClean = new Set(ids);
|
|
246
247
|
for (const id of ids){
|
|
247
248
|
this.jobsCache.delete(id);
|
|
249
|
+
const deferred = this.promises.get(id);
|
|
250
|
+
if (deferred) {
|
|
251
|
+
deferred.resolve({
|
|
252
|
+
status: 'rejected',
|
|
253
|
+
reason: 'Proving job cleaned up'
|
|
254
|
+
});
|
|
255
|
+
}
|
|
248
256
|
this.promises.delete(id);
|
|
249
257
|
this.resultsCache.delete(id);
|
|
250
258
|
this.inProgress.delete(id);
|
|
251
259
|
this.retries.delete(id);
|
|
252
260
|
this.enqueuedAt.delete(id);
|
|
253
261
|
}
|
|
262
|
+
this.completedJobNotifications = this.completedJobNotifications.filter((id)=>!idsToClean.has(id));
|
|
254
263
|
}
|
|
255
264
|
#getProvingJobStatus(id) {
|
|
256
265
|
const result = this.resultsCache.get(id);
|
|
@@ -313,7 +322,7 @@ import { ProvingBrokerInstrumentation } from './proving_broker_instrumentation.j
|
|
|
313
322
|
}
|
|
314
323
|
return undefined;
|
|
315
324
|
}
|
|
316
|
-
async #reportProvingJobError(id, err, retry = false, filter) {
|
|
325
|
+
async #reportProvingJobError(id, err, retry = false, filter, aborted = false) {
|
|
317
326
|
const info = this.inProgress.get(id);
|
|
318
327
|
const item = this.jobsCache.get(id);
|
|
319
328
|
const retries = this.retries.get(id) ?? 0;
|
|
@@ -360,7 +369,11 @@ import { ProvingBrokerInstrumentation } from './proving_broker_instrumentation.j
|
|
|
360
369
|
this.resultsCache.set(id, result);
|
|
361
370
|
this.promises.get(id).resolve(result);
|
|
362
371
|
this.completedJobNotifications.push(id);
|
|
363
|
-
|
|
372
|
+
if (aborted) {
|
|
373
|
+
this.instrumentation.incAbortedJobs(item.type);
|
|
374
|
+
} else {
|
|
375
|
+
this.instrumentation.incRejectedJobs(item.type);
|
|
376
|
+
}
|
|
364
377
|
if (info) {
|
|
365
378
|
const duration = this.msTimeSource() - info.startedAt;
|
|
366
379
|
this.instrumentation.recordJobDuration(item.type, duration);
|
|
@@ -475,20 +488,20 @@ import { ProvingBrokerInstrumentation } from './proving_broker_instrumentation.j
|
|
|
475
488
|
return this.#getProvingJob(filter);
|
|
476
489
|
}
|
|
477
490
|
async cleanupPass() {
|
|
478
|
-
this.cleanupStaleJobs();
|
|
479
491
|
this.reEnqueueExpiredJobs();
|
|
480
492
|
const oldestEpochToKeep = this.oldestEpochToKeep();
|
|
481
493
|
if (oldestEpochToKeep > 0) {
|
|
494
|
+
this.cleanupJobsOlderThanEpoch(EpochNumber(oldestEpochToKeep));
|
|
482
495
|
await this.database.deleteAllProvingJobsOlderThanEpoch(EpochNumber(oldestEpochToKeep));
|
|
483
496
|
this.logger.trace(`Deleted all epochs older than ${oldestEpochToKeep}`);
|
|
484
497
|
}
|
|
485
498
|
}
|
|
486
|
-
|
|
499
|
+
cleanupJobsOlderThanEpoch(epochNumber) {
|
|
487
500
|
const jobIds = Array.from(this.jobsCache.keys());
|
|
488
501
|
const jobsToClean = [];
|
|
489
502
|
for (const id of jobIds){
|
|
490
503
|
const job = this.jobsCache.get(id);
|
|
491
|
-
if (
|
|
504
|
+
if (job.epochNumber < epochNumber) {
|
|
492
505
|
jobsToClean.push(id);
|
|
493
506
|
}
|
|
494
507
|
}
|
|
@@ -511,12 +524,28 @@ import { ProvingBrokerInstrumentation } from './proving_broker_instrumentation.j
|
|
|
511
524
|
const now = this.msTimeSource();
|
|
512
525
|
const msSinceLastUpdate = now - metadata.lastUpdatedAt;
|
|
513
526
|
if (msSinceLastUpdate >= this.jobTimeoutMs) {
|
|
514
|
-
this.logger.warn(`Proving job id=${id} timed out. Adding it back to the queue.`, {
|
|
515
|
-
provingJobId: id
|
|
516
|
-
});
|
|
517
527
|
this.inProgress.delete(id);
|
|
518
|
-
this.enqueueJobInternal(item);
|
|
519
528
|
this.instrumentation.incTimedOutJobs(item.type);
|
|
529
|
+
const retries = this.retries.get(id) ?? 0;
|
|
530
|
+
if (retries + 1 < this.maxRetries && !this.isJobStale(item)) {
|
|
531
|
+
this.logger.warn(`Proving job id=${id} timed out. Re-enqueueing (retry ${retries + 1}/${this.maxRetries}).`, {
|
|
532
|
+
provingJobId: id
|
|
533
|
+
});
|
|
534
|
+
this.retries.set(id, retries + 1);
|
|
535
|
+
this.enqueueJobInternal(item);
|
|
536
|
+
} else {
|
|
537
|
+
this.logger.error(`Proving job id=${id} timed out after ${retries + 1} attempts. Marking as failed.`, {
|
|
538
|
+
provingJobId: id
|
|
539
|
+
});
|
|
540
|
+
const result = {
|
|
541
|
+
status: 'rejected',
|
|
542
|
+
reason: 'Timed out'
|
|
543
|
+
};
|
|
544
|
+
this.resultsCache.set(id, result);
|
|
545
|
+
this.promises.get(id)?.resolve(result);
|
|
546
|
+
this.completedJobNotifications.push(id);
|
|
547
|
+
this.instrumentation.incRejectedJobs(item.type);
|
|
548
|
+
}
|
|
520
549
|
}
|
|
521
550
|
}
|
|
522
551
|
}
|
|
@@ -499,7 +499,7 @@ export class KVBrokerDatabase {
|
|
|
499
499
|
continue;
|
|
500
500
|
}
|
|
501
501
|
logger.info(`Loading broker database for epoch ${epochNumber} from ${fullDirectory} with map size ${config.dataStoreMapSizeKb}KB`);
|
|
502
|
-
const db = await openVersionedStoreAt(fullDirectory, SingleEpochDatabase.SCHEMA_VERSION, config.
|
|
502
|
+
const db = await openVersionedStoreAt(fullDirectory, SingleEpochDatabase.SCHEMA_VERSION, config.rollupAddress, config.dataStoreMapSizeKb);
|
|
503
503
|
const epochDb = new SingleEpochDatabase(db);
|
|
504
504
|
epochs.set(epochNumber, epochDb);
|
|
505
505
|
}
|
|
@@ -563,7 +563,7 @@ export class KVBrokerDatabase {
|
|
|
563
563
|
recursive: true
|
|
564
564
|
});
|
|
565
565
|
this.logger.info(`Creating broker database for epoch ${epochNumber} at ${newEpochDirectory} with map size ${this.config.dataStoreMapSizeKb}`);
|
|
566
|
-
const db = await openVersionedStoreAt(newEpochDirectory, SingleEpochDatabase.SCHEMA_VERSION, this.config.
|
|
566
|
+
const db = await openVersionedStoreAt(newEpochDirectory, SingleEpochDatabase.SCHEMA_VERSION, this.config.rollupAddress, this.config.dataStoreMapSizeKb);
|
|
567
567
|
epochDb = new SingleEpochDatabase(db);
|
|
568
568
|
this.epochs.set(epochNumber, epochDb);
|
|
569
569
|
}
|
|
@@ -7,6 +7,7 @@ export declare class ProvingBrokerInstrumentation {
|
|
|
7
7
|
private activeJobs;
|
|
8
8
|
private resolvedJobs;
|
|
9
9
|
private rejectedJobs;
|
|
10
|
+
private abortedJobs;
|
|
10
11
|
private timedOutJobs;
|
|
11
12
|
private cachedJobs;
|
|
12
13
|
private totalJobs;
|
|
@@ -18,6 +19,7 @@ export declare class ProvingBrokerInstrumentation {
|
|
|
18
19
|
monitorActiveJobs(fn: MonitorCallback): void;
|
|
19
20
|
incResolvedJobs(proofType: ProvingRequestType): void;
|
|
20
21
|
incRejectedJobs(proofType: ProvingRequestType): void;
|
|
22
|
+
incAbortedJobs(proofType: ProvingRequestType): void;
|
|
21
23
|
incRetriedJobs(proofType: ProvingRequestType): void;
|
|
22
24
|
incTimedOutJobs(proofType: ProvingRequestType): void;
|
|
23
25
|
incCachedJobs(proofType: ProvingRequestType): void;
|
|
@@ -26,4 +28,4 @@ export declare class ProvingBrokerInstrumentation {
|
|
|
26
28
|
recordJobDuration(proofType: ProvingRequestType, msOrTimer: Timer | number): void;
|
|
27
29
|
private observe;
|
|
28
30
|
}
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdmluZ19icm9rZXJfaW5zdHJ1bWVudGF0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHJvdmluZ19icm9rZXIvcHJvdmluZ19icm9rZXJfaW5zdHJ1bWVudGF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3JELE9BQU8sRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQzFELE9BQU8sRUFNTCxLQUFLLGVBQWUsRUFHckIsTUFBTSx5QkFBeUIsQ0FBQztBQUVqQyxNQUFNLE1BQU0sZUFBZSxHQUFHLENBQUMsU0FBUyxFQUFFLGtCQUFrQixLQUFLLE1BQU0sQ0FBQztBQUV4RSxxQkFBYSw0QkFBNEI7SUFDdkMsT0FBTyxDQUFDLFNBQVMsQ0FBa0I7SUFDbkMsT0FBTyxDQUFDLFVBQVUsQ0FBa0I7SUFDcEMsT0FBTyxDQUFDLFlBQVksQ0FBZ0I7SUFDcEMsT0FBTyxDQUFDLFlBQVksQ0FBZ0I7SUFDcEMsT0FBTyxDQUFDLFdBQVcsQ0FBZ0I7SUFDbkMsT0FBTyxDQUFDLFlBQVksQ0FBZ0I7SUFDcEMsT0FBTyxDQUFDLFVBQVUsQ0FBZ0I7SUFDbEMsT0FBTyxDQUFDLFNBQVMsQ0FBZ0I7SUFDakMsT0FBTyxDQUFDLE9BQU8sQ0FBWTtJQUMzQixPQUFPLENBQUMsV0FBVyxDQUFZO0lBQy9CLE9BQU8sQ0FBQyxXQUFXLENBQWdCO0lBRW5DLFlBQVksTUFBTSxFQUFFLGVBQWUsRUFBRSxJQUFJLFNBQWtCLEVBMkIxRDtJQUVELGlCQUFpQixDQUFDLEVBQUUsRUFBRSxlQUFlLFFBRXBDO0lBRUQsaUJBQWlCLENBQUMsRUFBRSxFQUFFLGVBQWUsUUFFcEM7SUFFRCxlQUFlLENBQUMsU0FBUyxFQUFFLGtCQUFrQixRQUk1QztJQUVELGVBQWUsQ0FBQyxTQUFTLEVBQUUsa0JBQWtCLFFBSTVDO0lBRUQsY0FBYyxDQUFDLFNBQVMsRUFBRSxrQkFBa0IsUUFJM0M7SUFFRCxjQUFjLENBQUMsU0FBUyxFQUFFLGtCQUFrQixRQUkzQztJQUVELGVBQWUsQ0FBQyxTQUFTLEVBQUUsa0JBQWtCLFFBSTVDO0lBRUQsYUFBYSxDQUFDLFNBQVMsRUFBRSxrQkFBa0IsUUFJMUM7SUFFRCxZQUFZLENBQUMsU0FBUyxFQUFFLGtCQUFrQixRQUl6QztJQUVELGFBQWEsQ0FBQyxTQUFTLEVBQUUsa0JBQWtCLEVBQUUsU0FBUyxFQUFFLEtBQUssR0FBRyxNQUFNLFFBS3JFO0lBRUQsaUJBQWlCLENBQUMsU0FBUyxFQUFFLGtCQUFrQixFQUFFLFNBQVMsRUFBRSxLQUFLLEdBQUcsTUFBTSxRQUt6RTtJQUVELE9BQU8sQ0FBQyxPQUFPO0NBV2hCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proving_broker_instrumentation.d.ts","sourceRoot":"","sources":["../../src/proving_broker/proving_broker_instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAML,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,kBAAkB,KAAK,MAAM,CAAC;AAExE,qBAAa,4BAA4B;IACvC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,OAAO,CAAY;IAC3B,OAAO,CAAC,WAAW,CAAY;IAC/B,OAAO,CAAC,WAAW,CAAgB;IAEnC,YAAY,MAAM,EAAE,eAAe,EAAE,IAAI,SAAkB,
|
|
1
|
+
{"version":3,"file":"proving_broker_instrumentation.d.ts","sourceRoot":"","sources":["../../src/proving_broker/proving_broker_instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAML,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,kBAAkB,KAAK,MAAM,CAAC;AAExE,qBAAa,4BAA4B;IACvC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,OAAO,CAAY;IAC3B,OAAO,CAAC,WAAW,CAAY;IAC/B,OAAO,CAAC,WAAW,CAAgB;IAEnC,YAAY,MAAM,EAAE,eAAe,EAAE,IAAI,SAAkB,EA2B1D;IAED,iBAAiB,CAAC,EAAE,EAAE,eAAe,QAEpC;IAED,iBAAiB,CAAC,EAAE,EAAE,eAAe,QAEpC;IAED,eAAe,CAAC,SAAS,EAAE,kBAAkB,QAI5C;IAED,eAAe,CAAC,SAAS,EAAE,kBAAkB,QAI5C;IAED,cAAc,CAAC,SAAS,EAAE,kBAAkB,QAI3C;IAED,cAAc,CAAC,SAAS,EAAE,kBAAkB,QAI3C;IAED,eAAe,CAAC,SAAS,EAAE,kBAAkB,QAI5C;IAED,aAAa,CAAC,SAAS,EAAE,kBAAkB,QAI1C;IAED,YAAY,CAAC,SAAS,EAAE,kBAAkB,QAIzC;IAED,aAAa,CAAC,SAAS,EAAE,kBAAkB,EAAE,SAAS,EAAE,KAAK,GAAG,MAAM,QAKrE;IAED,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,SAAS,EAAE,KAAK,GAAG,MAAM,QAKzE;IAED,OAAO,CAAC,OAAO;CAWhB"}
|
|
@@ -5,6 +5,7 @@ export class ProvingBrokerInstrumentation {
|
|
|
5
5
|
activeJobs;
|
|
6
6
|
resolvedJobs;
|
|
7
7
|
rejectedJobs;
|
|
8
|
+
abortedJobs;
|
|
8
9
|
timedOutJobs;
|
|
9
10
|
cachedJobs;
|
|
10
11
|
totalJobs;
|
|
@@ -21,6 +22,7 @@ export class ProvingBrokerInstrumentation {
|
|
|
21
22
|
};
|
|
22
23
|
this.resolvedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_RESOLVED_JOBS, provingJobAttrs);
|
|
23
24
|
this.rejectedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_REJECTED_JOBS, provingJobAttrs);
|
|
25
|
+
this.abortedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_ABORTED_JOBS, provingJobAttrs);
|
|
24
26
|
this.retriedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_RETRIED_JOBS, provingJobAttrs);
|
|
25
27
|
this.timedOutJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_TIMED_OUT_JOBS, provingJobAttrs);
|
|
26
28
|
this.cachedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_CACHED_JOBS, provingJobAttrs);
|
|
@@ -44,6 +46,11 @@ export class ProvingBrokerInstrumentation {
|
|
|
44
46
|
[Attributes.PROVING_JOB_TYPE]: ProvingRequestType[proofType]
|
|
45
47
|
});
|
|
46
48
|
}
|
|
49
|
+
incAbortedJobs(proofType) {
|
|
50
|
+
this.abortedJobs.add(1, {
|
|
51
|
+
[Attributes.PROVING_JOB_TYPE]: ProvingRequestType[proofType]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
47
54
|
incRetriedJobs(proofType) {
|
|
48
55
|
this.retriedJobs.add(1, {
|
|
49
56
|
[Attributes.PROVING_JOB_TYPE]: ProvingRequestType[proofType]
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type ProvingJobBroker, type ProvingJobBrokerDebug, type ProvingJobConsumer, type ProvingJobProducer } from '@aztec/stdlib/interfaces/server';
|
|
2
2
|
import { type ApiSchemaFor } from '@aztec/stdlib/schemas';
|
|
3
3
|
import { type ComponentsVersions } from '@aztec/stdlib/versioning';
|
|
4
|
+
/** Indefinite backoff for broker communication: 1, 1, 1, 2, 4, 4, 4, ... seconds. */
|
|
5
|
+
export declare function proverBrokerBackoff(): Generator<number, void, unknown>;
|
|
4
6
|
export declare const ProvingJobProducerSchema: ApiSchemaFor<ProvingJobProducer>;
|
|
5
7
|
export declare const ProvingJobConsumerSchema: ApiSchemaFor<ProvingJobConsumer>;
|
|
6
8
|
export declare const ProvingJobBrokerSchema: ApiSchemaFor<ProvingJobBroker>;
|
|
@@ -24,4 +26,4 @@ export declare function createProvingJobConsumerClient(url: string, versions: Pa
|
|
|
24
26
|
get: (header: string) => string | null | undefined;
|
|
25
27
|
};
|
|
26
28
|
}>): ProvingJobConsumer;
|
|
27
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnBjLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHJvdmluZ19icm9rZXIvcnBjLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sRUFJTCxLQUFLLGdCQUFnQixFQUNyQixLQUFLLHFCQUFxQixFQUMxQixLQUFLLGtCQUFrQixFQUV2QixLQUFLLGtCQUFrQixFQUV4QixNQUFNLGlDQUFpQyxDQUFDO0FBRXpDLE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBWSxNQUFNLHVCQUF1QixDQUFDO0FBQ3BFLE9BQU8sRUFBRSxLQUFLLGtCQUFrQixFQUFnQyxNQUFNLDBCQUEwQixDQUFDO0FBS2pHLHFGQUFxRjtBQUNyRix3QkFBaUIsbUJBQW1CLHFDQU1uQztBQVdELGVBQU8sTUFBTSx3QkFBd0IsRUFBRSxZQUFZLENBQUMsa0JBQWtCLENBS3JFLENBQUM7QUFFRixlQUFPLE1BQU0sd0JBQXdCLEVBQUUsWUFBWSxDQUFDLGtCQUFrQixDQWlCckUsQ0FBQztBQUVGLGVBQU8sTUFBTSxzQkFBc0IsRUFBRSxZQUFZLENBQUMsZ0JBQWdCLENBR2pFLENBQUM7QUFFRixlQUFPLE1BQU0sMkJBQTJCLEVBQUUsWUFBWSxDQUFDLHFCQUFxQixDQUszRSxDQUFDO0FBRUYsZUFBTyxNQUFNLCtCQUErQixFQUFFLFlBQVksQ0FBQyxnQkFBZ0IsR0FBRyxxQkFBcUIsQ0FHbEcsQ0FBQztBQUVGLHdCQUFnQiw0QkFBNEIsQ0FDMUMsR0FBRyxFQUFFLE1BQU0sRUFDWCxRQUFRLEVBQUUsT0FBTyxDQUFDLGtCQUFrQixDQUFDLEVBQ3JDLEtBQUs7Ozs7O0VBQThDLEdBQ2xELGdCQUFnQixDQU1sQjtBQUVELHdCQUFnQiw4QkFBOEIsQ0FDNUMsR0FBRyxFQUFFLE1BQU0sRUFDWCxRQUFRLEVBQUUsT0FBTyxDQUFDLGtCQUFrQixDQUFDLEVBQ3JDLEtBQUs7Ozs7O0VBQThDLEdBQ2xELGtCQUFrQixDQU1wQjtBQUVELHdCQUFnQiw4QkFBOEIsQ0FDNUMsR0FBRyxFQUFFLE1BQU0sRUFDWCxRQUFRLEVBQUUsT0FBTyxDQUFDLGtCQUFrQixDQUFDLEVBQ3JDLEtBQUs7Ozs7O0VBQThDLEdBQ2xELGtCQUFrQixDQU1wQiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../../src/proving_broker/rpc.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAEvB,KAAK,kBAAkB,EAExB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,KAAK,YAAY,EAAY,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,KAAK,kBAAkB,EAAgC,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../../src/proving_broker/rpc.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAEvB,KAAK,kBAAkB,EAExB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,KAAK,YAAY,EAAY,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,KAAK,kBAAkB,EAAgC,MAAM,0BAA0B,CAAC;AAKjG,qFAAqF;AACrF,wBAAiB,mBAAmB,qCAMnC;AAWD,eAAO,MAAM,wBAAwB,EAAE,YAAY,CAAC,kBAAkB,CAKrE,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,YAAY,CAAC,kBAAkB,CAiBrE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,YAAY,CAAC,gBAAgB,CAGjE,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,YAAY,CAAC,qBAAqB,CAK3E,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,YAAY,CAAC,gBAAgB,GAAG,qBAAqB,CAGlG,CAAC;AAEF,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,EACrC,KAAK;;;;;EAA8C,GAClD,gBAAgB,CAMlB;AAED,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,EACrC,KAAK;;;;;EAA8C,GAClD,kBAAkB,CAMpB;AAED,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,EACrC,KAAK;;;;;EAA8C,GAClD,kBAAkB,CAMpB"}
|
|
@@ -6,6 +6,19 @@ import { optional } from '@aztec/stdlib/schemas';
|
|
|
6
6
|
import { getVersioningResponseHandler } from '@aztec/stdlib/versioning';
|
|
7
7
|
import { makeTracedFetch } from '@aztec/telemetry-client';
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
+
/** Indefinite backoff for broker communication: 1, 1, 1, 2, 4, 4, 4, ... seconds. */ export function* proverBrokerBackoff() {
|
|
10
|
+
const v = [
|
|
11
|
+
1,
|
|
12
|
+
1,
|
|
13
|
+
1,
|
|
14
|
+
2,
|
|
15
|
+
4
|
|
16
|
+
];
|
|
17
|
+
let i = 0;
|
|
18
|
+
while(true){
|
|
19
|
+
yield v[Math.min(i++, v.length - 1)];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
9
22
|
const ProvingJobFilterSchema = z.object({
|
|
10
23
|
allowList: z.array(z.nativeEnum(ProvingRequestType))
|
|
11
24
|
});
|
|
@@ -14,55 +27,98 @@ const GetProvingJobResponse = z.object({
|
|
|
14
27
|
time: z.number()
|
|
15
28
|
});
|
|
16
29
|
export const ProvingJobProducerSchema = {
|
|
17
|
-
enqueueProvingJob: z.function(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
enqueueProvingJob: z.function({
|
|
31
|
+
input: z.tuple([
|
|
32
|
+
ProvingJob
|
|
33
|
+
]),
|
|
34
|
+
output: ProvingJobStatus
|
|
35
|
+
}),
|
|
36
|
+
getProvingJobStatus: z.function({
|
|
37
|
+
input: z.tuple([
|
|
38
|
+
ProvingJobId
|
|
39
|
+
]),
|
|
40
|
+
output: ProvingJobStatus
|
|
41
|
+
}),
|
|
42
|
+
cancelProvingJob: z.function({
|
|
43
|
+
input: z.tuple([
|
|
44
|
+
ProvingJobId
|
|
45
|
+
]),
|
|
46
|
+
output: z.void()
|
|
47
|
+
}),
|
|
48
|
+
getCompletedJobs: z.function({
|
|
49
|
+
input: z.tuple([
|
|
50
|
+
z.array(ProvingJobId)
|
|
51
|
+
]),
|
|
52
|
+
output: z.array(ProvingJobId)
|
|
53
|
+
})
|
|
21
54
|
};
|
|
22
55
|
export const ProvingJobConsumerSchema = {
|
|
23
|
-
getProvingJob: z.function(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
56
|
+
getProvingJob: z.function({
|
|
57
|
+
input: z.tuple([
|
|
58
|
+
optional(ProvingJobFilterSchema)
|
|
59
|
+
]),
|
|
60
|
+
output: GetProvingJobResponse.optional()
|
|
61
|
+
}),
|
|
62
|
+
reportProvingJobError: z.function({
|
|
63
|
+
input: z.tuple([
|
|
64
|
+
ProvingJobId,
|
|
65
|
+
z.string(),
|
|
66
|
+
optional(z.boolean()),
|
|
67
|
+
optional(ProvingJobFilterSchema)
|
|
68
|
+
]),
|
|
69
|
+
output: GetProvingJobResponse.optional()
|
|
70
|
+
}),
|
|
71
|
+
reportProvingJobProgress: z.function({
|
|
72
|
+
input: z.tuple([
|
|
73
|
+
ProvingJobId,
|
|
74
|
+
z.number(),
|
|
75
|
+
optional(ProvingJobFilterSchema)
|
|
76
|
+
]),
|
|
77
|
+
output: GetProvingJobResponse.optional()
|
|
78
|
+
}),
|
|
79
|
+
reportProvingJobSuccess: z.function({
|
|
80
|
+
input: z.tuple([
|
|
81
|
+
ProvingJobId,
|
|
82
|
+
ProofUri,
|
|
83
|
+
optional(ProvingJobFilterSchema)
|
|
84
|
+
]),
|
|
85
|
+
output: GetProvingJobResponse.optional()
|
|
86
|
+
})
|
|
27
87
|
};
|
|
28
88
|
export const ProvingJobBrokerSchema = {
|
|
29
89
|
...ProvingJobConsumerSchema,
|
|
30
90
|
...ProvingJobProducerSchema
|
|
31
91
|
};
|
|
32
92
|
export const ProvingJobBrokerDebugSchema = {
|
|
33
|
-
replayProvingJob: z.function(
|
|
93
|
+
replayProvingJob: z.function({
|
|
94
|
+
input: z.tuple([
|
|
95
|
+
ProvingJobId,
|
|
96
|
+
z.nativeEnum(ProvingRequestType),
|
|
97
|
+
EpochNumberSchema,
|
|
98
|
+
ProofUri
|
|
99
|
+
]),
|
|
100
|
+
output: ProvingJobStatus
|
|
101
|
+
})
|
|
34
102
|
};
|
|
35
103
|
export const ProvingJobBrokerSchemaWithDebug = {
|
|
36
104
|
...ProvingJobBrokerSchema,
|
|
37
105
|
...ProvingJobBrokerDebugSchema
|
|
38
106
|
};
|
|
39
|
-
export function createProvingJobBrokerClient(url, versions, fetch = makeTracedFetch(
|
|
40
|
-
1,
|
|
41
|
-
2,
|
|
42
|
-
3
|
|
43
|
-
], false)) {
|
|
107
|
+
export function createProvingJobBrokerClient(url, versions, fetch = makeTracedFetch(proverBrokerBackoff, false)) {
|
|
44
108
|
return createSafeJsonRpcClient(url, ProvingJobBrokerSchema, {
|
|
45
109
|
namespaceMethods: 'proverBroker',
|
|
46
110
|
fetch,
|
|
47
111
|
onResponse: getVersioningResponseHandler(versions)
|
|
48
112
|
});
|
|
49
113
|
}
|
|
50
|
-
export function createProvingJobProducerClient(url, versions, fetch = makeTracedFetch(
|
|
51
|
-
1,
|
|
52
|
-
2,
|
|
53
|
-
3
|
|
54
|
-
], false)) {
|
|
114
|
+
export function createProvingJobProducerClient(url, versions, fetch = makeTracedFetch(proverBrokerBackoff, false)) {
|
|
55
115
|
return createSafeJsonRpcClient(url, ProvingJobProducerSchema, {
|
|
56
116
|
namespaceMethods: 'provingJobProducer',
|
|
57
117
|
fetch,
|
|
58
118
|
onResponse: getVersioningResponseHandler(versions)
|
|
59
119
|
});
|
|
60
120
|
}
|
|
61
|
-
export function createProvingJobConsumerClient(url, versions, fetch = makeTracedFetch(
|
|
62
|
-
1,
|
|
63
|
-
2,
|
|
64
|
-
3
|
|
65
|
-
], false)) {
|
|
121
|
+
export function createProvingJobConsumerClient(url, versions, fetch = makeTracedFetch(proverBrokerBackoff, false)) {
|
|
66
122
|
return createSafeJsonRpcClient(url, ProvingJobConsumerSchema, {
|
|
67
123
|
namespaceMethods: 'provingJobConsumer',
|
|
68
124
|
fetch,
|
|
@@ -20,8 +20,8 @@ export declare class TestBroker implements ProvingJobProducer {
|
|
|
20
20
|
export declare class MockProver implements ServerCircuitProver {
|
|
21
21
|
constructor();
|
|
22
22
|
getAvmProof(_inputs: AvmCircuitInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<import("@aztec/stdlib/proofs").RecursiveProof<16400>>;
|
|
23
|
-
getBaseParityProof(_inputs: ParityBasePrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<import("@aztec/stdlib/parity").ParityPublicInputs,
|
|
24
|
-
getRootParityProof(_inputs: ParityRootPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<import("@aztec/stdlib/parity").ParityPublicInputs,
|
|
23
|
+
getBaseParityProof(_inputs: ParityBasePrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<import("@aztec/stdlib/parity").ParityPublicInputs, 410>>;
|
|
24
|
+
getRootParityProof(_inputs: ParityRootPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<import("@aztec/stdlib/parity").ParityPublicInputs, 410>>;
|
|
25
25
|
getPublicChonkVerifierProof(_inputs: PublicChonkVerifierPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<PublicChonkVerifierPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
26
26
|
getPrivateTxBaseRollupProof(_baseRollupInput: PrivateTxBaseRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
27
27
|
getPublicTxBaseRollupProof(_inputs: PublicTxBaseRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
@@ -31,7 +31,7 @@ export declare class MockProver implements ServerCircuitProver {
|
|
|
31
31
|
getBlockRootEmptyTxFirstRollupProof(_input: BlockRootEmptyTxFirstRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
32
32
|
getBlockRootRollupProof(_input: BlockRootRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
33
33
|
getBlockRootSingleTxRollupProof(_input: BlockRootSingleTxRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
34
|
-
getBlockMergeRollupProof(_input: BlockMergeRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs,
|
|
34
|
+
getBlockMergeRollupProof(_input: BlockMergeRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, 480>>;
|
|
35
35
|
getCheckpointRootRollupProof(_input: CheckpointRootRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
36
36
|
getCheckpointRootSingleBlockRollupProof(_input: CheckpointRootSingleBlockRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
37
37
|
getCheckpointMergeRollupProof(_input: CheckpointMergeRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/prover-client",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.7cbc774",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"build:dev": "../scripts/tsc.sh --watch",
|
|
28
28
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
29
29
|
"bb": "node --no-warnings ./dest/bb/index.js",
|
|
30
|
-
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=3500000
|
|
31
|
-
"test:debug": "LOG_LEVEL
|
|
30
|
+
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=3500000",
|
|
31
|
+
"test:debug": "LOG_LEVEL=\"debug; info: json-rpc, simulator\" NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=1500000 --testNamePattern prover/bb_prover/parity"
|
|
32
32
|
},
|
|
33
33
|
"jest": {
|
|
34
34
|
"moduleNameMapper": {
|
|
@@ -68,29 +68,28 @@
|
|
|
68
68
|
]
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
72
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
73
|
-
"@aztec/constants": "0.0.1-commit.
|
|
74
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
75
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
76
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
77
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
78
|
-
"@aztec/noir-types": "0.0.1-commit.
|
|
79
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
80
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
81
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
82
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
83
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
84
|
-
"@google-cloud/storage": "^7.15.0",
|
|
71
|
+
"@aztec/bb-prover": "0.0.1-commit.7cbc774",
|
|
72
|
+
"@aztec/blob-lib": "0.0.1-commit.7cbc774",
|
|
73
|
+
"@aztec/constants": "0.0.1-commit.7cbc774",
|
|
74
|
+
"@aztec/ethereum": "0.0.1-commit.7cbc774",
|
|
75
|
+
"@aztec/foundation": "0.0.1-commit.7cbc774",
|
|
76
|
+
"@aztec/kv-store": "0.0.1-commit.7cbc774",
|
|
77
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.7cbc774",
|
|
78
|
+
"@aztec/noir-types": "0.0.1-commit.7cbc774",
|
|
79
|
+
"@aztec/protocol-contracts": "0.0.1-commit.7cbc774",
|
|
80
|
+
"@aztec/simulator": "0.0.1-commit.7cbc774",
|
|
81
|
+
"@aztec/stdlib": "0.0.1-commit.7cbc774",
|
|
82
|
+
"@aztec/telemetry-client": "0.0.1-commit.7cbc774",
|
|
83
|
+
"@aztec/world-state": "0.0.1-commit.7cbc774",
|
|
85
84
|
"@iarna/toml": "^2.2.5",
|
|
86
85
|
"commander": "^12.1.0",
|
|
87
86
|
"lodash.chunk": "^4.2.0",
|
|
88
87
|
"source-map-support": "^0.5.21",
|
|
89
88
|
"tslib": "^2.4.0",
|
|
90
|
-
"zod": "^
|
|
89
|
+
"zod": "^4"
|
|
91
90
|
},
|
|
92
91
|
"devDependencies": {
|
|
93
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
92
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.7cbc774",
|
|
94
93
|
"@jest/globals": "^30.0.0",
|
|
95
94
|
"@types/jest": "^30.0.0",
|
|
96
95
|
"@types/node": "^22.15.17",
|
package/src/config.ts
CHANGED
|
@@ -44,14 +44,30 @@ export const bbConfigMappings: ConfigMappingsType<BBConfig & ACVMConfig> = {
|
|
|
44
44
|
},
|
|
45
45
|
numConcurrentIVCVerifiers: {
|
|
46
46
|
env: 'BB_NUM_IVC_VERIFIERS',
|
|
47
|
-
description: 'Max
|
|
47
|
+
description: 'Max concurrent verifications for the RPC verifier (QueuedIVCVerifier).',
|
|
48
48
|
...numberConfigHelper(8),
|
|
49
49
|
},
|
|
50
50
|
bbIVCConcurrency: {
|
|
51
51
|
env: 'BB_IVC_CONCURRENCY',
|
|
52
|
-
description: '
|
|
52
|
+
description: 'Thread count for the RPC IVC verifier.',
|
|
53
53
|
...numberConfigHelper(1),
|
|
54
54
|
},
|
|
55
|
+
bbChonkVerifyMaxBatch: {
|
|
56
|
+
env: 'BB_CHONK_VERIFY_MAX_BATCH',
|
|
57
|
+
description:
|
|
58
|
+
'Upper bound on proofs per batch for the peer chonk batch verifier. Proofs are verified immediately as they arrive; this only caps how many can accumulate while a batch is already being processed.',
|
|
59
|
+
...numberConfigHelper(16),
|
|
60
|
+
},
|
|
61
|
+
bbChonkVerifyConcurrency: {
|
|
62
|
+
env: 'BB_CHONK_VERIFY_BATCH_CONCURRENCY',
|
|
63
|
+
description: 'Thread count for the peer batch verifier parallel reduce. 0 = auto.',
|
|
64
|
+
...numberConfigHelper(6),
|
|
65
|
+
},
|
|
66
|
+
bbDebugOutputDir: {
|
|
67
|
+
env: 'BB_DEBUG_OUTPUT_DIR',
|
|
68
|
+
description:
|
|
69
|
+
'When set, bb.js operations write input/output files and log equivalent CLI commands to this directory',
|
|
70
|
+
},
|
|
55
71
|
};
|
|
56
72
|
|
|
57
73
|
export const proverClientConfigMappings: ConfigMappingsType<ProverClientUserConfig> = {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { SpongeBlob, computeBlobsHashFromBlobs, encodeCheckpointEndMarker, getBlobsPerL1Block } from '@aztec/blob-lib';
|
|
2
|
-
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
3
2
|
import { type CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
|
|
4
|
-
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
5
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
4
|
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
5
|
+
import { elapsed } from '@aztec/foundation/timer';
|
|
7
6
|
import { L2Block } from '@aztec/stdlib/block';
|
|
8
7
|
import { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
9
8
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
10
9
|
import {
|
|
11
10
|
accumulateCheckpointOutHashes,
|
|
11
|
+
appendL1ToL2MessagesToTree,
|
|
12
12
|
computeCheckpointOutHash,
|
|
13
13
|
computeInHashFromL1ToL2Messages,
|
|
14
14
|
} from '@aztec/stdlib/messaging';
|
|
@@ -68,10 +68,7 @@ export class LightweightCheckpointBuilder {
|
|
|
68
68
|
feeAssetPriceModifier: bigint = 0n,
|
|
69
69
|
): Promise<LightweightCheckpointBuilder> {
|
|
70
70
|
// Insert l1-to-l2 messages into the tree.
|
|
71
|
-
await db
|
|
72
|
-
MerkleTreeId.L1_TO_L2_MESSAGE_TREE,
|
|
73
|
-
padArrayEnd<Fr, number>(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
|
|
74
|
-
);
|
|
71
|
+
await appendL1ToL2MessagesToTree(db, l1ToL2Messages);
|
|
75
72
|
|
|
76
73
|
return new LightweightCheckpointBuilder(
|
|
77
74
|
checkpointNumber,
|
|
@@ -116,6 +113,10 @@ export class LightweightCheckpointBuilder {
|
|
|
116
113
|
blockNumbers: existingBlocks.map(b => b.header.getBlockNumber()),
|
|
117
114
|
});
|
|
118
115
|
|
|
116
|
+
if (existingBlocks.length === 0) {
|
|
117
|
+
throw new Error(`Cannot resume checkpoint ${checkpointNumber} with no existing blocks`);
|
|
118
|
+
}
|
|
119
|
+
|
|
119
120
|
// Validate block order and consistency
|
|
120
121
|
for (let i = 1; i < existingBlocks.length; i++) {
|
|
121
122
|
const prev = existingBlocks[i - 1];
|
|
@@ -153,6 +154,10 @@ export class LightweightCheckpointBuilder {
|
|
|
153
154
|
return this.blocks.length;
|
|
154
155
|
}
|
|
155
156
|
|
|
157
|
+
public getBlocks() {
|
|
158
|
+
return this.blocks;
|
|
159
|
+
}
|
|
160
|
+
|
|
156
161
|
/**
|
|
157
162
|
* Adds a new block to the checkpoint. The tx effects must have already been inserted into the db if
|
|
158
163
|
* this is called after tx processing, if that's not the case, then set `insertTxsEffects` to true.
|
|
@@ -161,7 +166,8 @@ export class LightweightCheckpointBuilder {
|
|
|
161
166
|
globalVariables: GlobalVariables,
|
|
162
167
|
txs: ProcessedTx[],
|
|
163
168
|
opts: { insertTxsEffects?: boolean; expectedEndState?: StateReference } = {},
|
|
164
|
-
): Promise<L2Block> {
|
|
169
|
+
): Promise<{ block: L2Block; timings: Record<string, number> }> {
|
|
170
|
+
const timings: Record<string, number> = {};
|
|
165
171
|
const isFirstBlock = this.blocks.length === 0;
|
|
166
172
|
|
|
167
173
|
// Empty blocks are only allowed as the first block in a checkpoint
|
|
@@ -170,7 +176,9 @@ export class LightweightCheckpointBuilder {
|
|
|
170
176
|
}
|
|
171
177
|
|
|
172
178
|
if (isFirstBlock) {
|
|
173
|
-
|
|
179
|
+
const [msGetInitialArchive, initialArchive] = await elapsed(() => getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db));
|
|
180
|
+
this.lastArchives.push(initialArchive);
|
|
181
|
+
timings.getInitialArchive = msGetInitialArchive;
|
|
174
182
|
}
|
|
175
183
|
|
|
176
184
|
const lastArchive = this.lastArchives.at(-1)!;
|
|
@@ -180,12 +188,17 @@ export class LightweightCheckpointBuilder {
|
|
|
180
188
|
`Inserting side effects for ${txs.length} txs for block ${globalVariables.blockNumber} into db`,
|
|
181
189
|
{ txs: txs.map(tx => tx.hash.toString()) },
|
|
182
190
|
);
|
|
191
|
+
let msInsertSideEffects = 0;
|
|
183
192
|
for (const tx of txs) {
|
|
184
|
-
await insertSideEffects(tx, this.db);
|
|
193
|
+
const [ms] = await elapsed(() => insertSideEffects(tx, this.db));
|
|
194
|
+
msInsertSideEffects += ms;
|
|
185
195
|
}
|
|
196
|
+
timings.insertSideEffects = msInsertSideEffects;
|
|
186
197
|
}
|
|
187
198
|
|
|
188
|
-
const endState = await this.db.getStateReference();
|
|
199
|
+
const [msGetEndState, endState] = await elapsed(() => this.db.getStateReference());
|
|
200
|
+
timings.getEndState = msGetEndState;
|
|
201
|
+
|
|
189
202
|
if (opts.expectedEndState && !endState.equals(opts.expectedEndState)) {
|
|
190
203
|
this.logger.error('End state after processing txs does not match expected end state', {
|
|
191
204
|
globalVariables: globalVariables.toInspect(),
|
|
@@ -195,26 +208,31 @@ export class LightweightCheckpointBuilder {
|
|
|
195
208
|
throw new Error(`End state does not match expected end state when building block ${globalVariables.blockNumber}`);
|
|
196
209
|
}
|
|
197
210
|
|
|
198
|
-
const { header, body, blockBlobFields } = await
|
|
199
|
-
txs,
|
|
200
|
-
lastArchive,
|
|
201
|
-
endState,
|
|
202
|
-
globalVariables,
|
|
203
|
-
this.spongeBlob,
|
|
204
|
-
isFirstBlock,
|
|
211
|
+
const [msBuildHeaderAndBody, { header, body, blockBlobFields }] = await elapsed(() =>
|
|
212
|
+
buildHeaderAndBodyFromTxs(txs, lastArchive, endState, globalVariables, this.spongeBlob, isFirstBlock),
|
|
205
213
|
);
|
|
214
|
+
timings.buildHeaderAndBody = msBuildHeaderAndBody;
|
|
206
215
|
|
|
207
216
|
header.state.validate();
|
|
208
217
|
|
|
209
218
|
await this.db.updateArchive(header);
|
|
210
|
-
const newArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db);
|
|
219
|
+
const [msUpdateArchive, newArchive] = await elapsed(() => getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db));
|
|
220
|
+
timings.updateArchive = msUpdateArchive;
|
|
211
221
|
this.lastArchives.push(newArchive);
|
|
212
222
|
|
|
223
|
+
const expectedNextLeafIndex = Number(globalVariables.blockNumber) + 1;
|
|
224
|
+
if (newArchive.nextAvailableLeafIndex !== expectedNextLeafIndex) {
|
|
225
|
+
throw new Error(
|
|
226
|
+
`Archive tree next leaf index mismatch after building block ${globalVariables.blockNumber} (expected ${expectedNextLeafIndex} but got ${newArchive.nextAvailableLeafIndex})`,
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
213
230
|
const indexWithinCheckpoint = IndexWithinCheckpoint(this.blocks.length);
|
|
214
231
|
const block = new L2Block(newArchive, header, body, this.checkpointNumber, indexWithinCheckpoint);
|
|
215
232
|
this.blocks.push(block);
|
|
216
233
|
|
|
217
|
-
await this.spongeBlob.absorb(blockBlobFields);
|
|
234
|
+
const [msSpongeAbsorb] = await elapsed(() => this.spongeBlob.absorb(blockBlobFields));
|
|
235
|
+
timings.spongeAbsorb = msSpongeAbsorb;
|
|
218
236
|
this.blobFields.push(...blockBlobFields);
|
|
219
237
|
|
|
220
238
|
this.logger.debug(`Built block ${header.getBlockNumber()}`, {
|
|
@@ -225,7 +243,7 @@ export class LightweightCheckpointBuilder {
|
|
|
225
243
|
txs: block.body.txEffects.map(tx => tx.txHash.toString()),
|
|
226
244
|
});
|
|
227
245
|
|
|
228
|
-
return block;
|
|
246
|
+
return { block, timings };
|
|
229
247
|
}
|
|
230
248
|
|
|
231
249
|
async completeCheckpoint(): Promise<Checkpoint> {
|
|
@@ -272,6 +290,14 @@ export class LightweightCheckpointBuilder {
|
|
|
272
290
|
totalManaUsed,
|
|
273
291
|
});
|
|
274
292
|
|
|
293
|
+
this.logger.debug(`Completed checkpoint ${this.checkpointNumber}`, {
|
|
294
|
+
checkpointNumber: this.checkpointNumber,
|
|
295
|
+
headerHash: header.hash().toString(),
|
|
296
|
+
checkpointOutHash: checkpointOutHash.toString(),
|
|
297
|
+
numPreviousCheckpointOutHashes: this.previousCheckpointOutHashes.length,
|
|
298
|
+
...header.toInspect(),
|
|
299
|
+
});
|
|
300
|
+
|
|
275
301
|
return new Checkpoint(newArchive, header, blocks, this.checkpointNumber, this.feeAssetPriceModifier);
|
|
276
302
|
}
|
|
277
303
|
|