diff --git a/yarn-project/aztec/src/cli/cli.ts b/yarn-project/aztec/src/cli/cli.ts index d05cc439a67f..fc8a0d226af0 100644 --- a/yarn-project/aztec/src/cli/cli.ts +++ b/yarn-project/aztec/src/cli/cli.ts @@ -76,6 +76,9 @@ export function injectAztecCommands(program: Command, userLog: LogFn, debugLogge if (options.node) { const { startNode } = await import('./cmds/start_node.js'); services = await startNode(options, signalHandlers, userLog); + } else if (options.proofVerifier) { + const { startProofVerifier } = await import('./cmds/start_proof_verifier.js'); + services = await startProofVerifier(options, signalHandlers, userLog); } else if (options.bot) { const { startBot } = await import('./cmds/start_bot.js'); services = await startBot(options, signalHandlers, userLog); @@ -101,7 +104,7 @@ export function injectAztecCommands(program: Command, userLog: LogFn, debugLogge userLog(`Cannot run a standalone sequencer without a node`); process.exit(1); } else { - userLog(`No module specified to start ${JSON.stringify(options, null, 2)}`); + userLog(`No module specified to start`); process.exit(1); } } diff --git a/yarn-project/aztec/terraform/proof-verifier/variables.tf b/yarn-project/aztec/terraform/proof-verifier/variables.tf index 2063f6ee9a2e..335208e52a9a 100644 --- a/yarn-project/aztec/terraform/proof-verifier/variables.tf +++ b/yarn-project/aztec/terraform/proof-verifier/variables.tf @@ -29,5 +29,5 @@ variable "ROLLUP_CONTRACT_ADDRESS" { variable "PROOF_VERIFIER_POLL_INTERVAL_MS" { type = "number" - default = 10000 + default = 60000 } diff --git a/yarn-project/proof-verifier/src/config.ts b/yarn-project/proof-verifier/src/config.ts index 0b6e12986012..fcedde43e4c2 100644 --- a/yarn-project/proof-verifier/src/config.ts +++ b/yarn-project/proof-verifier/src/config.ts @@ -13,7 +13,7 @@ export type ProofVerifierConfig = { /** The L1 chain ID */ l1ChainId: number; /** Start block number */ - l1StartBlock: bigint; + l1StartBlock: number; /** The address of the Rollup contract */ rollupAddress: EthAddress; /** How often to poll L1 for proof submission */ @@ -40,9 +40,8 @@ export const proofVerifierConfigMappings: ConfigMappingsType BigInt(val), description: 'Start block number', - defaultValue: 1n, + ...numberConfigHelper(1), }, rollupAddress: { env: 'ROLLUP_CONTRACT_ADDRESS', @@ -52,7 +51,7 @@ export const proofVerifierConfigMappings: ConfigMappingsType { @@ -42,6 +44,7 @@ export class ProofVerifier { } start() { + this.logger.info(`Starting proof verifier monitoring rollup=${this.config.rollupAddress}`); this.runningPromise.start(); } @@ -58,24 +61,49 @@ export class ProofVerifier { startBlock, ); + if (retrievedData.length === 0) { + this.logger.debug(`No proofs found since L1 block ${startBlock}`); + return; + } else { + this.logger.debug(`Fetched ${retrievedData.length} proofs since L1 block ${startBlock}`); + } + for (const { l2BlockNumber, txHash, proof, proverId } of retrievedData) { + this.logger.debug( + `Proof size ${proof.buffer.length} for L2 block proverId=${proverId} l2Block=${l2BlockNumber} l1Tx=${txHash}`, + ); + + const invalidProofFormat = proof.buffer.length < EXPECTED_PROOF_SIZE; + if (invalidProofFormat) { + this.logger.warn( + `Invalid proof format detected: proof length=${proof.buffer.length}bytes proverId=${proverId} l2Block=${l2BlockNumber} l1Tx=${txHash}`, + ); + } + try { await this.verifier.verifyProofForCircuit('RootRollupArtifact', proof); this.logger.info(`Verified proof for L2 block proverId=${proverId} l2Block=${l2BlockNumber} l1Tx=${txHash}`); this.proofVerified.add(1, { [Attributes.ROLLUP_PROVER_ID]: proverId.toString(), - [Attributes.OK]: true, + [Attributes.STATUS]: 'valid', }); } catch (err) { this.logger.warn( `Failed to verify proof for L2 block proverId=${proverId} l2Block=${l2BlockNumber} l1Tx=${txHash}`, ); - this.proofVerified.add(1, { - [Attributes.ROLLUP_PROVER_ID]: proverId.toString(), - [Attributes.OK]: false, - }); + if (invalidProofFormat) { + this.proofVerified.add(1, { + [Attributes.ROLLUP_PROVER_ID]: proverId.toString(), + [Attributes.STATUS]: 'invalid_proof_format', + }); + } else { + this.proofVerified.add(1, { + [Attributes.ROLLUP_PROVER_ID]: proverId.toString(), + [Attributes.STATUS]: 'invalid', + }); + } } }