@aztec/prover-client 0.0.1-commit.f504929 → 0.0.1-commit.f5a9928
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 +2 -1
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -1
- package/dest/light/lightweight_checkpoint_builder.js +22 -5
- package/dest/mocks/test_context.d.ts +11 -11
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +25 -28
- package/dest/orchestrator/block-building-helpers.d.ts +1 -1
- package/dest/orchestrator/checkpoint-proving-state.d.ts +20 -36
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-proving-state.js +22 -120
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts +161 -0
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts.map +1 -0
- package/dest/orchestrator/{orchestrator.js → checkpoint-sub-tree-orchestrator.js} +267 -435
- package/dest/orchestrator/chonk-cache.d.ts +39 -0
- package/dest/orchestrator/chonk-cache.d.ts.map +1 -0
- package/dest/orchestrator/chonk-cache.js +80 -0
- package/dest/orchestrator/index.d.ts +4 -2
- package/dest/orchestrator/index.d.ts.map +1 -1
- package/dest/orchestrator/index.js +3 -1
- package/dest/orchestrator/proving-scheduler.d.ts +81 -0
- package/dest/orchestrator/proving-scheduler.d.ts.map +1 -0
- package/dest/orchestrator/proving-scheduler.js +120 -0
- package/dest/orchestrator/top-tree-orchestrator.d.ts +88 -0
- package/dest/orchestrator/top-tree-orchestrator.d.ts.map +1 -0
- package/dest/orchestrator/top-tree-orchestrator.js +232 -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/orchestrator/tx-proving-state.d.ts +3 -3
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/prover-client/prover-client.d.ts +62 -5
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +54 -7
- package/dest/proving_broker/broker_prover_facade.d.ts +3 -3
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +26 -20
- 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 +3 -2
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +219 -76
- package/dest/proving_broker/proving_broker_database/memory.d.ts +5 -2
- package/dest/proving_broker/proving_broker_database/memory.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/memory.js +14 -1
- package/dest/proving_broker/proving_broker_database/persisted.d.ts +15 -2
- package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +57 -6
- package/dest/proving_broker/proving_broker_database.d.ts +27 -1
- package/dest/proving_broker/proving_broker_database.d.ts.map +1 -1
- 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/epoch_settlement.d.ts +36 -0
- package/dest/test/epoch_settlement.d.ts.map +1 -0
- package/dest/test/epoch_settlement.js +52 -0
- package/dest/test/index.d.ts +2 -0
- package/dest/test/index.d.ts.map +1 -0
- package/dest/test/index.js +1 -0
- package/dest/test/mock_prover.d.ts +4 -4
- package/dest/test/mock_prover.js +2 -2
- package/package.json +19 -18
- package/src/config.ts +18 -2
- package/src/light/lightweight_checkpoint_builder.ts +27 -6
- package/src/mocks/test_context.ts +24 -41
- package/src/orchestrator/checkpoint-proving-state.ts +21 -162
- package/src/orchestrator/{orchestrator.ts → checkpoint-sub-tree-orchestrator.ts} +415 -646
- package/src/orchestrator/chonk-cache.ts +99 -0
- package/src/orchestrator/index.ts +8 -1
- package/src/orchestrator/proving-scheduler.ts +160 -0
- package/src/orchestrator/top-tree-orchestrator.ts +384 -0
- package/src/orchestrator/top-tree-proving-state.ts +219 -0
- package/src/orchestrator/tx-proving-state.ts +3 -3
- package/src/prover-client/prover-client.ts +129 -18
- package/src/proving_broker/broker_prover_facade.ts +29 -23
- package/src/proving_broker/config.ts +3 -2
- package/src/proving_broker/index.ts +1 -0
- package/src/proving_broker/proving_broker.ts +209 -78
- package/src/proving_broker/proving_broker_database/memory.ts +16 -2
- package/src/proving_broker/proving_broker_database/persisted.ts +71 -8
- package/src/proving_broker/proving_broker_database.ts +30 -0
- package/src/proving_broker/rpc.ts +36 -24
- package/src/test/epoch_settlement.ts +82 -0
- package/src/test/index.ts +1 -0
- package/src/test/mock_prover.ts +2 -2
- package/dest/orchestrator/epoch-proving-state.d.ts +0 -75
- package/dest/orchestrator/epoch-proving-state.d.ts.map +0 -1
- package/dest/orchestrator/epoch-proving-state.js +0 -269
- package/dest/orchestrator/orchestrator.d.ts +0 -128
- package/dest/orchestrator/orchestrator.d.ts.map +0 -1
- package/dest/prover-client/server-epoch-prover.d.ts +0 -32
- package/dest/prover-client/server-epoch-prover.d.ts.map +0 -1
- package/dest/prover-client/server-epoch-prover.js +0 -40
- package/src/orchestrator/epoch-proving-state.ts +0 -380
- package/src/prover-client/server-epoch-prover.ts +0 -69
|
@@ -393,7 +393,7 @@ class SingleEpochDatabase {
|
|
|
393
393
|
estimateSize() {
|
|
394
394
|
return this.store.estimateSize();
|
|
395
395
|
}
|
|
396
|
-
async batchWrite(jobs, results) {
|
|
396
|
+
async batchWrite(jobs, results, deletedResults = []) {
|
|
397
397
|
await this.store.transactionAsync(async ()=>{
|
|
398
398
|
for (const job of jobs){
|
|
399
399
|
await this.jobs.set(job.id, jsonStringify(job));
|
|
@@ -401,6 +401,11 @@ class SingleEpochDatabase {
|
|
|
401
401
|
for (const [id, result] of results){
|
|
402
402
|
await this.jobResults.set(id, jsonStringify(result));
|
|
403
403
|
}
|
|
404
|
+
// Deletes are applied after sets so that, if a set and a delete for the same id land in one
|
|
405
|
+
// batch (e.g. an abort immediately followed by a revive's result-delete), the delete wins.
|
|
406
|
+
for (const id of deletedResults){
|
|
407
|
+
await this.jobResults.delete(id);
|
|
408
|
+
}
|
|
404
409
|
});
|
|
405
410
|
}
|
|
406
411
|
async *allProvingJobs() {
|
|
@@ -414,6 +419,14 @@ class SingleEpochDatabase {
|
|
|
414
419
|
];
|
|
415
420
|
}
|
|
416
421
|
}
|
|
422
|
+
async getProvingJobInputs(id) {
|
|
423
|
+
const jobStr = await this.jobs.getAsync(id);
|
|
424
|
+
return jobStr ? jsonParseWithSchema(jobStr, ProvingJob).inputsUri : undefined;
|
|
425
|
+
}
|
|
426
|
+
async getProvingJobResult(id) {
|
|
427
|
+
const resultStr = await this.jobResults.getAsync(id);
|
|
428
|
+
return resultStr ? jsonParseWithSchema(resultStr, ProvingJobSettledResult) : undefined;
|
|
429
|
+
}
|
|
417
430
|
async setProvingJobError(id, reason) {
|
|
418
431
|
const result = {
|
|
419
432
|
status: 'rejected',
|
|
@@ -421,6 +434,12 @@ class SingleEpochDatabase {
|
|
|
421
434
|
};
|
|
422
435
|
await this.jobResults.set(id, jsonStringify(result));
|
|
423
436
|
}
|
|
437
|
+
async setProvingJobAborted(id) {
|
|
438
|
+
const result = {
|
|
439
|
+
status: 'aborted'
|
|
440
|
+
};
|
|
441
|
+
await this.jobResults.set(id, jsonStringify(result));
|
|
442
|
+
}
|
|
424
443
|
async setProvingJobResult(id, value) {
|
|
425
444
|
const result = {
|
|
426
445
|
status: 'fulfilled',
|
|
@@ -468,9 +487,11 @@ export class KVBrokerDatabase {
|
|
|
468
487
|
// exposed for testing
|
|
469
488
|
async commitWrites(items, epochNumber) {
|
|
470
489
|
const jobsToAdd = items.filter((item)=>'id' in item);
|
|
471
|
-
const
|
|
490
|
+
const resultOps = items.filter((item)=>Array.isArray(item));
|
|
491
|
+
const resultsToSet = resultOps.filter((op)=>op[1] !== undefined);
|
|
492
|
+
const resultsToDelete = resultOps.filter((op)=>op[1] === undefined).map(([id])=>id);
|
|
472
493
|
const db = await this.getEpochDatabase(EpochNumber(epochNumber));
|
|
473
|
-
await db.batchWrite(jobsToAdd,
|
|
494
|
+
await db.batchWrite(jobsToAdd, resultsToSet, resultsToDelete);
|
|
474
495
|
}
|
|
475
496
|
async estimateSize() {
|
|
476
497
|
const sizes = await Promise.all(Array.from(this.epochs.values()).map((x)=>x.estimateSize()));
|
|
@@ -499,7 +520,7 @@ export class KVBrokerDatabase {
|
|
|
499
520
|
continue;
|
|
500
521
|
}
|
|
501
522
|
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.
|
|
523
|
+
const db = await openVersionedStoreAt(fullDirectory, SingleEpochDatabase.SCHEMA_VERSION, config.rollupAddress, config.dataStoreMapSizeKb);
|
|
503
524
|
const epochDb = new SingleEpochDatabase(db);
|
|
504
525
|
epochs.set(epochNumber, epochDb);
|
|
505
526
|
}
|
|
@@ -528,8 +549,13 @@ export class KVBrokerDatabase {
|
|
|
528
549
|
this.epochs.delete(old);
|
|
529
550
|
}
|
|
530
551
|
}
|
|
552
|
+
// Key jobs by the id-derived epoch, the same epoch results are written under (setProvingJobResult et
|
|
553
|
+
// al.). This keeps a job's inputs and its result co-located in one epoch database so both can be read
|
|
554
|
+
// back with a single keyed lookup (getProvingJobInputs/getProvingJobResult) rather than a scan. The id
|
|
555
|
+
// embeds the epoch and equals `job.epochNumber` at every construction site, so this matches the prior
|
|
556
|
+
// storage epoch while making the id the single source of truth for placement.
|
|
531
557
|
addProvingJob(job) {
|
|
532
|
-
return this.batchQueue.put(job, job.
|
|
558
|
+
return this.batchQueue.put(job, getEpochFromProvingJobId(job.id));
|
|
533
559
|
}
|
|
534
560
|
async *allProvingJobs() {
|
|
535
561
|
const iterators = Array.from(this.epochs.values()).map((x)=>x.allProvingJobs());
|
|
@@ -537,6 +563,17 @@ export class KVBrokerDatabase {
|
|
|
537
563
|
yield* it;
|
|
538
564
|
}
|
|
539
565
|
}
|
|
566
|
+
// A job id is `${epochNumber}:${type}:${inputsHash}`, so its epoch is recoverable directly and maps to
|
|
567
|
+
// exactly one epoch database. Results are already written under this same id-derived epoch (see
|
|
568
|
+
// setProvingJobResult et al.), and a job's `epochNumber` equals its id-epoch at every construction site,
|
|
569
|
+
// so inputs live there too. Use `epochs.get` (not `getEpochDatabase`, which would create the store on a
|
|
570
|
+
// miss) so a read for an unknown id has no side effects.
|
|
571
|
+
getProvingJobInputs(id) {
|
|
572
|
+
return this.epochs.get(getEpochFromProvingJobId(id))?.getProvingJobInputs(id) ?? Promise.resolve(undefined);
|
|
573
|
+
}
|
|
574
|
+
getProvingJobResult(id) {
|
|
575
|
+
return this.epochs.get(getEpochFromProvingJobId(id))?.getProvingJobResult(id) ?? Promise.resolve(undefined);
|
|
576
|
+
}
|
|
540
577
|
setProvingJobError(id, reason) {
|
|
541
578
|
return this.batchQueue.put([
|
|
542
579
|
id,
|
|
@@ -546,6 +583,20 @@ export class KVBrokerDatabase {
|
|
|
546
583
|
}
|
|
547
584
|
], getEpochFromProvingJobId(id));
|
|
548
585
|
}
|
|
586
|
+
setProvingJobAborted(id) {
|
|
587
|
+
return this.batchQueue.put([
|
|
588
|
+
id,
|
|
589
|
+
{
|
|
590
|
+
status: 'aborted'
|
|
591
|
+
}
|
|
592
|
+
], getEpochFromProvingJobId(id));
|
|
593
|
+
}
|
|
594
|
+
deleteProvingJobResult(id) {
|
|
595
|
+
return this.batchQueue.put([
|
|
596
|
+
id,
|
|
597
|
+
undefined
|
|
598
|
+
], getEpochFromProvingJobId(id));
|
|
599
|
+
}
|
|
549
600
|
setProvingJobResult(id, value) {
|
|
550
601
|
return this.batchQueue.put([
|
|
551
602
|
id,
|
|
@@ -563,7 +614,7 @@ export class KVBrokerDatabase {
|
|
|
563
614
|
recursive: true
|
|
564
615
|
});
|
|
565
616
|
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.
|
|
617
|
+
const db = await openVersionedStoreAt(newEpochDirectory, SingleEpochDatabase.SCHEMA_VERSION, this.config.rollupAddress, this.config.dataStoreMapSizeKb);
|
|
567
618
|
epochDb = new SingleEpochDatabase(db);
|
|
568
619
|
this.epochs.set(epochNumber, epochDb);
|
|
569
620
|
}
|
|
@@ -18,6 +18,18 @@ export interface ProvingBrokerDatabase {
|
|
|
18
18
|
* Returns an iterator over all saved proving jobs
|
|
19
19
|
*/
|
|
20
20
|
allProvingJobs(): AsyncIterableIterator<[ProvingJob, ProvingJobSettledResult | undefined]>;
|
|
21
|
+
/**
|
|
22
|
+
* Reads a single job's inputs URI by id, or undefined if the job is unknown. The broker keeps only
|
|
23
|
+
* job metadata in memory and reads the (large) inputs from here on demand when dispatching to an agent.
|
|
24
|
+
* @param id - The ID of the proof request
|
|
25
|
+
*/
|
|
26
|
+
getProvingJobInputs(id: ProvingJobId): Promise<ProofUri | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Reads a single job's settled result by id, or undefined if not settled. The broker keeps only the
|
|
29
|
+
* settled status in memory and reads the (large) fulfilled proof from here on demand.
|
|
30
|
+
* @param id - The ID of the proof request
|
|
31
|
+
*/
|
|
32
|
+
getProvingJobResult(id: ProvingJobId): Promise<ProvingJobSettledResult | undefined>;
|
|
21
33
|
/**
|
|
22
34
|
* Saves the result of a proof request
|
|
23
35
|
* @param id - The ID of the proof request to save the result for
|
|
@@ -32,9 +44,23 @@ export interface ProvingBrokerDatabase {
|
|
|
32
44
|
* @param err - The error that occurred while processing the proof request
|
|
33
45
|
*/
|
|
34
46
|
setProvingJobError(id: ProvingJobId, err: string): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Records that a proof request was cancelled. Unlike a result or error this is not terminal:
|
|
49
|
+
* re-enqueuing the same job id revives it, so the aborted state can survive a restart without
|
|
50
|
+
* permanently blocking the proof.
|
|
51
|
+
* @param id - The ID of the cancelled proof request
|
|
52
|
+
*/
|
|
53
|
+
setProvingJobAborted(id: ProvingJobId): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Clears any stored result for a proof request, returning it to the pending state while keeping
|
|
56
|
+
* the job itself. Used when reviving an aborted job so the revival is persisted and a restart
|
|
57
|
+
* cannot resurrect the stale aborted state.
|
|
58
|
+
* @param id - The ID of the proof request whose result should be cleared
|
|
59
|
+
*/
|
|
60
|
+
deleteProvingJobResult(id: ProvingJobId): Promise<void>;
|
|
35
61
|
/**
|
|
36
62
|
* Closes the database
|
|
37
63
|
*/
|
|
38
64
|
close(): Promise<void>;
|
|
39
65
|
}
|
|
40
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
66
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdmluZ19icm9rZXJfZGF0YWJhc2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wcm92aW5nX2Jyb2tlci9wcm92aW5nX2Jyb2tlcl9kYXRhYmFzZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDOUQsT0FBTyxLQUFLLEVBQUUsUUFBUSxFQUFFLFVBQVUsRUFBRSxZQUFZLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FB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BQUM7SUFFeEQ7O09BRUc7SUFDSCxLQUFLLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0NBQ3hCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proving_broker_database.d.ts","sourceRoot":"","sources":["../../src/proving_broker/proving_broker_database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAEnH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C;;;OAGG;IACH,kCAAkC,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5E;;OAEG;IACH,cAAc,IAAI,qBAAqB,CAAC,CAAC,UAAU,EAAE,uBAAuB,GAAG,SAAS,CAAC,CAAC,CAAC;IAE3F;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtE;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjE;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
|
|
1
|
+
{"version":3,"file":"proving_broker_database.d.ts","sourceRoot":"","sources":["../../src/proving_broker/proving_broker_database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAEnH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C;;;OAGG;IACH,kCAAkC,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5E;;OAEG;IACH,cAAc,IAAI,qBAAqB,CAAC,CAAC,UAAU,EAAE,uBAAuB,GAAG,SAAS,CAAC,CAAC,CAAC;IAE3F;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC;IAErE;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAAC;IAEpF;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtE;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjE;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnBjLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHJvdmluZ19icm9rZXIvcnBjLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sRUFJTCxLQUFLLGdCQUFnQixFQUNyQixLQUFLLHFCQUFxQixFQUMxQixLQUFLLGtCQUFrQixFQUV2QixLQUFLLGtCQUFrQixFQUV4QixNQUFNLGlDQUFpQyxDQUFDO0FBRXpDLE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBWSxNQUFNLHVCQUF1QixDQUFDO0FBQ3BFLE9BQU8sRUFBRSxLQUFLLGtCQUFrQixFQUFnQyxNQUFNLDBCQUEwQixDQUFDO0FBS2pHLHFGQUFxRjtBQUNyRix3QkFBaUIsbUJBQW1CLHFDQU1uQztBQVdELGVBQU8sTUFBTSx3QkFBd0IsRUFBRSxZQUFZLENBQUMsa0JBQWtCLENBS3JFLENBQUM7QUFFRixlQUFPLE1BQU0sd0JBQXdCLEVBQUUsWUFBWSxDQUFDLGtCQUFrQixDQWlCckUsQ0FBQztBQUVGLGVBQU8sTU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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,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
+
import type { CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
4
|
+
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
5
|
+
/** Arguments for {@link settleEpochOutbox}. */
|
|
6
|
+
export type SettleEpochOutboxArgs = {
|
|
7
|
+
/** Cheat codes used to write the computed out hash directly into the L1 Outbox storage. */
|
|
8
|
+
rollupCheatCodes: RollupCheatCodes;
|
|
9
|
+
/** Source of checkpointed L2 blocks for the epoch being settled. */
|
|
10
|
+
l2BlockSource: L2BlockSource;
|
|
11
|
+
/** Epoch to settle. */
|
|
12
|
+
epoch: EpochNumber;
|
|
13
|
+
/**
|
|
14
|
+
* When set, only checkpoints up to and including this number are covered. Used to settle a partial
|
|
15
|
+
* epoch (the AZIP-14 Outbox keeps one root per `numCheckpointsInEpoch`, so a prefix of an epoch can
|
|
16
|
+
* be settled and consumed before the epoch completes). When omitted, every checkpointed block in the
|
|
17
|
+
* epoch is covered.
|
|
18
|
+
*/
|
|
19
|
+
maxCheckpoint?: CheckpointNumber;
|
|
20
|
+
log: Logger;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Computes the epoch out hash over the checkpointed blocks of an epoch (optionally only up to
|
|
24
|
+
* `maxCheckpoint`) and writes it into the L1 Outbox via cheat codes. This is the synthetic,
|
|
25
|
+
* no-prover equivalent of an epoch root proof landing on L1: it makes the L2-to-L1 messages in the
|
|
26
|
+
* covered checkpoints consumable. It does NOT advance the rollup's proven tip — callers
|
|
27
|
+
* `markAsProven` separately so a single prove call can settle multiple epochs before marking proven.
|
|
28
|
+
*
|
|
29
|
+
* Used by the test-only proving drivers: the `AutomineSequencer`'s auto-settle loop and the standalone
|
|
30
|
+
* `EpochTestSettler`. Lives here (rather than in either consumer) so both share one implementation.
|
|
31
|
+
*
|
|
32
|
+
* @returns The last checkpoint number covered by the settled range, or `undefined` if the epoch has
|
|
33
|
+
* no checkpointed blocks (within the `maxCheckpoint` bound).
|
|
34
|
+
*/
|
|
35
|
+
export declare function settleEpochOutbox({ rollupCheatCodes, l2BlockSource, epoch, maxCheckpoint, log }: SettleEp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xQy9EIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epoch_settlement.d.ts","sourceRoot":"","sources":["../../src/test/epoch_settlement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAc,MAAM,iCAAiC,CAAC;AAEjG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,+CAA+C;AAC/C,MAAM,MAAM,qBAAqB,GAAG;IAClC,2FAA2F;IAC3F,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,oEAAoE;IACpE,aAAa,EAAE,aAAa,CAAC;IAC7B,uBAAuB;IACvB,KAAK,EAAE,WAAW,CAAC;IACnB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,gBAAgB,EAChB,aAAa,EACb,KAAK,EACL,aAAa,EACb,GAAG,EACJ,EAAE,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAqC/D"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { computeEpochOutHash } from '@aztec/stdlib/messaging';
|
|
2
|
+
/**
|
|
3
|
+
* Computes the epoch out hash over the checkpointed blocks of an epoch (optionally only up to
|
|
4
|
+
* `maxCheckpoint`) and writes it into the L1 Outbox via cheat codes. This is the synthetic,
|
|
5
|
+
* no-prover equivalent of an epoch root proof landing on L1: it makes the L2-to-L1 messages in the
|
|
6
|
+
* covered checkpoints consumable. It does NOT advance the rollup's proven tip — callers
|
|
7
|
+
* `markAsProven` separately so a single prove call can settle multiple epochs before marking proven.
|
|
8
|
+
*
|
|
9
|
+
* Used by the test-only proving drivers: the `AutomineSequencer`'s auto-settle loop and the standalone
|
|
10
|
+
* `EpochTestSettler`. Lives here (rather than in either consumer) so both share one implementation.
|
|
11
|
+
*
|
|
12
|
+
* @returns The last checkpoint number covered by the settled range, or `undefined` if the epoch has
|
|
13
|
+
* no checkpointed blocks (within the `maxCheckpoint` bound).
|
|
14
|
+
*/ export async function settleEpochOutbox({ rollupCheatCodes, l2BlockSource, epoch, maxCheckpoint, log }) {
|
|
15
|
+
let blocks = await l2BlockSource.getBlocks({
|
|
16
|
+
epoch,
|
|
17
|
+
onlyCheckpointed: true
|
|
18
|
+
});
|
|
19
|
+
if (maxCheckpoint !== undefined) {
|
|
20
|
+
blocks = blocks.filter((block)=>block.checkpointNumber <= maxCheckpoint);
|
|
21
|
+
}
|
|
22
|
+
if (blocks.length === 0) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
log.info(`Settling epoch ${epoch}${maxCheckpoint !== undefined ? ` up to checkpoint ${maxCheckpoint}` : ''} with blocks ${blocks[0]?.header.getBlockNumber()} to ${blocks.at(-1)?.header.getBlockNumber()}`, {
|
|
26
|
+
epoch,
|
|
27
|
+
maxCheckpoint,
|
|
28
|
+
blocks: blocks.map((block)=>block.toBlockInfo())
|
|
29
|
+
});
|
|
30
|
+
const messagesInEpoch = [];
|
|
31
|
+
// Undefined (not SlotNumber.ZERO) so a first checkpointed block at slot 0 still opens checkpoint 0.
|
|
32
|
+
let previousSlotNumber;
|
|
33
|
+
let checkpointIndex = -1;
|
|
34
|
+
for (const block of blocks){
|
|
35
|
+
const slotNumber = block.header.globalVariables.slotNumber;
|
|
36
|
+
if (slotNumber !== previousSlotNumber) {
|
|
37
|
+
checkpointIndex++;
|
|
38
|
+
messagesInEpoch[checkpointIndex] = [];
|
|
39
|
+
previousSlotNumber = slotNumber;
|
|
40
|
+
}
|
|
41
|
+
messagesInEpoch[checkpointIndex].push(block.body.txEffects.map((txEffect)=>txEffect.l2ToL1Msgs));
|
|
42
|
+
}
|
|
43
|
+
const outHash = computeEpochOutHash(messagesInEpoch);
|
|
44
|
+
if (!outHash.isZero()) {
|
|
45
|
+
await rollupCheatCodes.insertOutbox(epoch, messagesInEpoch.length, outHash.toBigInt());
|
|
46
|
+
} else {
|
|
47
|
+
log.info(`No L2 to L1 messages in epoch ${epoch}`, {
|
|
48
|
+
epoch
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return blocks.at(-1)?.checkpointNumber;
|
|
52
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { settleEpochOutbox, type SettleEpochOutboxArgs } from './epoch_settlement.js';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxLQUFLLHFCQUFxQixFQUFFLE1BQU0sdUJBQXVCLENBQUMifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { settleEpochOutbox } from './epoch_settlement.js';
|
|
@@ -19,9 +19,9 @@ export declare class TestBroker implements ProvingJobProducer {
|
|
|
19
19
|
}
|
|
20
20
|
export declare class MockProver implements ServerCircuitProver {
|
|
21
21
|
constructor();
|
|
22
|
-
getAvmProof(_inputs: AvmCircuitInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<import("@aztec/stdlib/proofs").RecursiveProof<
|
|
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,
|
|
22
|
+
getAvmProof(_inputs: AvmCircuitInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<import("@aztec/stdlib/proofs").RecursiveProof<15516>>;
|
|
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/dest/test/mock_prover.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AVM_V2_PROOF_LENGTH_IN_FIELDS, NESTED_RECURSIVE_PROOF_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, RECURSIVE_PROOF_LENGTH } from '@aztec/constants';
|
|
2
2
|
import { times } from '@aztec/foundation/collection';
|
|
3
3
|
import { makePublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
4
4
|
import { makeEmptyRecursiveProof, makeRecursiveProof } from '@aztec/stdlib/proofs';
|
|
@@ -44,7 +44,7 @@ export class TestBroker {
|
|
|
44
44
|
export class MockProver {
|
|
45
45
|
constructor(){}
|
|
46
46
|
getAvmProof(_inputs, _signal, _epochNumber) {
|
|
47
|
-
return Promise.resolve(makeEmptyRecursiveProof(
|
|
47
|
+
return Promise.resolve(makeEmptyRecursiveProof(AVM_V2_PROOF_LENGTH_IN_FIELDS));
|
|
48
48
|
}
|
|
49
49
|
getBaseParityProof(_inputs, _signal, _epochNumber) {
|
|
50
50
|
return Promise.resolve(makePublicInputsAndRecursiveProof(makeParityPublicInputs(), makeRecursiveProof(RECURSIVE_PROOF_LENGTH), VerificationKeyData.makeFakeHonk()));
|
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.f5a9928",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"./orchestrator": "./dest/orchestrator/index.js",
|
|
10
10
|
"./helpers": "./dest/orchestrator/block-building-helpers.js",
|
|
11
11
|
"./light": "./dest/light/index.js",
|
|
12
|
-
"./config": "./dest/config.js"
|
|
12
|
+
"./config": "./dest/config.js",
|
|
13
|
+
"./test": "./dest/test/index.js"
|
|
13
14
|
},
|
|
14
15
|
"typedocOptions": {
|
|
15
16
|
"entryPoints": [
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
29
30
|
"bb": "node --no-warnings ./dest/bb/index.js",
|
|
30
31
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=3500000",
|
|
31
|
-
"test:debug": "LOG_LEVEL
|
|
32
|
+
"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
33
|
},
|
|
33
34
|
"jest": {
|
|
34
35
|
"moduleNameMapper": {
|
|
@@ -68,28 +69,28 @@
|
|
|
68
69
|
]
|
|
69
70
|
},
|
|
70
71
|
"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.
|
|
72
|
+
"@aztec/bb-prover": "0.0.1-commit.f5a9928",
|
|
73
|
+
"@aztec/blob-lib": "0.0.1-commit.f5a9928",
|
|
74
|
+
"@aztec/constants": "0.0.1-commit.f5a9928",
|
|
75
|
+
"@aztec/ethereum": "0.0.1-commit.f5a9928",
|
|
76
|
+
"@aztec/foundation": "0.0.1-commit.f5a9928",
|
|
77
|
+
"@aztec/kv-store": "0.0.1-commit.f5a9928",
|
|
78
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.f5a9928",
|
|
79
|
+
"@aztec/noir-types": "0.0.1-commit.f5a9928",
|
|
80
|
+
"@aztec/protocol-contracts": "0.0.1-commit.f5a9928",
|
|
81
|
+
"@aztec/simulator": "0.0.1-commit.f5a9928",
|
|
82
|
+
"@aztec/stdlib": "0.0.1-commit.f5a9928",
|
|
83
|
+
"@aztec/telemetry-client": "0.0.1-commit.f5a9928",
|
|
84
|
+
"@aztec/world-state": "0.0.1-commit.f5a9928",
|
|
84
85
|
"@iarna/toml": "^2.2.5",
|
|
85
86
|
"commander": "^12.1.0",
|
|
86
87
|
"lodash.chunk": "^4.2.0",
|
|
87
88
|
"source-map-support": "^0.5.21",
|
|
88
89
|
"tslib": "^2.4.0",
|
|
89
|
-
"zod": "^
|
|
90
|
+
"zod": "^4"
|
|
90
91
|
},
|
|
91
92
|
"devDependencies": {
|
|
92
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
93
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.f5a9928",
|
|
93
94
|
"@jest/globals": "^30.0.0",
|
|
94
95
|
"@types/jest": "^30.0.0",
|
|
95
96
|
"@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> = {
|