@aztec/prover-client 0.0.1-commit.b655e406 → 0.0.1-commit.c31f2472
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 +45 -0
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -0
- package/dest/light/lightweight_checkpoint_builder.js +197 -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 +116 -116
- package/dest/orchestrator/block-building-helpers.d.ts +17 -19
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +88 -113
- package/dest/orchestrator/block-proving-state.d.ts +17 -11
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +81 -20
- 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 +49 -17
- 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 +38 -4
- package/dest/orchestrator/index.d.ts +1 -1
- package/dest/orchestrator/orchestrator.d.ts +26 -11
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +556 -161
- 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 +3 -3
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +7 -4
- 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 +9 -15
- package/dest/proving_broker/config.d.ts +16 -8
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +14 -2
- 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 -2
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts +1 -1
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/index.d.ts +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 +2 -2
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +6 -11
- 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 +1 -1
- package/dest/proving_broker/proving_broker_instrumentation.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_instrumentation.js +15 -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 +4 -4
- 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 +3 -4
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/dest/test/mock_prover.js +4 -4
- package/package.json +20 -18
- package/src/config.ts +1 -1
- package/src/light/index.ts +1 -0
- package/src/light/lightweight_checkpoint_builder.ts +284 -0
- package/src/mocks/fixtures.ts +9 -31
- package/src/mocks/test_context.ts +158 -177
- package/src/orchestrator/block-building-helpers.ts +127 -207
- package/src/orchestrator/block-proving-state.ts +103 -25
- package/src/orchestrator/checkpoint-proving-state.ts +71 -21
- package/src/orchestrator/epoch-proving-state.ts +64 -14
- package/src/orchestrator/orchestrator.ts +158 -149
- 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 +25 -15
- package/src/prover-client/server-epoch-prover.ts +6 -7
- package/src/proving_broker/broker_prover_facade.ts +31 -37
- package/src/proving_broker/config.ts +17 -1
- package/src/proving_broker/fixtures.ts +8 -3
- package/src/proving_broker/proving_agent.ts +6 -19
- package/src/proving_broker/proving_broker.ts +6 -9
- 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 +14 -35
- package/src/proving_broker/proving_job_controller.ts +13 -7
- 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/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/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';
|
|
@@ -33,19 +34,33 @@ export class ProverClient implements EpochProverManager {
|
|
|
33
34
|
|
|
34
35
|
private constructor(
|
|
35
36
|
private config: ProverClientConfig,
|
|
36
|
-
private worldState: ForkMerkleTreeOperations,
|
|
37
|
+
private worldState: ForkMerkleTreeOperations & ReadonlyWorldStateAccess,
|
|
37
38
|
private orchestratorClient: ProvingJobProducer,
|
|
38
39
|
private agentClient?: ProvingJobConsumer,
|
|
39
40
|
private telemetry: TelemetryClient = getTelemetryClient(),
|
|
40
|
-
private log = createLogger('prover-client:tx-prover'),
|
|
41
|
+
private log: Logger = createLogger('prover-client:tx-prover'),
|
|
41
42
|
) {
|
|
42
43
|
this.proofStore = new InlineProofStore();
|
|
43
44
|
this.failedProofStore = this.config.failedProofStore ? createProofStore(this.config.failedProofStore) : undefined;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
public createEpochProver(): EpochProver {
|
|
47
|
-
const
|
|
48
|
-
const
|
|
48
|
+
const bindings = this.log.getBindings();
|
|
49
|
+
const facade = new BrokerCircuitProverFacade(
|
|
50
|
+
this.orchestratorClient,
|
|
51
|
+
this.proofStore,
|
|
52
|
+
this.failedProofStore,
|
|
53
|
+
undefined,
|
|
54
|
+
bindings,
|
|
55
|
+
);
|
|
56
|
+
const orchestrator = new ProvingOrchestrator(
|
|
57
|
+
this.worldState,
|
|
58
|
+
facade,
|
|
59
|
+
this.config.proverId,
|
|
60
|
+
this.config.cancelJobsOnStop,
|
|
61
|
+
this.telemetry,
|
|
62
|
+
bindings,
|
|
63
|
+
);
|
|
49
64
|
return new ServerEpochProver(facade, orchestrator);
|
|
50
65
|
}
|
|
51
66
|
|
|
@@ -99,7 +114,7 @@ export class ProverClient implements EpochProverManager {
|
|
|
99
114
|
*/
|
|
100
115
|
public static async new(
|
|
101
116
|
config: ProverClientConfig,
|
|
102
|
-
worldState: ForkMerkleTreeOperations,
|
|
117
|
+
worldState: ForkMerkleTreeOperations & ReadonlyWorldStateAccess,
|
|
103
118
|
broker: ProvingJobBroker,
|
|
104
119
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
105
120
|
) {
|
|
@@ -127,17 +142,11 @@ export class ProverClient implements EpochProverManager {
|
|
|
127
142
|
|
|
128
143
|
const proofStore = new InlineProofStore();
|
|
129
144
|
const prover = await buildServerCircuitProver(this.config, this.telemetry);
|
|
145
|
+
const bindings = this.log.getBindings();
|
|
130
146
|
this.agents = times(
|
|
131
147
|
this.config.proverAgentCount,
|
|
132
148
|
() =>
|
|
133
|
-
new ProvingAgent(
|
|
134
|
-
this.agentClient!,
|
|
135
|
-
proofStore,
|
|
136
|
-
prover,
|
|
137
|
-
[],
|
|
138
|
-
this.config.proverAgentPollIntervalMs,
|
|
139
|
-
this.telemetry,
|
|
140
|
-
),
|
|
149
|
+
new ProvingAgent(this.agentClient!, proofStore, prover, [], this.config.proverAgentPollIntervalMs, bindings),
|
|
141
150
|
);
|
|
142
151
|
|
|
143
152
|
await Promise.all(this.agents.map(agent => agent.start()));
|
|
@@ -156,8 +165,9 @@ export function buildServerCircuitProver(
|
|
|
156
165
|
return BBNativeRollupProver.new(config, telemetry);
|
|
157
166
|
}
|
|
158
167
|
|
|
168
|
+
const logger = createLogger('prover-client:acvm-native');
|
|
159
169
|
const simulator = config.acvmBinaryPath
|
|
160
|
-
? new NativeACVMSimulator(config.acvmWorkingDirectory, config.acvmBinaryPath)
|
|
170
|
+
? new NativeACVMSimulator(config.acvmWorkingDirectory, config.acvmBinaryPath, undefined, logger)
|
|
161
171
|
: undefined;
|
|
162
172
|
|
|
163
173
|
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,13 @@ 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 { sha256 } from '@aztec/foundation/crypto/sha256';
|
|
9
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
10
10
|
import { type PromiseWithResolvers, RunningPromise, promiseWithResolvers } from '@aztec/foundation/promise';
|
|
11
11
|
import { truncate } from '@aztec/foundation/string';
|
|
12
12
|
import type { AvmCircuitInputs } from '@aztec/stdlib/avm';
|
|
13
13
|
import {
|
|
14
|
-
type ProofAndVerificationKey,
|
|
15
14
|
type ProofUri,
|
|
16
15
|
type ProvingJobId,
|
|
17
16
|
type ProvingJobInputsMap,
|
|
@@ -23,7 +22,7 @@ import {
|
|
|
23
22
|
makeProvingJobId,
|
|
24
23
|
} from '@aztec/stdlib/interfaces/server';
|
|
25
24
|
import type { ParityBasePrivateInputs, ParityPublicInputs, ParityRootPrivateInputs } from '@aztec/stdlib/parity';
|
|
26
|
-
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
25
|
+
import { ProvingRequestType, RecursiveProof } from '@aztec/stdlib/proofs';
|
|
27
26
|
import type {
|
|
28
27
|
BlockMergeRollupPrivateInputs,
|
|
29
28
|
BlockRollupPublicInputs,
|
|
@@ -69,14 +68,17 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
69
68
|
private runningPromise?: RunningPromise;
|
|
70
69
|
private timeOfLastSnapshotSync = Date.now();
|
|
71
70
|
private jobsToRetrieve: Set<ProvingJobId> = new Set();
|
|
71
|
+
private log: Logger;
|
|
72
72
|
|
|
73
73
|
constructor(
|
|
74
74
|
private broker: ProvingJobProducer,
|
|
75
75
|
private proofStore: ProofStore = new InlineProofStore(),
|
|
76
76
|
private failedProofStore?: ProofStore,
|
|
77
77
|
private pollIntervalMs = 1000,
|
|
78
|
-
|
|
79
|
-
) {
|
|
78
|
+
bindings?: LoggerBindings,
|
|
79
|
+
) {
|
|
80
|
+
this.log = createLogger('prover-client:broker-circuit-prover-facade', bindings);
|
|
81
|
+
}
|
|
80
82
|
|
|
81
83
|
/**
|
|
82
84
|
* This is a critical section. This function can not be async since it writes
|
|
@@ -130,7 +132,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
130
132
|
id: ProvingJobId,
|
|
131
133
|
type: T,
|
|
132
134
|
inputs: ProvingJobInputsMap[T],
|
|
133
|
-
epochNumber =
|
|
135
|
+
epochNumber = EpochNumber.ZERO,
|
|
134
136
|
signal?: AbortSignal,
|
|
135
137
|
): Promise<ProvingJobResultsMap[T]> {
|
|
136
138
|
const { job: job, isEnqueued } = this.getOrCreateProvingJob(id, type, signal);
|
|
@@ -397,30 +399,22 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
397
399
|
|
|
398
400
|
getAvmProof(
|
|
399
401
|
inputs: AvmCircuitInputs,
|
|
400
|
-
skipPublicInputsValidation?: boolean, // TODO(#14234)[Unconditional PIs validation]: remove this argument
|
|
401
402
|
signal?: AbortSignal,
|
|
402
|
-
epochNumber?:
|
|
403
|
-
): Promise<
|
|
404
|
-
this.log.info(`getAvmProof() called with skipPublicInputsValidation: ${skipPublicInputsValidation}`);
|
|
405
|
-
|
|
403
|
+
epochNumber?: EpochNumber,
|
|
404
|
+
): Promise<RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>> {
|
|
406
405
|
return this.enqueueJob(
|
|
407
406
|
this.generateId(ProvingRequestType.PUBLIC_VM, inputs, epochNumber),
|
|
408
407
|
ProvingRequestType.PUBLIC_VM,
|
|
409
408
|
inputs,
|
|
410
409
|
epochNumber,
|
|
411
410
|
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
|
-
});
|
|
411
|
+
);
|
|
418
412
|
}
|
|
419
413
|
|
|
420
414
|
getBaseParityProof(
|
|
421
415
|
inputs: ParityBasePrivateInputs,
|
|
422
416
|
signal?: AbortSignal,
|
|
423
|
-
epochNumber?:
|
|
417
|
+
epochNumber?: EpochNumber,
|
|
424
418
|
): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof RECURSIVE_PROOF_LENGTH>> {
|
|
425
419
|
return this.enqueueJob(
|
|
426
420
|
this.generateId(ProvingRequestType.PARITY_BASE, inputs, epochNumber),
|
|
@@ -434,7 +428,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
434
428
|
getTxMergeRollupProof(
|
|
435
429
|
input: TxMergeRollupPrivateInputs,
|
|
436
430
|
signal?: AbortSignal,
|
|
437
|
-
epochNumber?:
|
|
431
|
+
epochNumber?: EpochNumber,
|
|
438
432
|
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
439
433
|
return this.enqueueJob(
|
|
440
434
|
this.generateId(ProvingRequestType.TX_MERGE_ROLLUP, input, epochNumber),
|
|
@@ -448,7 +442,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
448
442
|
getPublicChonkVerifierProof(
|
|
449
443
|
inputs: PublicChonkVerifierPrivateInputs,
|
|
450
444
|
signal?: AbortSignal,
|
|
451
|
-
epochNumber?:
|
|
445
|
+
epochNumber?: EpochNumber,
|
|
452
446
|
): Promise<
|
|
453
447
|
PublicInputsAndRecursiveProof<PublicChonkVerifierPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
454
448
|
> {
|
|
@@ -464,7 +458,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
464
458
|
getPrivateTxBaseRollupProof(
|
|
465
459
|
baseRollupInput: PrivateTxBaseRollupPrivateInputs,
|
|
466
460
|
signal?: AbortSignal,
|
|
467
|
-
epochNumber?:
|
|
461
|
+
epochNumber?: EpochNumber,
|
|
468
462
|
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
469
463
|
return this.enqueueJob(
|
|
470
464
|
this.generateId(ProvingRequestType.PRIVATE_TX_BASE_ROLLUP, baseRollupInput, epochNumber),
|
|
@@ -478,7 +472,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
478
472
|
getPublicTxBaseRollupProof(
|
|
479
473
|
inputs: PublicTxBaseRollupPrivateInputs,
|
|
480
474
|
signal?: AbortSignal,
|
|
481
|
-
epochNumber?:
|
|
475
|
+
epochNumber?: EpochNumber,
|
|
482
476
|
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
483
477
|
return this.enqueueJob(
|
|
484
478
|
this.generateId(ProvingRequestType.PUBLIC_TX_BASE_ROLLUP, inputs, epochNumber),
|
|
@@ -492,7 +486,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
492
486
|
getRootParityProof(
|
|
493
487
|
inputs: ParityRootPrivateInputs,
|
|
494
488
|
signal?: AbortSignal,
|
|
495
|
-
epochNumber?:
|
|
489
|
+
epochNumber?: EpochNumber,
|
|
496
490
|
): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>> {
|
|
497
491
|
return this.enqueueJob(
|
|
498
492
|
this.generateId(ProvingRequestType.PARITY_ROOT, inputs, epochNumber),
|
|
@@ -506,7 +500,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
506
500
|
getBlockRootFirstRollupProof(
|
|
507
501
|
input: BlockRootFirstRollupPrivateInputs,
|
|
508
502
|
signal?: AbortSignal,
|
|
509
|
-
epochNumber?:
|
|
503
|
+
epochNumber?: EpochNumber,
|
|
510
504
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
511
505
|
return this.enqueueJob(
|
|
512
506
|
this.generateId(ProvingRequestType.BLOCK_ROOT_FIRST_ROLLUP, input, epochNumber),
|
|
@@ -520,7 +514,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
520
514
|
getBlockRootSingleTxFirstRollupProof(
|
|
521
515
|
input: BlockRootSingleTxFirstRollupPrivateInputs,
|
|
522
516
|
signal?: AbortSignal,
|
|
523
|
-
epochNumber?:
|
|
517
|
+
epochNumber?: EpochNumber,
|
|
524
518
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
525
519
|
return this.enqueueJob(
|
|
526
520
|
this.generateId(ProvingRequestType.BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP, input, epochNumber),
|
|
@@ -534,7 +528,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
534
528
|
getBlockRootEmptyTxFirstRollupProof(
|
|
535
529
|
input: BlockRootEmptyTxFirstRollupPrivateInputs,
|
|
536
530
|
signal?: AbortSignal,
|
|
537
|
-
epochNumber?:
|
|
531
|
+
epochNumber?: EpochNumber,
|
|
538
532
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
539
533
|
return this.enqueueJob(
|
|
540
534
|
this.generateId(ProvingRequestType.BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP, input, epochNumber),
|
|
@@ -548,7 +542,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
548
542
|
getBlockRootRollupProof(
|
|
549
543
|
input: BlockRootRollupPrivateInputs,
|
|
550
544
|
signal?: AbortSignal,
|
|
551
|
-
epochNumber?:
|
|
545
|
+
epochNumber?: EpochNumber,
|
|
552
546
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
553
547
|
return this.enqueueJob(
|
|
554
548
|
this.generateId(ProvingRequestType.BLOCK_ROOT_ROLLUP, input, epochNumber),
|
|
@@ -562,7 +556,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
562
556
|
getBlockRootSingleTxRollupProof(
|
|
563
557
|
input: BlockRootSingleTxRollupPrivateInputs,
|
|
564
558
|
signal?: AbortSignal,
|
|
565
|
-
epochNumber?:
|
|
559
|
+
epochNumber?: EpochNumber,
|
|
566
560
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
567
561
|
return this.enqueueJob(
|
|
568
562
|
this.generateId(ProvingRequestType.BLOCK_ROOT_SINGLE_TX_ROLLUP, input, epochNumber),
|
|
@@ -576,7 +570,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
576
570
|
getBlockMergeRollupProof(
|
|
577
571
|
input: BlockMergeRollupPrivateInputs,
|
|
578
572
|
signal?: AbortSignal,
|
|
579
|
-
epochNumber?:
|
|
573
|
+
epochNumber?: EpochNumber,
|
|
580
574
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
581
575
|
return this.enqueueJob(
|
|
582
576
|
this.generateId(ProvingRequestType.BLOCK_MERGE_ROLLUP, input, epochNumber),
|
|
@@ -590,7 +584,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
590
584
|
getCheckpointRootRollupProof(
|
|
591
585
|
input: CheckpointRootRollupPrivateInputs,
|
|
592
586
|
signal?: AbortSignal,
|
|
593
|
-
epochNumber?:
|
|
587
|
+
epochNumber?: EpochNumber,
|
|
594
588
|
): Promise<
|
|
595
589
|
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
596
590
|
> {
|
|
@@ -606,7 +600,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
606
600
|
getCheckpointRootSingleBlockRollupProof(
|
|
607
601
|
input: CheckpointRootSingleBlockRollupPrivateInputs,
|
|
608
602
|
signal?: AbortSignal,
|
|
609
|
-
epochNumber?:
|
|
603
|
+
epochNumber?: EpochNumber,
|
|
610
604
|
): Promise<
|
|
611
605
|
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
612
606
|
> {
|
|
@@ -622,7 +616,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
622
616
|
getCheckpointPaddingRollupProof(
|
|
623
617
|
input: CheckpointPaddingRollupPrivateInputs,
|
|
624
618
|
signal?: AbortSignal,
|
|
625
|
-
epochNumber?:
|
|
619
|
+
epochNumber?: EpochNumber,
|
|
626
620
|
): Promise<
|
|
627
621
|
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
628
622
|
> {
|
|
@@ -638,7 +632,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
638
632
|
getCheckpointMergeRollupProof(
|
|
639
633
|
input: CheckpointMergeRollupPrivateInputs,
|
|
640
634
|
signal?: AbortSignal,
|
|
641
|
-
epochNumber?:
|
|
635
|
+
epochNumber?: EpochNumber,
|
|
642
636
|
): Promise<
|
|
643
637
|
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
644
638
|
> {
|
|
@@ -654,7 +648,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
654
648
|
getRootRollupProof(
|
|
655
649
|
input: RootRollupPrivateInputs,
|
|
656
650
|
signal?: AbortSignal,
|
|
657
|
-
epochNumber?:
|
|
651
|
+
epochNumber?: EpochNumber,
|
|
658
652
|
): Promise<PublicInputsAndRecursiveProof<RootRollupPublicInputs, typeof RECURSIVE_PROOF_LENGTH>> {
|
|
659
653
|
return this.enqueueJob(
|
|
660
654
|
this.generateId(ProvingRequestType.ROOT_ROLLUP, input, epochNumber),
|
|
@@ -665,7 +659,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
665
659
|
);
|
|
666
660
|
}
|
|
667
661
|
|
|
668
|
-
private generateId(type: ProvingRequestType, inputs: { toBuffer(): Buffer }, epochNumber =
|
|
662
|
+
private generateId(type: ProvingRequestType, inputs: { toBuffer(): Buffer }, epochNumber = EpochNumber.ZERO) {
|
|
669
663
|
const inputsHash = sha256(inputs.toBuffer());
|
|
670
664
|
return makeProvingJobId(epochNumber, type, inputsHash.toString('hex'));
|
|
671
665
|
}
|
|
@@ -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,
|
|
@@ -98,6 +98,10 @@ export const ProverAgentConfig = z.object({
|
|
|
98
98
|
proverTestDelayMs: z.number(),
|
|
99
99
|
/** If using realistic delays, what percentage of realistic times to apply. */
|
|
100
100
|
proverTestDelayFactor: z.number(),
|
|
101
|
+
/** The delay (ms) to inject during fake proof verification */
|
|
102
|
+
proverTestVerificationDelayMs: z.number().optional(),
|
|
103
|
+
/** Whether to abort pending proving jobs when the orchestrator is cancelled */
|
|
104
|
+
cancelJobsOnStop: z.boolean(),
|
|
101
105
|
});
|
|
102
106
|
|
|
103
107
|
export type ProverAgentConfig = z.infer<typeof ProverAgentConfig>;
|
|
@@ -146,4 +150,16 @@ export const proverAgentConfigMappings: ConfigMappingsType<ProverAgentConfig> =
|
|
|
146
150
|
description: 'If using realistic delays, what percentage of realistic times to apply.',
|
|
147
151
|
...numberConfigHelper(1),
|
|
148
152
|
},
|
|
153
|
+
proverTestVerificationDelayMs: {
|
|
154
|
+
env: 'PROVER_TEST_VERIFICATION_DELAY_MS',
|
|
155
|
+
description: 'The delay (ms) to inject during fake proof verification',
|
|
156
|
+
...numberConfigHelper(10),
|
|
157
|
+
},
|
|
158
|
+
cancelJobsOnStop: {
|
|
159
|
+
env: 'PROVER_CANCEL_JOBS_ON_STOP',
|
|
160
|
+
description:
|
|
161
|
+
'Whether to abort pending proving jobs when the orchestrator is cancelled. ' +
|
|
162
|
+
'When false (default), jobs remain in the broker queue and can be reused on restart/reorg.',
|
|
163
|
+
...booleanConfigHelper(false),
|
|
164
|
+
},
|
|
149
165
|
};
|
|
@@ -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 {
|
|
@@ -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) {
|