Skip to content

Commit

Permalink
Check db block number in orchestrator
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed Aug 6, 2024
1 parent 3d0b8a3 commit c68cf3b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions yarn-project/prover-client/src/orchestrator/orchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,18 @@ export class ProvingOrchestrator implements BlockProver {
if (!Number.isInteger(numTxs) || numTxs < 2) {
throw new Error(`Length of txs for the block should be at least two (got ${numTxs})`);
}

const { blockNumber } = globalVariables;
const dbBlockNumber = (await this.db.getTreeInfo(MerkleTreeId.ARCHIVE)).size - 1n;
if (dbBlockNumber !== blockNumber.toBigInt() - 1n) {
throw new Error(
`Database is at wrong block number (starting block ${blockNumber.toBigInt()} with db at ${dbBlockNumber})`,
);
}

// Cancel any currently proving block before starting a new one
this.cancelBlock();

logger.info(`Starting new block with ${numTxs} transactions`);
// we start the block by enqueueing all of the base parity circuits
let baseParityInputs: BaseParityInputs[] = [];
Expand Down

0 comments on commit c68cf3b

Please sign in to comment.