@aztec/prover-client 0.0.1-commit.993d240 → 0.0.1-commit.9a89641
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/light/lightweight_checkpoint_builder.d.ts +1 -1
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -1
- package/dest/light/lightweight_checkpoint_builder.js +3 -1
- package/dest/mocks/fixtures.d.ts +1 -1
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +3 -3
- package/dest/mocks/test_context.d.ts +9 -11
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +15 -23
- package/dest/orchestrator/block-building-helpers.d.ts +1 -1
- package/dest/orchestrator/checkpoint-proving-state.d.ts +13 -36
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-proving-state.js +18 -125
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts +116 -62
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.js +1005 -90
- 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 +2 -3
- package/dest/orchestrator/index.d.ts.map +1 -1
- package/dest/orchestrator/index.js +1 -2
- package/dest/orchestrator/proving-scheduler.d.ts +26 -17
- package/dest/orchestrator/proving-scheduler.d.ts.map +1 -1
- package/dest/orchestrator/proving-scheduler.js +28 -25
- package/dest/orchestrator/top-tree-orchestrator.d.ts +11 -6
- package/dest/orchestrator/top-tree-orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/top-tree-orchestrator.js +71 -21
- package/dest/orchestrator/top-tree-proving-state.d.ts +1 -1
- package/dest/orchestrator/top-tree-proving-state.d.ts.map +1 -1
- 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 +17 -19
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +24 -25
- 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 +13 -1
- package/dest/proving_broker/proving_broker.d.ts +2 -1
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +195 -77
- 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 +55 -4
- 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 +13 -4
- package/dest/proving_broker/rpc.d.ts.map +1 -1
- package/dest/proving_broker/rpc.js +14 -3
- 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 +1 -1
- package/dest/test/mock_prover.js +2 -2
- package/package.json +17 -16
- package/src/light/lightweight_checkpoint_builder.ts +2 -0
- package/src/mocks/fixtures.ts +2 -4
- package/src/mocks/test_context.ts +16 -35
- package/src/orchestrator/checkpoint-proving-state.ts +14 -168
- package/src/orchestrator/checkpoint-sub-tree-orchestrator.ts +902 -129
- package/src/orchestrator/chonk-cache.ts +99 -0
- package/src/orchestrator/index.ts +1 -2
- package/src/orchestrator/proving-scheduler.ts +29 -25
- package/src/orchestrator/top-tree-orchestrator.ts +114 -44
- package/src/orchestrator/top-tree-proving-state.ts +0 -1
- package/src/orchestrator/tx-proving-state.ts +3 -3
- package/src/prover-client/prover-client.ts +35 -49
- package/src/proving_broker/broker_prover_facade.ts +12 -3
- package/src/proving_broker/proving_broker.ts +186 -77
- package/src/proving_broker/proving_broker_database/memory.ts +16 -2
- package/src/proving_broker/proving_broker_database/persisted.ts +69 -6
- package/src/proving_broker/proving_broker_database.ts +30 -0
- package/src/proving_broker/rpc.ts +16 -0
- 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-context.d.ts +0 -51
- package/dest/orchestrator/epoch-proving-context.d.ts.map +0 -1
- package/dest/orchestrator/epoch-proving-context.js +0 -81
- 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 -118
- package/dest/orchestrator/orchestrator.d.ts.map +0 -1
- package/dest/orchestrator/orchestrator.js +0 -1113
- package/dest/orchestrator/top-tree-proving-scheduler.d.ts +0 -62
- package/dest/orchestrator/top-tree-proving-scheduler.d.ts.map +0 -1
- package/dest/orchestrator/top-tree-proving-scheduler.js +0 -73
- 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-context.ts +0 -101
- package/src/orchestrator/epoch-proving-state.ts +0 -380
- package/src/orchestrator/orchestrator.ts +0 -1111
- package/src/orchestrator/top-tree-proving-scheduler.ts +0 -154
- 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()));
|
|
@@ -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,
|
|
@@ -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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7SUFDSCxtQkFBbUIsQ0FBQyxFQUFFLEVBQUUsWUFBWSxFQUFFLEtBQUssRUFBRSxRQUFRLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBRXRFOzs7OztPQUtHO0lBQ0gsa0JBQWtCLENBQUMsRUFBRSxFQUFFLFlBQVksRUFBRSxHQUFHLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUVqRTs7Ozs7T0FLRztJQUNILG9CQUFvQixDQUFDLEVBQUUsRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBRXREOzs7OztPQUtHO0lBQ0gsc0JBQXNCLENBQUMsRUFBRSxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7SUFFeEQ7O09BRUc7SUFDSCxLQUFLLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0NBQ3hCIn0=
|
|
@@ -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,CA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AAG,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,15 @@
|
|
|
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
|
+
/**
|
|
5
|
+
* Max JSON-RPC request body the broker clients will send.
|
|
6
|
+
*
|
|
7
|
+
* Job inputs and proof results travel inline as `data:` URIs on this path, so a single call is routinely larger than
|
|
8
|
+
* the 1 mb the generic JSON-RPC client allows — that default sizes batches of small node requests against the node
|
|
9
|
+
* server's own default. An AVM (`PUBLIC_VM`) result is around 1.3 mb today. This value must stay at or below the
|
|
10
|
+
* broker server's `RPC_MAX_BODY_SIZE`, which deployments set to 50mb.
|
|
11
|
+
*/
|
|
12
|
+
export declare const PROVER_BROKER_MAX_REQUEST_BODY_SIZE: number;
|
|
4
13
|
/** Indefinite backoff for broker communication: 1, 1, 1, 2, 4, 4, 4, ... seconds. */
|
|
5
14
|
export declare function proverBrokerBackoff(): Generator<number, void, unknown>;
|
|
6
15
|
export declare const ProvingJobProducerSchema: ApiSchemaFor<ProvingJobProducer>;
|
|
@@ -13,17 +22,17 @@ export declare function createProvingJobBrokerClient(url: string, versions: Part
|
|
|
13
22
|
headers: {
|
|
14
23
|
get: (header: string) => string | null | undefined;
|
|
15
24
|
};
|
|
16
|
-
}
|
|
25
|
+
}>, maxRequestBodySize?: number): ProvingJobBroker;
|
|
17
26
|
export declare function createProvingJobProducerClient(url: string, versions: Partial<ComponentsVersions>, fetch?: (host: string, body: unknown, extraHeaders?: Record<string, string> | undefined, noRetry?: boolean | undefined) => Promise<{
|
|
18
27
|
response: any;
|
|
19
28
|
headers: {
|
|
20
29
|
get: (header: string) => string | null | undefined;
|
|
21
30
|
};
|
|
22
|
-
}
|
|
31
|
+
}>, maxRequestBodySize?: number): ProvingJobProducer;
|
|
23
32
|
export declare function createProvingJobConsumerClient(url: string, versions: Partial<ComponentsVersions>, fetch?: (host: string, body: unknown, extraHeaders?: Record<string, string> | undefined, noRetry?: boolean | undefined) => Promise<{
|
|
24
33
|
response: any;
|
|
25
34
|
headers: {
|
|
26
35
|
get: (header: string) => string | null | undefined;
|
|
27
36
|
};
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
37
|
+
}>, maxRequestBodySize?: number): ProvingJobConsumer;
|
|
38
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnBjLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHJvdmluZ19icm9rZXIvcnBjLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sRUFJTCxLQUFLLGdCQUFnQixFQUNyQixLQUFLLHFCQUFxQixFQUMxQixLQUFLLGtCQUFrQixFQUV2QixLQUFLLGtCQUFrQixFQUV4QixNQUFNLGlDQUFpQyxDQUFDO0FBRXpDLE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBWSxNQUFNLHVCQUF1QixDQUFDO0FBQ3BFLE9BQU8sRUFBRSxLQUFLLGtCQUFrQixFQUFnQyxNQUFNLDBCQUEwQixDQUFDO0FBS2pHOzs7Ozs7O0dBT0c7QUFDSCxlQUFPLE1BQU0sbUNBQW1DLFFBQW1CLENBQUM7QUFFcEUscUZBQXFGO0FBQ3JGLHdCQUFpQixtQkFBbUI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E,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,EACnD,kBAAkB,SAAsC,GACvD,gBAAgB,CAOlB;AAED,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,EACrC,KAAK;;;;;EAA8C,EACnD,kBAAkB,SAAsC,GACvD,kBAAkB,CAOpB;AAED,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,EACrC,KAAK;;;;;EAA8C,EACnD,kBAAkB,SAAsC,GACvD,kBAAkB,CAOpB"}
|
|
@@ -6,6 +6,14 @@ 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
|
+
/**
|
|
10
|
+
* Max JSON-RPC request body the broker clients will send.
|
|
11
|
+
*
|
|
12
|
+
* Job inputs and proof results travel inline as `data:` URIs on this path, so a single call is routinely larger than
|
|
13
|
+
* the 1 mb the generic JSON-RPC client allows — that default sizes batches of small node requests against the node
|
|
14
|
+
* server's own default. An AVM (`PUBLIC_VM`) result is around 1.3 mb today. This value must stay at or below the
|
|
15
|
+
* broker server's `RPC_MAX_BODY_SIZE`, which deployments set to 50mb.
|
|
16
|
+
*/ export const PROVER_BROKER_MAX_REQUEST_BODY_SIZE = 50 * 1024 * 1024;
|
|
9
17
|
/** Indefinite backoff for broker communication: 1, 1, 1, 2, 4, 4, 4, ... seconds. */ export function* proverBrokerBackoff() {
|
|
10
18
|
const v = [
|
|
11
19
|
1,
|
|
@@ -104,24 +112,27 @@ export const ProvingJobBrokerSchemaWithDebug = {
|
|
|
104
112
|
...ProvingJobBrokerSchema,
|
|
105
113
|
...ProvingJobBrokerDebugSchema
|
|
106
114
|
};
|
|
107
|
-
export function createProvingJobBrokerClient(url, versions, fetch = makeTracedFetch(proverBrokerBackoff, false)) {
|
|
115
|
+
export function createProvingJobBrokerClient(url, versions, fetch = makeTracedFetch(proverBrokerBackoff, false), maxRequestBodySize = PROVER_BROKER_MAX_REQUEST_BODY_SIZE) {
|
|
108
116
|
return createSafeJsonRpcClient(url, ProvingJobBrokerSchema, {
|
|
109
117
|
namespaceMethods: 'proverBroker',
|
|
110
118
|
fetch,
|
|
119
|
+
maxRequestBodySize,
|
|
111
120
|
onResponse: getVersioningResponseHandler(versions)
|
|
112
121
|
});
|
|
113
122
|
}
|
|
114
|
-
export function createProvingJobProducerClient(url, versions, fetch = makeTracedFetch(proverBrokerBackoff, false)) {
|
|
123
|
+
export function createProvingJobProducerClient(url, versions, fetch = makeTracedFetch(proverBrokerBackoff, false), maxRequestBodySize = PROVER_BROKER_MAX_REQUEST_BODY_SIZE) {
|
|
115
124
|
return createSafeJsonRpcClient(url, ProvingJobProducerSchema, {
|
|
116
125
|
namespaceMethods: 'provingJobProducer',
|
|
117
126
|
fetch,
|
|
127
|
+
maxRequestBodySize,
|
|
118
128
|
onResponse: getVersioningResponseHandler(versions)
|
|
119
129
|
});
|
|
120
130
|
}
|
|
121
|
-
export function createProvingJobConsumerClient(url, versions, fetch = makeTracedFetch(proverBrokerBackoff, false)) {
|
|
131
|
+
export function createProvingJobConsumerClient(url, versions, fetch = makeTracedFetch(proverBrokerBackoff, false), maxRequestBodySize = PROVER_BROKER_MAX_REQUEST_BODY_SIZE) {
|
|
122
132
|
return createSafeJsonRpcClient(url, ProvingJobConsumerSchema, {
|
|
123
133
|
namespaceMethods: 'provingJobConsumer',
|
|
124
134
|
fetch,
|
|
135
|
+
maxRequestBodySize,
|
|
125
136
|
onResponse: getVersioningResponseHandler(versions)
|
|
126
137
|
});
|
|
127
138
|
}
|
|
@@ -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 }: SettleEpochOutboxArgs): Promise<CheckpointNumber | undefined>;
|
|
36
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXBvY2hfc2V0dGxlbWVudC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3QvZXBvY2hfc2V0dGxlbWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQzdELE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLFdBQVcsRUFBYyxNQUFNLGlDQUFpQyxDQUFDO0FBRWpHLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBR3pELCtDQUErQztBQUMvQyxNQUFNLE1BQU0scUJBQXFCLEdBQUc7SUFDbEMsMkZBQTJGO0lBQzNGLGdCQUFnQixFQUFFLGdCQUFnQixDQUFDO0lBQ25DLG9FQUFvRTtJQUNwRSxhQUFhLEVBQUUsYUFBYSxDQUFDO0lBQzdCLHVCQ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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,7 +19,7 @@ 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<
|
|
22
|
+
getAvmProof(_inputs: AvmCircuitInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<import("@aztec/stdlib/proofs").RecursiveProof<14532>>;
|
|
23
23
|
getBaseParityProof(_inputs: ParityBasePrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<import("@aztec/stdlib/parity").ParityPublicInputs, 410>>;
|
|
24
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>>;
|
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.9a89641",
|
|
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": [
|
|
@@ -68,19 +69,19 @@
|
|
|
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
|
|
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.9a89641",
|
|
73
|
+
"@aztec/blob-lib": "0.0.1-commit.9a89641",
|
|
74
|
+
"@aztec/constants": "0.0.1-commit.9a89641",
|
|
75
|
+
"@aztec/ethereum": "0.0.1-commit.9a89641",
|
|
76
|
+
"@aztec/foundation": "0.0.1-commit.9a89641",
|
|
77
|
+
"@aztec/kv-store": "0.0.1-commit.9a89641",
|
|
78
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.9a89641",
|
|
79
|
+
"@aztec/noir-types": "6.0.0-nightly.20260807",
|
|
80
|
+
"@aztec/protocol-contracts": "0.0.1-commit.9a89641",
|
|
81
|
+
"@aztec/simulator": "0.0.1-commit.9a89641",
|
|
82
|
+
"@aztec/stdlib": "0.0.1-commit.9a89641",
|
|
83
|
+
"@aztec/telemetry-client": "0.0.1-commit.9a89641",
|
|
84
|
+
"@aztec/world-state": "0.0.1-commit.9a89641",
|
|
84
85
|
"@iarna/toml": "^2.2.5",
|
|
85
86
|
"commander": "^12.1.0",
|
|
86
87
|
"lodash.chunk": "^4.2.0",
|
|
@@ -89,7 +90,7 @@
|
|
|
89
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.9a89641",
|
|
93
94
|
"@jest/globals": "^30.0.0",
|
|
94
95
|
"@types/jest": "^30.0.0",
|
|
95
96
|
"@types/node": "^22.15.17",
|
|
@@ -275,6 +275,7 @@ export class LightweightCheckpointBuilder {
|
|
|
275
275
|
const timestamp = blocks[blocks.length - 1].timestamp;
|
|
276
276
|
|
|
277
277
|
const totalManaUsed = blocks.reduce((acc, block) => acc.add(block.header.totalManaUsed), Fr.ZERO);
|
|
278
|
+
const accumulatedFees = blocks.reduce((acc, block) => acc.add(block.header.totalFees), Fr.ZERO);
|
|
278
279
|
|
|
279
280
|
const header = CheckpointHeader.from({
|
|
280
281
|
lastArchiveRoot: this.lastArchives[0].root,
|
|
@@ -288,6 +289,7 @@ export class LightweightCheckpointBuilder {
|
|
|
288
289
|
feeRecipient,
|
|
289
290
|
gasFees,
|
|
290
291
|
totalManaUsed,
|
|
292
|
+
accumulatedFees,
|
|
291
293
|
});
|
|
292
294
|
|
|
293
295
|
this.logger.debug(`Completed checkpoint ${this.checkpointNumber}`, {
|
package/src/mocks/fixtures.ts
CHANGED
|
@@ -17,12 +17,10 @@ import { promises as fs } from 'fs';
|
|
|
17
17
|
import path from 'path';
|
|
18
18
|
|
|
19
19
|
const {
|
|
20
|
-
BB_RELEASE_DIR = 'cpp/build/bin',
|
|
21
20
|
TEMP_DIR = '/tmp',
|
|
22
21
|
BB_BINARY_PATH = '',
|
|
23
22
|
BB_WORKING_DIRECTORY = '',
|
|
24
23
|
BB_SKIP_CLEANUP = '',
|
|
25
|
-
NOIR_RELEASE_DIR = 'noir-repo/target/release',
|
|
26
24
|
ACVM_BINARY_PATH = '',
|
|
27
25
|
ACVM_WORKING_DIRECTORY = '',
|
|
28
26
|
} = process.env;
|
|
@@ -32,7 +30,7 @@ export const getEnvironmentConfig = async (logger: Logger) => {
|
|
|
32
30
|
try {
|
|
33
31
|
const expectedBBPath = BB_BINARY_PATH
|
|
34
32
|
? BB_BINARY_PATH
|
|
35
|
-
: `${path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../
|
|
33
|
+
: `${path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../labs-aztec-toolchain/bin')}/bb-avm`;
|
|
36
34
|
await fs.access(expectedBBPath, fs.constants.R_OK);
|
|
37
35
|
const tempWorkingDirectory = `${TEMP_DIR}/${randomBytes(4).toString('hex')}`;
|
|
38
36
|
const bbWorkingDirectory = BB_WORKING_DIRECTORY ? BB_WORKING_DIRECTORY : `${tempWorkingDirectory}/bb`;
|
|
@@ -41,7 +39,7 @@ export const getEnvironmentConfig = async (logger: Logger) => {
|
|
|
41
39
|
|
|
42
40
|
const expectedAcvmPath = ACVM_BINARY_PATH
|
|
43
41
|
? ACVM_BINARY_PATH
|
|
44
|
-
: `${path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../
|
|
42
|
+
: `${path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../labs-aztec-toolchain/bin')}/acvm`;
|
|
45
43
|
await fs.access(expectedAcvmPath, fs.constants.R_OK);
|
|
46
44
|
const acvmWorkingDirectory = ACVM_WORKING_DIRECTORY ? ACVM_WORKING_DIRECTORY : `${tempWorkingDirectory}/acvm`;
|
|
47
45
|
await fs.mkdir(acvmWorkingDirectory, { recursive: true });
|
|
@@ -5,13 +5,13 @@ import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
|
5
5
|
import { padArrayEnd, times, timesAsync } from '@aztec/foundation/collection';
|
|
6
6
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
7
7
|
import type { Logger } from '@aztec/foundation/log';
|
|
8
|
+
import { SerialQueue } from '@aztec/foundation/queue';
|
|
8
9
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
9
10
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
10
11
|
import { ProtocolContractsList } from '@aztec/protocol-contracts';
|
|
11
12
|
import { computeFeePayerBalanceLeafSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
12
13
|
import { PublicDataWrite } from '@aztec/stdlib/avm';
|
|
13
14
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
14
|
-
import { EthAddress } from '@aztec/stdlib/block';
|
|
15
15
|
import type { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
16
16
|
import type { MerkleTreeWriteOperations, ServerCircuitProver } from '@aztec/stdlib/interfaces/server';
|
|
17
17
|
import type { CheckpointConstantData } from '@aztec/stdlib/rollup';
|
|
@@ -36,12 +36,21 @@ import {
|
|
|
36
36
|
getTreeSnapshot,
|
|
37
37
|
insertSideEffects,
|
|
38
38
|
} from '../orchestrator/block-building-helpers.js';
|
|
39
|
-
import type { BlockProvingState } from '../orchestrator/block-proving-state.js';
|
|
40
|
-
import { ProvingOrchestrator } from '../orchestrator/index.js';
|
|
41
39
|
import { BrokerCircuitProverFacade } from '../proving_broker/broker_prover_facade.js';
|
|
42
40
|
import { TestBroker } from '../test/mock_prover.js';
|
|
43
41
|
import { getEnvironmentConfig, getSimulator, makeCheckpointConstants, makeGlobals } from './fixtures.js';
|
|
44
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Builds a started `SerialQueue` for use as an orchestrator's deferred-job queue in
|
|
45
|
+
* tests. Production wires a single shared queue via `ProverClient`; tests that construct
|
|
46
|
+
* orchestrators directly use one of these per orchestrator (or share one).
|
|
47
|
+
*/
|
|
48
|
+
export function makeTestDeferredJobQueue(concurrency = 10): SerialQueue {
|
|
49
|
+
const queue = new SerialQueue();
|
|
50
|
+
queue.start(concurrency);
|
|
51
|
+
return queue;
|
|
52
|
+
}
|
|
53
|
+
|
|
45
54
|
export class TestContext {
|
|
46
55
|
private headers: Map<number, BlockHeader> = new Map();
|
|
47
56
|
private checkpoints: Checkpoint[] = [];
|
|
@@ -57,7 +66,6 @@ export class TestContext {
|
|
|
57
66
|
public prover: ServerCircuitProver,
|
|
58
67
|
public broker: TestBroker,
|
|
59
68
|
public brokerProverFacade: BrokerCircuitProverFacade,
|
|
60
|
-
public orchestrator: TestProvingOrchestrator,
|
|
61
69
|
private feePayer: AztecAddress,
|
|
62
70
|
initialFeePayerBalance: Fr,
|
|
63
71
|
private directoriesToCleanup: string[],
|
|
@@ -66,10 +74,6 @@ export class TestContext {
|
|
|
66
74
|
this.feePayerBalance = initialFeePayerBalance;
|
|
67
75
|
}
|
|
68
76
|
|
|
69
|
-
public get epochProver() {
|
|
70
|
-
return this.orchestrator;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
77
|
static async new(
|
|
74
78
|
logger: Logger,
|
|
75
79
|
{
|
|
@@ -82,7 +86,7 @@ export class TestContext {
|
|
|
82
86
|
) {
|
|
83
87
|
const directoriesToCleanup: string[] = [];
|
|
84
88
|
|
|
85
|
-
const feePayer = AztecAddress.
|
|
89
|
+
const feePayer = AztecAddress.fromNumberUnsafe(42222);
|
|
86
90
|
const initialFeePayerBalance = new Fr(10n ** 20n);
|
|
87
91
|
const feePayerSlot = await computeFeePayerBalanceLeafSlot(feePayer);
|
|
88
92
|
const genesis: GenesisData = {
|
|
@@ -91,7 +95,7 @@ export class TestContext {
|
|
|
91
95
|
};
|
|
92
96
|
|
|
93
97
|
// Separated dbs for public processor and prover - see public_processor for context
|
|
94
|
-
const ws = await NativeWorldStateService.tmp(/*
|
|
98
|
+
const ws = await NativeWorldStateService.tmp(/*cleanupTmpDir=*/ true, genesis);
|
|
95
99
|
|
|
96
100
|
let localProver: ServerCircuitProver;
|
|
97
101
|
const config = await getEnvironmentConfig(logger);
|
|
@@ -118,22 +122,11 @@ export class TestContext {
|
|
|
118
122
|
|
|
119
123
|
const broker = new TestBroker(proverCount, localProver);
|
|
120
124
|
const facade = new BrokerCircuitProverFacade(broker);
|
|
121
|
-
const orchestrator = new TestProvingOrchestrator(ws, facade, EthAddress.ZERO, false, 10);
|
|
122
125
|
|
|
123
126
|
await broker.start();
|
|
124
127
|
facade.start();
|
|
125
128
|
|
|
126
|
-
return new this(
|
|
127
|
-
ws,
|
|
128
|
-
localProver,
|
|
129
|
-
broker,
|
|
130
|
-
facade,
|
|
131
|
-
orchestrator,
|
|
132
|
-
feePayer,
|
|
133
|
-
initialFeePayerBalance,
|
|
134
|
-
directoriesToCleanup,
|
|
135
|
-
logger,
|
|
136
|
-
);
|
|
129
|
+
return new this(ws, localProver, broker, facade, feePayer, initialFeePayerBalance, directoriesToCleanup, logger);
|
|
137
130
|
}
|
|
138
131
|
|
|
139
132
|
public getFork() {
|
|
@@ -143,6 +136,7 @@ export class TestContext {
|
|
|
143
136
|
async cleanup() {
|
|
144
137
|
await this.brokerProverFacade.stop();
|
|
145
138
|
await this.broker.stop();
|
|
139
|
+
await this.worldState.close();
|
|
146
140
|
for (const dir of this.directoriesToCleanup.filter(x => x !== '')) {
|
|
147
141
|
try {
|
|
148
142
|
await fs.rm(dir, { recursive: true, force: true, maxRetries: 3 });
|
|
@@ -352,16 +346,3 @@ export class TestContext {
|
|
|
352
346
|
return endStateReference;
|
|
353
347
|
}
|
|
354
348
|
}
|
|
355
|
-
|
|
356
|
-
class TestProvingOrchestrator extends ProvingOrchestrator {
|
|
357
|
-
public isVerifyBuiltBlockAgainstSyncedStateEnabled = false;
|
|
358
|
-
|
|
359
|
-
// Disable this check by default, since it requires seeding world state with the block being built
|
|
360
|
-
// This is only enabled in some tests with multiple blocks that populate the pending chain via makePendingBlock
|
|
361
|
-
protected override verifyBuiltBlockAgainstSyncedState(provingState: BlockProvingState): Promise<void> {
|
|
362
|
-
if (this.isVerifyBuiltBlockAgainstSyncedStateEnabled) {
|
|
363
|
-
return super.verifyBuiltBlockAgainstSyncedState(provingState);
|
|
364
|
-
}
|
|
365
|
-
return Promise.resolve();
|
|
366
|
-
}
|
|
367
|
-
}
|