@aztec/prover-node 0.0.1-commit.b655e406 → 0.0.1-commit.d3ec352c
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/actions/download-epoch-proving-job.d.ts +4 -4
- package/dest/actions/index.d.ts +1 -1
- package/dest/actions/rerun-epoch-proving-job.d.ts +2 -2
- package/dest/actions/upload-epoch-proof-failure.d.ts +1 -1
- package/dest/bin/run-failed-epoch.d.ts +1 -1
- package/dest/config.d.ts +1 -1
- package/dest/factory.d.ts +1 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +1 -1
- package/dest/index.d.ts +1 -1
- package/dest/job/epoch-proving-job-data.d.ts +7 -5
- package/dest/job/epoch-proving-job-data.d.ts.map +1 -1
- package/dest/job/epoch-proving-job-data.js +24 -17
- package/dest/job/epoch-proving-job.d.ts +5 -12
- package/dest/job/epoch-proving-job.d.ts.map +1 -1
- package/dest/job/epoch-proving-job.js +91 -82
- package/dest/metrics.d.ts +3 -2
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +8 -2
- package/dest/monitors/epoch-monitor.d.ts +3 -2
- package/dest/monitors/epoch-monitor.d.ts.map +1 -1
- package/dest/monitors/epoch-monitor.js +2 -1
- package/dest/monitors/index.d.ts +1 -1
- package/dest/prover-node-publisher.d.ts +6 -5
- package/dest/prover-node-publisher.d.ts.map +1 -1
- package/dest/prover-node-publisher.js +28 -26
- package/dest/prover-node.d.ts +7 -6
- package/dest/prover-node.d.ts.map +1 -1
- package/dest/prover-node.js +34 -31
- package/dest/prover-publisher-factory.d.ts +1 -1
- package/dest/prover-publisher-factory.d.ts.map +1 -1
- package/dest/test/index.d.ts +1 -1
- package/dest/test/index.d.ts.map +1 -1
- package/package.json +26 -25
- package/src/factory.ts +3 -1
- package/src/job/epoch-proving-job-data.ts +30 -24
- package/src/job/epoch-proving-job.ts +105 -99
- package/src/metrics.ts +14 -2
- package/src/monitors/epoch-monitor.ts +4 -3
- package/src/prover-node-publisher.ts +42 -37
- package/src/prover-node.ts +46 -40
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BatchedBlob, getEthBlobEvaluationInputs } from '@aztec/blob-lib';
|
|
2
2
|
import { AZTEC_MAX_EPOCH_DURATION } from '@aztec/constants';
|
|
3
3
|
import type { L1TxUtils, RollupContract, ViemCommitteeAttestation } from '@aztec/ethereum';
|
|
4
4
|
import { makeTuple } from '@aztec/foundation/array';
|
|
5
|
+
import { CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
5
6
|
import { areArraysEqual } from '@aztec/foundation/collection';
|
|
6
7
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
8
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -85,16 +86,16 @@ export class ProverNodePublisher {
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
public async submitEpochProof(args: {
|
|
88
|
-
epochNumber:
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
epochNumber: EpochNumber;
|
|
90
|
+
fromCheckpoint: CheckpointNumber;
|
|
91
|
+
toCheckpoint: CheckpointNumber;
|
|
91
92
|
publicInputs: RootRollupPublicInputs;
|
|
92
93
|
proof: Proof;
|
|
93
94
|
batchedBlobInputs: BatchedBlob;
|
|
94
95
|
attestations: ViemCommitteeAttestation[];
|
|
95
96
|
}): Promise<boolean> {
|
|
96
|
-
const { epochNumber,
|
|
97
|
-
const ctx = { epochNumber,
|
|
97
|
+
const { epochNumber, fromCheckpoint, toCheckpoint } = args;
|
|
98
|
+
const ctx = { epochNumber, fromCheckpoint, toCheckpoint };
|
|
98
99
|
|
|
99
100
|
if (!this.interrupted) {
|
|
100
101
|
const timer = new Timer();
|
|
@@ -138,44 +139,48 @@ export class ProverNodePublisher {
|
|
|
138
139
|
this.log.error(`Rollup.submitEpochProof tx status failed ${txReceipt.transactionHash}`, undefined, ctx);
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
this.log.verbose('
|
|
142
|
+
this.log.verbose('Checkpoint data syncing interrupted', ctx);
|
|
142
143
|
return false;
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
private async validateEpochProofSubmission(args: {
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
fromCheckpoint: CheckpointNumber;
|
|
148
|
+
toCheckpoint: CheckpointNumber;
|
|
148
149
|
publicInputs: RootRollupPublicInputs;
|
|
149
150
|
proof: Proof;
|
|
150
151
|
batchedBlobInputs: BatchedBlob;
|
|
151
152
|
attestations: ViemCommitteeAttestation[];
|
|
152
153
|
}) {
|
|
153
|
-
const {
|
|
154
|
+
const { fromCheckpoint, toCheckpoint, publicInputs, batchedBlobInputs } = args;
|
|
154
155
|
|
|
155
|
-
// Check that the
|
|
156
|
-
const {
|
|
157
|
-
// Don't publish if proven is beyond our
|
|
158
|
-
if (proven >
|
|
159
|
-
throw new Error(
|
|
156
|
+
// Check that the checkpoint numbers match the expected epoch to be proven
|
|
157
|
+
const { pending, proven } = await this.rollupContract.getTips();
|
|
158
|
+
// Don't publish if proven is beyond our toCheckpoint, pointless to do so
|
|
159
|
+
if (proven > toCheckpoint) {
|
|
160
|
+
throw new Error(
|
|
161
|
+
`Cannot submit epoch proof for ${fromCheckpoint}-${toCheckpoint} as proven checkpoint is ${proven}`,
|
|
162
|
+
);
|
|
160
163
|
}
|
|
161
|
-
//
|
|
162
|
-
if (
|
|
163
|
-
throw new Error(
|
|
164
|
+
// toCheckpoint can't be greater than pending
|
|
165
|
+
if (toCheckpoint > pending) {
|
|
166
|
+
throw new Error(
|
|
167
|
+
`Cannot submit epoch proof for ${fromCheckpoint}-${toCheckpoint} as pending checkpoint is ${pending}`,
|
|
168
|
+
);
|
|
164
169
|
}
|
|
165
170
|
|
|
166
|
-
// Check the archive for the immediate
|
|
167
|
-
const
|
|
168
|
-
if (publicInputs.previousArchiveRoot.toString() !==
|
|
171
|
+
// Check the archive for the immediate checkpoint before the epoch
|
|
172
|
+
const checkpointLog = await this.rollupContract.getCheckpoint(CheckpointNumber(fromCheckpoint - 1));
|
|
173
|
+
if (publicInputs.previousArchiveRoot.toString() !== checkpointLog.archive) {
|
|
169
174
|
throw new Error(
|
|
170
|
-
`Previous archive root mismatch: ${publicInputs.previousArchiveRoot.toString()} !== ${
|
|
175
|
+
`Previous archive root mismatch: ${publicInputs.previousArchiveRoot.toString()} !== ${checkpointLog.archive}`,
|
|
171
176
|
);
|
|
172
177
|
}
|
|
173
178
|
|
|
174
|
-
// Check the archive for the last
|
|
175
|
-
const
|
|
176
|
-
if (publicInputs.endArchiveRoot.toString() !==
|
|
179
|
+
// Check the archive for the last checkpoint in the epoch
|
|
180
|
+
const endCheckpointLog = await this.rollupContract.getCheckpoint(toCheckpoint);
|
|
181
|
+
if (publicInputs.endArchiveRoot.toString() !== endCheckpointLog.archive) {
|
|
177
182
|
throw new Error(
|
|
178
|
-
`End archive root mismatch: ${publicInputs.endArchiveRoot.toString()} !== ${
|
|
183
|
+
`End archive root mismatch: ${publicInputs.endArchiveRoot.toString()} !== ${endCheckpointLog.archive}`,
|
|
179
184
|
);
|
|
180
185
|
}
|
|
181
186
|
|
|
@@ -202,8 +207,8 @@ export class ProverNodePublisher {
|
|
|
202
207
|
}
|
|
203
208
|
|
|
204
209
|
private async sendSubmitEpochProofTx(args: {
|
|
205
|
-
|
|
206
|
-
|
|
210
|
+
fromCheckpoint: CheckpointNumber;
|
|
211
|
+
toCheckpoint: CheckpointNumber;
|
|
207
212
|
publicInputs: RootRollupPublicInputs;
|
|
208
213
|
proof: Proof;
|
|
209
214
|
batchedBlobInputs: BatchedBlob;
|
|
@@ -213,8 +218,8 @@ export class ProverNodePublisher {
|
|
|
213
218
|
|
|
214
219
|
this.log.info(`Submitting epoch proof to L1 rollup contract`, {
|
|
215
220
|
proofSize: args.proof.withoutPublicInputs().length,
|
|
216
|
-
|
|
217
|
-
|
|
221
|
+
fromCheckpoint: args.fromCheckpoint,
|
|
222
|
+
toCheckpoint: args.toCheckpoint,
|
|
218
223
|
});
|
|
219
224
|
const data = encodeFunctionData({
|
|
220
225
|
abi: RollupAbi,
|
|
@@ -243,16 +248,16 @@ export class ProverNodePublisher {
|
|
|
243
248
|
}
|
|
244
249
|
|
|
245
250
|
private getEpochProofPublicInputsArgs(args: {
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
fromCheckpoint: CheckpointNumber;
|
|
252
|
+
toCheckpoint: CheckpointNumber;
|
|
248
253
|
publicInputs: RootRollupPublicInputs;
|
|
249
254
|
batchedBlobInputs: BatchedBlob;
|
|
250
255
|
attestations: ViemCommitteeAttestation[];
|
|
251
256
|
}) {
|
|
252
257
|
// Returns arguments for EpochProofLib.sol -> getEpochProofPublicInputs()
|
|
253
258
|
return [
|
|
254
|
-
BigInt(args.
|
|
255
|
-
BigInt(args.
|
|
259
|
+
BigInt(args.fromCheckpoint) /*_start*/,
|
|
260
|
+
BigInt(args.toCheckpoint) /*_end*/,
|
|
256
261
|
{
|
|
257
262
|
previousArchive: args.publicInputs.previousArchiveRoot.toString(),
|
|
258
263
|
endArchive: args.publicInputs.endArchiveRoot.toString(),
|
|
@@ -263,13 +268,13 @@ export class ProverNodePublisher {
|
|
|
263
268
|
? args.publicInputs.fees[i / 2].recipient.toField().toString()
|
|
264
269
|
: args.publicInputs.fees[(i - 1) / 2].value.toString(),
|
|
265
270
|
) /*_fees*/,
|
|
266
|
-
args.batchedBlobInputs
|
|
271
|
+
getEthBlobEvaluationInputs(args.batchedBlobInputs) /*_blobPublicInputs*/,
|
|
267
272
|
] as const;
|
|
268
273
|
}
|
|
269
274
|
|
|
270
275
|
private getSubmitEpochProofArgs(args: {
|
|
271
|
-
|
|
272
|
-
|
|
276
|
+
fromCheckpoint: CheckpointNumber;
|
|
277
|
+
toCheckpoint: CheckpointNumber;
|
|
273
278
|
publicInputs: RootRollupPublicInputs;
|
|
274
279
|
proof: Proof;
|
|
275
280
|
batchedBlobInputs: BatchedBlob;
|
package/src/prover-node.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Archiver } from '@aztec/archiver';
|
|
2
2
|
import type { RollupContract } from '@aztec/ethereum';
|
|
3
|
+
import { BlockNumber, CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
3
4
|
import { assertRequired, compact, pick, sum } from '@aztec/foundation/collection';
|
|
4
5
|
import { memoize } from '@aztec/foundation/decorators';
|
|
5
6
|
import type { Fr } from '@aztec/foundation/fields';
|
|
@@ -8,7 +9,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 {
|
|
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:
|
|
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:
|
|
188
|
-
const job = await this.createProvingJob(
|
|
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:
|
|
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:
|
|
248
|
+
epochNumber: job.getEpochNumber(),
|
|
247
249
|
})),
|
|
248
250
|
);
|
|
249
251
|
}
|
|
250
252
|
|
|
251
253
|
protected async getActiveJobsForEpoch(
|
|
252
|
-
|
|
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]:
|
|
267
|
-
private async createProvingJob(epochNumber:
|
|
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
|
|
276
|
-
const
|
|
277
|
-
|
|
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]:
|
|
304
|
-
private async gatherEpochData(epochNumber:
|
|
305
|
-
const
|
|
306
|
-
const txArray = await this.gatherTxs(epochNumber,
|
|
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,
|
|
309
|
-
const
|
|
310
|
-
const
|
|
311
|
-
const
|
|
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 {
|
|
317
|
+
return { checkpoints, txs, l1ToL2Messages, epochNumber, previousBlockHeader, attestations };
|
|
314
318
|
}
|
|
315
319
|
|
|
316
|
-
private async
|
|
317
|
-
const
|
|
318
|
-
if (
|
|
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
|
|
325
|
+
return checkpoints;
|
|
322
326
|
}
|
|
323
327
|
|
|
324
|
-
private async gatherTxs(epochNumber:
|
|
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,26 @@ 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:
|
|
340
|
-
const messages = await Promise.all(
|
|
344
|
+
private async gatherMessages(epochNumber: EpochNumber, checkpoints: Checkpoint[]) {
|
|
345
|
+
const messages = await Promise.all(
|
|
346
|
+
checkpoints.map(c => this.l1ToL2MessageSource.getL1ToL2MessagesForCheckpoint(c.number)),
|
|
347
|
+
);
|
|
341
348
|
const messageCount = sum(messages.map(m => m.length));
|
|
342
349
|
this.log.verbose(`Gathered all ${messageCount} messages for epoch ${epochNumber}`, { epochNumber });
|
|
343
|
-
const
|
|
344
|
-
for (let i = 0; i <
|
|
345
|
-
|
|
350
|
+
const messagesByCheckpoint: Record<CheckpointNumber, Fr[]> = {};
|
|
351
|
+
for (let i = 0; i < checkpoints.length; i++) {
|
|
352
|
+
messagesByCheckpoint[checkpoints[i].number] = messages[i];
|
|
346
353
|
}
|
|
347
|
-
return
|
|
354
|
+
return messagesByCheckpoint;
|
|
348
355
|
}
|
|
349
356
|
|
|
350
|
-
private async gatherPreviousBlockHeader(epochNumber:
|
|
351
|
-
const previousBlockNumber = initialBlock.number - 1;
|
|
357
|
+
private async gatherPreviousBlockHeader(epochNumber: EpochNumber, previousBlockNumber: number) {
|
|
352
358
|
const header = await (previousBlockNumber === 0
|
|
353
359
|
? this.worldState.getCommitted().getInitialHeader()
|
|
354
|
-
: this.l2BlockSource.getBlockHeader(previousBlockNumber));
|
|
360
|
+
: this.l2BlockSource.getBlockHeader(BlockNumber(previousBlockNumber)));
|
|
355
361
|
|
|
356
362
|
if (!header) {
|
|
357
|
-
throw new Error(`Previous block header ${
|
|
363
|
+
throw new Error(`Previous block header ${previousBlockNumber} not found for proving epoch ${epochNumber}`);
|
|
358
364
|
}
|
|
359
365
|
|
|
360
366
|
this.log.verbose(`Gathered previous block header ${header.getBlockNumber()} for epoch ${epochNumber}`);
|
|
@@ -405,7 +411,7 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
405
411
|
}
|
|
406
412
|
|
|
407
413
|
class EmptyEpochError extends Error {
|
|
408
|
-
constructor(epochNumber:
|
|
414
|
+
constructor(epochNumber: EpochNumber) {
|
|
409
415
|
super(`No blocks found for epoch ${epochNumber}`);
|
|
410
416
|
this.name = 'EmptyEpochError';
|
|
411
417
|
}
|