Skip to content

fix: stop verifying a batch once a proof is rejected - #2297

Open
0xrlawrence wants to merge 1 commit into
yetanotherco:stagingfrom
0xrlawrence:fix/operator-batch-verification-robustness
Open

fix: stop verifying a batch once a proof is rejected#2297
0xrlawrence wants to merge 1 commit into
yetanotherco:stagingfrom
0xrlawrence:fix/operator-batch-verification-robustness

Conversation

@0xrlawrence

Copy link
Copy Markdown

Description

ProcessNewBatchLogV3 returns as soon as any proof fails, but the worker goroutines keep verifying the rest of the batch — which is the expensive part, and on a large batch can occupy every worker for a long time after the outcome is already decided. This closes an abandon channel on the failure path so workers stop picking up further proofs.

Two related cleanups in the same function:

  • results is sized from the batch length, so a zero-length batch leaves it unbuffered. Empty batches are rejected up front instead. This is currently unreachable — the merkle check rejects an empty batch before this point — but the sizing is fragile enough to be worth making explicit.
  • The DisabledVerifiers error path did results <- false and then returned. Nothing can ever read that value, since the only reader is the loop below which is never reached. It was both dead and, with an unbuffered results, the one statement that could have blocked forever. Removed.

Worth noting for review: jobs is buffered to the full batch length, so a worker returning early cannot block the producer.

Type of change

  • Bug fix
  • Optimization

Checklist

  • “Hotfix” to testnet, everything else to staging

Verified with go vet ./operator/pkg/ and gofmt on staging.

ProcessNewBatchLogV3 returns as soon as a proof fails, but the worker
goroutines kept verifying the rest of the batch, which is the expensive
part. Close an abandon channel on the failure path so workers stop
picking up further proofs.

Two related cleanups in the same function:

- results is sized from the batch length, so a zero-length batch made it
  unbuffered. Reject empty batches up front instead.
- The DisabledVerifiers error path pushed a value into results and then
  returned, so nothing could ever read it. That send was both dead and,
  with an unbuffered results, the one place that could have blocked
  forever. Drop it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant