@aztec/prover-client 0.0.0-test.1 → 0.0.1-commit.017a351

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.
Files changed (185) hide show
  1. package/dest/config.d.ts +8 -8
  2. package/dest/config.d.ts.map +1 -1
  3. package/dest/config.js +26 -2
  4. package/dest/index.d.ts +1 -1
  5. package/dest/light/index.d.ts +2 -0
  6. package/dest/light/index.d.ts.map +1 -0
  7. package/dest/light/index.js +1 -0
  8. package/dest/light/lightweight_checkpoint_builder.d.ts +52 -0
  9. package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -0
  10. package/dest/light/lightweight_checkpoint_builder.js +231 -0
  11. package/dest/mocks/fixtures.d.ts +8 -8
  12. package/dest/mocks/fixtures.d.ts.map +1 -1
  13. package/dest/mocks/fixtures.js +36 -17
  14. package/dest/mocks/test_context.d.ts +45 -32
  15. package/dest/mocks/test_context.d.ts.map +1 -1
  16. package/dest/mocks/test_context.js +162 -90
  17. package/dest/orchestrator/block-building-helpers.d.ts +36 -29
  18. package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
  19. package/dest/orchestrator/block-building-helpers.js +170 -189
  20. package/dest/orchestrator/block-proving-state.d.ts +73 -48
  21. package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
  22. package/dest/orchestrator/block-proving-state.js +289 -177
  23. package/dest/orchestrator/checkpoint-proving-state.d.ts +83 -0
  24. package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -0
  25. package/dest/orchestrator/checkpoint-proving-state.js +252 -0
  26. package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts +107 -0
  27. package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts.map +1 -0
  28. package/dest/orchestrator/checkpoint-sub-tree-orchestrator.js +151 -0
  29. package/dest/orchestrator/epoch-proving-context.d.ts +51 -0
  30. package/dest/orchestrator/epoch-proving-context.d.ts.map +1 -0
  31. package/dest/orchestrator/epoch-proving-context.js +81 -0
  32. package/dest/orchestrator/epoch-proving-state.d.ts +43 -28
  33. package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
  34. package/dest/orchestrator/epoch-proving-state.js +179 -73
  35. package/dest/orchestrator/index.d.ts +4 -1
  36. package/dest/orchestrator/index.d.ts.map +1 -1
  37. package/dest/orchestrator/index.js +3 -0
  38. package/dest/orchestrator/orchestrator.d.ts +59 -51
  39. package/dest/orchestrator/orchestrator.d.ts.map +1 -1
  40. package/dest/orchestrator/orchestrator.js +808 -385
  41. package/dest/orchestrator/orchestrator_metrics.d.ts +1 -1
  42. package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
  43. package/dest/orchestrator/orchestrator_metrics.js +2 -6
  44. package/dest/orchestrator/proving-scheduler.d.ts +72 -0
  45. package/dest/orchestrator/proving-scheduler.d.ts.map +1 -0
  46. package/dest/orchestrator/proving-scheduler.js +117 -0
  47. package/dest/orchestrator/top-tree-orchestrator.d.ts +83 -0
  48. package/dest/orchestrator/top-tree-orchestrator.d.ts.map +1 -0
  49. package/dest/orchestrator/top-tree-orchestrator.js +182 -0
  50. package/dest/orchestrator/top-tree-proving-scheduler.d.ts +62 -0
  51. package/dest/orchestrator/top-tree-proving-scheduler.d.ts.map +1 -0
  52. package/dest/orchestrator/top-tree-proving-scheduler.js +73 -0
  53. package/dest/orchestrator/top-tree-proving-state.d.ts +61 -0
  54. package/dest/orchestrator/top-tree-proving-state.d.ts.map +1 -0
  55. package/dest/orchestrator/top-tree-proving-state.js +185 -0
  56. package/dest/orchestrator/tx-proving-state.d.ts +15 -12
  57. package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
  58. package/dest/orchestrator/tx-proving-state.js +27 -44
  59. package/dest/prover-client/factory.d.ts +3 -3
  60. package/dest/prover-client/factory.d.ts.map +1 -1
  61. package/dest/prover-client/index.d.ts +1 -1
  62. package/dest/prover-client/prover-client.d.ts +68 -9
  63. package/dest/prover-client/prover-client.d.ts.map +1 -1
  64. package/dest/prover-client/prover-client.js +68 -14
  65. package/dest/prover-client/server-epoch-prover.d.ts +16 -12
  66. package/dest/prover-client/server-epoch-prover.d.ts.map +1 -1
  67. package/dest/prover-client/server-epoch-prover.js +11 -11
  68. package/dest/proving_broker/broker_prover_facade.d.ts +28 -19
  69. package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
  70. package/dest/proving_broker/broker_prover_facade.js +74 -61
  71. package/dest/proving_broker/config.d.ts +18 -61
  72. package/dest/proving_broker/config.d.ts.map +1 -1
  73. package/dest/proving_broker/config.js +43 -9
  74. package/dest/proving_broker/factory.d.ts +2 -2
  75. package/dest/proving_broker/factory.d.ts.map +1 -1
  76. package/dest/proving_broker/factory.js +5 -1
  77. package/dest/proving_broker/fixtures.d.ts +3 -2
  78. package/dest/proving_broker/fixtures.d.ts.map +1 -1
  79. package/dest/proving_broker/fixtures.js +3 -2
  80. package/dest/proving_broker/index.d.ts +2 -1
  81. package/dest/proving_broker/index.d.ts.map +1 -1
  82. package/dest/proving_broker/index.js +1 -0
  83. package/dest/proving_broker/proof_store/factory.d.ts +2 -5
  84. package/dest/proving_broker/proof_store/factory.d.ts.map +1 -1
  85. package/dest/proving_broker/proof_store/factory.js +7 -30
  86. package/dest/proving_broker/proof_store/file_store_proof_store.d.ts +18 -0
  87. package/dest/proving_broker/proof_store/file_store_proof_store.d.ts.map +1 -0
  88. package/dest/proving_broker/proof_store/file_store_proof_store.js +60 -0
  89. package/dest/proving_broker/proof_store/index.d.ts +2 -1
  90. package/dest/proving_broker/proof_store/index.d.ts.map +1 -1
  91. package/dest/proving_broker/proof_store/index.js +1 -0
  92. package/dest/proving_broker/proof_store/inline_proof_store.d.ts +1 -1
  93. package/dest/proving_broker/proof_store/inline_proof_store.d.ts.map +1 -1
  94. package/dest/proving_broker/proof_store/proof_store.d.ts +1 -1
  95. package/dest/proving_broker/proving_agent.d.ts +8 -12
  96. package/dest/proving_broker/proving_agent.d.ts.map +1 -1
  97. package/dest/proving_broker/proving_agent.js +86 -65
  98. package/dest/proving_broker/proving_broker.d.ts +18 -6
  99. package/dest/proving_broker/proving_broker.d.ts.map +1 -1
  100. package/dest/proving_broker/proving_broker.js +108 -44
  101. package/dest/proving_broker/proving_broker_database/memory.d.ts +3 -2
  102. package/dest/proving_broker/proving_broker_database/memory.d.ts.map +1 -1
  103. package/dest/proving_broker/proving_broker_database/memory.js +1 -1
  104. package/dest/proving_broker/proving_broker_database/persisted.d.ts +5 -3
  105. package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
  106. package/dest/proving_broker/proving_broker_database/persisted.js +401 -11
  107. package/dest/proving_broker/proving_broker_database.d.ts +3 -2
  108. package/dest/proving_broker/proving_broker_database.d.ts.map +1 -1
  109. package/dest/proving_broker/proving_broker_instrumentation.d.ts +3 -1
  110. package/dest/proving_broker/proving_broker_instrumentation.d.ts.map +1 -1
  111. package/dest/proving_broker/proving_broker_instrumentation.js +22 -35
  112. package/dest/proving_broker/proving_job_controller.d.ts +11 -10
  113. package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
  114. package/dest/proving_broker/proving_job_controller.js +92 -62
  115. package/dest/proving_broker/rpc.d.ts +9 -7
  116. package/dest/proving_broker/rpc.d.ts.map +1 -1
  117. package/dest/proving_broker/rpc.js +88 -27
  118. package/dest/test/mock_proof_store.d.ts +9 -0
  119. package/dest/test/mock_proof_store.d.ts.map +1 -0
  120. package/dest/test/mock_proof_store.js +10 -0
  121. package/dest/test/mock_prover.d.ts +23 -17
  122. package/dest/test/mock_prover.d.ts.map +1 -1
  123. package/dest/test/mock_prover.js +38 -20
  124. package/package.json +34 -33
  125. package/src/config.ts +41 -9
  126. package/src/light/index.ts +1 -0
  127. package/src/light/lightweight_checkpoint_builder.ts +320 -0
  128. package/src/mocks/fixtures.ts +46 -40
  129. package/src/mocks/test_context.ts +231 -120
  130. package/src/orchestrator/block-building-helpers.ts +258 -334
  131. package/src/orchestrator/block-proving-state.ts +334 -231
  132. package/src/orchestrator/checkpoint-proving-state.ts +362 -0
  133. package/src/orchestrator/checkpoint-sub-tree-orchestrator.ts +271 -0
  134. package/src/orchestrator/epoch-proving-context.ts +101 -0
  135. package/src/orchestrator/epoch-proving-state.ts +239 -111
  136. package/src/orchestrator/index.ts +8 -0
  137. package/src/orchestrator/orchestrator.ts +591 -451
  138. package/src/orchestrator/orchestrator_metrics.ts +2 -6
  139. package/src/orchestrator/proving-scheduler.ts +156 -0
  140. package/src/orchestrator/top-tree-orchestrator.ts +314 -0
  141. package/src/orchestrator/top-tree-proving-scheduler.ts +154 -0
  142. package/src/orchestrator/top-tree-proving-state.ts +220 -0
  143. package/src/orchestrator/tx-proving-state.ts +48 -66
  144. package/src/prover-client/factory.ts +6 -2
  145. package/src/prover-client/prover-client.ts +173 -38
  146. package/src/prover-client/server-epoch-prover.ts +40 -22
  147. package/src/proving_broker/broker_prover_facade.ts +227 -149
  148. package/src/proving_broker/config.ts +49 -8
  149. package/src/proving_broker/factory.ts +2 -1
  150. package/src/proving_broker/fixtures.ts +8 -3
  151. package/src/proving_broker/index.ts +1 -0
  152. package/src/proving_broker/proof_store/factory.ts +10 -32
  153. package/src/proving_broker/proof_store/file_store_proof_store.ts +78 -0
  154. package/src/proving_broker/proof_store/index.ts +1 -0
  155. package/src/proving_broker/proof_store/inline_proof_store.ts +1 -1
  156. package/src/proving_broker/proving_agent.ts +95 -66
  157. package/src/proving_broker/proving_broker.ts +121 -49
  158. package/src/proving_broker/proving_broker_database/memory.ts +3 -2
  159. package/src/proving_broker/proving_broker_database/persisted.ts +31 -15
  160. package/src/proving_broker/proving_broker_database.ts +2 -1
  161. package/src/proving_broker/proving_broker_instrumentation.ts +23 -35
  162. package/src/proving_broker/proving_job_controller.ts +100 -83
  163. package/src/proving_broker/rpc.ts +46 -25
  164. package/src/test/mock_proof_store.ts +14 -0
  165. package/src/test/mock_prover.ts +156 -64
  166. package/dest/bin/get-proof-inputs.d.ts +0 -2
  167. package/dest/bin/get-proof-inputs.d.ts.map +0 -1
  168. package/dest/bin/get-proof-inputs.js +0 -51
  169. package/dest/block_builder/index.d.ts +0 -6
  170. package/dest/block_builder/index.d.ts.map +0 -1
  171. package/dest/block_builder/index.js +0 -1
  172. package/dest/block_builder/light.d.ts +0 -33
  173. package/dest/block_builder/light.d.ts.map +0 -1
  174. package/dest/block_builder/light.js +0 -82
  175. package/dest/proving_broker/proof_store/gcs_proof_store.d.ts +0 -14
  176. package/dest/proving_broker/proof_store/gcs_proof_store.d.ts.map +0 -1
  177. package/dest/proving_broker/proof_store/gcs_proof_store.js +0 -51
  178. package/dest/proving_broker/proving_agent_instrumentation.d.ts +0 -8
  179. package/dest/proving_broker/proving_agent_instrumentation.d.ts.map +0 -1
  180. package/dest/proving_broker/proving_agent_instrumentation.js +0 -16
  181. package/src/bin/get-proof-inputs.ts +0 -59
  182. package/src/block_builder/index.ts +0 -6
  183. package/src/block_builder/light.ts +0 -101
  184. package/src/proving_broker/proof_store/gcs_proof_store.ts +0 -72
  185. package/src/proving_broker/proving_agent_instrumentation.ts +0 -21
