Skip to content

Commit f540fbe

Browse files
authored
fix: Race condition when cleaning epoch proof quotes (#10795)
The test `In-Memory P2P Client › deletes expired proof quotes` was sometimes failing with `epochProofQuotePool.deleteQuotesToEpoch` not being called. This could happen on a race condition where the p2p client reports to have synched to a given block number, but the quotes are deleted *after* the synched block number is set. This PR ensures setting the last block number is the last operation done.
1 parent 5f11cf4 commit f540fbe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

yarn-project/p2p/src/client/p2p_client.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -659,13 +659,14 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
659659
await this.attestationPool?.deleteAttestationsOlderThan(lastBlockSlotMinusKeepAttestationsInPoolFor);
660660
}
661661

662-
await this.synchedProvenBlockNumber.set(lastBlockNum);
663-
this.log.debug(`Synched to proven block ${lastBlockNum}`);
664662
const provenEpochNumber = await this.l2BlockSource.getProvenL2EpochNumber();
665663
if (provenEpochNumber !== undefined) {
666664
this.epochProofQuotePool.deleteQuotesToEpoch(BigInt(provenEpochNumber));
667665
}
668666

667+
await this.synchedProvenBlockNumber.set(lastBlockNum);
668+
this.log.debug(`Synched to proven block ${lastBlockNum}`);
669+
669670
await this.startServiceIfSynched();
670671
}
671672

0 commit comments

Comments
 (0)