@aztec/prover-client 0.0.1-commit.993d52e → 0.0.1-commit.9badcec54
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 +12 -2
- package/dest/light/lightweight_checkpoint_builder.d.ts +6 -2
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -1
- package/dest/light/lightweight_checkpoint_builder.js +28 -7
- package/dest/mocks/test_context.d.ts +1 -1
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +13 -8
- package/dest/orchestrator/block-building-helpers.d.ts +1 -1
- package/dest/orchestrator/epoch-proving-state.d.ts +1 -1
- package/dest/orchestrator/orchestrator.d.ts +4 -2
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +21 -5
- package/dest/prover-client/prover-client.d.ts +2 -2
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +1 -1
- package/dest/proving_broker/broker_prover_facade.d.ts +1 -1
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +13 -19
- package/dest/proving_broker/config.d.ts +2 -2
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +2 -2
- package/dest/proving_broker/proving_broker.d.ts +1 -1
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +20 -4
- 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 +16 -15
- package/dest/test/mock_prover.d.ts +3 -3
- package/package.json +17 -17
- package/src/config.ts +13 -2
- package/src/light/lightweight_checkpoint_builder.ts +32 -14
- package/src/mocks/test_context.ts +11 -9
- package/src/orchestrator/orchestrator.ts +19 -4
- package/src/prover-client/prover-client.ts +2 -1
- package/src/proving_broker/broker_prover_facade.ts +17 -20
- package/src/proving_broker/config.ts +2 -2
- package/src/proving_broker/proving_broker.ts +18 -2
- package/src/proving_broker/rpc.ts +12 -3
|
@@ -632,10 +632,26 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Pr
|
|
|
632
632
|
const now = this.msTimeSource();
|
|
633
633
|
const msSinceLastUpdate = now - metadata.lastUpdatedAt;
|
|
634
634
|
if (msSinceLastUpdate >= this.jobTimeoutMs) {
|
|
635
|
-
this.logger.warn(`Proving job id=${id} timed out. Adding it back to the queue.`, { provingJobId: id });
|
|
636
635
|
this.inProgress.delete(id);
|
|
637
|
-
this.enqueueJobInternal(item);
|
|
638
636
|
this.instrumentation.incTimedOutJobs(item.type);
|
|
637
|
+
|
|
638
|
+
const retries = this.retries.get(id) ?? 0;
|
|
639
|
+
if (retries + 1 < this.maxRetries && !this.isJobStale(item)) {
|
|
640
|
+
this.logger.warn(`Proving job id=${id} timed out. Re-enqueueing (retry ${retries + 1}/${this.maxRetries}).`, {
|
|
641
|
+
provingJobId: id,
|
|
642
|
+
});
|
|
643
|
+
this.retries.set(id, retries + 1);
|
|
644
|
+
this.enqueueJobInternal(item);
|
|
645
|
+
} else {
|
|
646
|
+
this.logger.error(`Proving job id=${id} timed out after ${retries + 1} attempts. Marking as failed.`, {
|
|
647
|
+
provingJobId: id,
|
|
648
|
+
});
|
|
649
|
+
const result: ProvingJobSettledResult = { status: 'rejected', reason: 'Timed out' };
|
|
650
|
+
this.resultsCache.set(id, result);
|
|
651
|
+
this.promises.get(id)?.resolve(result);
|
|
652
|
+
this.completedJobNotifications.push(id);
|
|
653
|
+
this.instrumentation.incRejectedJobs(item.type);
|
|
654
|
+
}
|
|
639
655
|
}
|
|
640
656
|
}
|
|
641
657
|
}
|
|
@@ -18,6 +18,15 @@ import { makeTracedFetch } from '@aztec/telemetry-client';
|
|
|
18
18
|
|
|
19
19
|
import { z } from 'zod';
|
|
20
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
|
+
|
|
21
30
|
const ProvingJobFilterSchema = z.object({
|
|
22
31
|
allowList: z.array(z.nativeEnum(ProvingRequestType)),
|
|
23
32
|
});
|
|
@@ -70,7 +79,7 @@ export const ProvingJobBrokerSchemaWithDebug: ApiSchemaFor<ProvingJobBroker & Pr
|
|
|
70
79
|
export function createProvingJobBrokerClient(
|
|
71
80
|
url: string,
|
|
72
81
|
versions: Partial<ComponentsVersions>,
|
|
73
|
-
fetch = makeTracedFetch(
|
|
82
|
+
fetch = makeTracedFetch(proverBrokerBackoff, false),
|
|
74
83
|
): ProvingJobBroker {
|
|
75
84
|
return createSafeJsonRpcClient(url, ProvingJobBrokerSchema, {
|
|
76
85
|
namespaceMethods: 'proverBroker',
|
|
@@ -82,7 +91,7 @@ export function createProvingJobBrokerClient(
|
|
|
82
91
|
export function createProvingJobProducerClient(
|
|
83
92
|
url: string,
|
|
84
93
|
versions: Partial<ComponentsVersions>,
|
|
85
|
-
fetch = makeTracedFetch(
|
|
94
|
+
fetch = makeTracedFetch(proverBrokerBackoff, false),
|
|
86
95
|
): ProvingJobProducer {
|
|
87
96
|
return createSafeJsonRpcClient(url, ProvingJobProducerSchema, {
|
|
88
97
|
namespaceMethods: 'provingJobProducer',
|
|
@@ -94,7 +103,7 @@ export function createProvingJobProducerClient(
|
|
|
94
103
|
export function createProvingJobConsumerClient(
|
|
95
104
|
url: string,
|
|
96
105
|
versions: Partial<ComponentsVersions>,
|
|
97
|
-
fetch = makeTracedFetch(
|
|
106
|
+
fetch = makeTracedFetch(proverBrokerBackoff, false),
|
|
98
107
|
): ProvingJobConsumer {
|
|
99
108
|
return createSafeJsonRpcClient(url, ProvingJobConsumerSchema, {
|
|
100
109
|
namespaceMethods: 'provingJobConsumer',
|