@aztec/prover-client 0.0.1-commit.b655e406 → 0.0.1-commit.b6e433891
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/config.d.ts +2 -2
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +1 -1
- package/dest/index.d.ts +1 -1
- package/dest/light/index.d.ts +2 -0
- package/dest/light/index.d.ts.map +1 -0
- package/dest/light/index.js +1 -0
- package/dest/light/lightweight_checkpoint_builder.d.ts +52 -0
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -0
- package/dest/light/lightweight_checkpoint_builder.js +223 -0
- package/dest/mocks/fixtures.d.ts +1 -4
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +9 -18
- package/dest/mocks/test_context.d.ts +29 -46
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +120 -117
- package/dest/orchestrator/block-building-helpers.d.ts +18 -20
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +90 -115
- package/dest/orchestrator/block-proving-state.d.ts +20 -11
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +87 -19
- package/dest/orchestrator/checkpoint-proving-state.d.ts +22 -9
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-proving-state.js +52 -20
- package/dest/orchestrator/epoch-proving-state.d.ts +12 -10
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +40 -4
- package/dest/orchestrator/index.d.ts +1 -1
- package/dest/orchestrator/orchestrator.d.ts +28 -11
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +582 -180
- package/dest/orchestrator/orchestrator_metrics.d.ts +1 -3
- package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator_metrics.js +2 -15
- package/dest/orchestrator/tx-proving-state.d.ts +6 -5
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.js +7 -16
- package/dest/prover-client/factory.d.ts +3 -3
- package/dest/prover-client/factory.d.ts.map +1 -1
- package/dest/prover-client/index.d.ts +1 -1
- package/dest/prover-client/prover-client.d.ts +6 -6
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +15 -10
- package/dest/prover-client/server-epoch-prover.d.ts +8 -7
- package/dest/prover-client/server-epoch-prover.d.ts.map +1 -1
- package/dest/prover-client/server-epoch-prover.js +2 -2
- package/dest/proving_broker/broker_prover_facade.d.ts +25 -23
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +11 -17
- package/dest/proving_broker/config.d.ts +25 -9
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +27 -4
- package/dest/proving_broker/factory.d.ts +1 -1
- package/dest/proving_broker/fixtures.d.ts +3 -2
- package/dest/proving_broker/fixtures.d.ts.map +1 -1
- package/dest/proving_broker/fixtures.js +3 -2
- package/dest/proving_broker/index.d.ts +1 -1
- package/dest/proving_broker/proof_store/factory.d.ts +2 -5
- package/dest/proving_broker/proof_store/factory.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/factory.js +7 -30
- package/dest/proving_broker/proof_store/file_store_proof_store.d.ts +18 -0
- package/dest/proving_broker/proof_store/file_store_proof_store.d.ts.map +1 -0
- package/dest/proving_broker/proof_store/file_store_proof_store.js +60 -0
- package/dest/proving_broker/proof_store/index.d.ts +2 -2
- package/dest/proving_broker/proof_store/index.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/index.js +1 -1
- package/dest/proving_broker/proof_store/inline_proof_store.d.ts +1 -1
- package/dest/proving_broker/proof_store/inline_proof_store.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/proof_store.d.ts +1 -1
- package/dest/proving_broker/proving_agent.d.ts +5 -9
- package/dest/proving_broker/proving_agent.d.ts.map +1 -1
- package/dest/proving_broker/proving_agent.js +4 -19
- package/dest/proving_broker/proving_broker.d.ts +7 -4
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +42 -15
- package/dest/proving_broker/proving_broker_database/memory.d.ts +3 -2
- package/dest/proving_broker/proving_broker_database/memory.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.d.ts +5 -3
- package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +392 -3
- package/dest/proving_broker/proving_broker_database.d.ts +3 -2
- package/dest/proving_broker/proving_broker_database.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_instrumentation.d.ts +3 -1
- package/dest/proving_broker/proving_broker_instrumentation.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_instrumentation.js +22 -35
- package/dest/proving_broker/proving_job_controller.d.ts +5 -3
- package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
- package/dest/proving_broker/proving_job_controller.js +8 -6
- package/dest/proving_broker/rpc.d.ts +7 -5
- package/dest/proving_broker/rpc.d.ts.map +1 -1
- package/dest/proving_broker/rpc.js +8 -0
- package/dest/test/mock_proof_store.d.ts +1 -1
- package/dest/test/mock_proof_store.d.ts.map +1 -1
- package/dest/test/mock_prover.d.ts +5 -6
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/dest/test/mock_prover.js +4 -4
- package/package.json +22 -21
- package/src/config.ts +1 -1
- package/src/light/index.ts +1 -0
- package/src/light/lightweight_checkpoint_builder.ts +312 -0
- package/src/mocks/fixtures.ts +9 -31
- package/src/mocks/test_context.ts +159 -178
- package/src/orchestrator/block-building-helpers.ts +129 -209
- package/src/orchestrator/block-proving-state.ts +109 -22
- package/src/orchestrator/checkpoint-proving-state.ts +75 -25
- package/src/orchestrator/epoch-proving-state.ts +67 -15
- package/src/orchestrator/orchestrator.ts +191 -173
- package/src/orchestrator/orchestrator_metrics.ts +2 -25
- package/src/orchestrator/tx-proving-state.ts +10 -27
- package/src/prover-client/factory.ts +6 -2
- package/src/prover-client/prover-client.ts +33 -24
- package/src/prover-client/server-epoch-prover.ts +6 -7
- package/src/proving_broker/broker_prover_facade.ts +38 -39
- package/src/proving_broker/config.ts +31 -2
- package/src/proving_broker/fixtures.ts +8 -3
- 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 +43 -12
- package/src/proving_broker/proving_broker_database/memory.ts +2 -1
- package/src/proving_broker/proving_broker_database/persisted.ts +20 -5
- package/src/proving_broker/proving_broker_database.ts +2 -1
- package/src/proving_broker/proving_broker_instrumentation.ts +23 -35
- package/src/proving_broker/proving_job_controller.ts +13 -7
- package/src/proving_broker/rpc.ts +14 -0
- package/src/test/mock_prover.ts +2 -14
- package/dest/block-factory/index.d.ts +0 -2
- package/dest/block-factory/index.d.ts.map +0 -1
- package/dest/block-factory/index.js +0 -1
- package/dest/block-factory/light.d.ts +0 -38
- package/dest/block-factory/light.d.ts.map +0 -1
- package/dest/block-factory/light.js +0 -94
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts +0 -14
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts.map +0 -1
- package/dest/proving_broker/proof_store/gcs_proof_store.js +0 -52
- package/dest/proving_broker/proving_agent_instrumentation.d.ts +0 -8
- package/dest/proving_broker/proving_agent_instrumentation.d.ts.map +0 -1
- package/dest/proving_broker/proving_agent_instrumentation.js +0 -16
- package/src/block-factory/index.ts +0 -1
- package/src/block-factory/light.ts +0 -140
- package/src/proving_broker/proof_store/gcs_proof_store.ts +0 -76
- package/src/proving_broker/proving_agent_instrumentation.ts +0 -21
|
@@ -1,41 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type Histogram,
|
|
3
|
-
Metrics,
|
|
4
|
-
type TelemetryClient,
|
|
5
|
-
type Tracer,
|
|
6
|
-
type UpDownCounter,
|
|
7
|
-
ValueType,
|
|
8
|
-
} from '@aztec/telemetry-client';
|
|
1
|
+
import { type Histogram, Metrics, type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
|
|
9
2
|
|
|
10
3
|
export class ProvingOrchestratorMetrics {
|
|
11
4
|
public readonly tracer: Tracer;
|
|
12
5
|
|
|
13
6
|
private baseRollupInputsDuration: Histogram;
|
|
14
|
-
private avmFallbackCount: UpDownCounter;
|
|
15
7
|
|
|
16
8
|
constructor(client: TelemetryClient, name = 'ProvingOrchestrator') {
|
|
17
9
|
this.tracer = client.getTracer(name);
|
|
18
10
|
const meter = client.getMeter(name);
|
|
19
11
|
|
|
20
|
-
this.baseRollupInputsDuration = meter.createHistogram(Metrics.PROVING_ORCHESTRATOR_BASE_ROLLUP_INPUTS_DURATION
|
|
21
|
-
unit: 'ms',
|
|
22
|
-
description: 'Duration to build base rollup inputs',
|
|
23
|
-
valueType: ValueType.INT,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
this.avmFallbackCount = meter.createUpDownCounter(Metrics.PROVING_ORCHESTRATOR_AVM_FALLBACK_COUNT, {
|
|
27
|
-
description: 'How many times the AVM fallback was used',
|
|
28
|
-
valueType: ValueType.INT,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
this.avmFallbackCount.add(0);
|
|
12
|
+
this.baseRollupInputsDuration = meter.createHistogram(Metrics.PROVING_ORCHESTRATOR_BASE_ROLLUP_INPUTS_DURATION);
|
|
32
13
|
}
|
|
33
14
|
|
|
34
15
|
recordBaseRollupInputs(durationMs: number) {
|
|
35
16
|
this.baseRollupInputsDuration.record(Math.ceil(durationMs));
|
|
36
17
|
}
|
|
37
|
-
|
|
38
|
-
incAvmFallback() {
|
|
39
|
-
this.avmFallbackCount.add(1);
|
|
40
|
-
}
|
|
41
18
|
}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
AVM_VK_INDEX,
|
|
4
|
-
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
|
-
} from '@aztec/constants';
|
|
6
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
1
|
+
import { AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
|
|
2
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
7
3
|
import { getVkData } from '@aztec/noir-protocol-circuits-types/server/vks';
|
|
8
|
-
import { getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
9
4
|
import type { AvmCircuitInputs } from '@aztec/stdlib/avm';
|
|
10
|
-
import type {
|
|
11
|
-
import { ProofData } from '@aztec/stdlib/proofs';
|
|
5
|
+
import type { PublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
6
|
+
import { ProofData, ProofDataForFixedVk, RecursiveProof } from '@aztec/stdlib/proofs';
|
|
12
7
|
import {
|
|
13
8
|
type BaseRollupHints,
|
|
14
9
|
PrivateBaseRollupHints,
|
|
@@ -20,7 +15,6 @@ import {
|
|
|
20
15
|
import type { CircuitName } from '@aztec/stdlib/stats';
|
|
21
16
|
import type { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
|
|
22
17
|
import type { ProcessedTx } from '@aztec/stdlib/tx';
|
|
23
|
-
import { VerificationKeyData, VkData } from '@aztec/stdlib/vks';
|
|
24
18
|
|
|
25
19
|
import {
|
|
26
20
|
getChonkProofFromTx,
|
|
@@ -38,7 +32,7 @@ export class TxProvingState {
|
|
|
38
32
|
PublicChonkVerifierPublicInputs,
|
|
39
33
|
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
40
34
|
>;
|
|
41
|
-
private
|
|
35
|
+
private avmProof?: RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>;
|
|
42
36
|
|
|
43
37
|
constructor(
|
|
44
38
|
public readonly processedTx: ProcessedTx,
|
|
@@ -52,7 +46,7 @@ export class TxProvingState {
|
|
|
52
46
|
}
|
|
53
47
|
|
|
54
48
|
public ready() {
|
|
55
|
-
return !this.requireAvmProof || (!!this.
|
|
49
|
+
return !this.requireAvmProof || (!!this.avmProof && !!this.publicChonkVerifier);
|
|
56
50
|
}
|
|
57
51
|
|
|
58
52
|
public getAvmInputs(): AvmCircuitInputs {
|
|
@@ -86,8 +80,8 @@ export class TxProvingState {
|
|
|
86
80
|
this.publicChonkVerifier = publicChonkVerifierProofAndVk;
|
|
87
81
|
}
|
|
88
82
|
|
|
89
|
-
public setAvmProof(
|
|
90
|
-
this.
|
|
83
|
+
public setAvmProof(avmProof: RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>) {
|
|
84
|
+
this.avmProof = avmProof;
|
|
91
85
|
}
|
|
92
86
|
|
|
93
87
|
#getPrivateBaseInputs() {
|
|
@@ -111,7 +105,7 @@ export class TxProvingState {
|
|
|
111
105
|
if (!this.publicChonkVerifier) {
|
|
112
106
|
throw new Error('Tx not ready for proving base rollup: public chonk verifier proof undefined');
|
|
113
107
|
}
|
|
114
|
-
if (!this.
|
|
108
|
+
if (!this.avmProof) {
|
|
115
109
|
throw new Error('Tx not ready for proving base rollup: avm proof undefined');
|
|
116
110
|
}
|
|
117
111
|
if (!(this.baseRollupHints instanceof PublicBaseRollupHints)) {
|
|
@@ -120,19 +114,8 @@ export class TxProvingState {
|
|
|
120
114
|
|
|
121
115
|
const publicChonkVerifierProofData = toProofData(this.publicChonkVerifier);
|
|
122
116
|
|
|
123
|
-
const avmProofData = new
|
|
124
|
-
this.processedTx.avmProvingRequest.inputs.publicInputs,
|
|
125
|
-
this.avm.proof,
|
|
126
|
-
this.#getVkData(this.avm!.verificationKey, AVM_VK_INDEX),
|
|
127
|
-
);
|
|
117
|
+
const avmProofData = new ProofDataForFixedVk(this.processedTx.avmProvingRequest.inputs.publicInputs, this.avmProof);
|
|
128
118
|
|
|
129
119
|
return new PublicTxBaseRollupPrivateInputs(publicChonkVerifierProofData, avmProofData, this.baseRollupHints);
|
|
130
120
|
}
|
|
131
|
-
|
|
132
|
-
#getVkData(verificationKey: VerificationKeyData, vkIndex: number) {
|
|
133
|
-
// TODO(#17162): Add avm vk hash to the tree and call `getVkData('AVM')` instead.
|
|
134
|
-
// Below will return a path to an empty leaf.
|
|
135
|
-
const vkPath = getVKSiblingPath(vkIndex);
|
|
136
|
-
return new VkData(verificationKey, vkIndex, vkPath);
|
|
137
|
-
}
|
|
138
121
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ForkMerkleTreeOperations,
|
|
3
|
+
ProvingJobBroker,
|
|
4
|
+
ReadonlyWorldStateAccess,
|
|
5
|
+
} from '@aztec/stdlib/interfaces/server';
|
|
2
6
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
3
7
|
|
|
4
8
|
import type { ProverClientConfig } from '../config.js';
|
|
@@ -6,7 +10,7 @@ import { ProverClient } from './prover-client.js';
|
|
|
6
10
|
|
|
7
11
|
export function createProverClient(
|
|
8
12
|
config: ProverClientConfig,
|
|
9
|
-
worldState: ForkMerkleTreeOperations,
|
|
13
|
+
worldState: ForkMerkleTreeOperations & ReadonlyWorldStateAccess,
|
|
10
14
|
broker: ProvingJobBroker,
|
|
11
15
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
12
16
|
) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ACVMConfig, type BBConfig, BBNativeRollupProver, TestCircuitProver } from '@aztec/bb-prover';
|
|
2
2
|
import { times } from '@aztec/foundation/collection';
|
|
3
3
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
+
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
5
5
|
import { NativeACVMSimulator } from '@aztec/simulator/server';
|
|
6
6
|
import {
|
|
7
7
|
type ActualProverConfig,
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
type ProvingJobBroker,
|
|
12
12
|
type ProvingJobConsumer,
|
|
13
13
|
type ProvingJobProducer,
|
|
14
|
+
type ReadonlyWorldStateAccess,
|
|
14
15
|
type ServerCircuitProver,
|
|
15
16
|
tryStop,
|
|
16
17
|
} from '@aztec/stdlib/interfaces/server';
|
|
@@ -28,24 +29,35 @@ export class ProverClient implements EpochProverManager {
|
|
|
28
29
|
private running = false;
|
|
29
30
|
private agents: ProvingAgent[] = [];
|
|
30
31
|
|
|
31
|
-
private proofStore: ProofStore;
|
|
32
|
-
private failedProofStore: ProofStore | undefined;
|
|
33
|
-
|
|
34
32
|
private constructor(
|
|
35
33
|
private config: ProverClientConfig,
|
|
36
|
-
private worldState: ForkMerkleTreeOperations,
|
|
34
|
+
private worldState: ForkMerkleTreeOperations & ReadonlyWorldStateAccess,
|
|
37
35
|
private orchestratorClient: ProvingJobProducer,
|
|
36
|
+
private proofStore: ProofStore,
|
|
37
|
+
private failedProofStore: ProofStore | undefined,
|
|
38
38
|
private agentClient?: ProvingJobConsumer,
|
|
39
39
|
private telemetry: TelemetryClient = getTelemetryClient(),
|
|
40
|
-
private log = createLogger('prover-client:tx-prover'),
|
|
41
|
-
) {
|
|
42
|
-
this.proofStore = new InlineProofStore();
|
|
43
|
-
this.failedProofStore = this.config.failedProofStore ? createProofStore(this.config.failedProofStore) : undefined;
|
|
44
|
-
}
|
|
40
|
+
private log: Logger = createLogger('prover-client:tx-prover'),
|
|
41
|
+
) {}
|
|
45
42
|
|
|
46
43
|
public createEpochProver(): EpochProver {
|
|
47
|
-
const
|
|
48
|
-
const
|
|
44
|
+
const bindings = this.log.getBindings();
|
|
45
|
+
const facade = new BrokerCircuitProverFacade(
|
|
46
|
+
this.orchestratorClient,
|
|
47
|
+
this.proofStore,
|
|
48
|
+
this.failedProofStore,
|
|
49
|
+
undefined,
|
|
50
|
+
bindings,
|
|
51
|
+
);
|
|
52
|
+
const orchestrator = new ProvingOrchestrator(
|
|
53
|
+
this.worldState,
|
|
54
|
+
facade,
|
|
55
|
+
this.config.proverId,
|
|
56
|
+
this.config.cancelJobsOnStop,
|
|
57
|
+
this.config.enqueueConcurrency,
|
|
58
|
+
this.telemetry,
|
|
59
|
+
bindings,
|
|
60
|
+
);
|
|
49
61
|
return new ServerEpochProver(facade, orchestrator);
|
|
50
62
|
}
|
|
51
63
|
|
|
@@ -99,11 +111,13 @@ export class ProverClient implements EpochProverManager {
|
|
|
99
111
|
*/
|
|
100
112
|
public static async new(
|
|
101
113
|
config: ProverClientConfig,
|
|
102
|
-
worldState: ForkMerkleTreeOperations,
|
|
114
|
+
worldState: ForkMerkleTreeOperations & ReadonlyWorldStateAccess,
|
|
103
115
|
broker: ProvingJobBroker,
|
|
104
116
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
105
117
|
) {
|
|
106
|
-
const
|
|
118
|
+
const proofStore = await createProofStore(config.proofStore);
|
|
119
|
+
const failedProofStore = config.failedProofStore ? await createProofStore(config.failedProofStore) : undefined;
|
|
120
|
+
const prover = new ProverClient(config, worldState, broker, proofStore, failedProofStore, broker, telemetry);
|
|
107
121
|
await prover.start();
|
|
108
122
|
return prover;
|
|
109
123
|
}
|
|
@@ -127,17 +141,11 @@ export class ProverClient implements EpochProverManager {
|
|
|
127
141
|
|
|
128
142
|
const proofStore = new InlineProofStore();
|
|
129
143
|
const prover = await buildServerCircuitProver(this.config, this.telemetry);
|
|
144
|
+
const bindings = this.log.getBindings();
|
|
130
145
|
this.agents = times(
|
|
131
146
|
this.config.proverAgentCount,
|
|
132
147
|
() =>
|
|
133
|
-
new ProvingAgent(
|
|
134
|
-
this.agentClient!,
|
|
135
|
-
proofStore,
|
|
136
|
-
prover,
|
|
137
|
-
[],
|
|
138
|
-
this.config.proverAgentPollIntervalMs,
|
|
139
|
-
this.telemetry,
|
|
140
|
-
),
|
|
148
|
+
new ProvingAgent(this.agentClient!, proofStore, prover, [], this.config.proverAgentPollIntervalMs, bindings),
|
|
141
149
|
);
|
|
142
150
|
|
|
143
151
|
await Promise.all(this.agents.map(agent => agent.start()));
|
|
@@ -149,15 +157,16 @@ export class ProverClient implements EpochProverManager {
|
|
|
149
157
|
}
|
|
150
158
|
|
|
151
159
|
export function buildServerCircuitProver(
|
|
152
|
-
config: ActualProverConfig & ACVMConfig & BBConfig,
|
|
160
|
+
config: Omit<ActualProverConfig, 'enqueueConcurrency'> & ACVMConfig & BBConfig,
|
|
153
161
|
telemetry: TelemetryClient,
|
|
154
162
|
): Promise<ServerCircuitProver> {
|
|
155
163
|
if (config.realProofs) {
|
|
156
164
|
return BBNativeRollupProver.new(config, telemetry);
|
|
157
165
|
}
|
|
158
166
|
|
|
167
|
+
const logger = createLogger('prover-client:acvm-native');
|
|
159
168
|
const simulator = config.acvmBinaryPath
|
|
160
|
-
? new NativeACVMSimulator(config.acvmWorkingDirectory, config.acvmBinaryPath)
|
|
169
|
+
? new NativeACVMSimulator(config.acvmWorkingDirectory, config.acvmBinaryPath, undefined, logger)
|
|
161
170
|
: undefined;
|
|
162
171
|
|
|
163
172
|
return Promise.resolve(new TestCircuitProver(simulator, config, telemetry));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { BatchedBlob, FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
2
|
-
import
|
|
1
|
+
import type { BatchedBlob, FinalBlobBatchingChallenges } from '@aztec/blob-lib/types';
|
|
2
|
+
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
4
|
import type { EthAddress } from '@aztec/stdlib/block';
|
|
4
5
|
import type { EpochProver } from '@aztec/stdlib/interfaces/server';
|
|
5
6
|
import type { Proof } from '@aztec/stdlib/proofs';
|
|
@@ -18,7 +19,7 @@ export class ServerEpochProver implements EpochProver {
|
|
|
18
19
|
) {}
|
|
19
20
|
|
|
20
21
|
startNewEpoch(
|
|
21
|
-
epochNumber:
|
|
22
|
+
epochNumber: EpochNumber,
|
|
22
23
|
totalNumCheckpoints: number,
|
|
23
24
|
finalBlobBatchingChallenges: FinalBlobBatchingChallenges,
|
|
24
25
|
): void {
|
|
@@ -30,7 +31,6 @@ export class ServerEpochProver implements EpochProver {
|
|
|
30
31
|
constants: CheckpointConstantData,
|
|
31
32
|
l1ToL2Messages: Fr[],
|
|
32
33
|
totalNumBlocks: number,
|
|
33
|
-
totalNumBlobFields: number,
|
|
34
34
|
headerOfLastBlockInPreviousCheckpoint: BlockHeader,
|
|
35
35
|
): Promise<void> {
|
|
36
36
|
return this.orchestrator.startNewCheckpoint(
|
|
@@ -38,14 +38,13 @@ export class ServerEpochProver implements EpochProver {
|
|
|
38
38
|
constants,
|
|
39
39
|
l1ToL2Messages,
|
|
40
40
|
totalNumBlocks,
|
|
41
|
-
totalNumBlobFields,
|
|
42
41
|
headerOfLastBlockInPreviousCheckpoint,
|
|
43
42
|
);
|
|
44
43
|
}
|
|
45
44
|
startChonkVerifierCircuits(txs: Tx[]): Promise<void> {
|
|
46
45
|
return this.orchestrator.startChonkVerifierCircuits(txs);
|
|
47
46
|
}
|
|
48
|
-
setBlockCompleted(blockNumber:
|
|
47
|
+
setBlockCompleted(blockNumber: BlockNumber, expectedBlockHeader?: BlockHeader): Promise<BlockHeader> {
|
|
49
48
|
return this.orchestrator.setBlockCompleted(blockNumber, expectedBlockHeader);
|
|
50
49
|
}
|
|
51
50
|
finalizeEpoch(): Promise<{ publicInputs: RootRollupPublicInputs; proof: Proof; batchedBlobInputs: BatchedBlob }> {
|
|
@@ -61,7 +60,7 @@ export class ServerEpochProver implements EpochProver {
|
|
|
61
60
|
await this.facade.stop();
|
|
62
61
|
await this.orchestrator.stop();
|
|
63
62
|
}
|
|
64
|
-
startNewBlock(blockNumber:
|
|
63
|
+
startNewBlock(blockNumber: BlockNumber, timestamp: UInt64, totalNumTxs: number): Promise<void> {
|
|
65
64
|
return this.orchestrator.startNewBlock(blockNumber, timestamp, totalNumTxs);
|
|
66
65
|
}
|
|
67
66
|
addTxs(txs: ProcessedTx[]): Promise<void> {
|
|
@@ -4,14 +4,12 @@ import type {
|
|
|
4
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
5
|
RECURSIVE_PROOF_LENGTH,
|
|
6
6
|
} from '@aztec/constants';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
7
|
+
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
8
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
10
9
|
import { type PromiseWithResolvers, RunningPromise, promiseWithResolvers } from '@aztec/foundation/promise';
|
|
11
10
|
import { truncate } from '@aztec/foundation/string';
|
|
12
11
|
import type { AvmCircuitInputs } from '@aztec/stdlib/avm';
|
|
13
12
|
import {
|
|
14
|
-
type ProofAndVerificationKey,
|
|
15
13
|
type ProofUri,
|
|
16
14
|
type ProvingJobId,
|
|
17
15
|
type ProvingJobInputsMap,
|
|
@@ -23,7 +21,7 @@ import {
|
|
|
23
21
|
makeProvingJobId,
|
|
24
22
|
} from '@aztec/stdlib/interfaces/server';
|
|
25
23
|
import type { ParityBasePrivateInputs, ParityPublicInputs, ParityRootPrivateInputs } from '@aztec/stdlib/parity';
|
|
26
|
-
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
24
|
+
import { ProvingRequestType, RecursiveProof } from '@aztec/stdlib/proofs';
|
|
27
25
|
import type {
|
|
28
26
|
BlockMergeRollupPrivateInputs,
|
|
29
27
|
BlockRollupPublicInputs,
|
|
@@ -47,6 +45,8 @@ import type {
|
|
|
47
45
|
TxRollupPublicInputs,
|
|
48
46
|
} from '@aztec/stdlib/rollup';
|
|
49
47
|
|
|
48
|
+
import { createHash } from 'node:crypto';
|
|
49
|
+
|
|
50
50
|
import { InlineProofStore, type ProofStore } from './proof_store/index.js';
|
|
51
51
|
|
|
52
52
|
// Perform a snapshot sync every 30 seconds
|
|
@@ -69,14 +69,17 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
69
69
|
private runningPromise?: RunningPromise;
|
|
70
70
|
private timeOfLastSnapshotSync = Date.now();
|
|
71
71
|
private jobsToRetrieve: Set<ProvingJobId> = new Set();
|
|
72
|
+
private log: Logger;
|
|
72
73
|
|
|
73
74
|
constructor(
|
|
74
75
|
private broker: ProvingJobProducer,
|
|
75
76
|
private proofStore: ProofStore = new InlineProofStore(),
|
|
76
77
|
private failedProofStore?: ProofStore,
|
|
77
78
|
private pollIntervalMs = 1000,
|
|
78
|
-
|
|
79
|
-
) {
|
|
79
|
+
bindings?: LoggerBindings,
|
|
80
|
+
) {
|
|
81
|
+
this.log = createLogger('prover-client:broker-circuit-prover-facade', bindings);
|
|
82
|
+
}
|
|
80
83
|
|
|
81
84
|
/**
|
|
82
85
|
* This is a critical section. This function can not be async since it writes
|
|
@@ -130,7 +133,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
130
133
|
id: ProvingJobId,
|
|
131
134
|
type: T,
|
|
132
135
|
inputs: ProvingJobInputsMap[T],
|
|
133
|
-
epochNumber =
|
|
136
|
+
epochNumber = EpochNumber.ZERO,
|
|
134
137
|
signal?: AbortSignal,
|
|
135
138
|
): Promise<ProvingJobResultsMap[T]> {
|
|
136
139
|
const { job: job, isEnqueued } = this.getOrCreateProvingJob(id, type, signal);
|
|
@@ -397,30 +400,22 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
397
400
|
|
|
398
401
|
getAvmProof(
|
|
399
402
|
inputs: AvmCircuitInputs,
|
|
400
|
-
skipPublicInputsValidation?: boolean, // TODO(#14234)[Unconditional PIs validation]: remove this argument
|
|
401
403
|
signal?: AbortSignal,
|
|
402
|
-
epochNumber?:
|
|
403
|
-
): Promise<
|
|
404
|
-
this.log.info(`getAvmProof() called with skipPublicInputsValidation: ${skipPublicInputsValidation}`);
|
|
405
|
-
|
|
404
|
+
epochNumber?: EpochNumber,
|
|
405
|
+
): Promise<RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>> {
|
|
406
406
|
return this.enqueueJob(
|
|
407
407
|
this.generateId(ProvingRequestType.PUBLIC_VM, inputs, epochNumber),
|
|
408
408
|
ProvingRequestType.PUBLIC_VM,
|
|
409
409
|
inputs,
|
|
410
410
|
epochNumber,
|
|
411
411
|
signal,
|
|
412
|
-
)
|
|
413
|
-
// TODO(#14234)[Unconditional PIs validation]: Remove ".then()".
|
|
414
|
-
// Override the default value of skipPublicInputsValidation potentially set in BBNativeRollupProver.getAvmProof().
|
|
415
|
-
result.proof.proof[0] = skipPublicInputsValidation ? new Fr(1) : new Fr(0);
|
|
416
|
-
return result;
|
|
417
|
-
});
|
|
412
|
+
);
|
|
418
413
|
}
|
|
419
414
|
|
|
420
415
|
getBaseParityProof(
|
|
421
416
|
inputs: ParityBasePrivateInputs,
|
|
422
417
|
signal?: AbortSignal,
|
|
423
|
-
epochNumber?:
|
|
418
|
+
epochNumber?: EpochNumber,
|
|
424
419
|
): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof RECURSIVE_PROOF_LENGTH>> {
|
|
425
420
|
return this.enqueueJob(
|
|
426
421
|
this.generateId(ProvingRequestType.PARITY_BASE, inputs, epochNumber),
|
|
@@ -434,7 +429,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
434
429
|
getTxMergeRollupProof(
|
|
435
430
|
input: TxMergeRollupPrivateInputs,
|
|
436
431
|
signal?: AbortSignal,
|
|
437
|
-
epochNumber?:
|
|
432
|
+
epochNumber?: EpochNumber,
|
|
438
433
|
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
439
434
|
return this.enqueueJob(
|
|
440
435
|
this.generateId(ProvingRequestType.TX_MERGE_ROLLUP, input, epochNumber),
|
|
@@ -448,7 +443,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
448
443
|
getPublicChonkVerifierProof(
|
|
449
444
|
inputs: PublicChonkVerifierPrivateInputs,
|
|
450
445
|
signal?: AbortSignal,
|
|
451
|
-
epochNumber?:
|
|
446
|
+
epochNumber?: EpochNumber,
|
|
452
447
|
): Promise<
|
|
453
448
|
PublicInputsAndRecursiveProof<PublicChonkVerifierPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
454
449
|
> {
|
|
@@ -464,7 +459,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
464
459
|
getPrivateTxBaseRollupProof(
|
|
465
460
|
baseRollupInput: PrivateTxBaseRollupPrivateInputs,
|
|
466
461
|
signal?: AbortSignal,
|
|
467
|
-
epochNumber?:
|
|
462
|
+
epochNumber?: EpochNumber,
|
|
468
463
|
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
469
464
|
return this.enqueueJob(
|
|
470
465
|
this.generateId(ProvingRequestType.PRIVATE_TX_BASE_ROLLUP, baseRollupInput, epochNumber),
|
|
@@ -478,7 +473,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
478
473
|
getPublicTxBaseRollupProof(
|
|
479
474
|
inputs: PublicTxBaseRollupPrivateInputs,
|
|
480
475
|
signal?: AbortSignal,
|
|
481
|
-
epochNumber?:
|
|
476
|
+
epochNumber?: EpochNumber,
|
|
482
477
|
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
483
478
|
return this.enqueueJob(
|
|
484
479
|
this.generateId(ProvingRequestType.PUBLIC_TX_BASE_ROLLUP, inputs, epochNumber),
|
|
@@ -492,7 +487,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
492
487
|
getRootParityProof(
|
|
493
488
|
inputs: ParityRootPrivateInputs,
|
|
494
489
|
signal?: AbortSignal,
|
|
495
|
-
epochNumber?:
|
|
490
|
+
epochNumber?: EpochNumber,
|
|
496
491
|
): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>> {
|
|
497
492
|
return this.enqueueJob(
|
|
498
493
|
this.generateId(ProvingRequestType.PARITY_ROOT, inputs, epochNumber),
|
|
@@ -506,7 +501,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
506
501
|
getBlockRootFirstRollupProof(
|
|
507
502
|
input: BlockRootFirstRollupPrivateInputs,
|
|
508
503
|
signal?: AbortSignal,
|
|
509
|
-
epochNumber?:
|
|
504
|
+
epochNumber?: EpochNumber,
|
|
510
505
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
511
506
|
return this.enqueueJob(
|
|
512
507
|
this.generateId(ProvingRequestType.BLOCK_ROOT_FIRST_ROLLUP, input, epochNumber),
|
|
@@ -520,7 +515,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
520
515
|
getBlockRootSingleTxFirstRollupProof(
|
|
521
516
|
input: BlockRootSingleTxFirstRollupPrivateInputs,
|
|
522
517
|
signal?: AbortSignal,
|
|
523
|
-
epochNumber?:
|
|
518
|
+
epochNumber?: EpochNumber,
|
|
524
519
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
525
520
|
return this.enqueueJob(
|
|
526
521
|
this.generateId(ProvingRequestType.BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP, input, epochNumber),
|
|
@@ -534,7 +529,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
534
529
|
getBlockRootEmptyTxFirstRollupProof(
|
|
535
530
|
input: BlockRootEmptyTxFirstRollupPrivateInputs,
|
|
536
531
|
signal?: AbortSignal,
|
|
537
|
-
epochNumber?:
|
|
532
|
+
epochNumber?: EpochNumber,
|
|
538
533
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
539
534
|
return this.enqueueJob(
|
|
540
535
|
this.generateId(ProvingRequestType.BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP, input, epochNumber),
|
|
@@ -548,7 +543,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
548
543
|
getBlockRootRollupProof(
|
|
549
544
|
input: BlockRootRollupPrivateInputs,
|
|
550
545
|
signal?: AbortSignal,
|
|
551
|
-
epochNumber?:
|
|
546
|
+
epochNumber?: EpochNumber,
|
|
552
547
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
553
548
|
return this.enqueueJob(
|
|
554
549
|
this.generateId(ProvingRequestType.BLOCK_ROOT_ROLLUP, input, epochNumber),
|
|
@@ -562,7 +557,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
562
557
|
getBlockRootSingleTxRollupProof(
|
|
563
558
|
input: BlockRootSingleTxRollupPrivateInputs,
|
|
564
559
|
signal?: AbortSignal,
|
|
565
|
-
epochNumber?:
|
|
560
|
+
epochNumber?: EpochNumber,
|
|
566
561
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
567
562
|
return this.enqueueJob(
|
|
568
563
|
this.generateId(ProvingRequestType.BLOCK_ROOT_SINGLE_TX_ROLLUP, input, epochNumber),
|
|
@@ -576,7 +571,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
576
571
|
getBlockMergeRollupProof(
|
|
577
572
|
input: BlockMergeRollupPrivateInputs,
|
|
578
573
|
signal?: AbortSignal,
|
|
579
|
-
epochNumber?:
|
|
574
|
+
epochNumber?: EpochNumber,
|
|
580
575
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
581
576
|
return this.enqueueJob(
|
|
582
577
|
this.generateId(ProvingRequestType.BLOCK_MERGE_ROLLUP, input, epochNumber),
|
|
@@ -590,7 +585,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
590
585
|
getCheckpointRootRollupProof(
|
|
591
586
|
input: CheckpointRootRollupPrivateInputs,
|
|
592
587
|
signal?: AbortSignal,
|
|
593
|
-
epochNumber?:
|
|
588
|
+
epochNumber?: EpochNumber,
|
|
594
589
|
): Promise<
|
|
595
590
|
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
596
591
|
> {
|
|
@@ -606,7 +601,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
606
601
|
getCheckpointRootSingleBlockRollupProof(
|
|
607
602
|
input: CheckpointRootSingleBlockRollupPrivateInputs,
|
|
608
603
|
signal?: AbortSignal,
|
|
609
|
-
epochNumber?:
|
|
604
|
+
epochNumber?: EpochNumber,
|
|
610
605
|
): Promise<
|
|
611
606
|
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
612
607
|
> {
|
|
@@ -622,7 +617,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
622
617
|
getCheckpointPaddingRollupProof(
|
|
623
618
|
input: CheckpointPaddingRollupPrivateInputs,
|
|
624
619
|
signal?: AbortSignal,
|
|
625
|
-
epochNumber?:
|
|
620
|
+
epochNumber?: EpochNumber,
|
|
626
621
|
): Promise<
|
|
627
622
|
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
628
623
|
> {
|
|
@@ -638,7 +633,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
638
633
|
getCheckpointMergeRollupProof(
|
|
639
634
|
input: CheckpointMergeRollupPrivateInputs,
|
|
640
635
|
signal?: AbortSignal,
|
|
641
|
-
epochNumber?:
|
|
636
|
+
epochNumber?: EpochNumber,
|
|
642
637
|
): Promise<
|
|
643
638
|
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
644
639
|
> {
|
|
@@ -654,7 +649,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
654
649
|
getRootRollupProof(
|
|
655
650
|
input: RootRollupPrivateInputs,
|
|
656
651
|
signal?: AbortSignal,
|
|
657
|
-
epochNumber?:
|
|
652
|
+
epochNumber?: EpochNumber,
|
|
658
653
|
): Promise<PublicInputsAndRecursiveProof<RootRollupPublicInputs, typeof RECURSIVE_PROOF_LENGTH>> {
|
|
659
654
|
return this.enqueueJob(
|
|
660
655
|
this.generateId(ProvingRequestType.ROOT_ROLLUP, input, epochNumber),
|
|
@@ -665,8 +660,12 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
665
660
|
);
|
|
666
661
|
}
|
|
667
662
|
|
|
668
|
-
private generateId(
|
|
669
|
-
|
|
670
|
-
|
|
663
|
+
private generateId(
|
|
664
|
+
type: ProvingRequestType,
|
|
665
|
+
inputs: { toBuffer(): Buffer },
|
|
666
|
+
epochNumber = EpochNumber.ZERO,
|
|
667
|
+
): ProvingJobId {
|
|
668
|
+
const inputsHash = createHash('sha256').update(inputs.toBuffer()).digest('hex');
|
|
669
|
+
return makeProvingJobId(epochNumber, type, inputsHash);
|
|
671
670
|
}
|
|
672
671
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type L1ReaderConfig, l1ReaderConfigMappings } from '@aztec/ethereum';
|
|
1
|
+
import { type L1ReaderConfig, l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
|
|
2
2
|
import {
|
|
3
3
|
type ConfigMappingsType,
|
|
4
4
|
booleanConfigHelper,
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
numberConfigHelper,
|
|
7
7
|
} from '@aztec/foundation/config';
|
|
8
8
|
import { pickConfigMappings } from '@aztec/foundation/config';
|
|
9
|
-
import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
|
|
10
9
|
import { type ChainConfig, chainConfigMappings } from '@aztec/stdlib/config';
|
|
10
|
+
import { type DataStoreConfig, dataConfigMappings } from '@aztec/stdlib/kv-store';
|
|
11
11
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
12
12
|
|
|
13
13
|
import { z } from 'zod';
|
|
@@ -31,6 +31,8 @@ export const ProverBrokerConfig = z.object({
|
|
|
31
31
|
proverBrokerBatchIntervalMs: z.number().int().nonnegative(),
|
|
32
32
|
/** The maximum number of epochs to keep results for */
|
|
33
33
|
proverBrokerMaxEpochsToKeepResultsFor: z.number().int().nonnegative(),
|
|
34
|
+
/** Enable debug replay mode for replaying proving jobs from stored inputs */
|
|
35
|
+
proverBrokerDebugReplayEnabled: z.boolean(),
|
|
34
36
|
});
|
|
35
37
|
|
|
36
38
|
export type ProverBrokerConfig = z.infer<typeof ProverBrokerConfig> &
|
|
@@ -74,6 +76,11 @@ export const proverBrokerConfigMappings: ConfigMappingsType<ProverBrokerConfig>
|
|
|
74
76
|
parseEnv: (val: string | undefined) => (val ? +val : undefined),
|
|
75
77
|
description: "The size of the prover broker's database. Will override the dataStoreMapSizeKb if set.",
|
|
76
78
|
},
|
|
79
|
+
proverBrokerDebugReplayEnabled: {
|
|
80
|
+
env: 'PROVER_BROKER_DEBUG_REPLAY_ENABLED',
|
|
81
|
+
description: 'Enable debug replay mode for replaying proving jobs from stored inputs',
|
|
82
|
+
...booleanConfigHelper(false),
|
|
83
|
+
},
|
|
77
84
|
...dataConfigMappings,
|
|
78
85
|
...l1ReaderConfigMappings,
|
|
79
86
|
...pickConfigMappings(chainConfigMappings, ['rollupVersion']),
|
|
@@ -98,6 +105,12 @@ export const ProverAgentConfig = z.object({
|
|
|
98
105
|
proverTestDelayMs: z.number(),
|
|
99
106
|
/** If using realistic delays, what percentage of realistic times to apply. */
|
|
100
107
|
proverTestDelayFactor: z.number(),
|
|
108
|
+
/** The delay (ms) to inject during fake proof verification */
|
|
109
|
+
proverTestVerificationDelayMs: z.number().optional(),
|
|
110
|
+
/** Whether to abort pending proving jobs when the orchestrator is cancelled */
|
|
111
|
+
cancelJobsOnStop: z.boolean(),
|
|
112
|
+
/** Where to store proving results. Must be accessible to both prover node and agents. If not set will inline-encode the parameters */
|
|
113
|
+
proofStore: z.string().optional(),
|
|
101
114
|
});
|
|
102
115
|
|
|
103
116
|
export type ProverAgentConfig = z.infer<typeof ProverAgentConfig>;
|
|
@@ -146,4 +159,20 @@ export const proverAgentConfigMappings: ConfigMappingsType<ProverAgentConfig> =
|
|
|
146
159
|
description: 'If using realistic delays, what percentage of realistic times to apply.',
|
|
147
160
|
...numberConfigHelper(1),
|
|
148
161
|
},
|
|
162
|
+
proverTestVerificationDelayMs: {
|
|
163
|
+
env: 'PROVER_TEST_VERIFICATION_DELAY_MS',
|
|
164
|
+
description: 'The delay (ms) to inject during fake proof verification',
|
|
165
|
+
...numberConfigHelper(10),
|
|
166
|
+
},
|
|
167
|
+
cancelJobsOnStop: {
|
|
168
|
+
env: 'PROVER_CANCEL_JOBS_ON_STOP',
|
|
169
|
+
description:
|
|
170
|
+
'Whether to abort pending proving jobs when the orchestrator is cancelled. ' +
|
|
171
|
+
'When false (default), jobs remain in the broker queue and can be reused on restart/reorg.',
|
|
172
|
+
...booleanConfigHelper(false),
|
|
173
|
+
},
|
|
174
|
+
proofStore: {
|
|
175
|
+
env: 'PROVER_PROOF_STORE',
|
|
176
|
+
description: 'Optional proof input store for the prover',
|
|
177
|
+
},
|
|
149
178
|
};
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
2
3
|
import { type ProofUri, type ProvingJobId, makeProvingJobId } from '@aztec/stdlib/interfaces/server';
|
|
3
4
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
4
5
|
|
|
5
|
-
export function makeRandomProvingJobId(epochNumber?:
|
|
6
|
-
return makeProvingJobId(
|
|
6
|
+
export function makeRandomProvingJobId(epochNumber?: EpochNumber): ProvingJobId {
|
|
7
|
+
return makeProvingJobId(
|
|
8
|
+
epochNumber ?? EpochNumber(1),
|
|
9
|
+
ProvingRequestType.PARITY_BASE,
|
|
10
|
+
randomBytes(8).toString('hex'),
|
|
11
|
+
);
|
|
7
12
|
}
|
|
8
13
|
|
|
9
14
|
export function makeInputsUri(): ProofUri {
|