Skip to content

Commit 0990598

Browse files
authored
fix: catch exceptions in ChonkBatchVerifier::batch_check (#22270)
## Summary PR #22263 replaced `BB_ASSERT(val.on_curve())` with `throw_or_abort()` in `field_conversion.hpp` for the external audit response. This bypasses `BB_DISABLE_ASSERTS()` and causes `ChonkBatchVerifierTests.RandomMixedBatches` to crash when deserializing corrupted IPA proof points during `batch_check()`. Added try-catch in `batch_check()` so exceptions from corrupted proof data return `false` (triggering bisection) instead of terminating the process. This is consistent with the existing try-catch in `parallel_reduce()`. All 29 chonk tests pass. Full analysis: https://gist.github.com/AztecBot/71089def650112d95757a7d3af6c0d67 ClaudeBox log: https://claudebox.work/s/fd385651d6fa6262?run=1
1 parent 7511415 commit 0990598

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

barretenberg/cpp/src/barretenberg/chonk/chonk_batch_verifier.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,23 @@ bool ChonkBatchVerifier::batch_check(const std::vector<ReduceResult>& results, c
216216

217217
set_parallel_for_concurrency(num_cores_);
218218

219-
// Collect IPA claims and transcripts for batch verification
220-
std::vector<OpeningClaim<curve::Grumpkin>> claims;
221-
std::vector<std::shared_ptr<NativeTranscript>> transcripts;
222-
claims.reserve(indices.size());
223-
transcripts.reserve(indices.size());
224-
for (size_t idx : indices) {
225-
claims.push_back(results[idx].ipa_claim);
226-
transcripts.push_back(std::make_shared<NativeTranscript>(results[idx].ipa_proof));
227-
}
219+
try {
220+
// Collect IPA claims and transcripts for batch verification
221+
std::vector<OpeningClaim<curve::Grumpkin>> claims;
222+
std::vector<std::shared_ptr<NativeTranscript>> transcripts;
223+
claims.reserve(indices.size());
224+
transcripts.reserve(indices.size());
225+
for (size_t idx : indices) {
226+
claims.push_back(results[idx].ipa_claim);
227+
transcripts.push_back(std::make_shared<NativeTranscript>(results[idx].ipa_proof));
228+
}
228229

229-
auto ipa_vk = VerifierCommitmentKey<curve::Grumpkin>{ ECCVMFlavor::ECCVM_FIXED_SIZE };
230-
return IPA<curve::Grumpkin>::batch_reduce_verify(ipa_vk, claims, transcripts);
230+
auto ipa_vk = VerifierCommitmentKey<curve::Grumpkin>{ ECCVMFlavor::ECCVM_FIXED_SIZE };
231+
return IPA<curve::Grumpkin>::batch_reduce_verify(ipa_vk, claims, transcripts);
232+
} catch (const std::exception& e) {
233+
info("ChonkBatchVerifier: batch_check exception: ", e.what());
234+
return false;
235+
}
231236
}
232237

233238
void ChonkBatchVerifier::bisect(std::vector<ReduceResult>& results,

0 commit comments

Comments
 (0)