@aztec/prover-node 3.0.0-devnet.6 → 3.0.0-devnet.6-patch.1

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 (46) hide show
  1. package/dest/actions/download-epoch-proving-job.d.ts +4 -4
  2. package/dest/actions/index.d.ts +1 -1
  3. package/dest/actions/rerun-epoch-proving-job.d.ts +2 -2
  4. package/dest/actions/upload-epoch-proof-failure.d.ts +1 -1
  5. package/dest/bin/run-failed-epoch.d.ts +1 -1
  6. package/dest/config.d.ts +2 -2
  7. package/dest/config.d.ts.map +1 -1
  8. package/dest/config.js +1 -1
  9. package/dest/factory.d.ts +2 -2
  10. package/dest/factory.d.ts.map +1 -1
  11. package/dest/factory.js +5 -3
  12. package/dest/index.d.ts +1 -1
  13. package/dest/job/epoch-proving-job-data.d.ts +8 -6
  14. package/dest/job/epoch-proving-job-data.d.ts.map +1 -1
  15. package/dest/job/epoch-proving-job-data.js +25 -18
  16. package/dest/job/epoch-proving-job.d.ts +5 -12
  17. package/dest/job/epoch-proving-job.d.ts.map +1 -1
  18. package/dest/job/epoch-proving-job.js +94 -84
  19. package/dest/metrics.d.ts +4 -3
  20. package/dest/metrics.d.ts.map +1 -1
  21. package/dest/metrics.js +8 -2
  22. package/dest/monitors/epoch-monitor.d.ts +3 -2
  23. package/dest/monitors/epoch-monitor.d.ts.map +1 -1
  24. package/dest/monitors/epoch-monitor.js +2 -1
  25. package/dest/monitors/index.d.ts +1 -1
  26. package/dest/prover-node-publisher.d.ts +9 -7
  27. package/dest/prover-node-publisher.d.ts.map +1 -1
  28. package/dest/prover-node-publisher.js +43 -37
  29. package/dest/prover-node.d.ts +8 -7
  30. package/dest/prover-node.d.ts.map +1 -1
  31. package/dest/prover-node.js +34 -31
  32. package/dest/prover-publisher-factory.d.ts +4 -2
  33. package/dest/prover-publisher-factory.d.ts.map +1 -1
  34. package/dest/test/index.d.ts +1 -1
  35. package/dest/test/index.d.ts.map +1 -1
  36. package/package.json +26 -25
  37. package/src/bin/run-failed-epoch.ts +1 -1
  38. package/src/config.ts +1 -1
  39. package/src/factory.ts +8 -2
  40. package/src/job/epoch-proving-job-data.ts +31 -25
  41. package/src/job/epoch-proving-job.ts +107 -100
  42. package/src/metrics.ts +15 -3
  43. package/src/monitors/epoch-monitor.ts +4 -3
  44. package/src/prover-node-publisher.ts +62 -52
  45. package/src/prover-node.ts +46 -42
  46. package/src/prover-publisher-factory.ts +3 -1
@@ -1,10 +1,12 @@
1
- import type { BatchedBlob } from '@aztec/blob-lib';
1
+ import { BatchedBlob, getEthBlobEvaluationInputs } from '@aztec/blob-lib';
2
2
  import { AZTEC_MAX_EPOCH_DURATION } from '@aztec/constants';
