@aztec/prover-client 0.0.1-commit.d1f2d6c → 0.0.1-commit.d20b825a7
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 +13 -5
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -1
- package/dest/light/lightweight_checkpoint_builder.js +49 -20
- 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 +1 -1
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +17 -9
- package/dest/orchestrator/block-building-helpers.d.ts +4 -4
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +3 -3
- 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 +3 -3
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-proving-state.js +4 -4
- package/dest/orchestrator/epoch-proving-state.d.ts +3 -3
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +5 -3
- package/dest/orchestrator/orchestrator.d.ts +7 -3
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +125 -117
- package/dest/prover-client/prover-client.d.ts +4 -4
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +15 -10
- package/dest/proving_broker/broker_prover_facade.d.ts +4 -3
- 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 +10 -2
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +15 -4
- 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 +4 -3
- package/dest/proving_broker/proving_agent.d.ts.map +1 -1
- package/dest/proving_broker/proving_agent.js +4 -4
- package/dest/proving_broker/proving_broker.d.ts +7 -4
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +64 -9
- 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 +18 -7
- 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 +24 -15
- package/dest/test/mock_prover.d.ts +4 -4
- package/package.json +17 -18
- package/src/config.ts +13 -2
- package/src/light/lightweight_checkpoint_builder.ts +59 -21
- package/src/mocks/fixtures.ts +2 -1
- package/src/mocks/test_context.ts +12 -10
- package/src/orchestrator/block-building-helpers.ts +3 -3
- package/src/orchestrator/block-proving-state.ts +9 -0
- package/src/orchestrator/checkpoint-proving-state.ts +5 -5
- package/src/orchestrator/epoch-proving-state.ts +6 -4
- package/src/orchestrator/orchestrator.ts +135 -125
- package/src/prover-client/prover-client.ts +24 -14
- package/src/proving_broker/broker_prover_facade.ts +23 -23
- package/src/proving_broker/config.ts +15 -2
- 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 +5 -2
- package/src/proving_broker/proving_broker.ts +60 -6
- package/src/proving_broker/proving_broker_instrumentation.ts +19 -6
- package/src/proving_broker/proving_job_controller.ts +9 -3
- package/src/proving_broker/rpc.ts +26 -3
- 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/src/proving_broker/proof_store/gcs_proof_store.ts +0 -76
|
@@ -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
|
});
|
|
@@ -53,10 +64,22 @@ export const ProvingJobBrokerSchema: ApiSchemaFor<ProvingJobBroker> = {
|
|
|
53
64
|
...ProvingJobProducerSchema,
|
|
54
65
|
};
|
|
55
66
|
|
|
67
|
+
export const ProvingJobBrokerDebugSchema: ApiSchemaFor<ProvingJobBrokerDebug> = {
|
|
68
|
+
replayProvingJob: z
|
|
69
|
+
.function()
|
|
70
|
+
.args(ProvingJobId, z.nativeEnum(ProvingRequestType), EpochNumberSchema, ProofUri)
|
|
71
|
+
.returns(ProvingJobStatus),
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const ProvingJobBrokerSchemaWithDebug: ApiSchemaFor<ProvingJobBroker & ProvingJobBrokerDebug> = {
|
|
75
|
+
...ProvingJobBrokerSchema,
|
|
76
|
+
...ProvingJobBrokerDebugSchema,
|
|
77
|
+
};
|
|
78
|
+
|
|
56
79
|
export function createProvingJobBrokerClient(
|
|
57
80
|
url: string,
|
|
58
81
|
versions: Partial<ComponentsVersions>,
|
|
59
|
-
fetch = makeTracedFetch(
|
|
82
|
+
fetch = makeTracedFetch(proverBrokerBackoff, false),
|
|
60
83
|
): ProvingJobBroker {
|
|
61
84
|
return createSafeJsonRpcClient(url, ProvingJobBrokerSchema, {
|
|
62
85
|
namespaceMethods: 'proverBroker',
|
|
@@ -68,7 +91,7 @@ export function createProvingJobBrokerClient(
|
|
|
68
91
|
export function createProvingJobProducerClient(
|
|
69
92
|
url: string,
|
|
70
93
|
versions: Partial<ComponentsVersions>,
|
|
71
|
-
fetch = makeTracedFetch(
|
|
94
|
+
fetch = makeTracedFetch(proverBrokerBackoff, false),
|
|
72
95
|
): ProvingJobProducer {
|
|
73
96
|
return createSafeJsonRpcClient(url, ProvingJobProducerSchema, {
|
|
74
97
|
namespaceMethods: 'provingJobProducer',
|
|
@@ -80,7 +103,7 @@ export function createProvingJobProducerClient(
|
|
|
80
103
|
export function createProvingJobConsumerClient(
|
|
81
104
|
url: string,
|
|
82
105
|
versions: Partial<ComponentsVersions>,
|
|
83
|
-
fetch = makeTracedFetch(
|
|
106
|
+
fetch = makeTracedFetch(proverBrokerBackoff, false),
|
|
84
107
|
): ProvingJobConsumer {
|
|
85
108
|
return createSafeJsonRpcClient(url, ProvingJobConsumerSchema, {
|
|
86
109
|
namespaceMethods: 'provingJobConsumer',
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type ProofUri, type ProvingJobId, type ProvingJobInputs, type ProvingJobInputsMap, type ProvingJobResult, type ProvingJobResultsMap } from '@aztec/stdlib/interfaces/server';
|
|
2
|
-
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
3
|
-
import type { ProofStore } from './proof_store.js';
|
|
4
|
-
export declare class GoogleCloudStorageProofStore implements ProofStore {
|
|
5
|
-
private readonly bucketName;
|
|
6
|
-
private readonly path;
|
|
7
|
-
private readonly storage;
|
|
8
|
-
constructor(bucketName: string, path: string);
|
|
9
|
-
saveProofInput<T extends ProvingRequestType>(id: ProvingJobId, type: T, inputs: ProvingJobInputsMap[T]): Promise<ProofUri>;
|
|
10
|
-
saveProofOutput<T extends ProvingRequestType>(_id: ProvingJobId, _type: T, _result: ProvingJobResultsMap[T]): Promise<ProofUri>;
|
|
11
|
-
getProofInput(uri: ProofUri): Promise<ProvingJobInputs>;
|
|
12
|
-
getProofOutput(_uri: ProofUri): Promise<ProvingJobResult>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2NzX3Byb29mX3N0b3JlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHJvdmluZ19icm9rZXIvcHJvb2Zfc3RvcmUvZ2NzX3Byb29mX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGlu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
|
|
|
1
|
-
import { getProvingJobInputClassFor } from '@aztec/stdlib/interfaces/server';
|
|
2
|
-
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
3
|
-
import { Storage } from '@google-cloud/storage';
|
|
4
|
-
import { join } from 'path';
|
|
5
|
-
const INPUTS_PATH = 'inputs';
|
|
6
|
-
// REFACTOR(#13067): Use the stdlib/file-store instead of referencing google-cloud-storage directly.
|
|
7
|
-
export class GoogleCloudStorageProofStore {
|
|
8
|
-
bucketName;
|
|
9
|
-
path;
|
|
10
|
-
storage;
|
|
11
|
-
constructor(bucketName, path){
|
|
12
|
-
this.bucketName = bucketName;
|
|
13
|
-
this.path = path;
|
|
14
|
-
this.storage = new Storage();
|
|
15
|
-
}
|
|
16
|
-
async saveProofInput(id, type, inputs) {
|
|
17
|
-
const path = join(this.path, INPUTS_PATH, ProvingRequestType[type], id);
|
|
18
|
-
const file = this.storage.bucket(this.bucketName).file(path);
|
|
19
|
-
await file.save(inputs.toBuffer());
|
|
20
|
-
return file.cloudStorageURI.toString();
|
|
21
|
-
}
|
|
22
|
-
saveProofOutput(_id, _type, _result) {
|
|
23
|
-
throw new Error('Not implemented');
|
|
24
|
-
}
|
|
25
|
-
async getProofInput(uri) {
|
|
26
|
-
try {
|
|
27
|
-
const url = new URL(uri);
|
|
28
|
-
const bucket = this.storage.bucket(url.host);
|
|
29
|
-
const path = url.pathname.replace(/^\/+/, '');
|
|
30
|
-
const file = bucket.file(path);
|
|
31
|
-
if (!await file.exists()) {
|
|
32
|
-
throw new Error(`File at ${uri} does not exist`);
|
|
33
|
-
}
|
|
34
|
-
const typeString = path.split('/').at(-2);
|
|
35
|
-
const type = typeString ? ProvingRequestType[typeString] : undefined;
|
|
36
|
-
if (type === undefined) {
|
|
37
|
-
throw new Error(`Unrecognized proof type ${type} in path ${path}`);
|
|
38
|
-
}
|
|
39
|
-
const contents = await file.download();
|
|
40
|
-
const inputs = getProvingJobInputClassFor(type).fromBuffer(contents[0]);
|
|
41
|
-
return {
|
|
42
|
-
inputs,
|
|
43
|
-
type
|
|
44
|
-
};
|
|
45
|
-
} catch (err) {
|
|
46
|
-
throw new Error(`Error getting proof input at ${uri}: ${err}`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
getProofOutput(_uri) {
|
|
50
|
-
throw new Error('Not implemented');
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ProofUri,
|
|
3
|
-
type ProvingJobId,
|
|
4
|
-
type ProvingJobInputs,
|
|
5
|
-
type ProvingJobInputsMap,
|
|
6
|
-
type ProvingJobResult,
|
|
7
|
-
type ProvingJobResultsMap,
|
|
8
|
-
getProvingJobInputClassFor,
|
|
9
|
-
} from '@aztec/stdlib/interfaces/server';
|
|
10
|
-
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
11
|
-
|
|
12
|
-
import { Storage } from '@google-cloud/storage';
|
|
13
|
-
import { join } from 'path';
|
|
14
|
-
|
|
15
|
-
import type { ProofStore } from './proof_store.js';
|
|
16
|
-
|
|
17
|
-
const INPUTS_PATH = 'inputs';
|
|
18
|
-
|
|
19
|
-
// REFACTOR(#13067): Use the stdlib/file-store instead of referencing google-cloud-storage directly.
|
|
20
|
-
export class GoogleCloudStorageProofStore implements ProofStore {
|
|
21
|
-
private readonly storage: Storage;
|
|
22
|
-
|
|
23
|
-
constructor(
|
|
24
|
-
private readonly bucketName: string,
|
|
25
|
-
private readonly path: string,
|
|
26
|
-
) {
|
|
27
|
-
this.storage = new Storage();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public async saveProofInput<T extends ProvingRequestType>(
|
|
31
|
-
id: ProvingJobId,
|
|
32
|
-
type: T,
|
|
33
|
-
inputs: ProvingJobInputsMap[T],
|
|
34
|
-
): Promise<ProofUri> {
|
|
35
|
-
const path = join(this.path, INPUTS_PATH, ProvingRequestType[type], id);
|
|
36
|
-
const file = this.storage.bucket(this.bucketName).file(path);
|
|
37
|
-
await file.save(inputs.toBuffer());
|
|
38
|
-
return file.cloudStorageURI.toString() as ProofUri;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
saveProofOutput<T extends ProvingRequestType>(
|
|
42
|
-
_id: ProvingJobId,
|
|
43
|
-
_type: T,
|
|
44
|
-
_result: ProvingJobResultsMap[T],
|
|
45
|
-
): Promise<ProofUri> {
|
|
46
|
-
throw new Error('Not implemented');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public async getProofInput(uri: ProofUri): Promise<ProvingJobInputs> {
|
|
50
|
-
try {
|
|
51
|
-
const url = new URL(uri);
|
|
52
|
-
const bucket = this.storage.bucket(url.host);
|
|
53
|
-
const path = url.pathname.replace(/^\/+/, '');
|
|
54
|
-
const file = bucket.file(path);
|
|
55
|
-
if (!(await file.exists())) {
|
|
56
|
-
throw new Error(`File at ${uri} does not exist`);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const typeString = path.split('/').at(-2);
|
|
60
|
-
const type = typeString ? ProvingRequestType[typeString as keyof typeof ProvingRequestType] : undefined;
|
|
61
|
-
if (type === undefined) {
|
|
62
|
-
throw new Error(`Unrecognized proof type ${type} in path ${path}`);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const contents = await file.download();
|
|
66
|
-
const inputs = getProvingJobInputClassFor(type).fromBuffer(contents[0]);
|
|
67
|
-
return { inputs, type } as ProvingJobInputs;
|
|
68
|
-
} catch (err) {
|
|
69
|
-
throw new Error(`Error getting proof input at ${uri}: ${err}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
getProofOutput(_uri: ProofUri): Promise<ProvingJobResult> {
|
|
74
|
-
throw new Error('Not implemented');
|
|
75
|
-
}
|
|
76
|
-
}
|