@aztec/prover-client 0.0.1-commit.b655e406 → 0.0.1-commit.b9865e97
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 +2 -2
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +17 -3
- package/dest/index.d.ts +1 -1
- package/dest/light/index.d.ts +2 -0
- package/dest/light/index.d.ts.map +1 -0
- package/dest/light/index.js +1 -0
- package/dest/light/lightweight_checkpoint_builder.d.ts +52 -0
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -0
- package/dest/light/lightweight_checkpoint_builder.js +231 -0
- package/dest/mocks/fixtures.d.ts +1 -4
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +9 -18
- package/dest/mocks/test_context.d.ts +31 -46
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +133 -123
- package/dest/orchestrator/block-building-helpers.d.ts +18 -20
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +90 -115
- package/dest/orchestrator/block-proving-state.d.ts +20 -11
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +87 -19
- package/dest/orchestrator/checkpoint-proving-state.d.ts +29 -9
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-proving-state.js +62 -21
- 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 +12 -10
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +40 -4
- 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 +37 -32
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +568 -303
- package/dest/orchestrator/orchestrator_metrics.d.ts +1 -3
- package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator_metrics.js +2 -15
- 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/orchestrator/tx-proving-state.d.ts +6 -5
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.js +7 -16
- package/dest/prover-client/factory.d.ts +3 -3
- package/dest/prover-client/factory.d.ts.map +1 -1
- package/dest/prover-client/index.d.ts +1 -1
- package/dest/prover-client/prover-client.d.ts +66 -7
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +64 -11
- package/dest/prover-client/server-epoch-prover.d.ts +8 -7
- package/dest/prover-client/server-epoch-prover.d.ts.map +1 -1
- package/dest/prover-client/server-epoch-prover.js +2 -2
- package/dest/proving_broker/broker_prover_facade.d.ts +25 -23
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +21 -33
- package/dest/proving_broker/config.d.ts +14 -62
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +29 -6
- package/dest/proving_broker/factory.d.ts +1 -1
- package/dest/proving_broker/fixtures.d.ts +3 -2
- package/dest/proving_broker/fixtures.d.ts.map +1 -1
- package/dest/proving_broker/fixtures.js +3 -2
- 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/proof_store/factory.d.ts +2 -5
- package/dest/proving_broker/proof_store/factory.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/factory.js +7 -30
- package/dest/proving_broker/proof_store/file_store_proof_store.d.ts +18 -0
- package/dest/proving_broker/proof_store/file_store_proof_store.d.ts.map +1 -0
- package/dest/proving_broker/proof_store/file_store_proof_store.js +60 -0
- package/dest/proving_broker/proof_store/index.d.ts +2 -2
- package/dest/proving_broker/proof_store/index.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/index.js +1 -1
- package/dest/proving_broker/proof_store/inline_proof_store.d.ts +1 -1
- package/dest/proving_broker/proof_store/inline_proof_store.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/proof_store.d.ts +1 -1
- package/dest/proving_broker/proving_agent.d.ts +5 -9
- package/dest/proving_broker/proving_agent.d.ts.map +1 -1
- package/dest/proving_broker/proving_agent.js +4 -19
- package/dest/proving_broker/proving_broker.d.ts +8 -5
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +74 -22
- package/dest/proving_broker/proving_broker_database/memory.d.ts +3 -2
- package/dest/proving_broker/proving_broker_database/memory.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.d.ts +5 -3
- package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +394 -5
- package/dest/proving_broker/proving_broker_database.d.ts +3 -2
- package/dest/proving_broker/proving_broker_database.d.ts.map +1 -1
- 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 +22 -35
- package/dest/proving_broker/proving_job_controller.d.ts +5 -3
- package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
- package/dest/proving_broker/proving_job_controller.js +8 -6
- package/dest/proving_broker/rpc.d.ts +9 -5
- package/dest/proving_broker/rpc.d.ts.map +1 -1
- package/dest/proving_broker/rpc.js +87 -23
- package/dest/test/mock_proof_store.d.ts +1 -1
- package/dest/test/mock_proof_store.d.ts.map +1 -1
- package/dest/test/mock_prover.d.ts +5 -6
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/dest/test/mock_prover.js +4 -4
- package/package.json +23 -22
- package/src/config.ts +19 -3
- package/src/light/index.ts +1 -0
- package/src/light/lightweight_checkpoint_builder.ts +320 -0
- package/src/mocks/fixtures.ts +9 -31
- package/src/mocks/test_context.ts +170 -185
- package/src/orchestrator/block-building-helpers.ts +129 -209
- package/src/orchestrator/block-proving-state.ts +109 -22
- package/src/orchestrator/checkpoint-proving-state.ts +89 -26
- package/src/orchestrator/checkpoint-sub-tree-orchestrator.ts +271 -0
- package/src/orchestrator/epoch-proving-context.ts +101 -0
- package/src/orchestrator/epoch-proving-state.ts +67 -15
- package/src/orchestrator/index.ts +8 -0
- package/src/orchestrator/orchestrator.ts +193 -354
- package/src/orchestrator/orchestrator_metrics.ts +2 -25
- 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/orchestrator/tx-proving-state.ts +10 -27
- package/src/prover-client/factory.ts +6 -2
- package/src/prover-client/prover-client.ts +157 -24
- package/src/prover-client/server-epoch-prover.ts +6 -7
- package/src/proving_broker/broker_prover_facade.ts +46 -55
- package/src/proving_broker/config.ts +33 -3
- package/src/proving_broker/fixtures.ts +8 -3
- package/src/proving_broker/index.ts +1 -0
- package/src/proving_broker/proof_store/factory.ts +10 -32
- package/src/proving_broker/proof_store/file_store_proof_store.ts +78 -0
- package/src/proving_broker/proof_store/index.ts +1 -1
- package/src/proving_broker/proving_agent.ts +6 -19
- package/src/proving_broker/proving_broker.ts +70 -17
- package/src/proving_broker/proving_broker_database/memory.ts +2 -1
- package/src/proving_broker/proving_broker_database/persisted.ts +22 -7
- package/src/proving_broker/proving_broker_database.ts +2 -1
- package/src/proving_broker/proving_broker_instrumentation.ts +23 -35
- package/src/proving_broker/proving_job_controller.ts +13 -7
- package/src/proving_broker/rpc.ts +46 -20
- package/src/test/mock_prover.ts +2 -14
- package/dest/block-factory/index.d.ts +0 -2
- package/dest/block-factory/index.d.ts.map +0 -1
- package/dest/block-factory/index.js +0 -1
- package/dest/block-factory/light.d.ts +0 -38
- package/dest/block-factory/light.d.ts.map +0 -1
- package/dest/block-factory/light.js +0 -94
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts +0 -14
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts.map +0 -1
- package/dest/proving_broker/proof_store/gcs_proof_store.js +0 -52
- package/dest/proving_broker/proving_agent_instrumentation.d.ts +0 -8
- package/dest/proving_broker/proving_agent_instrumentation.d.ts.map +0 -1
- package/dest/proving_broker/proving_agent_instrumentation.js +0 -16
- package/src/block-factory/index.ts +0 -1
- package/src/block-factory/light.ts +0 -140
- package/src/proving_broker/proof_store/gcs_proof_store.ts +0 -76
- package/src/proving_broker/proving_agent_instrumentation.ts +0 -21
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
3
|
import { type PromiseWithResolvers, RunningPromise, promiseWithResolvers } from '@aztec/foundation/promise';
|
|
3
4
|
import { PriorityMemoryQueue } from '@aztec/foundation/queue';
|
|
@@ -6,6 +7,7 @@ import {
|
|
|
6
7
|
type GetProvingJobResponse,
|
|
7
8
|
type ProofUri,
|
|
8
9
|
type ProvingJob,
|
|
10
|
+
type ProvingJobBrokerDebug,
|
|
9
11
|
type ProvingJobConsumer,
|
|
10
12
|
type ProvingJobFilter,
|
|
11
13
|
type ProvingJobId,
|
|
@@ -15,13 +17,7 @@ import {
|
|
|
15
17
|
tryStop,
|
|
16
18
|
} from '@aztec/stdlib/interfaces/server';
|
|
17
19
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
18
|
-
import {
|
|
19
|
-
type TelemetryClient,
|
|
20
|
-
type Traceable,
|
|
21
|
-
type Tracer,
|
|
22
|
-
getTelemetryClient,
|
|
23
|
-
trackSpan,
|
|
24
|
-
} from '@aztec/telemetry-client';
|
|
20
|
+
import { type TelemetryClient, type Traceable, type Tracer, getTelemetryClient } from '@aztec/telemetry-client';
|
|
25
21
|
|
|
26
22
|
import assert from 'assert';
|
|
27
23
|
|
|
@@ -41,7 +37,7 @@ type EnqueuedProvingJob = Pick<ProvingJob, 'id' | 'epochNumber'>;
|
|
|
41
37
|
* A broker that manages proof requests and distributes them to workers based on their priority.
|
|
42
38
|
* It takes a backend that is responsible for storing and retrieving proof requests and results.
|
|
43
39
|
*/
|
|
44
|
-
export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Traceable {
|
|
40
|
+
export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, ProvingJobBrokerDebug, Traceable {
|
|
45
41
|
private queues: ProvingQueues = {
|
|
46
42
|
[ProvingRequestType.PUBLIC_VM]: new PriorityMemoryQueue<EnqueuedProvingJob>(provingJobComparator),
|
|
47
43
|
[ProvingRequestType.PUBLIC_CHONK_VERIFIER]: new PriorityMemoryQueue<EnqueuedProvingJob>(provingJobComparator),
|
|
@@ -119,6 +115,8 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
119
115
|
|
|
120
116
|
private started = false;
|
|
121
117
|
|
|
118
|
+
private debugReplayEnabled: boolean;
|
|
119
|
+
|
|
122
120
|
public constructor(
|
|
123
121
|
private database: ProvingBrokerDatabase,
|
|
124
122
|
{
|
|
@@ -126,6 +124,7 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
126
124
|
proverBrokerPollIntervalMs,
|
|
127
125
|
proverBrokerJobMaxRetries,
|
|
128
126
|
proverBrokerMaxEpochsToKeepResultsFor,
|
|
127
|
+
proverBrokerDebugReplayEnabled,
|
|
129
128
|
}: Required<
|
|
130
129
|
Pick<
|
|
131
130
|
ProverBrokerConfig,
|
|
@@ -133,6 +132,7 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
133
132
|
| 'proverBrokerPollIntervalMs'
|
|
134
133
|
| 'proverBrokerJobMaxRetries'
|
|
135
134
|
| 'proverBrokerMaxEpochsToKeepResultsFor'
|
|
135
|
+
| 'proverBrokerDebugReplayEnabled'
|
|
136
136
|
>
|
|
137
137
|
> = defaultProverBrokerConfig,
|
|
138
138
|
client: TelemetryClient = getTelemetryClient(),
|
|
@@ -144,6 +144,7 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
144
144
|
this.jobTimeoutMs = proverBrokerJobTimeoutMs!;
|
|
145
145
|
this.maxRetries = proverBrokerJobMaxRetries!;
|
|
146
146
|
this.maxEpochsToKeepResultsFor = proverBrokerMaxEpochsToKeepResultsFor!;
|
|
147
|
+
this.debugReplayEnabled = proverBrokerDebugReplayEnabled ?? false;
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
private measureQueueDepth: MonitorCallback = (type: ProvingRequestType) => {
|
|
@@ -246,6 +247,29 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
246
247
|
return Promise.resolve(this.#reportProvingJobProgress(id, startedAt, filter));
|
|
247
248
|
}
|
|
248
249
|
|
|
250
|
+
public async replayProvingJob(
|
|
251
|
+
jobId: ProvingJobId,
|
|
252
|
+
type: ProvingRequestType,
|
|
253
|
+
epochNumber: EpochNumber,
|
|
254
|
+
inputsUri: ProofUri,
|
|
255
|
+
): Promise<ProvingJobStatus> {
|
|
256
|
+
if (!this.debugReplayEnabled) {
|
|
257
|
+
throw new Error('Debug replay not enabled. Set PROVER_BROKER_DEBUG_REPLAY_ENABLED=true');
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
this.logger.info(`Replaying proving job`, { provingJobId: jobId, epochNumber, inputsUri });
|
|
261
|
+
|
|
262
|
+
// Clear existing state and enqueue
|
|
263
|
+
this.cleanUpProvingJobState([jobId]);
|
|
264
|
+
|
|
265
|
+
const job: ProvingJob = { id: jobId, type, epochNumber, inputsUri };
|
|
266
|
+
this.jobsCache.set(jobId, job);
|
|
267
|
+
await this.database.addProvingJob(job);
|
|
268
|
+
this.enqueueJobInternal(job);
|
|
269
|
+
|
|
270
|
+
return { status: 'in-queue' };
|
|
271
|
+
}
|
|
272
|
+
|
|
249
273
|
async #enqueueProvingJob(job: ProvingJob): Promise<ProvingJobStatus> {
|
|
250
274
|
// We return the job status at the start of this call
|
|
251
275
|
const jobStatus = this.#getProvingJobStatus(job.id);
|
|
@@ -290,18 +314,25 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
290
314
|
// notify listeners of the cancellation
|
|
291
315
|
if (!this.resultsCache.has(id)) {
|
|
292
316
|
this.logger.info(`Cancelling job id=${id}`, { provingJobId: id });
|
|
293
|
-
await this.#reportProvingJobError(id, 'Aborted', false);
|
|
317
|
+
await this.#reportProvingJobError(id, 'Aborted', false, undefined, true);
|
|
294
318
|
}
|
|
295
319
|
}
|
|
296
320
|
|
|
297
321
|
private cleanUpProvingJobState(ids: ProvingJobId[]) {
|
|
322
|
+
const idsToClean = new Set(ids);
|
|
298
323
|
for (const id of ids) {
|
|
299
324
|
this.jobsCache.delete(id);
|
|
325
|
+
const deferred = this.promises.get(id);
|
|
326
|
+
if (deferred) {
|
|
327
|
+
deferred.resolve({ status: 'rejected', reason: 'Proving job cleaned up' });
|
|
328
|
+
}
|
|
300
329
|
this.promises.delete(id);
|
|
301
330
|
this.resultsCache.delete(id);
|
|
302
331
|
this.inProgress.delete(id);
|
|
303
332
|
this.retries.delete(id);
|
|
333
|
+
this.enqueuedAt.delete(id);
|
|
304
334
|
}
|
|
335
|
+
this.completedJobNotifications = this.completedJobNotifications.filter(id => !idsToClean.has(id));
|
|
305
336
|
}
|
|
306
337
|
|
|
307
338
|
#getProvingJobStatus(id: ProvingJobId): ProvingJobStatus {
|
|
@@ -353,6 +384,8 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
353
384
|
const enqueuedAt = this.enqueuedAt.get(job.id);
|
|
354
385
|
if (enqueuedAt) {
|
|
355
386
|
this.instrumentation.recordJobWait(job.type, enqueuedAt);
|
|
387
|
+
// we can clear this flag now.
|
|
388
|
+
this.enqueuedAt.delete(job.id);
|
|
356
389
|
}
|
|
357
390
|
|
|
358
391
|
return { job, time };
|
|
@@ -368,6 +401,7 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
368
401
|
err: string,
|
|
369
402
|
retry = false,
|
|
370
403
|
filter?: ProvingJobFilter,
|
|
404
|
+
aborted = false,
|
|
371
405
|
): Promise<GetProvingJobResponse | undefined> {
|
|
372
406
|
const info = this.inProgress.get(id);
|
|
373
407
|
const item = this.jobsCache.get(id);
|
|
@@ -428,7 +462,11 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
428
462
|
this.promises.get(id)!.resolve(result);
|
|
429
463
|
this.completedJobNotifications.push(id);
|
|
430
464
|
|
|
431
|
-
|
|
465
|
+
if (aborted) {
|
|
466
|
+
this.instrumentation.incAbortedJobs(item.type);
|
|
467
|
+
} else {
|
|
468
|
+
this.instrumentation.incRejectedJobs(item.type);
|
|
469
|
+
}
|
|
432
470
|
if (info) {
|
|
433
471
|
const duration = this.msTimeSource() - info.startedAt;
|
|
434
472
|
this.instrumentation.recordJobDuration(item.type, duration);
|
|
@@ -561,23 +599,22 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
561
599
|
return this.#getProvingJob(filter);
|
|
562
600
|
}
|
|
563
601
|
|
|
564
|
-
@trackSpan('ProvingBroker.cleanupPass')
|
|
565
602
|
private async cleanupPass() {
|
|
566
|
-
this.cleanupStaleJobs();
|
|
567
603
|
this.reEnqueueExpiredJobs();
|
|
568
604
|
const oldestEpochToKeep = this.oldestEpochToKeep();
|
|
569
605
|
if (oldestEpochToKeep > 0) {
|
|
570
|
-
|
|
606
|
+
this.cleanupJobsOlderThanEpoch(EpochNumber(oldestEpochToKeep));
|
|
607
|
+
await this.database.deleteAllProvingJobsOlderThanEpoch(EpochNumber(oldestEpochToKeep));
|
|
571
608
|
this.logger.trace(`Deleted all epochs older than ${oldestEpochToKeep}`);
|
|
572
609
|
}
|
|
573
610
|
}
|
|
574
611
|
|
|
575
|
-
private
|
|
612
|
+
private cleanupJobsOlderThanEpoch(epochNumber: EpochNumber) {
|
|
576
613
|
const jobIds = Array.from(this.jobsCache.keys());
|
|
577
614
|
const jobsToClean: ProvingJobId[] = [];
|
|
578
615
|
for (const id of jobIds) {
|
|
579
616
|
const job = this.jobsCache.get(id)!;
|
|
580
|
-
if (
|
|
617
|
+
if (job.epochNumber < epochNumber) {
|
|
581
618
|
jobsToClean.push(id);
|
|
582
619
|
}
|
|
583
620
|
}
|
|
@@ -601,10 +638,26 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
601
638
|
const now = this.msTimeSource();
|
|
602
639
|
const msSinceLastUpdate = now - metadata.lastUpdatedAt;
|
|
603
640
|
if (msSinceLastUpdate >= this.jobTimeoutMs) {
|
|
604
|
-
this.logger.warn(`Proving job id=${id} timed out. Adding it back to the queue.`, { provingJobId: id });
|
|
605
641
|
this.inProgress.delete(id);
|
|
606
|
-
this.enqueueJobInternal(item);
|
|
607
642
|
this.instrumentation.incTimedOutJobs(item.type);
|
|
643
|
+
|
|
644
|
+
const retries = this.retries.get(id) ?? 0;
|
|
645
|
+
if (retries + 1 < this.maxRetries && !this.isJobStale(item)) {
|
|
646
|
+
this.logger.warn(`Proving job id=${id} timed out. Re-enqueueing (retry ${retries + 1}/${this.maxRetries}).`, {
|
|
647
|
+
provingJobId: id,
|
|
648
|
+
});
|
|
649
|
+
this.retries.set(id, retries + 1);
|
|
650
|
+
this.enqueueJobInternal(item);
|
|
651
|
+
} else {
|
|
652
|
+
this.logger.error(`Proving job id=${id} timed out after ${retries + 1} attempts. Marking as failed.`, {
|
|
653
|
+
provingJobId: id,
|
|
654
|
+
});
|
|
655
|
+
const result: ProvingJobSettledResult = { status: 'rejected', reason: 'Timed out' };
|
|
656
|
+
this.resultsCache.set(id, result);
|
|
657
|
+
this.promises.get(id)?.resolve(result);
|
|
658
|
+
this.completedJobNotifications.push(id);
|
|
659
|
+
this.instrumentation.incRejectedJobs(item.type);
|
|
660
|
+
}
|
|
608
661
|
}
|
|
609
662
|
}
|
|
610
663
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import {
|
|
2
3
|
type ProofUri,
|
|
3
4
|
type ProvingJob,
|
|
@@ -43,7 +44,7 @@ export class InMemoryBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
43
44
|
return Promise.resolve();
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
deleteAllProvingJobsOlderThanEpoch(epochNumber:
|
|
47
|
+
deleteAllProvingJobsOlderThanEpoch(epochNumber: EpochNumber): Promise<void> {
|
|
47
48
|
const toDelete = [
|
|
48
49
|
...Array.from(this.jobs.keys()).filter(x => getEpochFromProvingJobId(x) < epochNumber),
|
|
49
50
|
...Array.from(this.results.keys()).filter(x => getEpochFromProvingJobId(x) < epochNumber),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
|
|
2
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { BatchQueue } from '@aztec/foundation/queue';
|
|
@@ -10,7 +11,14 @@ import {
|
|
|
10
11
|
ProvingJobSettledResult,
|
|
11
12
|
getEpochFromProvingJobId,
|
|
12
13
|
} from '@aztec/stdlib/interfaces/server';
|
|
13
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
Attributes,
|
|
16
|
+
LmdbMetrics,
|
|
17
|
+
type TelemetryClient,
|
|
18
|
+
type Tracer,
|
|
19
|
+
getTelemetryClient,
|
|
20
|
+
trackSpan,
|
|
21
|
+
} from '@aztec/telemetry-client';
|
|
14
22
|
|
|
15
23
|
import { mkdir, readdir } from 'fs/promises';
|
|
16
24
|
import { join } from 'path';
|
|
@@ -77,6 +85,8 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
77
85
|
|
|
78
86
|
private batchQueue: BatchQueue<ProvingJob | [ProvingJobId, ProvingJobSettledResult], number>;
|
|
79
87
|
|
|
88
|
+
public readonly tracer: Tracer;
|
|
89
|
+
|
|
80
90
|
private constructor(
|
|
81
91
|
private epochs: Map<number, SingleEpochDatabase>,
|
|
82
92
|
private config: ProverBrokerConfig,
|
|
@@ -91,6 +101,8 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
91
101
|
() => this.estimateSize(),
|
|
92
102
|
);
|
|
93
103
|
|
|
104
|
+
this.tracer = client.getTracer('KVBrokerDatabase');
|
|
105
|
+
|
|
94
106
|
this.batchQueue = new BatchQueue(
|
|
95
107
|
(items, key) => this.commitWrites(items, key),
|
|
96
108
|
config.proverBrokerBatchSize,
|
|
@@ -104,7 +116,7 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
104
116
|
const jobsToAdd = items.filter((item): item is ProvingJob => 'id' in item);
|
|
105
117
|
const resultsToAdd = items.filter((item): item is [ProvingJobId, ProvingJobSettledResult] => Array.isArray(item));
|
|
106
118
|
|
|
107
|
-
const db = await this.getEpochDatabase(epochNumber);
|
|
119
|
+
const db = await this.getEpochDatabase(EpochNumber(epochNumber));
|
|
108
120
|
await db.batchWrite(jobsToAdd, resultsToAdd);
|
|
109
121
|
}
|
|
110
122
|
|
|
@@ -142,7 +154,7 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
142
154
|
const db = await openVersionedStoreAt(
|
|
143
155
|
fullDirectory,
|
|
144
156
|
SingleEpochDatabase.SCHEMA_VERSION,
|
|
145
|
-
config.
|
|
157
|
+
config.rollupAddress,
|
|
146
158
|
config.dataStoreMapSizeKb,
|
|
147
159
|
);
|
|
148
160
|
const epochDb = new SingleEpochDatabase(db);
|
|
@@ -164,8 +176,11 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
164
176
|
}
|
|
165
177
|
}
|
|
166
178
|
|
|
167
|
-
|
|
168
|
-
|
|
179
|
+
@trackSpan('KVBrokerDatabase.deleteAllProvingJobsOlderThanEpoch', epochNumber => ({
|
|
180
|
+
[Attributes.EPOCH_NUMBER]: epochNumber,
|
|
181
|
+
}))
|
|
182
|
+
async deleteAllProvingJobsOlderThanEpoch(epochNumber: EpochNumber): Promise<void> {
|
|
183
|
+
const oldEpochs = Array.from(this.epochs.keys()).filter(e => e < Number(epochNumber));
|
|
169
184
|
for (const old of oldEpochs) {
|
|
170
185
|
const db = this.epochs.get(old);
|
|
171
186
|
if (!db) {
|
|
@@ -196,7 +211,7 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
196
211
|
return this.batchQueue.put([id, { status: 'fulfilled', value }], getEpochFromProvingJobId(id));
|
|
197
212
|
}
|
|
198
213
|
|
|
199
|
-
private async getEpochDatabase(epochNumber:
|
|
214
|
+
private async getEpochDatabase(epochNumber: EpochNumber): Promise<SingleEpochDatabase> {
|
|
200
215
|
let epochDb = this.epochs.get(epochNumber);
|
|
201
216
|
if (!epochDb) {
|
|
202
217
|
const newEpochDirectory = join(this.config.dataDirectory!, epochNumber.toString());
|
|
@@ -207,7 +222,7 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
207
222
|
const db = await openVersionedStoreAt(
|
|
208
223
|
newEpochDirectory,
|
|
209
224
|
SingleEpochDatabase.SCHEMA_VERSION,
|
|
210
|
-
this.config.
|
|
225
|
+
this.config.rollupAddress,
|
|
211
226
|
this.config.dataStoreMapSizeKb,
|
|
212
227
|
);
|
|
213
228
|
epochDb = new SingleEpochDatabase(db);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { ProofUri, ProvingJob, ProvingJobId, ProvingJobSettledResult } from '@aztec/stdlib/interfaces/server';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -14,7 +15,7 @@ export interface ProvingBrokerDatabase {
|
|
|
14
15
|
* Deletes all proving jobs belonging to epochs older than the given epoch
|
|
15
16
|
* @param epochNumber - The epoch number beyond which jobs should be deleted
|
|
16
17
|
*/
|
|
17
|
-
deleteAllProvingJobsOlderThanEpoch(epochNumber:
|
|
18
|
+
deleteAllProvingJobsOlderThanEpoch(epochNumber: EpochNumber): Promise<void>;
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Returns an iterator over all saved proving jobs
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type ObservableResult,
|
|
9
9
|
type TelemetryClient,
|
|
10
10
|
type UpDownCounter,
|
|
11
|
-
|
|
11
|
+
createUpDownCounterWithDefault,
|
|
12
12
|
} from '@aztec/telemetry-client';
|
|
13
13
|
|
|
14
14
|
export type MonitorCallback = (proofType: ProvingRequestType) => number;
|
|
@@ -18,6 +18,7 @@ export class ProvingBrokerInstrumentation {
|
|
|
18
18
|
private activeJobs: ObservableGauge;
|
|
19
19
|
private resolvedJobs: UpDownCounter;
|
|
20
20
|
private rejectedJobs: UpDownCounter;
|
|
21
|
+
private abortedJobs: UpDownCounter;
|
|
21
22
|
private timedOutJobs: UpDownCounter;
|
|
22
23
|
private cachedJobs: UpDownCounter;
|
|
23
24
|
private totalJobs: UpDownCounter;
|
|
@@ -28,49 +29,30 @@ export class ProvingBrokerInstrumentation {
|
|
|
28
29
|
constructor(client: TelemetryClient, name = 'ProvingBroker') {
|
|
29
30
|
const meter = client.getMeter(name);
|
|
30
31
|
|
|
31
|
-
this.queueSize = meter.createObservableGauge(Metrics.PROVING_QUEUE_SIZE
|
|
32
|
-
valueType: ValueType.INT,
|
|
33
|
-
});
|
|
32
|
+
this.queueSize = meter.createObservableGauge(Metrics.PROVING_QUEUE_SIZE);
|
|
34
33
|
|
|
35
|
-
this.activeJobs = meter.createObservableGauge(Metrics.PROVING_QUEUE_ACTIVE_JOBS
|
|
36
|
-
valueType: ValueType.INT,
|
|
37
|
-
});
|
|
34
|
+
this.activeJobs = meter.createObservableGauge(Metrics.PROVING_QUEUE_ACTIVE_JOBS);
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
36
|
+
const provingJobTypes = Object.values(ProvingRequestType).filter(v => typeof v === 'string');
|
|
37
|
+
const provingJobAttrs = { [Attributes.PROVING_JOB_TYPE]: provingJobTypes };
|
|
42
38
|
|
|
43
|
-
this.
|
|
44
|
-
valueType: ValueType.INT,
|
|
45
|
-
});
|
|
39
|
+
this.resolvedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_RESOLVED_JOBS, provingJobAttrs);
|
|
46
40
|
|
|
47
|
-
this.
|
|
48
|
-
valueType: ValueType.INT,
|
|
49
|
-
});
|
|
41
|
+
this.rejectedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_REJECTED_JOBS, provingJobAttrs);
|
|
50
42
|
|
|
51
|
-
this.
|
|
52
|
-
valueType: ValueType.INT,
|
|
53
|
-
});
|
|
43
|
+
this.abortedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_ABORTED_JOBS, provingJobAttrs);
|
|
54
44
|
|
|
55
|
-
this.
|
|
56
|
-
valueType: ValueType.INT,
|
|
57
|
-
});
|
|
45
|
+
this.retriedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_RETRIED_JOBS, provingJobAttrs);
|
|
58
46
|
|
|
59
|
-
this.
|
|
60
|
-
valueType: ValueType.INT,
|
|
61
|
-
});
|
|
47
|
+
this.timedOutJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_TIMED_OUT_JOBS, provingJobAttrs);
|
|
62
48
|
|
|
63
|
-
this.
|
|
64
|
-
description: 'Records how long a job sits in the queue',
|
|
65
|
-
unit: 'ms',
|
|
66
|
-
valueType: ValueType.INT,
|
|
67
|
-
});
|
|
49
|
+
this.cachedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_CACHED_JOBS, provingJobAttrs);
|
|
68
50
|
|
|
69
|
-
this.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
51
|
+
this.totalJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_TOTAL_JOBS, provingJobAttrs);
|
|
52
|
+
|
|
53
|
+
this.jobWait = meter.createHistogram(Metrics.PROVING_QUEUE_JOB_WAIT);
|
|
54
|
+
|
|
55
|
+
this.jobDuration = meter.createHistogram(Metrics.PROVING_QUEUE_JOB_DURATION);
|
|
74
56
|
}
|
|
75
57
|
|
|
76
58
|
monitorQueueDepth(fn: MonitorCallback) {
|
|
@@ -93,6 +75,12 @@ export class ProvingBrokerInstrumentation {
|
|
|
93
75
|
});
|
|
94
76
|
}
|
|
95
77
|
|
|
78
|
+
incAbortedJobs(proofType: ProvingRequestType) {
|
|
79
|
+
this.abortedJobs.add(1, {
|
|
80
|
+
[Attributes.PROVING_JOB_TYPE]: ProvingRequestType[proofType],
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
96
84
|
incRetriedJobs(proofType: ProvingRequestType) {
|
|
97
85
|
this.retriedJobs.add(1, {
|
|
98
86
|
[Attributes.PROVING_JOB_TYPE]: ProvingRequestType[proofType],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
2
3
|
import { AbortError } from '@aztec/foundation/error';
|
|
3
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
4
5
|
import type {
|
|
5
6
|
ProvingJobId,
|
|
6
7
|
ProvingJobInputs,
|
|
@@ -20,16 +21,22 @@ export class ProvingJobController {
|
|
|
20
21
|
private promise?: Promise<void>;
|
|
21
22
|
private abortController = new AbortController();
|
|
22
23
|
private result?: ProvingJobResultsMap[ProvingRequestType] | Error;
|
|
24
|
+
private log: Logger;
|
|
23
25
|
|
|
24
26
|
constructor(
|
|
25
27
|
private jobId: ProvingJobId,
|
|
26
28
|
private inputs: ProvingJobInputs,
|
|
27
|
-
private epochNumber:
|
|
29
|
+
private epochNumber: EpochNumber,
|
|
28
30
|
private startedAt: number,
|
|
29
31
|
private circuitProver: ServerCircuitProver,
|
|
30
32
|
private onComplete: () => void,
|
|
31
|
-
|
|
32
|
-
) {
|
|
33
|
+
bindings?: LoggerBindings,
|
|
34
|
+
) {
|
|
35
|
+
this.log = createLogger('prover-client:proving-agent:job-controller', {
|
|
36
|
+
instanceId: randomBytes(4).toString('hex'),
|
|
37
|
+
...bindings,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
33
40
|
|
|
34
41
|
public start(): void {
|
|
35
42
|
if (this.status !== ProvingJobControllerStatus.IDLE) {
|
|
@@ -124,8 +131,7 @@ export class ProvingJobController {
|
|
|
124
131
|
const signal = this.abortController.signal;
|
|
125
132
|
switch (type) {
|
|
126
133
|
case ProvingRequestType.PUBLIC_VM: {
|
|
127
|
-
|
|
128
|
-
return await this.circuitProver.getAvmProof(inputs, undefined, signal, this.epochNumber);
|
|
134
|
+
return await this.circuitProver.getAvmProof(inputs, signal, this.epochNumber);
|
|
129
135
|
}
|
|
130
136
|
|
|
131
137
|
case ProvingRequestType.PUBLIC_CHONK_VERIFIER: {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { EpochNumberSchema } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { createSafeJsonRpcClient } from '@aztec/foundation/json-rpc/client';
|
|
2
3
|
import {
|
|
3
4
|
type GetProvingJobResponse,
|
|
4
5
|
ProofUri,
|
|
5
6
|
ProvingJob,
|
|
6
7
|
type ProvingJobBroker,
|
|
8
|
+
type ProvingJobBrokerDebug,
|
|
7
9
|
type ProvingJobConsumer,
|
|
8
10
|
ProvingJobId,
|
|
9
11
|
type ProvingJobProducer,
|
|
@@ -16,6 +18,15 @@ import { makeTracedFetch } from '@aztec/telemetry-client';
|
|
|
16
18
|
|
|
17
19
|
import { z } from 'zod';
|
|
18
20
|
|
|
21
|
+
/** Indefinite backoff for broker communication: 1, 1, 1, 2, 4, 4, 4, ... seconds. */
|
|
22
|
+
export function* proverBrokerBackoff() {
|
|
23
|
+
const v = [1, 1, 1, 2, 4];
|
|
24
|
+
let i = 0;
|
|
25
|
+
while (true) {
|
|
26
|
+
yield v[Math.min(i++, v.length - 1)];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
19
30
|
const ProvingJobFilterSchema = z.object({
|
|
20
31
|
allowList: z.array(z.nativeEnum(ProvingRequestType)),
|
|
21
32
|
});
|
|
@@ -26,26 +37,29 @@ const GetProvingJobResponse = z.object({
|
|
|
26
37
|
});
|
|
27
38
|
|
|
28
39
|
export const ProvingJobProducerSchema: ApiSchemaFor<ProvingJobProducer> = {
|
|
29
|
-
enqueueProvingJob: z.function(
|
|
30
|
-
getProvingJobStatus: z.function(
|
|
31
|
-
cancelProvingJob: z.function(
|
|
32
|
-
getCompletedJobs: z.function(
|
|
40
|
+
enqueueProvingJob: z.function({ input: z.tuple([ProvingJob]), output: ProvingJobStatus }),
|
|
41
|
+
getProvingJobStatus: z.function({ input: z.tuple([ProvingJobId]), output: ProvingJobStatus }),
|
|
42
|
+
cancelProvingJob: z.function({ input: z.tuple([ProvingJobId]), output: z.void() }),
|
|
43
|
+
getCompletedJobs: z.function({ input: z.tuple([z.array(ProvingJobId)]), output: z.array(ProvingJobId) }),
|
|
33
44
|
};
|
|
34
45
|
|
|
35
46
|
export const ProvingJobConsumerSchema: ApiSchemaFor<ProvingJobConsumer> = {
|
|
36
|
-
getProvingJob: z.function(
|
|
37
|
-
|
|
38
|
-
.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
.
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
getProvingJob: z.function({
|
|
48
|
+
input: z.tuple([optional(ProvingJobFilterSchema)]),
|
|
49
|
+
output: GetProvingJobResponse.optional(),
|
|
50
|
+
}),
|
|
51
|
+
reportProvingJobError: z.function({
|
|
52
|
+
input: z.tuple([ProvingJobId, z.string(), optional(z.boolean()), optional(ProvingJobFilterSchema)]),
|
|
53
|
+
output: GetProvingJobResponse.optional(),
|
|
54
|
+
}),
|
|
55
|
+
reportProvingJobProgress: z.function({
|
|
56
|
+
input: z.tuple([ProvingJobId, z.number(), optional(ProvingJobFilterSchema)]),
|
|
57
|
+
output: GetProvingJobResponse.optional(),
|
|
58
|
+
}),
|
|
59
|
+
reportProvingJobSuccess: z.function({
|
|
60
|
+
input: z.tuple([ProvingJobId, ProofUri, optional(ProvingJobFilterSchema)]),
|
|
61
|
+
output: GetProvingJobResponse.optional(),
|
|
62
|
+
}),
|
|
49
63
|
};
|
|
50
64
|
|
|
51
65
|
export const ProvingJobBrokerSchema: ApiSchemaFor<ProvingJobBroker> = {
|
|
@@ -53,10 +67,22 @@ export const ProvingJobBrokerSchema: ApiSchemaFor<ProvingJobBroker> = {
|
|
|
53
67
|
...ProvingJobProducerSchema,
|
|
54
68
|
};
|
|
55
69
|
|
|
70
|
+
export const ProvingJobBrokerDebugSchema: ApiSchemaFor<ProvingJobBrokerDebug> = {
|
|
71
|
+
replayProvingJob: z.function({
|
|
72
|
+
input: z.tuple([ProvingJobId, z.nativeEnum(ProvingRequestType), EpochNumberSchema, ProofUri]),
|
|
73
|
+
output: ProvingJobStatus,
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const ProvingJobBrokerSchemaWithDebug: ApiSchemaFor<ProvingJobBroker & ProvingJobBrokerDebug> = {
|
|
78
|
+
...ProvingJobBrokerSchema,
|
|
79
|
+
...ProvingJobBrokerDebugSchema,
|
|
80
|
+
};
|
|
81
|
+
|
|
56
82
|
export function createProvingJobBrokerClient(
|
|
57
83
|
url: string,
|
|
58
84
|
versions: Partial<ComponentsVersions>,
|
|
59
|
-
fetch = makeTracedFetch(
|
|
85
|
+
fetch = makeTracedFetch(proverBrokerBackoff, false),
|
|
60
86
|
): ProvingJobBroker {
|
|
61
87
|
return createSafeJsonRpcClient(url, ProvingJobBrokerSchema, {
|
|
62
88
|
namespaceMethods: 'proverBroker',
|
|
@@ -68,7 +94,7 @@ export function createProvingJobBrokerClient(
|
|
|
68
94
|
export function createProvingJobProducerClient(
|
|
69
95
|
url: string,
|
|
70
96
|
versions: Partial<ComponentsVersions>,
|
|
71
|
-
fetch = makeTracedFetch(
|
|
97
|
+
fetch = makeTracedFetch(proverBrokerBackoff, false),
|
|
72
98
|
): ProvingJobProducer {
|
|
73
99
|
return createSafeJsonRpcClient(url, ProvingJobProducerSchema, {
|
|
74
100
|
namespaceMethods: 'provingJobProducer',
|
|
@@ -80,7 +106,7 @@ export function createProvingJobProducerClient(
|
|
|
80
106
|
export function createProvingJobConsumerClient(
|
|
81
107
|
url: string,
|
|
82
108
|
versions: Partial<ComponentsVersions>,
|
|
83
|
-
fetch = makeTracedFetch(
|
|
109
|
+
fetch = makeTracedFetch(proverBrokerBackoff, false),
|
|
84
110
|
): ProvingJobConsumer {
|
|
85
111
|
return createSafeJsonRpcClient(url, ProvingJobConsumerSchema, {
|
|
86
112
|
namespaceMethods: 'provingJobConsumer',
|
package/src/test/mock_prover.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
|
|
3
|
-
AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED,
|
|
4
3
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
5
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
6
5
|
RECURSIVE_PROOF_LENGTH,
|
|
@@ -14,7 +13,6 @@ import {
|
|
|
14
13
|
type ProvingJobStatus,
|
|
15
14
|
type PublicInputsAndRecursiveProof,
|
|
16
15
|
type ServerCircuitProver,
|
|
17
|
-
makeProofAndVerificationKey,
|
|
18
16
|
makePublicInputsAndRecursiveProof,
|
|
19
17
|
} from '@aztec/stdlib/interfaces/server';
|
|
20
18
|
import type { ParityBasePrivateInputs, ParityRootPrivateInputs } from '@aztec/stdlib/parity';
|
|
@@ -105,18 +103,8 @@ export class TestBroker implements ProvingJobProducer {
|
|
|
105
103
|
export class MockProver implements ServerCircuitProver {
|
|
106
104
|
constructor() {}
|
|
107
105
|
|
|
108
|
-
getAvmProof(
|
|
109
|
-
|
|
110
|
-
_skipPublicInputsValidation?: boolean, // TODO(#14234)[Unconditional PIs validation]: Remove.
|
|
111
|
-
_signal?: AbortSignal,
|
|
112
|
-
_epochNumber?: number,
|
|
113
|
-
) {
|
|
114
|
-
return Promise.resolve(
|
|
115
|
-
makeProofAndVerificationKey(
|
|
116
|
-
makeEmptyRecursiveProof(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED),
|
|
117
|
-
VerificationKeyData.makeFake(AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED),
|
|
118
|
-
),
|
|
119
|
-
);
|
|
106
|
+
getAvmProof(_inputs: AvmCircuitInputs, _signal?: AbortSignal, _epochNumber?: number) {
|
|
107
|
+
return Promise.resolve(makeEmptyRecursiveProof(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED));
|
|
120
108
|
}
|
|
121
109
|
|
|
122
110
|
getBaseParityProof(_inputs: ParityBasePrivateInputs, _signal?: AbortSignal, _epochNumber?: number) {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/block-factory/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './light.js';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { SpongeBlob } from '@aztec/blob-lib';
|
|
2
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { L2Block } from '@aztec/stdlib/block';
|
|
4
|
-
import type { IBlockFactory, MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
5
|
-
import type { GlobalVariables, ProcessedTx } from '@aztec/stdlib/tx';
|
|
6
|
-
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
7
|
-
/**
|
|
8
|
-
* Builds a block and its header from a set of processed tx without running any circuits.
|
|
9
|
-
*
|
|
10
|
-
* NOTE: the onus is ON THE CALLER to update the db that is passed in with the notes hashes, nullifiers, etc
|
|
11
|
-
* PRIOR to calling `buildBlock`.
|
|
12
|
-
*
|
|
13
|
-
* Why? Because if you are, e.g. building a block in practice from TxObjects, you are using the
|
|
14
|
-
* PublicProcessor which will do this for you as it processes transactions.
|
|
15
|
-
*
|
|
16
|
-
* If you haven't already inserted the side effects, e.g. because you are in a testing context, you can use the helper
|
|
17
|
-
* function `buildBlockWithCleanDB`, which calls `insertSideEffectsAndBuildBaseRollupHints` for you.
|
|
18
|
-
*/
|
|
19
|
-
export declare class LightweightBlockFactory implements IBlockFactory {
|
|
20
|
-
private db;
|
|
21
|
-
private telemetry;
|
|
22
|
-
private globalVariables?;
|
|
23
|
-
private l1ToL2Messages?;
|
|
24
|
-
private startSpongeBlob?;
|
|
25
|
-
private txs;
|
|
26
|
-
private readonly logger;
|
|
27
|
-
constructor(db: MerkleTreeWriteOperations, telemetry?: TelemetryClient);
|
|
28
|
-
startNewBlock(globalVariables: GlobalVariables, l1ToL2Messages: Fr[], startSpongeBlob?: SpongeBlob, isFirstBlock?: boolean): Promise<void>;
|
|
29
|
-
addTxs(txs: ProcessedTx[]): Promise<void>;
|
|
30
|
-
setBlockCompleted(): Promise<L2Block>;
|
|
31
|
-
private buildBlock;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Inserts the processed transactions into the DB, then creates a block.
|
|
35
|
-
* @param db - A db fork to use for block building which WILL BE MODIFIED.
|
|
36
|
-
*/
|
|
37
|
-
export declare function buildBlockWithCleanDB(txs: ProcessedTx[], globalVariables: GlobalVariables, l1ToL2Messages: Fr[], db: MerkleTreeWriteOperations, startSpongeBlob?: SpongeBlob, isFirstBlock?: boolean, telemetry?: TelemetryClient): Promise<L2Block>;
|
|
38
|
-
//# sourceMappingURL=light.d.ts.map
|