@aztec/prover-client 0.0.1-commit.03f7ef2 → 0.0.1-commit.04d373f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/config.d.ts +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +16 -2
- package/dest/light/lightweight_checkpoint_builder.d.ts +22 -6
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -1
- package/dest/light/lightweight_checkpoint_builder.js +112 -28
- package/dest/mocks/fixtures.d.ts +1 -1
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +2 -1
- package/dest/mocks/test_context.d.ts +6 -2
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +31 -11
- package/dest/orchestrator/block-building-helpers.d.ts +5 -5
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +4 -4
- package/dest/orchestrator/block-proving-state.d.ts +4 -1
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +7 -0
- package/dest/orchestrator/checkpoint-proving-state.d.ts +24 -4
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-proving-state.js +47 -5
- 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 +7 -6
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +37 -1
- 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 +30 -25
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +549 -255
- package/dest/orchestrator/orchestrator_metrics.d.ts +1 -1
- package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator_metrics.js +2 -6
- 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 +5 -4
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.js +6 -6
- package/dest/prover-client/factory.d.ts +3 -3
- package/dest/prover-client/factory.d.ts.map +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/proving_broker/broker_prover_facade.d.ts +7 -5
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +16 -22
- package/dest/proving_broker/config.d.ts +12 -64
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +22 -5
- 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/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 +69 -21
- package/dest/proving_broker/proving_broker_database/persisted.d.ts +3 -2
- package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +391 -3
- 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 +4 -3
- package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
- package/dest/proving_broker/proving_job_controller.js +6 -3
- package/dest/proving_broker/rpc.d.ts +6 -2
- 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 +3 -3
- package/dest/test/mock_proof_store.d.ts.map +1 -1
- package/dest/test/mock_prover.d.ts +5 -5
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/dest/test/mock_prover.js +3 -3
- package/package.json +19 -21
- package/src/config.ts +18 -2
- package/src/light/lightweight_checkpoint_builder.ts +159 -37
- package/src/mocks/fixtures.ts +2 -1
- package/src/mocks/test_context.ts +24 -11
- package/src/orchestrator/block-building-helpers.ts +4 -4
- package/src/orchestrator/block-proving-state.ts +9 -0
- package/src/orchestrator/checkpoint-proving-state.ts +65 -6
- 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 +59 -9
- package/src/orchestrator/index.ts +8 -0
- package/src/orchestrator/orchestrator.ts +165 -293
- package/src/orchestrator/orchestrator_metrics.ts +2 -6
- 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 +8 -11
- package/src/prover-client/factory.ts +6 -2
- package/src/prover-client/prover-client.ts +157 -24
- package/src/proving_broker/broker_prover_facade.ts +25 -26
- package/src/proving_broker/config.ts +25 -2
- 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 +65 -16
- package/src/proving_broker/proving_broker_database/persisted.ts +17 -3
- package/src/proving_broker/proving_broker_instrumentation.ts +23 -35
- package/src/proving_broker/proving_job_controller.ts +9 -3
- package/src/proving_broker/rpc.ts +46 -20
- package/src/test/mock_prover.ts +1 -8
- 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 -108
- 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 -137
- package/src/proving_broker/proof_store/gcs_proof_store.ts +0 -76
- package/src/proving_broker/proving_agent_instrumentation.ts +0 -21
|
@@ -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';
|
|
@@ -31,6 +32,8 @@ export const ProverBrokerConfig = z.object({
|
|
|
31
32
|
proverBrokerBatchIntervalMs: z.number().int().nonnegative(),
|
|
32
33
|
/** The maximum number of epochs to keep results for */
|
|
33
34
|
proverBrokerMaxEpochsToKeepResultsFor: z.number().int().nonnegative(),
|
|
35
|
+
/** Enable debug replay mode for replaying proving jobs from stored inputs */
|
|
36
|
+
proverBrokerDebugReplayEnabled: z.boolean(),
|
|
34
37
|
});
|
|
35
38
|
|
|
36
39
|
export type ProverBrokerConfig = z.infer<typeof ProverBrokerConfig> &
|
|
@@ -71,9 +74,14 @@ export const proverBrokerConfigMappings: ConfigMappingsType<ProverBrokerConfig>
|
|
|
71
74
|
},
|
|
72
75
|
proverBrokerStoreMapSizeKb: {
|
|
73
76
|
env: 'PROVER_BROKER_STORE_MAP_SIZE_KB',
|
|
74
|
-
|
|
77
|
+
...optionalNumberConfigHelper(),
|
|
75
78
|
description: "The size of the prover broker's database. Will override the dataStoreMapSizeKb if set.",
|
|
76
79
|
},
|
|
80
|
+
proverBrokerDebugReplayEnabled: {
|
|
81
|
+
env: 'PROVER_BROKER_DEBUG_REPLAY_ENABLED',
|
|
82
|
+
description: 'Enable debug replay mode for replaying proving jobs from stored inputs',
|
|
83
|
+
...booleanConfigHelper(false),
|
|
84
|
+
},
|
|
77
85
|
...dataConfigMappings,
|
|
78
86
|
...l1ReaderConfigMappings,
|
|
79
87
|
...pickConfigMappings(chainConfigMappings, ['rollupVersion']),
|
|
@@ -100,6 +108,10 @@ export const ProverAgentConfig = z.object({
|
|
|
100
108
|
proverTestDelayFactor: z.number(),
|
|
101
109
|
/** The delay (ms) to inject during fake proof verification */
|
|
102
110
|
proverTestVerificationDelayMs: z.number().optional(),
|
|
111
|
+
/** Whether to abort pending proving jobs when the orchestrator is cancelled */
|
|
112
|
+
cancelJobsOnStop: z.boolean(),
|
|
113
|
+
/** Where to store proving results. Must be accessible to both prover node and agents. If not set will inline-encode the parameters */
|
|
114
|
+
proofStore: z.string().optional(),
|
|
103
115
|
});
|
|
104
116
|
|
|
105
117
|
export type ProverAgentConfig = z.infer<typeof ProverAgentConfig>;
|
|
@@ -153,4 +165,15 @@ export const proverAgentConfigMappings: ConfigMappingsType<ProverAgentConfig> =
|
|
|
153
165
|
description: 'The delay (ms) to inject during fake proof verification',
|
|
154
166
|
...numberConfigHelper(10),
|
|
155
167
|
},
|
|
168
|
+
cancelJobsOnStop: {
|
|
169
|
+
env: 'PROVER_CANCEL_JOBS_ON_STOP',
|
|
170
|
+
description:
|
|
171
|
+
'Whether to abort pending proving jobs when the orchestrator is cancelled. ' +
|
|
172
|
+
'When false (default), jobs remain in the broker queue and can be reused on restart/reorg.',
|
|
173
|
+
...booleanConfigHelper(false),
|
|
174
|
+
},
|
|
175
|
+
proofStore: {
|
|
176
|
+
env: 'PROVER_PROOF_STORE',
|
|
177
|
+
description: 'Optional proof input store for the prover',
|
|
178
|
+
},
|
|
156
179
|
};
|
|
@@ -1,42 +1,20 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { createFileStore } from '@aztec/stdlib/file-store';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import { FileStoreProofStore } from './file_store_proof_store.js';
|
|
4
5
|
import { InlineProofStore } from './inline_proof_store.js';
|
|
5
6
|
import type { ProofStore } from './proof_store.js';
|
|
6
7
|
|
|
7
|
-
export function createProofStore(
|
|
8
|
-
|
|
8
|
+
export async function createProofStore(
|
|
9
|
+
config: string | undefined,
|
|
10
|
+
logger = createLogger('prover-client:proof-store'),
|
|
11
|
+
): Promise<ProofStore> {
|
|
12
|
+
if (!config) {
|
|
9
13
|
logger.info('Creating inline proof store');
|
|
10
14
|
return new InlineProofStore();
|
|
11
|
-
} else if (config.startsWith('gs://')) {
|
|
12
|
-
try {
|
|
13
|
-
const url = new URL(config);
|
|
14
|
-
const bucket = url.host;
|
|
15
|
-
const path = url.pathname.replace(/^\/+/, '');
|
|
16
|
-
logger.info(`Creating google cloud proof store at ${bucket}`, { bucket, path });
|
|
17
|
-
return new GoogleCloudStorageProofStore(bucket, path);
|
|
18
|
-
} catch {
|
|
19
|
-
throw new Error(
|
|
20
|
-
`Invalid google cloud proof store definition: '${config}'. Supported values are 'gs://bucket-name/path/to/store'.`,
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
} else {
|
|
24
|
-
throw new Error(`Unknown proof store config: '${config}'. Supported values are 'gs://bucket-name/path/to/store'.`);
|
|
25
15
|
}
|
|
26
|
-
}
|
|
27
16
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
): Pick<ProofStore, 'getProofInput' | 'getProofOutput'> {
|
|
32
|
-
if (uri.startsWith('data://')) {
|
|
33
|
-
return createProofStore(undefined, logger);
|
|
34
|
-
} else if (uri.startsWith('gs://')) {
|
|
35
|
-
const url = new URL(uri);
|
|
36
|
-
const basePath = url.pathname.replace(/^\/+/, '').split('/').slice(0, -3);
|
|
37
|
-
url.pathname = basePath.join('/');
|
|
38
|
-
return createProofStore(uri, logger);
|
|
39
|
-
} else {
|
|
40
|
-
throw new Error(`Unknown proof store config: '${uri}'. Supported protocols are 'data://' and 'gs://'.`);
|
|
41
|
-
}
|
|
17
|
+
const fileStore = await createFileStore(config, logger);
|
|
18
|
+
logger.info(`Creating file store proof store at ${config}`);
|
|
19
|
+
return new FileStoreProofStore(fileStore);
|
|
42
20
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
|
|
2
|
+
import type { FileStore } from '@aztec/stdlib/file-store';
|
|
3
|
+
import {
|
|
4
|
+
type ProofUri,
|
|
5
|
+
type ProvingJobId,
|
|
6
|
+
type ProvingJobInputs,
|
|
7
|
+
type ProvingJobInputsMap,
|
|
8
|
+
ProvingJobResult,
|
|
9
|
+
type ProvingJobResultsMap,
|
|
10
|
+
getProvingJobInputClassFor,
|
|
11
|
+
} from '@aztec/stdlib/interfaces/server';
|
|
12
|
+
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
13
|
+
|
|
14
|
+
import type { ProofStore } from './proof_store.js';
|
|
15
|
+
|
|
16
|
+
const INPUTS_PATH = 'inputs';
|
|
17
|
+
const OUTPUTS_PATH = 'outputs';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A proof store implementation backed by a generic FileStore.
|
|
21
|
+
* Supports any storage backend (GCS, S3, local filesystem) via the FileStore abstraction.
|
|
22
|
+
*/
|
|
23
|
+
export class FileStoreProofStore implements ProofStore {
|
|
24
|
+
constructor(private readonly fileStore: FileStore) {}
|
|
25
|
+
|
|
26
|
+
async saveProofInput<T extends ProvingRequestType>(
|
|
27
|
+
id: ProvingJobId,
|
|
28
|
+
type: T,
|
|
29
|
+
inputs: ProvingJobInputsMap[T],
|
|
30
|
+
): Promise<ProofUri> {
|
|
31
|
+
const path = `${INPUTS_PATH}/${ProvingRequestType[type]}/${id}`;
|
|
32
|
+
const uri = await this.fileStore.save(path, inputs.toBuffer());
|
|
33
|
+
return uri as ProofUri;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async saveProofOutput<T extends ProvingRequestType>(
|
|
37
|
+
id: ProvingJobId,
|
|
38
|
+
type: T,
|
|
39
|
+
result: ProvingJobResultsMap[T],
|
|
40
|
+
): Promise<ProofUri> {
|
|
41
|
+
const jobResult = { type, result } as ProvingJobResult;
|
|
42
|
+
const json = jsonStringify(jobResult);
|
|
43
|
+
const path = `${OUTPUTS_PATH}/${ProvingRequestType[type]}/${id}.json`;
|
|
44
|
+
const uri = await this.fileStore.save(path, Buffer.from(json, 'utf-8'));
|
|
45
|
+
return uri as ProofUri;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async getProofInput(uri: ProofUri): Promise<ProvingJobInputs> {
|
|
49
|
+
try {
|
|
50
|
+
const buffer = await this.fileStore.read(uri);
|
|
51
|
+
const type = this.extractTypeFromUri(uri);
|
|
52
|
+
const inputs = getProvingJobInputClassFor(type).fromBuffer(buffer);
|
|
53
|
+
return { inputs, type } as ProvingJobInputs;
|
|
54
|
+
} catch (err) {
|
|
55
|
+
throw new Error(`Error getting proof input at ${uri}: ${err}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async getProofOutput(uri: ProofUri): Promise<ProvingJobResult> {
|
|
60
|
+
try {
|
|
61
|
+
const buffer = await this.fileStore.read(uri);
|
|
62
|
+
return jsonParseWithSchema(buffer.toString('utf-8'), ProvingJobResult);
|
|
63
|
+
} catch (err) {
|
|
64
|
+
throw new Error(`Error getting proof output at ${uri}: ${err}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private extractTypeFromUri(uri: string): ProvingRequestType {
|
|
69
|
+
const url = new URL(uri);
|
|
70
|
+
const pathParts = url.pathname.split('/').filter(Boolean);
|
|
71
|
+
const typeString = pathParts.at(-2);
|
|
72
|
+
const type = typeString ? ProvingRequestType[typeString as keyof typeof ProvingRequestType] : undefined;
|
|
73
|
+
if (type === undefined) {
|
|
74
|
+
throw new Error(`Unrecognized proof type ${typeString} in URI ${uri}`);
|
|
75
|
+
}
|
|
76
|
+
return type;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbortError } from '@aztec/foundation/error';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
4
4
|
import { truncate } from '@aztec/foundation/string';
|
|
5
5
|
import { ProvingError } from '@aztec/stdlib/errors';
|
|
@@ -13,27 +13,17 @@ import type {
|
|
|
13
13
|
ServerCircuitProver,
|
|
14
14
|
} from '@aztec/stdlib/interfaces/server';
|
|
15
15
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
16
|
-
import {
|
|
17
|
-
type TelemetryClient,
|
|
18
|
-
type Traceable,
|
|
19
|
-
type Tracer,
|
|
20
|
-
getTelemetryClient,
|
|
21
|
-
trackSpan,
|
|
22
|
-
} from '@aztec/telemetry-client';
|
|
23
16
|
|
|
24
17
|
import type { ProofStore } from './proof_store/index.js';
|
|
25
|
-
import { ProvingAgentInstrumentation } from './proving_agent_instrumentation.js';
|
|
26
18
|
import { ProvingJobController, ProvingJobControllerStatus } from './proving_job_controller.js';
|
|
27
19
|
|
|
28
20
|
/**
|
|
29
21
|
* A helper class that encapsulates a circuit prover and connects it to a job source.
|
|
30
22
|
*/
|
|
31
|
-
export class ProvingAgent
|
|
23
|
+
export class ProvingAgent {
|
|
32
24
|
private currentJobController?: ProvingJobController;
|
|
33
25
|
private runningPromise: RunningPromise;
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
public readonly tracer: Tracer;
|
|
26
|
+
private log: Logger;
|
|
37
27
|
|
|
38
28
|
constructor(
|
|
39
29
|
/** The source of proving jobs */
|
|
@@ -46,12 +36,9 @@ export class ProvingAgent implements Traceable {
|
|
|
46
36
|
private proofAllowList: Array<ProvingRequestType> = [],
|
|
47
37
|
/** How long to wait between jobs */
|
|
48
38
|
private pollIntervalMs = 1000,
|
|
49
|
-
|
|
50
|
-
client: TelemetryClient = getTelemetryClient(),
|
|
51
|
-
private log = createLogger('prover-client:proving-agent'),
|
|
39
|
+
bindings?: LoggerBindings,
|
|
52
40
|
) {
|
|
53
|
-
this.
|
|
54
|
-
this.instrumentation = new ProvingAgentInstrumentation(client);
|
|
41
|
+
this.log = createLogger('prover-client:proving-agent', bindings);
|
|
55
42
|
this.runningPromise = new RunningPromise(this.work.bind(this), this.log, this.pollIntervalMs);
|
|
56
43
|
}
|
|
57
44
|
|
|
@@ -85,7 +72,6 @@ export class ProvingAgent implements Traceable {
|
|
|
85
72
|
return this.runningPromise.isRunning() ? { status: 'running' } : { status: 'stopped' };
|
|
86
73
|
}
|
|
87
74
|
|
|
88
|
-
@trackSpan('ProvingAgent.safeWork')
|
|
89
75
|
private async work() {
|
|
90
76
|
// every tick we need to take one of the following actions:
|
|
91
77
|
// 1. send a hearbeat to the broker that we're working on some job
|
|
@@ -175,6 +161,7 @@ export class ProvingAgent implements Traceable {
|
|
|
175
161
|
// no need to await this here. The controller will stay alive (in DONE state) until the result is send to the broker
|
|
176
162
|
void this.runningPromise.trigger();
|
|
177
163
|
},
|
|
164
|
+
this.log.getBindings(),
|
|
178
165
|
);
|
|
179
166
|
|
|
180
167
|
if (abortedProofJobId) {
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
type GetProvingJobResponse,
|
|
8
8
|
type ProofUri,
|
|
9
9
|
type ProvingJob,
|
|
10
|
+
type ProvingJobBrokerDebug,
|
|
10
11
|
type ProvingJobConsumer,
|
|
11
12
|
type ProvingJobFilter,
|
|
12
13
|
type ProvingJobId,
|
|
@@ -16,13 +17,7 @@ import {
|
|
|
16
17
|
tryStop,
|
|
17
18
|
} from '@aztec/stdlib/interfaces/server';
|
|
18
19
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
19
|
-
import {
|
|
20
|
-
type TelemetryClient,
|
|
21
|
-
type Traceable,
|
|
22
|
-
type Tracer,
|
|
23
|
-
getTelemetryClient,
|
|
24
|
-
trackSpan,
|
|
25
|
-
} from '@aztec/telemetry-client';
|
|
20
|
+
import { type TelemetryClient, type Traceable, type Tracer, getTelemetryClient } from '@aztec/telemetry-client';
|
|
26
21
|
|
|
27
22
|
import assert from 'assert';
|
|
28
23
|
|
|
@@ -42,7 +37,7 @@ type EnqueuedProvingJob = Pick<ProvingJob, 'id' | 'epochNumber'>;
|
|
|
42
37
|
* A broker that manages proof requests and distributes them to workers based on their priority.
|
|
43
38
|
* It takes a backend that is responsible for storing and retrieving proof requests and results.
|
|
44
39
|
*/
|
|
45
|
-
export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Traceable {
|
|
40
|
+
export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, ProvingJobBrokerDebug, Traceable {
|
|
46
41
|
private queues: ProvingQueues = {
|
|
47
42
|
[ProvingRequestType.PUBLIC_VM]: new PriorityMemoryQueue<EnqueuedProvingJob>(provingJobComparator),
|
|
48
43
|
[ProvingRequestType.PUBLIC_CHONK_VERIFIER]: new PriorityMemoryQueue<EnqueuedProvingJob>(provingJobComparator),
|
|
@@ -120,6 +115,8 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
120
115
|
|
|
121
116
|
private started = false;
|
|
122
117
|
|
|
118
|
+
private debugReplayEnabled: boolean;
|
|
119
|
+
|
|
123
120
|
public constructor(
|
|
124
121
|
private database: ProvingBrokerDatabase,
|
|
125
122
|
{
|
|
@@ -127,6 +124,7 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
127
124
|
proverBrokerPollIntervalMs,
|
|
128
125
|
proverBrokerJobMaxRetries,
|
|
129
126
|
proverBrokerMaxEpochsToKeepResultsFor,
|
|
127
|
+
proverBrokerDebugReplayEnabled,
|
|
130
128
|
}: Required<
|
|
131
129
|
Pick<
|
|
132
130
|
ProverBrokerConfig,
|
|
@@ -134,6 +132,7 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
134
132
|
| 'proverBrokerPollIntervalMs'
|
|
135
133
|
| 'proverBrokerJobMaxRetries'
|
|
136
134
|
| 'proverBrokerMaxEpochsToKeepResultsFor'
|
|
135
|
+
| 'proverBrokerDebugReplayEnabled'
|
|
137
136
|
>
|
|
138
137
|
> = defaultProverBrokerConfig,
|
|
139
138
|
client: TelemetryClient = getTelemetryClient(),
|
|
@@ -145,6 +144,7 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
145
144
|
this.jobTimeoutMs = proverBrokerJobTimeoutMs!;
|
|
146
145
|
this.maxRetries = proverBrokerJobMaxRetries!;
|
|
147
146
|
this.maxEpochsToKeepResultsFor = proverBrokerMaxEpochsToKeepResultsFor!;
|
|
147
|
+
this.debugReplayEnabled = proverBrokerDebugReplayEnabled ?? false;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
private measureQueueDepth: MonitorCallback = (type: ProvingRequestType) => {
|
|
@@ -247,6 +247,29 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
247
247
|
return Promise.resolve(this.#reportProvingJobProgress(id, startedAt, filter));
|
|
248
248
|
}
|
|
249
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
|
+
|
|
250
273
|
async #enqueueProvingJob(job: ProvingJob): Promise<ProvingJobStatus> {
|
|
251
274
|
// We return the job status at the start of this call
|
|
252
275
|
const jobStatus = this.#getProvingJobStatus(job.id);
|
|
@@ -291,19 +314,25 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
291
314
|
// notify listeners of the cancellation
|
|
292
315
|
if (!this.resultsCache.has(id)) {
|
|
293
316
|
this.logger.info(`Cancelling job id=${id}`, { provingJobId: id });
|
|
294
|
-
await this.#reportProvingJobError(id, 'Aborted', false);
|
|
317
|
+
await this.#reportProvingJobError(id, 'Aborted', false, undefined, true);
|
|
295
318
|
}
|
|
296
319
|
}
|
|
297
320
|
|
|
298
321
|
private cleanUpProvingJobState(ids: ProvingJobId[]) {
|
|
322
|
+
const idsToClean = new Set(ids);
|
|
299
323
|
for (const id of ids) {
|
|
300
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
|
+
}
|
|
301
329
|
this.promises.delete(id);
|
|
302
330
|
this.resultsCache.delete(id);
|
|
303
331
|
this.inProgress.delete(id);
|
|
304
332
|
this.retries.delete(id);
|
|
305
333
|
this.enqueuedAt.delete(id);
|
|
306
334
|
}
|
|
335
|
+
this.completedJobNotifications = this.completedJobNotifications.filter(id => !idsToClean.has(id));
|
|
307
336
|
}
|
|
308
337
|
|
|
309
338
|
#getProvingJobStatus(id: ProvingJobId): ProvingJobStatus {
|
|
@@ -372,6 +401,7 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
372
401
|
err: string,
|
|
373
402
|
retry = false,
|
|
374
403
|
filter?: ProvingJobFilter,
|
|
404
|
+
aborted = false,
|
|
375
405
|
): Promise<GetProvingJobResponse | undefined> {
|
|
376
406
|
const info = this.inProgress.get(id);
|
|
377
407
|
const item = this.jobsCache.get(id);
|
|
@@ -432,7 +462,11 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
432
462
|
this.promises.get(id)!.resolve(result);
|
|
433
463
|
this.completedJobNotifications.push(id);
|
|
434
464
|
|
|
435
|
-
|
|
465
|
+
if (aborted) {
|
|
466
|
+
this.instrumentation.incAbortedJobs(item.type);
|
|
467
|
+
} else {
|
|
468
|
+
this.instrumentation.incRejectedJobs(item.type);
|
|
469
|
+
}
|
|
436
470
|
if (info) {
|
|
437
471
|
const duration = this.msTimeSource() - info.startedAt;
|
|
438
472
|
this.instrumentation.recordJobDuration(item.type, duration);
|
|
@@ -565,23 +599,22 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
565
599
|
return this.#getProvingJob(filter);
|
|
566
600
|
}
|
|
567
601
|
|
|
568
|
-
@trackSpan('ProvingBroker.cleanupPass')
|
|
569
602
|
private async cleanupPass() {
|
|
570
|
-
this.cleanupStaleJobs();
|
|
571
603
|
this.reEnqueueExpiredJobs();
|
|
572
604
|
const oldestEpochToKeep = this.oldestEpochToKeep();
|
|
573
605
|
if (oldestEpochToKeep > 0) {
|
|
606
|
+
this.cleanupJobsOlderThanEpoch(EpochNumber(oldestEpochToKeep));
|
|
574
607
|
await this.database.deleteAllProvingJobsOlderThanEpoch(EpochNumber(oldestEpochToKeep));
|
|
575
608
|
this.logger.trace(`Deleted all epochs older than ${oldestEpochToKeep}`);
|
|
576
609
|
}
|
|
577
610
|
}
|
|
578
611
|
|
|
579
|
-
private
|
|
612
|
+
private cleanupJobsOlderThanEpoch(epochNumber: EpochNumber) {
|
|
580
613
|
const jobIds = Array.from(this.jobsCache.keys());
|
|
581
614
|
const jobsToClean: ProvingJobId[] = [];
|
|
582
615
|
for (const id of jobIds) {
|
|
583
616
|
const job = this.jobsCache.get(id)!;
|
|
584
|
-
if (
|
|
617
|
+
if (job.epochNumber < epochNumber) {
|
|
585
618
|
jobsToClean.push(id);
|
|
586
619
|
}
|
|
587
620
|
}
|
|
@@ -605,10 +638,26 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
605
638
|
const now = this.msTimeSource();
|
|
606
639
|
const msSinceLastUpdate = now - metadata.lastUpdatedAt;
|
|
607
640
|
if (msSinceLastUpdate >= this.jobTimeoutMs) {
|
|
608
|
-
this.logger.warn(`Proving job id=${id} timed out. Adding it back to the queue.`, { provingJobId: id });
|
|
609
641
|
this.inProgress.delete(id);
|
|
610
|
-
this.enqueueJobInternal(item);
|
|
611
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
|
+
}
|
|
612
661
|
}
|
|
613
662
|
}
|
|
614
663
|
}
|
|
@@ -11,7 +11,14 @@ import {
|
|
|
11
11
|
ProvingJobSettledResult,
|
|
12
12
|
getEpochFromProvingJobId,
|
|
13
13
|
} from '@aztec/stdlib/interfaces/server';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
Attributes,
|
|
16
|
+
LmdbMetrics,
|
|
17
|
+
type TelemetryClient,
|
|
18
|
+
type Tracer,
|
|
19
|
+
getTelemetryClient,
|
|
20
|
+
trackSpan,
|
|
21
|
+
} from '@aztec/telemetry-client';
|
|
15
22
|
|
|
16
23
|
import { mkdir, readdir } from 'fs/promises';
|
|
17
24
|
import { join } from 'path';
|
|
@@ -78,6 +85,8 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
78
85
|
|
|
79
86
|
private batchQueue: BatchQueue<ProvingJob | [ProvingJobId, ProvingJobSettledResult], number>;
|
|
80
87
|
|
|
88
|
+
public readonly tracer: Tracer;
|
|
89
|
+
|
|
81
90
|
private constructor(
|
|
82
91
|
private epochs: Map<number, SingleEpochDatabase>,
|
|
83
92
|
private config: ProverBrokerConfig,
|
|
@@ -92,6 +101,8 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
92
101
|
() => this.estimateSize(),
|
|
93
102
|
);
|
|
94
103
|
|
|
104
|
+
this.tracer = client.getTracer('KVBrokerDatabase');
|
|
105
|
+
|
|
95
106
|
this.batchQueue = new BatchQueue(
|
|
96
107
|
(items, key) => this.commitWrites(items, key),
|
|
97
108
|
config.proverBrokerBatchSize,
|
|
@@ -143,7 +154,7 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
143
154
|
const db = await openVersionedStoreAt(
|
|
144
155
|
fullDirectory,
|
|
145
156
|
SingleEpochDatabase.SCHEMA_VERSION,
|
|
146
|
-
config.
|
|
157
|
+
config.rollupAddress,
|
|
147
158
|
config.dataStoreMapSizeKb,
|
|
148
159
|
);
|
|
149
160
|
const epochDb = new SingleEpochDatabase(db);
|
|
@@ -165,6 +176,9 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
165
176
|
}
|
|
166
177
|
}
|
|
167
178
|
|
|
179
|
+
@trackSpan('KVBrokerDatabase.deleteAllProvingJobsOlderThanEpoch', epochNumber => ({
|
|
180
|
+
[Attributes.EPOCH_NUMBER]: epochNumber,
|
|
181
|
+
}))
|
|
168
182
|
async deleteAllProvingJobsOlderThanEpoch(epochNumber: EpochNumber): Promise<void> {
|
|
169
183
|
const oldEpochs = Array.from(this.epochs.keys()).filter(e => e < Number(epochNumber));
|
|
170
184
|
for (const old of oldEpochs) {
|
|
@@ -208,7 +222,7 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
208
222
|
const db = await openVersionedStoreAt(
|
|
209
223
|
newEpochDirectory,
|
|
210
224
|
SingleEpochDatabase.SCHEMA_VERSION,
|
|
211
|
-
this.config.
|
|
225
|
+
this.config.rollupAddress,
|
|
212
226
|
this.config.dataStoreMapSizeKb,
|
|
213
227
|
);
|
|
214
228
|
epochDb = new SingleEpochDatabase(db);
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
3
3
|
import { AbortError } from '@aztec/foundation/error';
|
|
4
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
5
5
|
import type {
|
|
6
6
|
ProvingJobId,
|
|
7
7
|
ProvingJobInputs,
|
|
@@ -21,6 +21,7 @@ export class ProvingJobController {
|
|
|
21
21
|
private promise?: Promise<void>;
|
|
22
22
|
private abortController = new AbortController();
|
|
23
23
|
private result?: ProvingJobResultsMap[ProvingRequestType] | Error;
|
|
24
|
+
private log: Logger;
|
|
24
25
|
|
|
25
26
|
constructor(
|
|
26
27
|
private jobId: ProvingJobId,
|
|
@@ -29,8 +30,13 @@ export class ProvingJobController {
|
|
|
29
30
|
private startedAt: number,
|
|
30
31
|
private circuitProver: ServerCircuitProver,
|
|
31
32
|
private onComplete: () => void,
|
|
32
|
-
|
|
33
|
-
) {
|
|
33
|
+
bindings?: LoggerBindings,
|
|
34
|
+
) {
|
|
35
|
+
this.log = createLogger('prover-client:proving-agent:job-controller', {
|
|
36
|
+
instanceId: randomBytes(4).toString('hex'),
|
|
37
|
+
...bindings,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
34
40
|
|
|
35
41
|
public start(): void {
|
|
36
42
|
if (this.status !== ProvingJobControllerStatus.IDLE) {
|