@aztec/prover-client 0.0.1-commit.934299a21 → 0.0.1-commit.949a33fd8
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 +2 -1
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -1
- package/dest/light/lightweight_checkpoint_builder.js +7 -0
- 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 +12 -7
- package/dest/orchestrator/block-building-helpers.d.ts +1 -1
- package/dest/orchestrator/checkpoint-proving-state.js +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 +3 -3
- 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 +28 -5
- 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 -18
- package/src/config.ts +13 -2
- package/src/light/lightweight_checkpoint_builder.ts +11 -0
- package/src/mocks/test_context.ts +10 -8
- package/src/orchestrator/checkpoint-proving-state.ts +1 -1
- 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 +3 -2
- package/src/proving_broker/proving_broker.ts +23 -3
- package/src/proving_broker/rpc.ts +12 -3
|
@@ -245,6 +245,13 @@ import { ProvingBrokerInstrumentation } from './proving_broker_instrumentation.j
|
|
|
245
245
|
cleanUpProvingJobState(ids) {
|
|
246
246
|
for (const id of ids){
|
|
247
247
|
this.jobsCache.delete(id);
|
|
248
|
+
const deferred = this.promises.get(id);
|
|
249
|
+
if (deferred) {
|
|
250
|
+
deferred.resolve({
|
|
251
|
+
status: 'rejected',
|
|
252
|
+
reason: 'Proving job cleaned up'
|
|
253
|
+
});
|
|
254
|
+
}
|
|
248
255
|
this.promises.delete(id);
|
|
249
256
|
this.resultsCache.delete(id);
|
|
250
257
|
this.inProgress.delete(id);
|
|
@@ -492,7 +499,7 @@ import { ProvingBrokerInstrumentation } from './proving_broker_instrumentation.j
|
|
|
492
499
|
const jobsToClean = [];
|
|
493
500
|
for (const id of jobIds){
|
|
494
501
|
const job = this.jobsCache.get(id);
|
|
495
|
-
if (this.isJobStale(job)) {
|
|
502
|
+
if (this.isJobStale(job) && !this.inProgress.has(id) && !this.resultsCache.has(id)) {
|
|
496
503
|
jobsToClean.push(id);
|
|
497
504
|
}
|
|
498
505
|
}
|
|
@@ -515,12 +522,28 @@ import { ProvingBrokerInstrumentation } from './proving_broker_instrumentation.j
|
|
|
515
522
|
const now = this.msTimeSource();
|
|
516
523
|
const msSinceLastUpdate = now - metadata.lastUpdatedAt;
|
|
517
524
|
if (msSinceLastUpdate >= this.jobTimeoutMs) {
|
|
518
|
-
this.logger.warn(`Proving job id=${id} timed out. Adding it back to the queue.`, {
|
|
519
|
-
provingJobId: id
|
|
520
|
-
});
|
|
521
525
|
this.inProgress.delete(id);
|
|
522
|
-
this.enqueueJobInternal(item);
|
|
523
526
|
this.instrumentation.incTimedOutJobs(item.type);
|
|
527
|
+
const retries = this.retries.get(id) ?? 0;
|
|
528
|
+
if (retries + 1 < this.maxRetries && !this.isJobStale(item)) {
|
|
529
|
+
this.logger.warn(`Proving job id=${id} timed out. Re-enqueueing (retry ${retries + 1}/${this.maxRetries}).`, {
|
|
530
|
+
provingJobId: id
|
|
531
|
+
});
|
|
532
|
+
this.retries.set(id, retries + 1);
|
|
533
|
+
this.enqueueJobInternal(item);
|
|
534
|
+
} else {
|
|
535
|
+
this.logger.error(`Proving job id=${id} timed out after ${retries + 1} attempts. Marking as failed.`, {
|
|
536
|
+
provingJobId: id
|
|
537
|
+
});
|
|
538
|
+
const result = {
|
|
539
|
+
status: 'rejected',
|
|
540
|
+
reason: 'Timed out'
|
|
541
|
+
};
|
|
542
|
+
this.resultsCache.set(id, result);
|
|
543
|
+
this.promises.get(id)?.resolve(result);
|
|
544
|
+
this.completedJobNotifications.push(id);
|
|
545
|
+
this.instrumentation.incRejectedJobs(item.type);
|
|
546
|
+
}
|
|
524
547
|
}
|
|
525
548
|
}
|
|
526
549
|
}
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnBjLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHJvdmluZ19icm9rZXIvcnBjLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sRUFJTCxLQUFLLGdCQUFnQixFQUNyQixLQUFLLHFCQUFxQixFQUMxQixLQUFLLGtCQUFrQixFQUV2QixLQUFLLGtCQUFrQixFQUV4QixNQUFNLGlDQUFpQyxDQUFDO0FBRXpDLE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBWSxNQUFNLHVCQUF1QixDQUFDO0FBQ3BFLE9BQU8sRUFBRSxLQUFLLGtCQUFrQixFQUFnQyxNQUFNLDBCQUEwQixDQUFDO0FBS2pHLHFGQUFxRjtBQUNyRix3QkFBaUIsbUJBQW1CLHFDQU1uQztBQVdELGVBQU8sTUFBTSx3QkFBd0IsRUFBRSxZQUFZLENBQUMsa0JBQWtCLENBS3JFLENBQUM7QUFFRixlQUFPLE1BQU0sd0JBQXdCLEVBQUUsWUFBWSxDQUFDLGtCQUFrQixDQWNyRSxDQUFDO0FBRUYsZUFBTyxNQUFNLHNCQUFzQixFQUFFLFlBQVksQ0FBQyxnQkFBZ0IsQ0FHakUsQ0FBQztBQUVGLGVBQU8sTUFBTSwyQkFBMkIsRUFBRSxZQUFZLENBQUMscUJBQXFCLENBSzNFLENBQUM7QUFFRixlQUFPLE1BQU0sK0JBQStCLEVBQUUsWUFBWSxDQUFDLGdCQUFnQixHQUFHLHFCQUFxQixDQUdsRyxDQUFDO0FBRUYsd0JBQWdCLDRCQUE0QixDQUMxQyxHQUFHLEVBQUUsTUFBTSxFQUNYLFFBQVEsRUFBRSxPQUFPLENBQUMsa0JBQWtCLENBQUMsRUFDckMsS0FBSzs7Ozs7RUFBOEMsR0FDbEQsZ0JBQWdCLENBTWxCO0FBRUQsd0JBQWdCLDhCQUE4QixDQUM1QyxHQUFHLEVBQUUsTUFBTSxFQUNYLFFBQVEsRUFBRSxPQUFPLENBQUMsa0JBQWtCLENBQUMsRUFDckMsS0FBSzs7Ozs7RUFBOEMsR0FDbEQsa0JBQWtCLENBTXBCO0FBRUQsd0JBQWdCLDhCQUE4QixDQUM1QyxHQUFHLEVBQUUsTUFBTSxFQUNYLFFBQVEsRUFBRSxPQUFPLENBQUMsa0JBQWtCLENBQUMsRUFDckMsS0FBSzs7Ozs7RUFBOEMsR0FDbEQsa0JBQWtCLENBTXBCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../../src/proving_broker/rpc.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAEvB,KAAK,kBAAkB,EAExB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,KAAK,YAAY,EAAY,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,KAAK,kBAAkB,EAAgC,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../../src/proving_broker/rpc.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAEvB,KAAK,kBAAkB,EAExB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,KAAK,YAAY,EAAY,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,KAAK,kBAAkB,EAAgC,MAAM,0BAA0B,CAAC;AAKjG,qFAAqF;AACrF,wBAAiB,mBAAmB,qCAMnC;AAWD,eAAO,MAAM,wBAAwB,EAAE,YAAY,CAAC,kBAAkB,CAKrE,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,YAAY,CAAC,kBAAkB,CAcrE,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
|
});
|
|
@@ -36,33 +49,21 @@ export const ProvingJobBrokerSchemaWithDebug = {
|
|
|
36
49
|
...ProvingJobBrokerSchema,
|
|
37
50
|
...ProvingJobBrokerDebugSchema
|
|
38
51
|
};
|
|
39
|
-
export function createProvingJobBrokerClient(url, versions, fetch = makeTracedFetch(
|
|
40
|
-
1,
|
|
41
|
-
2,
|
|
42
|
-
3
|
|
43
|
-
], false)) {
|
|
52
|
+
export function createProvingJobBrokerClient(url, versions, fetch = makeTracedFetch(proverBrokerBackoff, false)) {
|
|
44
53
|
return createSafeJsonRpcClient(url, ProvingJobBrokerSchema, {
|
|
45
54
|
namespaceMethods: 'proverBroker',
|
|
46
55
|
fetch,
|
|
47
56
|
onResponse: getVersioningResponseHandler(versions)
|
|
48
57
|
});
|
|
49
58
|
}
|
|
50
|
-
export function createProvingJobProducerClient(url, versions, fetch = makeTracedFetch(
|
|
51
|
-
1,
|
|
52
|
-
2,
|
|
53
|
-
3
|
|
54
|
-
], false)) {
|
|
59
|
+
export function createProvingJobProducerClient(url, versions, fetch = makeTracedFetch(proverBrokerBackoff, false)) {
|
|
55
60
|
return createSafeJsonRpcClient(url, ProvingJobProducerSchema, {
|
|
56
61
|
namespaceMethods: 'provingJobProducer',
|
|
57
62
|
fetch,
|
|
58
63
|
onResponse: getVersioningResponseHandler(versions)
|
|
59
64
|
});
|
|
60
65
|
}
|
|
61
|
-
export function createProvingJobConsumerClient(url, versions, fetch = makeTracedFetch(
|
|
62
|
-
1,
|
|
63
|
-
2,
|
|
64
|
-
3
|
|
65
|
-
], false)) {
|
|
66
|
+
export function createProvingJobConsumerClient(url, versions, fetch = makeTracedFetch(proverBrokerBackoff, false)) {
|
|
66
67
|
return createSafeJsonRpcClient(url, ProvingJobConsumerSchema, {
|
|
67
68
|
namespaceMethods: 'provingJobConsumer',
|
|
68
69
|
fetch,
|
|
@@ -20,8 +20,8 @@ export declare class TestBroker implements ProvingJobProducer {
|
|
|
20
20
|
export declare class MockProver implements ServerCircuitProver {
|
|
21
21
|
constructor();
|
|
22
22
|
getAvmProof(_inputs: AvmCircuitInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<import("@aztec/stdlib/proofs").RecursiveProof<16400>>;
|
|
23
|
-
getBaseParityProof(_inputs: ParityBasePrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<import("@aztec/stdlib/parity").ParityPublicInputs,
|
|
24
|
-
getRootParityProof(_inputs: ParityRootPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<import("@aztec/stdlib/parity").ParityPublicInputs,
|
|
23
|
+
getBaseParityProof(_inputs: ParityBasePrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<import("@aztec/stdlib/parity").ParityPublicInputs, 410>>;
|
|
24
|
+
getRootParityProof(_inputs: ParityRootPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<import("@aztec/stdlib/parity").ParityPublicInputs, 410>>;
|
|
25
25
|
getPublicChonkVerifierProof(_inputs: PublicChonkVerifierPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<PublicChonkVerifierPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
26
26
|
getPrivateTxBaseRollupProof(_baseRollupInput: PrivateTxBaseRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
27
27
|
getPublicTxBaseRollupProof(_inputs: PublicTxBaseRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
@@ -31,7 +31,7 @@ export declare class MockProver implements ServerCircuitProver {
|
|
|
31
31
|
getBlockRootEmptyTxFirstRollupProof(_input: BlockRootEmptyTxFirstRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
32
32
|
getBlockRootRollupProof(_input: BlockRootRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
33
33
|
getBlockRootSingleTxRollupProof(_input: BlockRootSingleTxRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
34
|
-
getBlockMergeRollupProof(_input: BlockMergeRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs,
|
|
34
|
+
getBlockMergeRollupProof(_input: BlockMergeRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, 480>>;
|
|
35
35
|
getCheckpointRootRollupProof(_input: CheckpointRootRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
36
36
|
getCheckpointRootSingleBlockRollupProof(_input: CheckpointRootSingleBlockRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
37
37
|
getCheckpointMergeRollupProof(_input: CheckpointMergeRollupPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/prover-client",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.949a33fd8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"build:dev": "../scripts/tsc.sh --watch",
|
|
28
28
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
29
29
|
"bb": "node --no-warnings ./dest/bb/index.js",
|
|
30
|
-
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=3500000
|
|
31
|
-
"test:debug": "LOG_LEVEL=debug NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=1500000 --
|
|
30
|
+
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=3500000",
|
|
31
|
+
"test:debug": "LOG_LEVEL=debug NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=1500000 --testNamePattern prover/bb_prover/parity"
|
|
32
32
|
},
|
|
33
33
|
"jest": {
|
|
34
34
|
"moduleNameMapper": {
|
|
@@ -68,20 +68,19 @@
|
|
|
68
68
|
]
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
72
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
73
|
-
"@aztec/constants": "0.0.1-commit.
|
|
74
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
75
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
76
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
77
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
78
|
-
"@aztec/noir-types": "0.0.1-commit.
|
|
79
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
80
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
81
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
82
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
83
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
84
|
-
"@google-cloud/storage": "^7.15.0",
|
|
71
|
+
"@aztec/bb-prover": "0.0.1-commit.949a33fd8",
|
|
72
|
+
"@aztec/blob-lib": "0.0.1-commit.949a33fd8",
|
|
73
|
+
"@aztec/constants": "0.0.1-commit.949a33fd8",
|
|
74
|
+
"@aztec/ethereum": "0.0.1-commit.949a33fd8",
|
|
75
|
+
"@aztec/foundation": "0.0.1-commit.949a33fd8",
|
|
76
|
+
"@aztec/kv-store": "0.0.1-commit.949a33fd8",
|
|
77
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.949a33fd8",
|
|
78
|
+
"@aztec/noir-types": "0.0.1-commit.949a33fd8",
|
|
79
|
+
"@aztec/protocol-contracts": "0.0.1-commit.949a33fd8",
|
|
80
|
+
"@aztec/simulator": "0.0.1-commit.949a33fd8",
|
|
81
|
+
"@aztec/stdlib": "0.0.1-commit.949a33fd8",
|
|
82
|
+
"@aztec/telemetry-client": "0.0.1-commit.949a33fd8",
|
|
83
|
+
"@aztec/world-state": "0.0.1-commit.949a33fd8",
|
|
85
84
|
"@iarna/toml": "^2.2.5",
|
|
86
85
|
"commander": "^12.1.0",
|
|
87
86
|
"lodash.chunk": "^4.2.0",
|
|
@@ -90,7 +89,7 @@
|
|
|
90
89
|
"zod": "^3.23.8"
|
|
91
90
|
},
|
|
92
91
|
"devDependencies": {
|
|
93
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
92
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.949a33fd8",
|
|
94
93
|
"@jest/globals": "^30.0.0",
|
|
95
94
|
"@types/jest": "^30.0.0",
|
|
96
95
|
"@types/node": "^22.15.17",
|
package/src/config.ts
CHANGED
|
@@ -44,14 +44,25 @@ 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
|
+
},
|
|
55
66
|
};
|
|
56
67
|
|
|
57
68
|
export const proverClientConfigMappings: ConfigMappingsType<ProverClientUserConfig> = {
|
|
@@ -154,6 +154,10 @@ export class LightweightCheckpointBuilder {
|
|
|
154
154
|
return this.blocks.length;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
public getBlocks() {
|
|
158
|
+
return this.blocks;
|
|
159
|
+
}
|
|
160
|
+
|
|
157
161
|
/**
|
|
158
162
|
* Adds a new block to the checkpoint. The tx effects must have already been inserted into the db if
|
|
159
163
|
* this is called after tx processing, if that's not the case, then set `insertTxsEffects` to true.
|
|
@@ -216,6 +220,13 @@ export class LightweightCheckpointBuilder {
|
|
|
216
220
|
timings.updateArchive = msUpdateArchive;
|
|
217
221
|
this.lastArchives.push(newArchive);
|
|
218
222
|
|
|
223
|
+
const expectedNextLeafIndex = Number(globalVariables.blockNumber) + 1;
|
|
224
|
+
if (newArchive.nextAvailableLeafIndex !== expectedNextLeafIndex) {
|
|
225
|
+
throw new Error(
|
|
226
|
+
`Archive tree next leaf index mismatch after building block ${globalVariables.blockNumber} (expected ${expectedNextLeafIndex} but got ${newArchive.nextAvailableLeafIndex})`,
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
219
230
|
const indexWithinCheckpoint = IndexWithinCheckpoint(this.blocks.length);
|
|
220
231
|
const block = new L2Block(newArchive, header, body, this.checkpointNumber, indexWithinCheckpoint);
|
|
221
232
|
this.blocks.push(block);
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
StateReference,
|
|
25
25
|
TreeSnapshots,
|
|
26
26
|
} from '@aztec/stdlib/tx';
|
|
27
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
27
28
|
import type { MerkleTreeAdminDatabase } from '@aztec/world-state';
|
|
28
29
|
import { NativeWorldStateService } from '@aztec/world-state/native';
|
|
29
30
|
|
|
@@ -84,14 +85,13 @@ export class TestContext {
|
|
|
84
85
|
const feePayer = AztecAddress.fromNumber(42222);
|
|
85
86
|
const initialFeePayerBalance = new Fr(10n ** 20n);
|
|
86
87
|
const feePayerSlot = await computeFeePayerBalanceLeafSlot(feePayer);
|
|
87
|
-
const
|
|
88
|
+
const genesis: GenesisData = {
|
|
89
|
+
prefilledPublicData: [new PublicDataTreeLeaf(feePayerSlot, initialFeePayerBalance)],
|
|
90
|
+
genesisTimestamp: 0n,
|
|
91
|
+
};
|
|
88
92
|
|
|
89
93
|
// Separated dbs for public processor and prover - see public_processor for context
|
|
90
|
-
const ws = await NativeWorldStateService.tmp(
|
|
91
|
-
/*rollupAddress=*/ undefined,
|
|
92
|
-
/*cleanupTmpDir=*/ true,
|
|
93
|
-
prefilledPublicData,
|
|
94
|
-
);
|
|
94
|
+
const ws = await NativeWorldStateService.tmp(/*rollupAddress=*/ undefined, /*cleanupTmpDir=*/ true, genesis);
|
|
95
95
|
|
|
96
96
|
let localProver: ServerCircuitProver;
|
|
97
97
|
const config = await getEnvironmentConfig(logger);
|
|
@@ -104,8 +104,10 @@ export class TestContext {
|
|
|
104
104
|
bbBinaryPath: config.expectedBBPath,
|
|
105
105
|
bbWorkingDirectory: config.bbWorkingDirectory,
|
|
106
106
|
bbSkipCleanup: config.bbSkipCleanup,
|
|
107
|
-
numConcurrentIVCVerifiers:
|
|
107
|
+
numConcurrentIVCVerifiers: 8,
|
|
108
108
|
bbIVCConcurrency: 1,
|
|
109
|
+
bbChonkVerifyMaxBatch: 16,
|
|
110
|
+
bbChonkVerifyConcurrency: 6,
|
|
109
111
|
};
|
|
110
112
|
localProver = await createProver(bbConfig);
|
|
111
113
|
}
|
|
@@ -116,7 +118,7 @@ export class TestContext {
|
|
|
116
118
|
|
|
117
119
|
const broker = new TestBroker(proverCount, localProver);
|
|
118
120
|
const facade = new BrokerCircuitProverFacade(broker);
|
|
119
|
-
const orchestrator = new TestProvingOrchestrator(ws, facade, EthAddress.ZERO);
|
|
121
|
+
const orchestrator = new TestProvingOrchestrator(ws, facade, EthAddress.ZERO, false, 10);
|
|
120
122
|
|
|
121
123
|
await broker.start();
|
|
122
124
|
facade.start();
|
|
@@ -204,7 +204,7 @@ export class CheckpointProvingState {
|
|
|
204
204
|
Fr.ZERO,
|
|
205
205
|
NUM_MSGS_PER_BASE_PARITY,
|
|
206
206
|
);
|
|
207
|
-
return new ParityBasePrivateInputs(messages, this.constants.vkTreeRoot);
|
|
207
|
+
return new ParityBasePrivateInputs(messages, this.constants.vkTreeRoot, this.constants.proverId);
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
public setOutHashHint(hint: OutHashHint) {
|
|
@@ -12,7 +12,9 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
12
12
|
import { AbortError } from '@aztec/foundation/error';
|
|
13
13
|
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
14
14
|
import { promiseWithResolvers } from '@aztec/foundation/promise';
|
|
15
|
+
import { SerialQueue } from '@aztec/foundation/queue';
|
|
15
16
|
import { assertLength } from '@aztec/foundation/serialize';
|
|
17
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
16
18
|
import { pushTestData } from '@aztec/foundation/testing';
|
|
17
19
|
import { elapsed } from '@aztec/foundation/timer';
|
|
18
20
|
import type { TreeNodeLocation } from '@aztec/foundation/trees';
|
|
@@ -94,17 +96,20 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
94
96
|
// eslint-disable-next-line aztec-custom/no-non-primitive-in-collections
|
|
95
97
|
private dbs: Map<BlockNumber, MerkleTreeWriteOperations> = new Map();
|
|
96
98
|
private logger: Logger;
|
|
99
|
+
private deferredJobQueue = new SerialQueue();
|
|
97
100
|
|
|
98
101
|
constructor(
|
|
99
102
|
private dbProvider: ReadonlyWorldStateAccess & ForkMerkleTreeOperations,
|
|
100
103
|
private prover: ServerCircuitProver,
|
|
101
104
|
private readonly proverId: EthAddress,
|
|
102
105
|
private readonly cancelJobsOnStop: boolean = false,
|
|
106
|
+
private readonly enqueueConcurrency: number,
|
|
103
107
|
telemetryClient: TelemetryClient = getTelemetryClient(),
|
|
104
108
|
bindings?: LoggerBindings,
|
|
105
109
|
) {
|
|
106
110
|
this.logger = createLogger('prover-client:orchestrator', bindings);
|
|
107
111
|
this.metrics = new ProvingOrchestratorMetrics(telemetryClient, 'ProvingOrchestrator');
|
|
112
|
+
this.deferredJobQueue.start(this.enqueueConcurrency);
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
get tracer(): Tracer {
|
|
@@ -119,9 +124,11 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
119
124
|
return this.dbs.size;
|
|
120
125
|
}
|
|
121
126
|
|
|
122
|
-
public stop(): Promise<void> {
|
|
127
|
+
public async stop(): Promise<void> {
|
|
128
|
+
// Grab the old queue before cancel() replaces it, so we can await its draining.
|
|
129
|
+
const oldQueue = this.deferredJobQueue;
|
|
123
130
|
this.cancel();
|
|
124
|
-
|
|
131
|
+
await oldQueue.cancel();
|
|
125
132
|
}
|
|
126
133
|
|
|
127
134
|
public startNewEpoch(
|
|
@@ -514,6 +521,11 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
514
521
|
* If cancelJobsOnStop is false (default), jobs remain in the broker queue and can be reused on restart/reorg.
|
|
515
522
|
*/
|
|
516
523
|
public cancel() {
|
|
524
|
+
void this.deferredJobQueue.cancel();
|
|
525
|
+
// Recreate the queue so it can accept jobs for subsequent epochs.
|
|
526
|
+
this.deferredJobQueue = new SerialQueue();
|
|
527
|
+
this.deferredJobQueue.start(this.enqueueConcurrency);
|
|
528
|
+
|
|
517
529
|
if (this.cancelJobsOnStop) {
|
|
518
530
|
for (const controller of this.pendingProvingJobs) {
|
|
519
531
|
controller.abort();
|
|
@@ -623,8 +635,11 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
623
635
|
}
|
|
624
636
|
};
|
|
625
637
|
|
|
626
|
-
|
|
627
|
-
|
|
638
|
+
void this.deferredJobQueue.put(async () => {
|
|
639
|
+
void safeJob();
|
|
640
|
+
// we yield here to the macro task queue such to give Nodejs a chance to run other operatoins in between enqueues
|
|
641
|
+
await sleep(0);
|
|
642
|
+
});
|
|
628
643
|
}
|
|
629
644
|
|
|
630
645
|
private async updateL1ToL2MessageTree(l1ToL2Messages: Fr[], db: MerkleTreeWriteOperations) {
|
|
@@ -54,6 +54,7 @@ export class ProverClient implements EpochProverManager {
|
|
|
54
54
|
facade,
|
|
55
55
|
this.config.proverId,
|
|
56
56
|
this.config.cancelJobsOnStop,
|
|
57
|
+
this.config.enqueueConcurrency,
|
|
57
58
|
this.telemetry,
|
|
58
59
|
bindings,
|
|
59
60
|
);
|
|
@@ -156,7 +157,7 @@ export class ProverClient implements EpochProverManager {
|
|
|
156
157
|
}
|
|
157
158
|
|
|
158
159
|
export function buildServerCircuitProver(
|
|
159
|
-
config: ActualProverConfig & ACVMConfig & BBConfig,
|
|
160
|
+
config: Omit<ActualProverConfig, 'enqueueConcurrency'> & ACVMConfig & BBConfig,
|
|
160
161
|
telemetry: TelemetryClient,
|
|
161
162
|
): Promise<ServerCircuitProver> {
|
|
162
163
|
if (config.realProofs) {
|
|
@@ -4,8 +4,9 @@ import type {
|
|
|
4
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
5
|
RECURSIVE_PROOF_LENGTH,
|
|
6
6
|
} from '@aztec/constants';
|
|
7
|
+
import { asyncPool } from '@aztec/foundation/async-pool';
|
|
7
8
|
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
8
|
-
import {
|
|
9
|
+
import { chunk } from '@aztec/foundation/collection';
|
|
9
10
|
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
10
11
|
import { type PromiseWithResolvers, RunningPromise, promiseWithResolvers } from '@aztec/foundation/promise';
|
|
11
12
|
import { truncate } from '@aztec/foundation/string';
|
|
@@ -46,6 +47,8 @@ import type {
|
|
|
46
47
|
TxRollupPublicInputs,
|
|
47
48
|
} from '@aztec/stdlib/rollup';
|
|
48
49
|
|
|
50
|
+
import { createHash } from 'node:crypto';
|
|
51
|
+
|
|
49
52
|
import { InlineProofStore, type ProofStore } from './proof_store/index.js';
|
|
50
53
|
|
|
51
54
|
// Perform a snapshot sync every 30 seconds
|
|
@@ -225,17 +228,11 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
225
228
|
// We collect all returned notifications and return them
|
|
226
229
|
const allCompleted = new Set<ProvingJobId>();
|
|
227
230
|
try {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
const
|
|
231
|
-
const completed = await this.broker.getCompletedJobs(slice);
|
|
231
|
+
const batches = ids.length > 0 ? chunk(ids, SNAPSHOT_SYNC_CHECK_MAX_REQUEST_SIZE) : [[]];
|
|
232
|
+
await asyncPool(1, batches, async batch => {
|
|
233
|
+
const completed = await this.broker.getCompletedJobs(batch);
|
|
232
234
|
completed.forEach(id => allCompleted.add(id));
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
if (numRequests === 0) {
|
|
236
|
-
const final = await this.broker.getCompletedJobs([]);
|
|
237
|
-
final.forEach(id => allCompleted.add(id));
|
|
238
|
-
}
|
|
235
|
+
});
|
|
239
236
|
} catch (err) {
|
|
240
237
|
this.log.error(`Error thrown when requesting completed job notifications from the broker`, err);
|
|
241
238
|
}
|
|
@@ -351,12 +348,8 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
351
348
|
.map(id => this.jobs.get(id)!)
|
|
352
349
|
.filter(x => x !== undefined);
|
|
353
350
|
const totalJobsToRetrieve = toBeRetrieved.length;
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
const slice = toBeRetrieved.splice(0, MAX_CONCURRENT_JOB_SETTLED_REQUESTS);
|
|
357
|
-
const results = await Promise.all(slice.map(job => processJob(job!)));
|
|
358
|
-
totalJobsRetrieved += results.filter(x => x).length;
|
|
359
|
-
}
|
|
351
|
+
const results = await asyncPool(MAX_CONCURRENT_JOB_SETTLED_REQUESTS, toBeRetrieved, job => processJob(job));
|
|
352
|
+
const totalJobsRetrieved = results.filter(x => x).length;
|
|
360
353
|
if (totalJobsToRetrieve > 0) {
|
|
361
354
|
this.log.verbose(
|
|
362
355
|
`Successfully retrieved ${totalJobsRetrieved} of ${totalJobsToRetrieve} jobs that should be ready, total ready jobs is now: ${this.jobsToRetrieve.size}`,
|
|
@@ -659,8 +652,12 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
659
652
|
);
|
|
660
653
|
}
|
|
661
654
|
|
|
662
|
-
private generateId(
|
|
663
|
-
|
|
664
|
-
|
|
655
|
+
private generateId(
|
|
656
|
+
type: ProvingRequestType,
|
|
657
|
+
inputs: { toBuffer(): Buffer },
|
|
658
|
+
epochNumber = EpochNumber.ZERO,
|
|
659
|
+
): ProvingJobId {
|
|
660
|
+
const inputsHash = createHash('sha256').update(inputs.toBuffer()).digest('hex');
|
|
661
|
+
return makeProvingJobId(epochNumber, type, inputsHash);
|
|
665
662
|
}
|
|
666
663
|
}
|
|
@@ -4,10 +4,11 @@ import {
|
|
|
4
4
|
booleanConfigHelper,
|
|
5
5
|
getDefaultConfig,
|
|
6
6
|
numberConfigHelper,
|
|
7
|
+
optionalNumberConfigHelper,
|
|
7
8
|
} from '@aztec/foundation/config';
|
|
8
9
|
import { pickConfigMappings } from '@aztec/foundation/config';
|
|
9
|
-
import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
|
|
10
10
|
import { type ChainConfig, chainConfigMappings } from '@aztec/stdlib/config';
|
|
11
|
+
import { type DataStoreConfig, dataConfigMappings } from '@aztec/stdlib/kv-store';
|
|
11
12
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
12
13
|
|
|
13
14
|
import { z } from 'zod';
|
|
@@ -73,7 +74,7 @@ export const proverBrokerConfigMappings: ConfigMappingsType<ProverBrokerConfig>
|
|
|
73
74
|
},
|
|
74
75
|
proverBrokerStoreMapSizeKb: {
|
|
75
76
|
env: 'PROVER_BROKER_STORE_MAP_SIZE_KB',
|
|
76
|
-
|
|
77
|
+
...optionalNumberConfigHelper(),
|
|
77
78
|
description: "The size of the prover broker's database. Will override the dataStoreMapSizeKb if set.",
|
|
78
79
|
},
|
|
79
80
|
proverBrokerDebugReplayEnabled: {
|
|
@@ -321,6 +321,10 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Pr
|
|
|
321
321
|
private cleanUpProvingJobState(ids: ProvingJobId[]) {
|
|
322
322
|
for (const id of ids) {
|
|
323
323
|
this.jobsCache.delete(id);
|
|
324
|
+
const deferred = this.promises.get(id);
|
|
325
|
+
if (deferred) {
|
|
326
|
+
deferred.resolve({ status: 'rejected', reason: 'Proving job cleaned up' });
|
|
327
|
+
}
|
|
324
328
|
this.promises.delete(id);
|
|
325
329
|
this.resultsCache.delete(id);
|
|
326
330
|
this.inProgress.delete(id);
|
|
@@ -608,7 +612,7 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Pr
|
|
|
608
612
|
const jobsToClean: ProvingJobId[] = [];
|
|
609
613
|
for (const id of jobIds) {
|
|
610
614
|
const job = this.jobsCache.get(id)!;
|
|
611
|
-
if (this.isJobStale(job)) {
|
|
615
|
+
if (this.isJobStale(job) && !this.inProgress.has(id) && !this.resultsCache.has(id)) {
|
|
612
616
|
jobsToClean.push(id);
|
|
613
617
|
}
|
|
614
618
|
}
|
|
@@ -632,10 +636,26 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Pr
|
|
|
632
636
|
const now = this.msTimeSource();
|
|
633
637
|
const msSinceLastUpdate = now - metadata.lastUpdatedAt;
|
|
634
638
|
if (msSinceLastUpdate >= this.jobTimeoutMs) {
|
|
635
|
-
this.logger.warn(`Proving job id=${id} timed out. Adding it back to the queue.`, { provingJobId: id });
|
|
636
639
|
this.inProgress.delete(id);
|
|
637
|
-
this.enqueueJobInternal(item);
|
|
638
640
|
this.instrumentation.incTimedOutJobs(item.type);
|
|
641
|
+
|
|
642
|
+
const retries = this.retries.get(id) ?? 0;
|
|
643
|
+
if (retries + 1 < this.maxRetries && !this.isJobStale(item)) {
|
|
644
|
+
this.logger.warn(`Proving job id=${id} timed out. Re-enqueueing (retry ${retries + 1}/${this.maxRetries}).`, {
|
|
645
|
+
provingJobId: id,
|
|
646
|
+
});
|
|
647
|
+
this.retries.set(id, retries + 1);
|
|
648
|
+
this.enqueueJobInternal(item);
|
|
649
|
+
} else {
|
|
650
|
+
this.logger.error(`Proving job id=${id} timed out after ${retries + 1} attempts. Marking as failed.`, {
|
|
651
|
+
provingJobId: id,
|
|
652
|
+
});
|
|
653
|
+
const result: ProvingJobSettledResult = { status: 'rejected', reason: 'Timed out' };
|
|
654
|
+
this.resultsCache.set(id, result);
|
|
655
|
+
this.promises.get(id)?.resolve(result);
|
|
656
|
+
this.completedJobNotifications.push(id);
|
|
657
|
+
this.instrumentation.incRejectedJobs(item.type);
|
|
658
|
+
}
|
|
639
659
|
}
|
|
640
660
|
}
|
|
641
661
|
}
|
|
@@ -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',
|