From 39d3bc286ab7ac33a83f27e09df7dd1a482fadf4 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Tue, 10 Dec 2024 12:59:00 -0300 Subject: [PATCH] fix: Do not attempt proof quote on empty epoch (#10557) Fixes the [following error](https://github.com/AztecProtocol/aztec-packages/actions/runs/12201704715/job/34044555922#step:5:2809): ``` ./yarn-project+network-test | [./prover-node.sh 8078 false] [17:14:59.111] ERROR: prover-node Error handling epoch completed: TypeError: Cannot read properties of undefined (reading 'number') ./yarn-project+network-test | [./prover-node.sh 8078 false] at ProverNode.handleEpochCompleted (file:///usr/src/yarn-project/prover-node/dest/prover-node.js:106:91) ./yarn-project+network-test | [./prover-node.sh 8078 false] at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ./yarn-project+network-test | [./prover-node.sh 8078 false] at async ProverNode.handleInitialEpochSync (file:///usr/src/yarn-project/prover-node/dest/prover-node.js:69:17) ./yarn-project+network-test | [./prover-node.sh 8078 false] at async EpochMonitor.work (file:///usr/src/yarn-project/prover-node/dest/monitors/epoch-monitor.js:23:17) ./yarn-project+network-test | [./prover-node.sh 8078 false] at async poll (file:///usr/src/yarn-project/foundation/dest/promise/running-promise.js:25:17) ``` --- yarn-project/prover-node/src/prover-node.test.ts | 6 ++++++ yarn-project/prover-node/src/prover-node.ts | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/yarn-project/prover-node/src/prover-node.test.ts b/yarn-project/prover-node/src/prover-node.test.ts index a9f4be5f2e0..98714c2e1d0 100644 --- a/yarn-project/prover-node/src/prover-node.test.ts +++ b/yarn-project/prover-node/src/prover-node.test.ts @@ -175,6 +175,12 @@ describe('prover-node', () => { expect(coordination.addEpochProofQuote).toHaveBeenCalledWith(toExpectedQuote(10n)); }); + it('does not send a quote if there are no blocks in the epoch', async () => { + l2BlockSource.getBlocksForEpoch.mockResolvedValue([]); + await proverNode.handleEpochCompleted(10n); + expect(coordination.addEpochProofQuote).not.toHaveBeenCalled(); + }); + it('does not send a quote on a finished epoch if the provider does not return one', async () => { quoteProvider.getQuote.mockResolvedValue(undefined); await proverNode.handleEpochCompleted(10n); diff --git a/yarn-project/prover-node/src/prover-node.ts b/yarn-project/prover-node/src/prover-node.ts index 51cad0f1227..eedf2d77c55 100644 --- a/yarn-project/prover-node/src/prover-node.ts +++ b/yarn-project/prover-node/src/prover-node.ts @@ -128,9 +128,14 @@ export class ProverNode implements ClaimsMonitorHandler, EpochMonitorHandler, Pr try { // Construct a quote for the epoch const blocks = await this.l2BlockSource.getBlocksForEpoch(epochNumber); + if (blocks.length === 0) { + this.log.info(`No blocks found for epoch ${epochNumber}`); + return; + } + const partialQuote = await this.quoteProvider.getQuote(Number(epochNumber), blocks); if (!partialQuote) { - this.log.verbose(`No quote produced for epoch ${epochNumber}`); + this.log.info(`No quote produced for epoch ${epochNumber}`); return; }