fix: batch verifier review fixes#21644
Merged
ludamad merged 2 commits intoMar 17, 2026
Merged
Conversation
added 2 commits
March 17, 2026 01:32
…ness
- Replace execSync(`mkfifo ...`) with execFileSync('mkfifo', [...]) in production
and test code to eliminate shell injection surface (S1)
- Add BB_ASSERT(len <= UINT32_MAX) bounds check in write_frame to prevent silent
truncation on >4GiB payloads (S2)
- Optimize bisection to skip redundant batch_check on the passing half — when left
half passes, all failures must be in right half, saving ~50% bisection cost for
the common single-bad-proof case (P1)
- Change queue_ from std::vector to std::deque for O(1) front erasure instead of
O(n) element shifting (P2)
- Consolidate write_frame into a single write() syscall by combining header and
payload into one buffer (P4)
- Harmonize batch_size defaults: C++ default 4 → 8 to match TypeScript default (P5)
…rrency into batch_check - Replace execFileSync/execSync with async execFileAsync (promisify(execFile)) - Replace unlinkSync/mkdirSync/writeFileSync with fs/promises (unlink, mkdir, writeFile) - Keep unlinkSync only in signal handlers where async is not allowed - Move set_parallel_for_concurrency(num_cores_) into batch_check so callers don't need to remember it — simplifies bisection and coordinator_loop code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Review fixes for #21460 (batch chonk verifier service), addressing findings from a 4-agent code review:
execSync(mkfifo ...)withexecFileSync('mkfifo', [...])in production code (batch_chonk_verifier.ts) and test code (batch_verifier.test.ts). The bench and queue test files already used the safe form.BB_ASSERT(len <= UINT32_MAX)inwrite_framebefore theuint32_tcast to catch >4GiB payloads instead of silently truncating.batch_checkcall. This halves bisection cost for the common single-bad-proof case (3 batch_checks instead of 6 for a batch of 8).queue_fromstd::vectortostd::dequeso front-erasure incoordinator_loopis O(1) instead of O(n).write_framefor onewrite()syscall instead of two.BatchVerifierConfig::batch_sizedefault from 4 to 8 to match the TypeScript default.Test plan
batch_verifier_queue.test.ts,batch_verifier.test.ts) cover all bisection patterns including random patterns with multiple bad proofs — these validate the P1 bisection optimization.execFileSyncchange is a drop-in replacement with identical behavior for valid paths.std::dequechange is API-compatible withstd::vectorfor all operations used.