@aztec/prover-client 0.0.0-test.1 → 0.0.1-commit.b655e406
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/block-factory/index.d.ts +2 -0
- package/dest/block-factory/index.d.ts.map +1 -0
- package/dest/block-factory/light.d.ts +38 -0
- package/dest/block-factory/light.d.ts.map +1 -0
- package/dest/block-factory/light.js +94 -0
- package/dest/config.d.ts +6 -6
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +11 -1
- package/dest/mocks/fixtures.d.ts +7 -4
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +32 -4
- package/dest/mocks/test_context.d.ts +43 -15
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +110 -48
- package/dest/orchestrator/block-building-helpers.d.ts +37 -28
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +156 -150
- package/dest/orchestrator/block-proving-state.d.ts +62 -46
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +223 -179
- package/dest/orchestrator/checkpoint-proving-state.d.ts +63 -0
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -0
- package/dest/orchestrator/checkpoint-proving-state.js +211 -0
- package/dest/orchestrator/epoch-proving-state.d.ts +37 -24
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +143 -73
- package/dest/orchestrator/orchestrator.d.ts +34 -31
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +392 -234
- package/dest/orchestrator/orchestrator_metrics.d.ts +2 -0
- package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator_metrics.js +9 -0
- package/dest/orchestrator/tx-proving-state.d.ts +12 -10
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.js +30 -38
- 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 +5 -4
- package/dest/prover-client/server-epoch-prover.d.ts +13 -10
- package/dest/prover-client/server-epoch-prover.d.ts.map +1 -1
- package/dest/prover-client/server-epoch-prover.js +11 -11
- package/dest/proving_broker/broker_prover_facade.d.ts +22 -15
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +64 -39
- package/dest/proving_broker/config.d.ts +9 -4
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +15 -4
- package/dest/proving_broker/factory.d.ts +1 -1
- package/dest/proving_broker/factory.d.ts.map +1 -1
- package/dest/proving_broker/factory.js +5 -1
- package/dest/proving_broker/fixtures.js +1 -1
- package/dest/proving_broker/proof_store/factory.js +1 -1
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/gcs_proof_store.js +1 -0
- package/dest/proving_broker/proof_store/index.d.ts +1 -0
- package/dest/proving_broker/proof_store/index.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/index.js +1 -0
- package/dest/proving_broker/proving_agent.d.ts +3 -3
- package/dest/proving_broker/proving_agent.d.ts.map +1 -1
- package/dest/proving_broker/proving_agent.js +83 -47
- package/dest/proving_broker/proving_broker.d.ts +11 -2
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +34 -22
- package/dest/proving_broker/proving_broker_database/memory.js +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +9 -8
- package/dest/proving_broker/proving_job_controller.d.ts +7 -8
- package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
- package/dest/proving_broker/proving_job_controller.js +89 -61
- package/dest/proving_broker/rpc.d.ts +3 -5
- package/dest/proving_broker/rpc.d.ts.map +1 -1
- package/dest/proving_broker/rpc.js +1 -4
- package/dest/test/mock_proof_store.d.ts +9 -0
- package/dest/test/mock_proof_store.d.ts.map +1 -0
- package/dest/test/mock_proof_store.js +10 -0
- package/dest/test/mock_prover.d.ts +23 -16
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/dest/test/mock_prover.js +38 -20
- package/package.json +29 -29
- package/src/block-factory/index.ts +1 -0
- package/src/block-factory/light.ts +140 -0
- package/src/config.ts +24 -8
- package/src/mocks/fixtures.ts +43 -15
- package/src/mocks/test_context.ts +201 -75
- package/src/orchestrator/block-building-helpers.ts +247 -243
- package/src/orchestrator/block-proving-state.ts +247 -231
- package/src/orchestrator/checkpoint-proving-state.ts +299 -0
- package/src/orchestrator/epoch-proving-state.ts +187 -111
- package/src/orchestrator/orchestrator.ts +590 -289
- package/src/orchestrator/orchestrator_metrics.ts +20 -1
- package/src/orchestrator/tx-proving-state.ts +60 -61
- package/src/prover-client/prover-client.ts +16 -14
- package/src/prover-client/server-epoch-prover.ts +40 -21
- package/src/proving_broker/broker_prover_facade.ts +200 -113
- package/src/proving_broker/config.ts +17 -6
- package/src/proving_broker/factory.ts +2 -1
- package/src/proving_broker/fixtures.ts +1 -1
- package/src/proving_broker/proof_store/factory.ts +1 -1
- package/src/proving_broker/proof_store/gcs_proof_store.ts +5 -1
- package/src/proving_broker/proof_store/index.ts +1 -0
- package/src/proving_broker/proof_store/inline_proof_store.ts +1 -1
- package/src/proving_broker/proving_agent.ts +89 -47
- package/src/proving_broker/proving_broker.ts +51 -32
- package/src/proving_broker/proving_broker_database/memory.ts +1 -1
- package/src/proving_broker/proving_broker_database/persisted.ts +9 -8
- package/src/proving_broker/proving_job_controller.ts +92 -81
- package/src/proving_broker/rpc.ts +1 -6
- package/src/test/mock_proof_store.ts +14 -0
- package/src/test/mock_prover.ts +164 -60
- package/dest/bin/get-proof-inputs.d.ts +0 -2
- package/dest/bin/get-proof-inputs.d.ts.map +0 -1
- package/dest/bin/get-proof-inputs.js +0 -51
- package/dest/block_builder/index.d.ts +0 -6
- package/dest/block_builder/index.d.ts.map +0 -1
- package/dest/block_builder/light.d.ts +0 -33
- package/dest/block_builder/light.d.ts.map +0 -1
- package/dest/block_builder/light.js +0 -82
- package/src/bin/get-proof-inputs.ts +0 -59
- package/src/block_builder/index.ts +0 -6
- package/src/block_builder/light.ts +0 -101
- /package/dest/{block_builder → block-factory}/index.js +0 -0
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type Histogram,
|
|
3
|
+
Metrics,
|
|
4
|
+
type TelemetryClient,
|
|
5
|
+
type Tracer,
|
|
6
|
+
type UpDownCounter,
|
|
7
|
+
ValueType,
|
|
8
|
+
} from '@aztec/telemetry-client';
|
|
2
9
|
|
|
3
10
|
export class ProvingOrchestratorMetrics {
|
|
4
11
|
public readonly tracer: Tracer;
|
|
5
12
|
|
|
6
13
|
private baseRollupInputsDuration: Histogram;
|
|
14
|
+
private avmFallbackCount: UpDownCounter;
|
|
7
15
|
|
|
8
16
|
constructor(client: TelemetryClient, name = 'ProvingOrchestrator') {
|
|
9
17
|
this.tracer = client.getTracer(name);
|
|
@@ -14,9 +22,20 @@ export class ProvingOrchestratorMetrics {
|
|
|
14
22
|
description: 'Duration to build base rollup inputs',
|
|
15
23
|
valueType: ValueType.INT,
|
|
16
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);
|
|
17
32
|
}
|
|
18
33
|
|
|
19
34
|
recordBaseRollupInputs(durationMs: number) {
|
|
20
35
|
this.baseRollupInputsDuration.record(Math.ceil(durationMs));
|
|
21
36
|
}
|
|
37
|
+
|
|
38
|
+
incAvmFallback() {
|
|
39
|
+
this.avmFallbackCount.add(1);
|
|
40
|
+
}
|
|
22
41
|
}
|
|
@@ -1,22 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
|
|
3
|
+
AVM_VK_INDEX,
|
|
4
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
|
+
} from '@aztec/constants';
|
|
6
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
7
|
+
import { getVkData } from '@aztec/noir-protocol-circuits-types/server/vks';
|
|
8
|
+
import { getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
3
9
|
import type { AvmCircuitInputs } from '@aztec/stdlib/avm';
|
|
4
|
-
import type { ProofAndVerificationKey } from '@aztec/stdlib/interfaces/server';
|
|
10
|
+
import type { ProofAndVerificationKey, PublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
11
|
+
import { ProofData } from '@aztec/stdlib/proofs';
|
|
5
12
|
import {
|
|
6
|
-
AvmProofData,
|
|
7
13
|
type BaseRollupHints,
|
|
8
14
|
PrivateBaseRollupHints,
|
|
9
|
-
|
|
10
|
-
PrivateTubeData,
|
|
15
|
+
PrivateTxBaseRollupPrivateInputs,
|
|
11
16
|
PublicBaseRollupHints,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
TubeInputs,
|
|
17
|
+
PublicChonkVerifierPublicInputs,
|
|
18
|
+
PublicTxBaseRollupPrivateInputs,
|
|
15
19
|
} from '@aztec/stdlib/rollup';
|
|
16
20
|
import type { CircuitName } from '@aztec/stdlib/stats';
|
|
17
21
|
import type { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
|
|
18
22
|
import type { ProcessedTx } from '@aztec/stdlib/tx';
|
|
19
|
-
import {
|
|
23
|
+
import { VerificationKeyData, VkData } from '@aztec/stdlib/vks';
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
getChonkProofFromTx,
|
|
27
|
+
getPublicChonkVerifierPrivateInputsFromTx,
|
|
28
|
+
toProofData,
|
|
29
|
+
} from './block-building-helpers.js';
|
|
20
30
|
|
|
21
31
|
/**
|
|
22
32
|
* Helper class to manage the proving cycle of a transaction
|
|
@@ -24,13 +34,17 @@ import { VkWitnessData } from '@aztec/stdlib/vks';
|
|
|
24
34
|
* Also stores the inputs to the base rollup for this transaction and the tree snapshots
|
|
25
35
|
*/
|
|
26
36
|
export class TxProvingState {
|
|
27
|
-
private
|
|
28
|
-
|
|
37
|
+
private publicChonkVerifier?: PublicInputsAndRecursiveProof<
|
|
38
|
+
PublicChonkVerifierPublicInputs,
|
|
39
|
+
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
40
|
+
>;
|
|
41
|
+
private avm?: ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>;
|
|
29
42
|
|
|
30
43
|
constructor(
|
|
31
44
|
public readonly processedTx: ProcessedTx,
|
|
32
45
|
private readonly baseRollupHints: BaseRollupHints,
|
|
33
46
|
public readonly treeSnapshots: Map<MerkleTreeId, AppendOnlyTreeSnapshot>,
|
|
47
|
+
private readonly proverId: Fr,
|
|
34
48
|
) {}
|
|
35
49
|
|
|
36
50
|
get requireAvmProof() {
|
|
@@ -38,102 +52,87 @@ export class TxProvingState {
|
|
|
38
52
|
}
|
|
39
53
|
|
|
40
54
|
public ready() {
|
|
41
|
-
return
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
public getTubeInputs() {
|
|
45
|
-
return new TubeInputs(this.processedTx.clientIvcProof);
|
|
55
|
+
return !this.requireAvmProof || (!!this.avm && !!this.publicChonkVerifier);
|
|
46
56
|
}
|
|
47
57
|
|
|
48
58
|
public getAvmInputs(): AvmCircuitInputs {
|
|
49
59
|
return this.processedTx.avmProvingRequest!.inputs;
|
|
50
60
|
}
|
|
51
61
|
|
|
62
|
+
public getPublicChonkVerifierPrivateInputs() {
|
|
63
|
+
return getPublicChonkVerifierPrivateInputsFromTx(this.processedTx, this.proverId);
|
|
64
|
+
}
|
|
65
|
+
|
|
52
66
|
public getBaseRollupTypeAndInputs() {
|
|
53
67
|
if (this.requireAvmProof) {
|
|
54
68
|
return {
|
|
55
|
-
rollupType: '
|
|
69
|
+
rollupType: 'rollup-tx-base-public' satisfies CircuitName,
|
|
56
70
|
inputs: this.#getPublicBaseInputs(),
|
|
57
71
|
};
|
|
58
72
|
} else {
|
|
59
73
|
return {
|
|
60
|
-
rollupType: '
|
|
74
|
+
rollupType: 'rollup-tx-base-private' satisfies CircuitName,
|
|
61
75
|
inputs: this.#getPrivateBaseInputs(),
|
|
62
76
|
};
|
|
63
77
|
}
|
|
64
78
|
}
|
|
65
79
|
|
|
66
|
-
public
|
|
67
|
-
|
|
80
|
+
public setPublicChonkVerifierProof(
|
|
81
|
+
publicChonkVerifierProofAndVk: PublicInputsAndRecursiveProof<
|
|
82
|
+
PublicChonkVerifierPublicInputs,
|
|
83
|
+
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
84
|
+
>,
|
|
85
|
+
) {
|
|
86
|
+
this.publicChonkVerifier = publicChonkVerifierProofAndVk;
|
|
68
87
|
}
|
|
69
88
|
|
|
70
|
-
public setAvmProof(avmProofAndVk: ProofAndVerificationKey<typeof
|
|
89
|
+
public setAvmProof(avmProofAndVk: ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>) {
|
|
71
90
|
this.avm = avmProofAndVk;
|
|
72
91
|
}
|
|
73
92
|
|
|
74
93
|
#getPrivateBaseInputs() {
|
|
75
|
-
if (!this.
|
|
76
|
-
throw new Error('
|
|
94
|
+
if (!(this.baseRollupHints instanceof PrivateBaseRollupHints)) {
|
|
95
|
+
throw new Error('Mismatched base rollup hints, expected private base rollup hints');
|
|
77
96
|
}
|
|
78
97
|
|
|
79
|
-
const
|
|
80
|
-
const tubeData = new PrivateTubeData(
|
|
98
|
+
const privateTailProofData = new ProofData(
|
|
81
99
|
this.processedTx.data.toPrivateToRollupKernelCircuitPublicInputs(),
|
|
82
|
-
this.
|
|
83
|
-
|
|
100
|
+
getChonkProofFromTx(this.processedTx),
|
|
101
|
+
getVkData('HidingKernelToRollup'),
|
|
84
102
|
);
|
|
85
103
|
|
|
86
|
-
|
|
87
|
-
throw new Error('Mismatched base rollup hints, expected private base rollup hints');
|
|
88
|
-
}
|
|
89
|
-
return new PrivateBaseRollupInputs(tubeData, this.baseRollupHints);
|
|
104
|
+
return new PrivateTxBaseRollupPrivateInputs(privateTailProofData, this.baseRollupHints);
|
|
90
105
|
}
|
|
91
106
|
|
|
92
107
|
#getPublicBaseInputs() {
|
|
93
108
|
if (!this.processedTx.avmProvingRequest) {
|
|
94
109
|
throw new Error('Should create private base rollup for a tx not requiring avm proof.');
|
|
95
110
|
}
|
|
96
|
-
if (!this.
|
|
97
|
-
throw new Error('Tx not ready for proving base rollup:
|
|
111
|
+
if (!this.publicChonkVerifier) {
|
|
112
|
+
throw new Error('Tx not ready for proving base rollup: public chonk verifier proof undefined');
|
|
98
113
|
}
|
|
99
114
|
if (!this.avm) {
|
|
100
115
|
throw new Error('Tx not ready for proving base rollup: avm proof undefined');
|
|
101
116
|
}
|
|
102
|
-
|
|
103
|
-
const tubeData = new PublicTubeData(
|
|
104
|
-
this.processedTx.data.toPrivateToPublicKernelCircuitPublicInputs(),
|
|
105
|
-
this.tube.proof,
|
|
106
|
-
this.#getTubeVkData(),
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
const avmProofData = new AvmProofData(
|
|
110
|
-
this.processedTx.avmProvingRequest.inputs.publicInputs,
|
|
111
|
-
this.avm.proof,
|
|
112
|
-
this.#getAvmVkData(),
|
|
113
|
-
);
|
|
114
|
-
|
|
115
117
|
if (!(this.baseRollupHints instanceof PublicBaseRollupHints)) {
|
|
116
118
|
throw new Error('Mismatched base rollup hints, expected public base rollup hints');
|
|
117
119
|
}
|
|
118
120
|
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
+
const publicChonkVerifierProofData = toProofData(this.publicChonkVerifier);
|
|
121
122
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
// TODO(#7410) The VK for the tube won't be in the tree for now, so we manually set it to the tube vk index
|
|
128
|
-
}
|
|
129
|
-
const vkPath = getVKSiblingPath(vkIndex);
|
|
123
|
+
const avmProofData = new ProofData(
|
|
124
|
+
this.processedTx.avmProvingRequest.inputs.publicInputs,
|
|
125
|
+
this.avm.proof,
|
|
126
|
+
this.#getVkData(this.avm!.verificationKey, AVM_VK_INDEX),
|
|
127
|
+
);
|
|
130
128
|
|
|
131
|
-
return new
|
|
129
|
+
return new PublicTxBaseRollupPrivateInputs(publicChonkVerifierProofData, avmProofData, this.baseRollupHints);
|
|
132
130
|
}
|
|
133
131
|
|
|
134
|
-
#
|
|
135
|
-
|
|
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.
|
|
136
135
|
const vkPath = getVKSiblingPath(vkIndex);
|
|
137
|
-
return new
|
|
136
|
+
return new VkData(verificationKey, vkIndex, vkPath);
|
|
138
137
|
}
|
|
139
138
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { type ACVMConfig, type BBConfig, BBNativeRollupProver, TestCircuitProver } from '@aztec/bb-prover';
|
|
2
2
|
import { times } from '@aztec/foundation/collection';
|
|
3
|
-
import {
|
|
3
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
5
|
import { NativeACVMSimulator } from '@aztec/simulator/server';
|
|
6
|
-
import
|
|
7
|
-
ActualProverConfig,
|
|
8
|
-
EpochProver,
|
|
9
|
-
EpochProverManager,
|
|
10
|
-
ForkMerkleTreeOperations,
|
|
11
|
-
ProvingJobBroker,
|
|
12
|
-
ProvingJobConsumer,
|
|
13
|
-
ProvingJobProducer,
|
|
14
|
-
ServerCircuitProver,
|
|
6
|
+
import {
|
|
7
|
+
type ActualProverConfig,
|
|
8
|
+
type EpochProver,
|
|
9
|
+
type EpochProverManager,
|
|
10
|
+
type ForkMerkleTreeOperations,
|
|
11
|
+
type ProvingJobBroker,
|
|
12
|
+
type ProvingJobConsumer,
|
|
13
|
+
type ProvingJobProducer,
|
|
14
|
+
type ServerCircuitProver,
|
|
15
|
+
tryStop,
|
|
15
16
|
} from '@aztec/stdlib/interfaces/server';
|
|
16
17
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
17
18
|
|
|
@@ -48,8 +49,8 @@ export class ProverClient implements EpochProverManager {
|
|
|
48
49
|
return new ServerEpochProver(facade, orchestrator);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
public getProverId():
|
|
52
|
-
return this.config.proverId
|
|
52
|
+
public getProverId(): EthAddress {
|
|
53
|
+
return this.config.proverId;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
async updateProverConfig(config: Partial<ProverClientConfig>): Promise<void> {
|
|
@@ -87,6 +88,7 @@ export class ProverClient implements EpochProverManager {
|
|
|
87
88
|
}
|
|
88
89
|
this.running = false;
|
|
89
90
|
await this.stopAgents();
|
|
91
|
+
await tryStop(this.orchestratorClient);
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
/**
|
|
@@ -154,9 +156,9 @@ export function buildServerCircuitProver(
|
|
|
154
156
|
return BBNativeRollupProver.new(config, telemetry);
|
|
155
157
|
}
|
|
156
158
|
|
|
157
|
-
const
|
|
159
|
+
const simulator = config.acvmBinaryPath
|
|
158
160
|
? new NativeACVMSimulator(config.acvmWorkingDirectory, config.acvmBinaryPath)
|
|
159
161
|
: undefined;
|
|
160
162
|
|
|
161
|
-
return Promise.resolve(new TestCircuitProver(
|
|
163
|
+
return Promise.resolve(new TestCircuitProver(simulator, config, telemetry));
|
|
162
164
|
}
|
|
@@ -1,49 +1,68 @@
|
|
|
1
|
+
import type { BatchedBlob, FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
1
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import type {
|
|
3
|
+
import type { EthAddress } from '@aztec/stdlib/block';
|
|
3
4
|
import type { EpochProver } from '@aztec/stdlib/interfaces/server';
|
|
4
5
|
import type { Proof } from '@aztec/stdlib/proofs';
|
|
5
|
-
import type { RootRollupPublicInputs } from '@aztec/stdlib/rollup';
|
|
6
|
-
import type { BlockHeader,
|
|
6
|
+
import type { CheckpointConstantData, RootRollupPublicInputs } from '@aztec/stdlib/rollup';
|
|
7
|
+
import type { BlockHeader, ProcessedTx, Tx } from '@aztec/stdlib/tx';
|
|
8
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
7
9
|
|
|
8
10
|
import type { ProvingOrchestrator } from '../orchestrator/orchestrator.js';
|
|
9
11
|
import type { BrokerCircuitProverFacade } from '../proving_broker/broker_prover_facade.js';
|
|
10
12
|
|
|
11
13
|
/** Encapsulates the proving orchestrator and the broker facade */
|
|
12
14
|
export class ServerEpochProver implements EpochProver {
|
|
13
|
-
constructor(
|
|
15
|
+
constructor(
|
|
16
|
+
private facade: BrokerCircuitProverFacade,
|
|
17
|
+
private orchestrator: ProvingOrchestrator,
|
|
18
|
+
) {}
|
|
14
19
|
|
|
15
|
-
startNewEpoch(
|
|
16
|
-
|
|
20
|
+
startNewEpoch(
|
|
21
|
+
epochNumber: number,
|
|
22
|
+
totalNumCheckpoints: number,
|
|
23
|
+
finalBlobBatchingChallenges: FinalBlobBatchingChallenges,
|
|
24
|
+
): void {
|
|
25
|
+
this.orchestrator.startNewEpoch(epochNumber, totalNumCheckpoints, finalBlobBatchingChallenges);
|
|
17
26
|
this.facade.start();
|
|
18
27
|
}
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
startNewCheckpoint(
|
|
29
|
+
checkpointIndex: number,
|
|
30
|
+
constants: CheckpointConstantData,
|
|
31
|
+
l1ToL2Messages: Fr[],
|
|
32
|
+
totalNumBlocks: number,
|
|
33
|
+
totalNumBlobFields: number,
|
|
34
|
+
headerOfLastBlockInPreviousCheckpoint: BlockHeader,
|
|
35
|
+
): Promise<void> {
|
|
36
|
+
return this.orchestrator.startNewCheckpoint(
|
|
37
|
+
checkpointIndex,
|
|
38
|
+
constants,
|
|
39
|
+
l1ToL2Messages,
|
|
40
|
+
totalNumBlocks,
|
|
41
|
+
totalNumBlobFields,
|
|
42
|
+
headerOfLastBlockInPreviousCheckpoint,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
startChonkVerifierCircuits(txs: Tx[]): Promise<void> {
|
|
46
|
+
return this.orchestrator.startChonkVerifierCircuits(txs);
|
|
21
47
|
}
|
|
22
|
-
setBlockCompleted(blockNumber: number, expectedBlockHeader?: BlockHeader): Promise<
|
|
48
|
+
setBlockCompleted(blockNumber: number, expectedBlockHeader?: BlockHeader): Promise<BlockHeader> {
|
|
23
49
|
return this.orchestrator.setBlockCompleted(blockNumber, expectedBlockHeader);
|
|
24
50
|
}
|
|
25
|
-
|
|
26
|
-
return this.orchestrator.
|
|
51
|
+
finalizeEpoch(): Promise<{ publicInputs: RootRollupPublicInputs; proof: Proof; batchedBlobInputs: BatchedBlob }> {
|
|
52
|
+
return this.orchestrator.finalizeEpoch();
|
|
27
53
|
}
|
|
28
54
|
cancel(): void {
|
|
29
55
|
this.orchestrator.cancel();
|
|
30
56
|
}
|
|
31
|
-
getProverId():
|
|
57
|
+
getProverId(): EthAddress {
|
|
32
58
|
return this.orchestrator.getProverId();
|
|
33
59
|
}
|
|
34
|
-
getBlock(index: number): L2Block {
|
|
35
|
-
return this.orchestrator.getBlock(index);
|
|
36
|
-
}
|
|
37
60
|
async stop(): Promise<void> {
|
|
38
61
|
await this.facade.stop();
|
|
39
62
|
await this.orchestrator.stop();
|
|
40
63
|
}
|
|
41
|
-
startNewBlock(
|
|
42
|
-
|
|
43
|
-
l1ToL2Messages: Fr[],
|
|
44
|
-
previousBlockHeader: BlockHeader,
|
|
45
|
-
): Promise<void> {
|
|
46
|
-
return this.orchestrator.startNewBlock(globalVariables, l1ToL2Messages, previousBlockHeader);
|
|
64
|
+
startNewBlock(blockNumber: number, timestamp: UInt64, totalNumTxs: number): Promise<void> {
|
|
65
|
+
return this.orchestrator.startNewBlock(blockNumber, timestamp, totalNumTxs);
|
|
47
66
|
}
|
|
48
67
|
addTxs(txs: ProcessedTx[]): Promise<void> {
|
|
49
68
|
return this.orchestrator.addTxs(txs);
|