3
- import type { L1TxUtils, RollupContract, ViemCommitteeAttestation } from '@aztec/ethereum';
3
+ import type { RollupContract, ViemCommitteeAttestation } from '@aztec/ethereum/contracts';
4
+ import type { L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
4
5
  import { makeTuple } from '@aztec/foundation/array';
6
+ import { CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
5
7
  import { areArraysEqual } from '@aztec/foundation/collection';
8
+ import { Fr } from '@aztec/foundation/curves/bn254';
6
9
  import { EthAddress } from '@aztec/foundation/eth-address';
7
- import { Fr } from '@aztec/foundation/fields';
8
10
  import { createLogger } from '@aztec/foundation/log';
9
11
  import type { Tuple } from '@aztec/foundation/serialize';
10
12
  import { Timer } from '@aztec/foundation/timer';
@@ -85,16 +87,16 @@ export class ProverNodePublisher {
85
87
  }
86
88
 
87
89
  public async submitEpochProof(args: {
88
- epochNumber: number;
89
- fromBlock: number;
90
- toBlock: number;
90
+ epochNumber: EpochNumber;
91
+ fromCheckpoint: CheckpointNumber;
92
+ toCheckpoint: CheckpointNumber;
91
93
  publicInputs: RootRollupPublicInputs;
92
94
  proof: Proof;
93
95
  batchedBlobInputs: BatchedBlob;
94
96
  attestations: ViemCommitteeAttestation[];
95
97
  }): Promise<boolean> {
96
- const { epochNumber, fromBlock, toBlock } = args;
97
- const ctx = { epochNumber, fromBlock, toBlock };
98
+ const { epochNumber, fromCheckpoint, toCheckpoint } = args;
99
+ const ctx = { epochNumber, fromCheckpoint, toCheckpoint };
98
100
 
99
101
  if (!this.interrupted) {
100
102
  const timer = new Timer();
@@ -103,6 +105,7 @@ export class ProverNodePublisher {
103
105
 
104
106
  const txReceipt = await this.sendSubmitEpochProofTx(args);
105
107
  if (!txReceipt) {
108
+ this.log.error(`Failed to mine submitEpochProof tx`, undefined, ctx);
106
109
  return false;
107
110
  }
108
111
 
@@ -135,47 +138,51 @@ export class ProverNodePublisher {
135
138
  }
136
139
 
137
140
  this.metrics.recordFailedTx();
138
- this.log.error(`Rollup.submitEpochProof tx status failed ${txReceipt.transactionHash}`, undefined, ctx);
141
+ this.log.error(`Rollup submitEpochProof tx reverted ${txReceipt.transactionHash}`, undefined, ctx);
139
142
  }
140
143
 
141
- this.log.verbose('L2 block data syncing interrupted', ctx);
144
+ this.log.verbose('Checkpoint data syncing interrupted', ctx);
142
145
  return false;
143
146
  }
144
147
 
145
148
  private async validateEpochProofSubmission(args: {
146
- fromBlock: number;
147
- toBlock: number;
149
+ fromCheckpoint: CheckpointNumber;
150
+ toCheckpoint: CheckpointNumber;
148
151
  publicInputs: RootRollupPublicInputs;
149
152
  proof: Proof;
150
153
  batchedBlobInputs: BatchedBlob;
151
154
  attestations: ViemCommitteeAttestation[];
152
155
  }) {
153
- const { fromBlock, toBlock, publicInputs, batchedBlobInputs } = args;
156
+ const { fromCheckpoint, toCheckpoint, publicInputs, batchedBlobInputs } = args;
154
157
 
155
- // Check that the block numbers match the expected epoch to be proven
156
- const { pendingBlockNumber: pending, provenBlockNumber: proven } = await this.rollupContract.getTips();
157
- // Don't publish if proven is beyond our toBlock, pointless to do so
158
- if (proven > BigInt(toBlock)) {
159
- throw new Error(`Cannot submit epoch proof for ${fromBlock}-${toBlock} as proven block is ${proven}`);
158
+ // Check that the checkpoint numbers match the expected epoch to be proven
159
+ const { pending, proven } = await this.rollupContract.getTips();
160
+ // Don't publish if proven is beyond our toCheckpoint, pointless to do so
161
+ if (proven > toCheckpoint) {
162
+ throw new Error(
163
+ `Cannot submit epoch proof for ${fromCheckpoint}-${toCheckpoint} as proven checkpoint is ${proven}`,
164
+ );
160
165
  }
161
- // toBlock can't be greater than pending
162
- if (toBlock > pending) {
163
- throw new Error(`Cannot submit epoch proof for ${fromBlock}-${toBlock} as pending block is ${pending}`);
166
+ // toCheckpoint can't be greater than pending
167
+ if (toCheckpoint > pending) {
168
+ throw new Error(
169
+ `Cannot submit epoch proof for ${fromCheckpoint}-${toCheckpoint} as pending checkpoint is ${pending}`,
170
+ );
164
171
  }
165
172
 
166
- // Check the archive for the immediate block before the epoch
167
- const blockLog = await this.rollupContract.getBlock(BigInt(fromBlock - 1));
168
- if (publicInputs.previousArchiveRoot.toString() !== blockLog.archive) {
173
+ // Check the archive for the immediate checkpoint before the epoch
174
+ const checkpointLog = await this.rollupContract.getCheckpoint(CheckpointNumber(fromCheckpoint - 1));
175
+ if (publicInputs.previousArchiveRoot.toString() !== checkpointLog.archive) {
169
176
  throw new Error(
170
- `Previous archive root mismatch: ${publicInputs.previousArchiveRoot.toString()} !== ${blockLog.archive}`,
177
+ `Previous archive root mismatch: ${publicInputs.previousArchiveRoot.toString()} !== ${checkpointLog.archive}`,
171
178
  );
172
179
  }
173
180
 
174
- // Check the archive for the last block in the epoch
175
- const endBlockLog = await this.rollupContract.getBlock(BigInt(toBlock));
176
- if (publicInputs.endArchiveRoot.toString() !== endBlockLog.archive) {
181
+ // Check the archive for the last checkpoint in the epoch
182
+ const endCheckpointLog = await this.rollupContract.getCheckpoint(toCheckpoint);
183
+ if (publicInputs.endArchiveRoot.toString() !== endCheckpointLog.archive) {
177
184
  throw new Error(
178
- `End archive root mismatch: ${publicInputs.endArchiveRoot.toString()} !== ${endBlockLog.archive}`,
185
+ `End archive root mismatch: ${publicInputs.endArchiveRoot.toString()} !== ${endCheckpointLog.archive}`,
179
186
  );
180
187
  }
181
188
 
@@ -202,8 +209,8 @@ export class ProverNodePublisher {
202
209
  }
203
210
 
204
211
  private async sendSubmitEpochProofTx(args: {
205
- fromBlock: number;
206
- toBlock: number;
212
+ fromCheckpoint: CheckpointNumber;
213
+ toCheckpoint: CheckpointNumber;
207
214
  publicInputs: RootRollupPublicInputs;
208
215
  proof: Proof;
209
216
  batchedBlobInputs: BatchedBlob;
@@ -213,8 +220,8 @@ export class ProverNodePublisher {
213
220
 
214
221
  this.log.info(`Submitting epoch proof to L1 rollup contract`, {
215
222
  proofSize: args.proof.withoutPublicInputs().length,
216
- fromBlock: args.fromBlock,
217
- toBlock: args.toBlock,
223
+ fromCheckpoint: args.fromCheckpoint,
224
+ toCheckpoint: args.toCheckpoint,
218
225
  });
219
226
  const data = encodeFunctionData({
220
227
  abi: RollupAbi,
@@ -223,36 +230,39 @@ export class ProverNodePublisher {
223
230
  });
224
231
  try {
225
232
  const { receipt } = await this.l1TxUtils.sendAndMonitorTransaction({ to: this.rollupContract.address, data });
233
+ if (receipt.status !== 'success') {
234
+ const errorMsg = await this.l1TxUtils.tryGetErrorFromRevertedTx(
235
+ data,
236
+ {
237
+ args: [...txArgs],
238
+ functionName: 'submitEpochRootProof',
239
+ abi: RollupAbi,
240
+ address: this.rollupContract.address,
241
+ },
242
+ /*blobInputs*/ undefined,
243
+ /*stateOverride*/ [],
244
+ );
245
+ this.log.error(`Rollup submit epoch proof tx reverted with ${errorMsg ?? 'unknown error'}`);
246
+ return undefined;
247
+ }
226
248
  return receipt;
227
249
  } catch (err) {
228
250
  this.log.error(`Rollup submit epoch proof failed`, err);
229
- const errorMsg = await this.l1TxUtils.tryGetErrorFromRevertedTx(
230
- data,
231
- {
232
- args: [...txArgs],
233
- functionName: 'submitEpochRootProof',
234
- abi: RollupAbi,
235
- address: this.rollupContract.address,
236
- },
237
- /*blobInputs*/ undefined,
238
- /*stateOverride*/ [],
239
- );
240
- this.log.error(`Rollup submit epoch proof tx reverted. ${errorMsg}`);
241
251
  return undefined;
242
252
  }
243
253
  }
244
254
 
245
255
  private getEpochProofPublicInputsArgs(args: {
246
- fromBlock: number;
247
- toBlock: number;
256
+ fromCheckpoint: CheckpointNumber;
257
+ toCheckpoint: CheckpointNumber;
248
258
  publicInputs: RootRollupPublicInputs;
249
259
  batchedBlobInputs: BatchedBlob;
250
260
  attestations: ViemCommitteeAttestation[];
251
261
  }) {
252
262
  // Returns arguments for EpochProofLib.sol -> getEpochProofPublicInputs()
253
263
  return [
254
- BigInt(args.fromBlock) /*_start*/,
255
- BigInt(args.toBlock) /*_end*/,
264
+ BigInt(args.fromCheckpoint) /*_start*/,
265
+ BigInt(args.toCheckpoint) /*_end*/,
256
266
  {
257
267
  previousArchive: args.publicInputs.previousArchiveRoot.toString(),
258
268
  endArchive: args.publicInputs.endArchiveRoot.toString(),
@@ -263,13 +273,13 @@ export class ProverNodePublisher {
263
273
  ? args.publicInputs.fees[i / 2].recipient.toField().toString()
264
274
  : args.publicInputs.fees[(i - 1) / 2].value.toString(),
265
275
  ) /*_fees*/,
266
- args.batchedBlobInputs.getEthBlobEvaluationInputs() /*_blobPublicInputs*/,
276
+ getEthBlobEvaluationInputs(args.batchedBlobInputs) /*_blobPublicInputs*/,
267
277
  ] as const;
268
278
  }
269
279
 
270
280
  private getSubmitEpochProofArgs(args: {
271
- fromBlock: number;
272
- toBlock: number;
281
+ fromCheckpoint: CheckpointNumber;
282
+ toCheckpoint: CheckpointNumber;
273
283
  publicInputs: RootRollupPublicInputs;
274
284
  proof: Proof;
275
285
  batchedBlobInputs: BatchedBlob;
@@ -1,14 +1,16 @@
1
1
  import type { Archiver } from '@aztec/archiver';
2
- import type { RollupContract } from '@aztec/ethereum';
2
+ import type { RollupContract } from '@aztec/ethereum/contracts';
3
+ import { BlockNumber, CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
3
4
  import { assertRequired, compact, pick, sum } from '@aztec/foundation/collection';
5
+ import type { Fr } from '@aztec/foundation/curves/bn254';
4
6
  import { memoize } from '@aztec/foundation/decorators';
5
- import type { Fr } from '@aztec/foundation/fields';
6
7
  import { createLogger } from '@aztec/foundation/log';
7
8
  import { DateProvider } from '@aztec/foundation/timer';
8
9
  import type { DataStoreConfig } from '@aztec/kv-store/config';
9
10
  import type { P2PClient } from '@aztec/p2p';
10
11
  import { PublicProcessorFactory } from '@aztec/simulator/server';
11
- import type { L2Block, L2BlockSource } from '@aztec/stdlib/block';
12
+ import type { L2BlockSource } from '@aztec/stdlib/block';
13
+ import type { Checkpoint } from '@aztec/stdlib/checkpoint';
12
14
  import type { ChainConfig } from '@aztec/stdlib/config';
13
15
  import type { ContractDataSource } from '@aztec/stdlib/contract';
14
16
  import { getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
@@ -114,7 +116,7 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
114
116
  * @param epochNumber - The epoch number that was just completed.
115
117
  * @returns false if there is an error, true otherwise
116
118
  */
117
- async handleEpochReadyToProve(epochNumber: bigint): Promise<boolean> {
119
+ async handleEpochReadyToProve(epochNumber: EpochNumber): Promise<boolean> {
118
120
  try {
119
121
  this.log.debug(`Running jobs as ${epochNumber} is ready to prove`, {
120
122
  jobs: Array.from(this.jobs.values()).map(job => `${job.getEpochNumber()}:${job.getId()}`),
@@ -184,8 +186,8 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
184
186
  /**
185
187
  * Starts a proving process and returns immediately.
186
188
  */
187
- public async startProof(epochNumber: number | bigint) {
188
- const job = await this.createProvingJob(BigInt(epochNumber), { skipEpochCheck: true });
189
+ public async startProof(epochNumber: EpochNumber) {
190
+ const job = await this.createProvingJob(epochNumber, { skipEpochCheck: true });
189
191
  void this.runJob(job);
190
192
  }
191
193
 
@@ -238,21 +240,20 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
238
240
  /**
239
241
  * Returns an array of jobs being processed.
240
242
  */
241
- public getJobs(): Promise<{ uuid: string; status: EpochProvingJobState; epochNumber: number }[]> {
243
+ public getJobs(): Promise<{ uuid: string; status: EpochProvingJobState; epochNumber: EpochNumber }[]> {
242
244
  return Promise.resolve(
243
245
  Array.from(this.jobs.entries()).map(([uuid, job]) => ({
244
246
  uuid,
245
247
  status: job.getState(),
246
- epochNumber: Number(job.getEpochNumber()),
248
+ epochNumber: job.getEpochNumber(),
247
249
  })),
248
250
  );
249
251
  }
250
252
 
251
253
  protected async getActiveJobsForEpoch(
252
- epochBigInt: bigint,
254
+ epochNumber: EpochNumber,
253
255
  ): Promise<{ uuid: string; status: EpochProvingJobState }[]> {
254
256
  const jobs = await this.getJobs();
255
- const epochNumber = Number(epochBigInt);
256
257
  return jobs.filter(job => job.epochNumber === epochNumber && !EpochProvingJobTerminalState.includes(job.status));
257
258
  }
258
259
 
@@ -263,18 +264,21 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
263
264
  }
264
265
  }
265
266
 
266
- @trackSpan('ProverNode.createProvingJob', epochNumber => ({ [Attributes.EPOCH_NUMBER]: Number(epochNumber) }))
267
- private async createProvingJob(epochNumber: bigint, opts: { skipEpochCheck?: boolean } = {}) {
267
+ @trackSpan('ProverNode.createProvingJob', epochNumber => ({ [Attributes.EPOCH_NUMBER]: epochNumber }))
268
+ private async createProvingJob(epochNumber: EpochNumber, opts: { skipEpochCheck?: boolean } = {}) {
268
269
  this.checkMaximumPendingJobs();
269
270
 
270
271
  this.publisher = await this.publisherFactory.create();
271
272
 
272
273
  // Gather all data for this epoch
273
274
  const epochData = await this.gatherEpochData(epochNumber);
274
-
275
- const fromBlock = epochData.blocks[0].number;
276
- const toBlock = epochData.blocks.at(-1)!.number;
277
- this.log.verbose(`Creating proving job for epoch ${epochNumber} for block range ${fromBlock} to ${toBlock}`);
275
+ const fromCheckpoint = epochData.checkpoints[0].number;
276
+ const toCheckpoint = epochData.checkpoints.at(-1)!.number;
277
+ const fromBlock = epochData.checkpoints[0].blocks[0].number;
278
+ const toBlock = epochData.checkpoints.at(-1)!.blocks.at(-1)!.number;
279
+ this.log.verbose(
280
+ `Creating proving job for epoch ${epochNumber} for checkpoint range ${fromCheckpoint} to ${toCheckpoint} and block range ${fromBlock} to ${toBlock}`,
281
+ );
278
282
 
279
283
  // Fast forward world state to right before the target block and get a fork
280
284
  await this.worldState.syncImmediate(toBlock);
@@ -289,7 +293,6 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
289
293
  // Set deadline for this job to run. It will abort if it takes too long.
290
294
  const deadlineTs = getProofSubmissionDeadlineTimestamp(epochNumber, await this.getL1Constants());
291
295
  const deadline = new Date(Number(deadlineTs) * 1000);
292
-
293
296
  const job = this.doCreateEpochProvingJob(epochData, deadline, publicProcessorFactory, this.publisher, opts);
294
297
  this.jobs.set(job.getId(), job);
295
298
  return job;
@@ -300,30 +303,32 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
300
303
  return this.l2BlockSource.getL1Constants();
301
304
  }
302
305
 
303
- @trackSpan('ProverNode.gatherEpochData', epochNumber => ({ [Attributes.EPOCH_NUMBER]: Number(epochNumber) }))
304
- private async gatherEpochData(epochNumber: bigint): Promise<EpochProvingJobData> {
305
- const blocks = await this.gatherBlocks(epochNumber);
306
- const txArray = await this.gatherTxs(epochNumber, blocks);
306
+ @trackSpan('ProverNode.gatherEpochData', epochNumber => ({ [Attributes.EPOCH_NUMBER]: epochNumber }))
307
+ private async gatherEpochData(epochNumber: EpochNumber): Promise<EpochProvingJobData> {
308
+ const checkpoints = await this.gatherCheckpoints(epochNumber);
309
+ const txArray = await this.gatherTxs(epochNumber, checkpoints);
307
310
  const txs = new Map<string, Tx>(txArray.map(tx => [tx.getTxHash().toString(), tx]));
308
- const l1ToL2Messages = await this.gatherMessages(epochNumber, blocks);
309
- const previousBlockHeader = await this.gatherPreviousBlockHeader(epochNumber, blocks[0]);
310
- const [lastBlock] = await this.l2BlockSource.getPublishedBlocks(blocks.at(-1)!.number, 1);
311
- const attestations = lastBlock?.attestations ?? [];
311
+ const l1ToL2Messages = await this.gatherMessages(epochNumber, checkpoints);
312
+ const [firstBlock] = checkpoints[0].blocks;
313
+ const previousBlockHeader = await this.gatherPreviousBlockHeader(epochNumber, firstBlock.number - 1);
314
+ const [lastPublishedCheckpoint] = await this.l2BlockSource.getPublishedCheckpoints(checkpoints.at(-1)!.number, 1);
315
+ const attestations = lastPublishedCheckpoint?.attestations ?? [];
312
316
 
313
- return { blocks, txs, l1ToL2Messages, epochNumber, previousBlockHeader, attestations };
317
+ return { checkpoints, txs, l1ToL2Messages, epochNumber, previousBlockHeader, attestations };
314
318
  }
315
319
 
316
- private async gatherBlocks(epochNumber: bigint) {
317
- const blocks = await this.l2BlockSource.getBlocksForEpoch(epochNumber);
318
- if (blocks.length === 0) {
320
+ private async gatherCheckpoints(epochNumber: EpochNumber) {
321
+ const checkpoints = await this.l2BlockSource.getCheckpointsForEpoch(epochNumber);
322
+ if (checkpoints.length === 0) {
319
323
  throw new EmptyEpochError(epochNumber);
320
324
  }
321
- return blocks;
325
+ return checkpoints;
322
326
  }
323
327
 
324
- private async gatherTxs(epochNumber: bigint, blocks: L2Block[]) {
328
+ private async gatherTxs(epochNumber: EpochNumber, checkpoints: Checkpoint[]) {
325
329
  const deadline = new Date(this.dateProvider.now() + this.config.txGatheringTimeoutMs);
326
330
  const txProvider = this.p2pClient.getTxProvider();
331
+ const blocks = checkpoints.flatMap(checkpoint => checkpoint.blocks);
327
332
  const txsByBlock = await Promise.all(blocks.map(block => txProvider.getTxsForBlock(block, { deadline })));
328
333
  const txs = txsByBlock.map(({ txs }) => txs).flat();
329
334
  const missingTxs = txsByBlock.map(({ missingTxs }) => missingTxs).flat();
@@ -336,25 +341,24 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
336
341
  throw new Error(`Txs not found for epoch ${epochNumber}: ${missingTxs.map(hash => hash.toString()).join(', ')}`);
337
342
  }
338
343
 
339
- private async gatherMessages(epochNumber: bigint, blocks: L2Block[]) {
340
- const messages = await Promise.all(blocks.map(b => this.l1ToL2MessageSource.getL1ToL2Messages(b.number)));
344
+ private async gatherMessages(epochNumber: EpochNumber, checkpoints: Checkpoint[]) {
345
+ const messages = await Promise.all(checkpoints.map(c => this.l1ToL2MessageSource.getL1ToL2Messages(c.number)));
341
346
  const messageCount = sum(messages.map(m => m.length));
342
347
  this.log.verbose(`Gathered all ${messageCount} messages for epoch ${epochNumber}`, { epochNumber });
343
- const messagesByBlock: Record<number, Fr[]> = {};
344
- for (let i = 0; i < blocks.length; i++) {
345
- messagesByBlock[blocks[i].number] = messages[i];
348
+ const messagesByCheckpoint: Record<CheckpointNumber, Fr[]> = {};
349
+ for (let i = 0; i < checkpoints.length; i++) {
350
+ messagesByCheckpoint[checkpoints[i].number] = messages[i];
346
351
  }
347
- return messagesByBlock;
352
+ return messagesByCheckpoint;
348
353
  }
349
354
 
350
- private async gatherPreviousBlockHeader(epochNumber: bigint, initialBlock: L2Block) {
351
- const previousBlockNumber = initialBlock.number - 1;
355
+ private async gatherPreviousBlockHeader(epochNumber: EpochNumber, previousBlockNumber: number) {
352
356
  const header = await (previousBlockNumber === 0
353
357
  ? this.worldState.getCommitted().getInitialHeader()
354
- : this.l2BlockSource.getBlockHeader(previousBlockNumber));
358
+ : this.l2BlockSource.getBlockHeader(BlockNumber(previousBlockNumber)));
355
359
 
356
360
  if (!header) {
357
- throw new Error(`Previous block header ${initialBlock.number} not found for proving epoch ${epochNumber}`);
361
+ throw new Error(`Previous block header ${previousBlockNumber} not found for proving epoch ${epochNumber}`);
358
362
  }
359
363
 
360
364
  this.log.verbose(`Gathered previous block header ${header.getBlockNumber()} for epoch ${epochNumber}`);
@@ -405,7 +409,7 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
405
409
  }
406
410
 
407
411
  class EmptyEpochError extends Error {
408
- constructor(epochNumber: bigint) {
412
+ constructor(epochNumber: EpochNumber) {
409
413
  super(`No blocks found for epoch ${epochNumber}`);
410
414
  this.name = 'EmptyEpochError';
411
415
  }
@@ -1,4 +1,6 @@
1
- import type { L1TxUtils, PublisherManager, RollupContract } from '@aztec/ethereum';
1
+ import type { RollupContract } from '@aztec/ethereum/contracts';
2
+ import type { L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
3
+ import type { PublisherManager } from '@aztec/ethereum/publisher-manager';
2
4
  import type { PublisherConfig, TxSenderConfig } from '@aztec/sequencer-client';
3
5
  import type { TelemetryClient } from '@aztec/telemetry-client';
4
6