@@ -1,55 +1,184 @@
1
1
  import { type ACVMConfig, type BBConfig, BBNativeRollupProver, TestCircuitProver } from '@aztec/bb-prover';
2
+ import type { EpochNumber } from '@aztec/foundation/branded-types';
2
3
  import { times } from '@aztec/foundation/collection';
3
- import { Fr } from '@aztec/foundation/fields';
4
- import { createLogger } from '@aztec/foundation/log';
4
+ import type { Fr } from '@aztec/foundation/curves/bn254';
5
+ import type { EthAddress } from '@aztec/foundation/eth-address';
6
+ import { type Logger, createLogger } from '@aztec/foundation/log';
5
7
  import { NativeACVMSimulator } from '@aztec/simulator/server';
6
- import type {
7
- ActualProverConfig,
8
- EpochProver,
9
- EpochProverManager,
10
- ForkMerkleTreeOperations,
11
- ProvingJobBroker,
12
- ProvingJobConsumer,
13
- ProvingJobProducer,
14
- ServerCircuitProver,
8
+ import {
9
+ type ActualProverConfig,
10
+ type EpochProver,
11
+ type EpochProverManager,
12
+ type ForkMerkleTreeOperations,
13
+ type ProvingJobBroker,
14
+ type ProvingJobConsumer,
15
+ type ProvingJobProducer,
16
+ type ReadonlyWorldStateAccess,
17
+ type ServerCircuitProver,
18
+ tryStop,
15
19
  } from '@aztec/stdlib/interfaces/server';
20
+ import type { CheckpointConstantData } from '@aztec/stdlib/rollup';
21
+ import type { BlockHeader } from '@aztec/stdlib/tx';
16
22
  import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
17
23
 
18
24
  import type { ProverClientConfig } from '../config.js';
25
+ import { CheckpointSubTreeOrchestrator } from '../orchestrator/checkpoint-sub-tree-orchestrator.js';
26
+ import { EpochProvingContext } from '../orchestrator/epoch-proving-context.js';
19
27
  import { ProvingOrchestrator } from '../orchestrator/orchestrator.js';
28
+ import { TopTreeOrchestrator } from '../orchestrator/top-tree-orchestrator.js';
20
29
  import { BrokerCircuitProverFacade } from '../proving_broker/broker_prover_facade.js';
21
30
  import { InlineProofStore, type ProofStore, createProofStore } from '../proving_broker/proof_store/index.js';
22
31
  import { ProvingAgent } from '../proving_broker/proving_agent.js';
23
32
  import { ServerEpochProver } from './server-epoch-prover.js';
24
33
 
34
+ /**
35
+ * The factory surface that `EpochProvingJob` (in `prover-node`) depends on. Implemented
36
+ * by `ProverClient`. Defined here rather than in stdlib because the return types
37
+ * (`CheckpointSubTreeOrchestrator`, `TopTreeOrchestrator`) are concrete classes from
38
+ * this package.
39
+ *
40
+ * A single `BrokerCircuitProverFacade` is owned by `ProverClient` and shared across
41
+ * every orchestrator (every sub-tree and every top-tree across every concurrent epoch
42
+ * job). The broker delivers each completed-job notification exactly once (drained on
43
+ * the first `getCompletedJobs` poll), so multiple facades polling the same broker
44
+ * race and lose notifications
45
+ *
46
+ * The facade's job map cleans up entries on resolve/reject, and the prover-node
47
+ * keeps `ProverClient` alive for its whole lifetime
48
+ */
49
+ export interface EpochProverFactory {
50
+ getProverId(): EthAddress;
51
+ /**
52
+ * Constructs a per-epoch shared context for the caching of e.g. chonk verifier results
53
+ */
54
+ createEpochProvingContext(epochNumber: EpochNumber): EpochProvingContext;
55
+ /**
56
+ * Constructs and starts a `CheckpointSubTreeOrchestrator` for a single checkpoint.
57
+ */
58
+ createCheckpointSubTreeOrchestrator(
59
+ epochContext: EpochProvingContext,
60
+ checkpointConstants: CheckpointConstantData,
61
+ l1ToL2Messages: Fr[],
62
+ totalNumBlocks: number,
63
+ headerOfLastBlockInPreviousCheckpoint: BlockHeader,
64
+ ): Promise<CheckpointSubTreeOrchestrator>;
65
+ createTopTreeOrchestrator(): TopTreeOrchestrator;
66
+ }
67
+
25
68
  /** Manages proving of epochs by orchestrating the proving of individual blocks relying on a pool of prover agents. */
26
- export class ProverClient implements EpochProverManager {
69
+ export class ProverClient implements EpochProverManager, EpochProverFactory {
27
70
  private running = false;
28
71
  private agents: ProvingAgent[] = [];
29
-
30
- private proofStore: ProofStore;
31
- private failedProofStore: ProofStore | undefined;
72
+ /**
73
+ * The single broker facade shared by every orchestrator created from this client.
74
+ * Constructed lazily on `start()` and torn down on `stop()` — see the comment on
75
+ * `EpochProverFactory` for why a single shared facade is required.
76
+ */
77
+ private facade: BrokerCircuitProverFacade | undefined;
32
78
 
33
79
  private constructor(
34
80
  private config: ProverClientConfig,
35
- private worldState: ForkMerkleTreeOperations,
81
+ private worldState: ForkMerkleTreeOperations & ReadonlyWorldStateAccess,
36
82
  private orchestratorClient: ProvingJobProducer,
83
+ private proofStore: ProofStore,
84
+ private failedProofStore: ProofStore | undefined,
37
85
  private agentClient?: ProvingJobConsumer,
38
86
  private telemetry: TelemetryClient = getTelemetryClient(),
39
- private log = createLogger('prover-client:tx-prover'),
40
- ) {
41
- this.proofStore = new InlineProofStore();
42
- this.failedProofStore = this.config.failedProofStore ? createProofStore(this.config.failedProofStore) : undefined;
87
+ private log: Logger = createLogger('prover-client:tx-prover'),
88
+ ) {}
89
+
90
+ /**
91
+ * Lazy-init the shared facade. The broker delivers each completed-job notification
92
+ * exactly once (drained on the first `getCompletedJobs` poll), so we cannot start
93
+ * a shared facade alongside the per-call facades that `createEpochProver` builds —
94
+ * they would race for notifications and one side would silently drop them. Starting
95
+ * the shared facade only on first use of one of the new factory methods keeps the
96
+ * legacy `createEpochProver` path race-free.
97
+ */
98
+ private getFacade(): BrokerCircuitProverFacade {
99
+ if (!this.running) {
100
+ throw new Error('ProverClient is not running; call start() before constructing orchestrators.');
101
+ }
102
+ if (!this.facade) {
103
+ this.facade = new BrokerCircuitProverFacade(
104
+ this.orchestratorClient,
105
+ this.proofStore,
106
+ this.failedProofStore,
107
+ undefined,
108
+ this.log.getBindings(),
109
+ );
110
+ this.facade.start();
111
+ }
112
+ return this.facade;
43
113
  }
44
114
 
115
+ /**
116
+ * Legacy single-class epoch prover. Each call constructs its own
117
+ * `BrokerCircuitProverFacade`; the new factory methods (`createCheckpointSubTreeOrchestrator`,
118
+ * `createTopTreeOrchestrator`, `createEpochProvingContext`) share a single facade
119
+ * owned by `ProverClient`. Both APIs coexist while the prover-node migrates onto
120
+ * the new pair.
121
+ */
45
122
  public createEpochProver(): EpochProver {
46
- const facade = new BrokerCircuitProverFacade(this.orchestratorClient, this.proofStore, this.failedProofStore);
47
- const orchestrator = new ProvingOrchestrator(this.worldState, facade, this.config.proverId, this.telemetry);
123
+ const bindings = this.log.getBindings();
124
+ const facade = new BrokerCircuitProverFacade(
125
+ this.orchestratorClient,
126
+ this.proofStore,
127
+ this.failedProofStore,
128
+ undefined,
129
+ bindings,
130
+ );
131
+ const orchestrator = new ProvingOrchestrator(
132
+ this.worldState,
133
+ facade,
134
+ this.config.proverId,
135
+ this.config.cancelJobsOnStop,
136
+ this.config.enqueueConcurrency,
137
+ this.telemetry,
138
+ bindings,
139
+ );
48
140
  return new ServerEpochProver(facade, orchestrator);
49
141
  }
50
142
 
51
- public getProverId(): Fr {
52
- return this.config.proverId ?? Fr.ZERO;
143
+ public createEpochProvingContext(epochNumber: EpochNumber): EpochProvingContext {
144
+ return new EpochProvingContext(this.getFacade(), epochNumber, this.log.getBindings());
145
+ }
146
+
147
+ public createCheckpointSubTreeOrchestrator(
148
+ epochContext: EpochProvingContext,
149
+ checkpointConstants: CheckpointConstantData,
150
+ l1ToL2Messages: Fr[],
151
+ totalNumBlocks: number,
152
+ headerOfLastBlockInPreviousCheckpoint: BlockHeader,
153
+ ): Promise<CheckpointSubTreeOrchestrator> {
154
+ return CheckpointSubTreeOrchestrator.start(
155
+ this.worldState,
156
+ this.getFacade(),
157
+ this.config.proverId,
158
+ epochContext,
159
+ this.config.cancelJobsOnStop,
160
+ this.config.enqueueConcurrency,
161
+ checkpointConstants,
162
+ l1ToL2Messages,
163
+ totalNumBlocks,
164
+ headerOfLastBlockInPreviousCheckpoint,
165
+ this.telemetry,
166
+ this.log.getBindings(),
167
+ );
168
+ }
169
+
170
+ public createTopTreeOrchestrator(): TopTreeOrchestrator {
171
+ return new TopTreeOrchestrator(
172
+ this.getFacade(),
173
+ this.config.proverId,
174
+ this.config.enqueueConcurrency,
175
+ this.telemetry,
176
+ this.log.getBindings(),
177
+ );
178
+ }
179
+
180
+ public getProverId(): EthAddress {
181
+ return this.config.proverId;
53
182
  }
54
183
 
55
184
  async updateProverConfig(config: Partial<ProverClientConfig>): Promise<void> {
@@ -87,6 +216,15 @@ export class ProverClient implements EpochProverManager {
87
216
  }
88
217
  this.running = false;
89
218
  await this.stopAgents();
219
+ if (this.facade) {
220
+ try {
221
+ await this.facade.stop();
222
+ } catch (err) {
223
+ this.log.error('Error stopping shared broker facade', err);
224
+ }
225
+ this.facade = undefined;
226
+ }
227
+ await tryStop(this.orchestratorClient);
90
228
  }
91
229
 
92
230
  /**
@@ -97,11 +235,13 @@ export class ProverClient implements EpochProverManager {
97
235
  */
98
236
  public static async new(
99
237
  config: ProverClientConfig,
100
- worldState: ForkMerkleTreeOperations,
238
+ worldState: ForkMerkleTreeOperations & ReadonlyWorldStateAccess,
101
239
  broker: ProvingJobBroker,
102
240
  telemetry: TelemetryClient = getTelemetryClient(),
103
241
  ) {
104
- const prover = new ProverClient(config, worldState, broker, broker, telemetry);
242
+ const proofStore = await createProofStore(config.proofStore);
243
+ const failedProofStore = config.failedProofStore ? await createProofStore(config.failedProofStore) : undefined;
244
+ const prover = new ProverClient(config, worldState, broker, proofStore, failedProofStore, broker, telemetry);
105
245
  await prover.start();
106
246
  return prover;
107
247
  }
@@ -125,17 +265,11 @@ export class ProverClient implements EpochProverManager {
125
265
 
126
266
  const proofStore = new InlineProofStore();
127
267
  const prover = await buildServerCircuitProver(this.config, this.telemetry);
268
+ const bindings = this.log.getBindings();
128
269
  this.agents = times(
129
270
  this.config.proverAgentCount,
130
271
  () =>
131
- new ProvingAgent(
132
- this.agentClient!,
133
- proofStore,
134
- prover,
135
- [],
136
- this.config.proverAgentPollIntervalMs,
137
- this.telemetry,
138
- ),
272
+ new ProvingAgent(this.agentClient!, proofStore, prover, [], this.config.proverAgentPollIntervalMs, bindings),
139
273
  );
140
274
 
141
275
  await Promise.all(this.agents.map(agent => agent.start()));
@@ -147,16 +281,17 @@ export class ProverClient implements EpochProverManager {
147
281
  }
148
282
 
149
283
  export function buildServerCircuitProver(
150
- config: ActualProverConfig & ACVMConfig & BBConfig,
284
+ config: Omit<ActualProverConfig, 'enqueueConcurrency'> & ACVMConfig & BBConfig,
151
285
  telemetry: TelemetryClient,
152
286
  ): Promise<ServerCircuitProver> {
153
287
  if (config.realProofs) {
154
288
  return BBNativeRollupProver.new(config, telemetry);
155
289
  }
156
290
 
157
- const simulationProvider = config.acvmBinaryPath
158
- ? new NativeACVMSimulator(config.acvmWorkingDirectory, config.acvmBinaryPath)
291
+ const logger = createLogger('prover-client:acvm-native');
292
+ const simulator = config.acvmBinaryPath
293
+ ? new NativeACVMSimulator(config.acvmWorkingDirectory, config.acvmBinaryPath, undefined, logger)
159
294
  : undefined;
160
295
 
161
- return Promise.resolve(new TestCircuitProver(simulationProvider, config, telemetry));
296
+ return Promise.resolve(new TestCircuitProver(simulator, config, telemetry));
162
297
  }
@@ -1,49 +1,67 @@
1
- import type { Fr } from '@aztec/foundation/fields';
2
- import type { L2Block } from '@aztec/stdlib/block';
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';
4
+ import type { EthAddress } from '@aztec/stdlib/block';
3
5
  import type { EpochProver } from '@aztec/stdlib/interfaces/server';
4
6
  import type { Proof } from '@aztec/stdlib/proofs';
5
- import type { RootRollupPublicInputs } from '@aztec/stdlib/rollup';
6
- import type { BlockHeader, GlobalVariables, ProcessedTx, Tx } from '@aztec/stdlib/tx';
7
+ import type { CheckpointConstantData, RootRollupPublicInputs } from '@aztec/stdlib/rollup';
8
+ import type { BlockHeader, ProcessedTx, Tx } from '@aztec/stdlib/tx';
9
+ import type { UInt64 } from '@aztec/stdlib/types';
7
10
 
8
11
  import type { ProvingOrchestrator } from '../orchestrator/orchestrator.js';
9
12
  import type { BrokerCircuitProverFacade } from '../proving_broker/broker_prover_facade.js';
10
13
 
11
14
  /** Encapsulates the proving orchestrator and the broker facade */
12
15
  export class ServerEpochProver implements EpochProver {
13
- constructor(private facade: BrokerCircuitProverFacade, private orchestrator: ProvingOrchestrator) {}
16
+ constructor(
17
+ private facade: BrokerCircuitProverFacade,
18
+ private orchestrator: ProvingOrchestrator,
19
+ ) {}
14
20
 
15
- startNewEpoch(epochNumber: number, firstBlockNumber: number, totalNumBlocks: number): void {
16
- this.orchestrator.startNewEpoch(epochNumber, firstBlockNumber, totalNumBlocks);
21
+ startNewEpoch(
22
+ epochNumber: EpochNumber,
23
+ totalNumCheckpoints: number,
24
+ finalBlobBatchingChallenges: FinalBlobBatchingChallenges,
25
+ ): void {
26
+ this.orchestrator.startNewEpoch(epochNumber, totalNumCheckpoints, finalBlobBatchingChallenges);
17
27
  this.facade.start();
18
28
  }
19
- startTubeCircuits(txs: Tx[]): Promise<void> {
20
- return this.orchestrator.startTubeCircuits(txs);
29
+ startNewCheckpoint(
30
+ checkpointIndex: number,
31
+ constants: CheckpointConstantData,
32
+ l1ToL2Messages: Fr[],
33
+ totalNumBlocks: number,
34
+ headerOfLastBlockInPreviousCheckpoint: BlockHeader,
35
+ ): Promise<void> {
36
+ return this.orchestrator.startNewCheckpoint(
37
+ checkpointIndex,
38
+ constants,
39
+ l1ToL2Messages,
40
+ totalNumBlocks,
41
+ headerOfLastBlockInPreviousCheckpoint,
42
+ );
43
+ }
44
+ startChonkVerifierCircuits(txs: Tx[]): Promise<void> {
45
+ return this.orchestrator.startChonkVerifierCircuits(txs);
21
46
  }
22
- setBlockCompleted(blockNumber: number, expectedBlockHeader?: BlockHeader): Promise<L2Block> {
47
+ setBlockCompleted(blockNumber: BlockNumber, expectedBlockHeader?: BlockHeader): Promise<BlockHeader> {
23
48
  return this.orchestrator.setBlockCompleted(blockNumber, expectedBlockHeader);
24
49
  }
25
- finaliseEpoch(): Promise<{ publicInputs: RootRollupPublicInputs; proof: Proof }> {
26
- return this.orchestrator.finaliseEpoch();
50
+ finalizeEpoch(): Promise<{ publicInputs: RootRollupPublicInputs; proof: Proof; batchedBlobInputs: BatchedBlob }> {
51
+ return this.orchestrator.finalizeEpoch();
27
52
  }
28
53
  cancel(): void {
29
54
  this.orchestrator.cancel();
30
55
  }
31
- getProverId(): Fr {
56
+ getProverId(): EthAddress {
32
57
  return this.orchestrator.getProverId();
33
58
  }
34
- getBlock(index: number): L2Block {
35
- return this.orchestrator.getBlock(index);
36
- }
37
59
  async stop(): Promise<void> {
38
60
  await this.facade.stop();
39
61
  await this.orchestrator.stop();
40
62
  }
41
- startNewBlock(
42
- globalVariables: GlobalVariables,
43
- l1ToL2Messages: Fr[],
44
- previousBlockHeader: BlockHeader,
45
- ): Promise<void> {
46
- return this.orchestrator.startNewBlock(globalVariables, l1ToL2Messages, previousBlockHeader);
63
+ startNewBlock(blockNumber: BlockNumber, timestamp: UInt64, totalNumTxs: number): Promise<void> {
64
+ return this.orchestrator.startNewBlock(blockNumber, timestamp, totalNumTxs);
47
65
  }
48
66
  addTxs(txs: ProcessedTx[]): Promise<void> {
49
67
  return this.orchestrator.addTxs(txs);