|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Asynchronous batch verifier for Chonk IVC proofs. More...
#include <chonk_batch_verifier.hpp>
Classes | |
| struct | ReduceResult |
| Per-proof result from the reduce phase. More... | |
Public Types | |
| using | ResultCallback = std::function< void(VerifyResult)> |
Public Member Functions | |
| ChonkBatchVerifier ()=default | |
| ~ChonkBatchVerifier () | |
| ChonkBatchVerifier (const ChonkBatchVerifier &)=delete | |
| ChonkBatchVerifier & | operator= (const ChonkBatchVerifier &)=delete |
| void | start (std::vector< std::shared_ptr< MegaZKFlavor::VKAndHash > > vks, uint32_t num_cores, uint32_t batch_size, ResultCallback on_result) |
| Start the coordinator thread. | |
| void | enqueue (VerifyRequest request) |
| Enqueue a proof for verification. | |
| void | stop () |
| Stop the processor, flushing remaining proofs. | |
Private Member Functions | |
| void | coordinator_loop () |
| std::vector< ReduceResult > | parallel_reduce (const std::vector< VerifyRequest > &batch) |
| bool | batch_check (const std::vector< ReduceResult > &results, const std::vector< size_t > &indices) |
| void | bisect (std::vector< ReduceResult > &results, std::vector< size_t > indices, uint32_t depth, std::chrono::steady_clock::time_point reduce_start) |
| void | emit_ok (const std::vector< ReduceResult > &results, const std::vector< size_t > &indices, std::chrono::steady_clock::time_point reduce_start, double ipa_ms, uint32_t depth) |
Static Private Member Functions | |
| static double | ms_since (std::chrono::steady_clock::time_point t) |
| static double | ms_between (std::chrono::steady_clock::time_point from, std::chrono::steady_clock::time_point to) |
Private Attributes | |
| std::vector< std::shared_ptr< MegaZKFlavor::VKAndHash > > | vks_ |
| uint32_t | num_cores_ = 1 |
| uint32_t | batch_size_ = 8 |
| ResultCallback | on_result_ |
| std::mutex | mutex_ |
| std::condition_variable | cv_ |
| std::deque< VerifyRequest > | queue_ |
| bool | shutdown_ = false |
| std::thread | coordinator_thread_ |
Asynchronous batch verifier for Chonk IVC proofs.
Pipeline: Phase 1 (parallel reduce): Work-stealing threads each run full non-IPA verification (MegaZK sumcheck, databus, Goblin merge/eccvm/translator). Phase 2 (batch check): Batch IPA verification via IPA::batch_reduce_verify on all passed proofs. Phase 3 (emit/bisect): On success, emit OK for all. On failure, binary-search to isolate bad proofs.
Definition at line 27 of file chonk_batch_verifier.hpp.
| using bb::ChonkBatchVerifier::ResultCallback = std::function<void(VerifyResult)> |
Definition at line 29 of file chonk_batch_verifier.hpp.
|
default |
| bb::ChonkBatchVerifier::~ChonkBatchVerifier | ( | ) |
Definition at line 50 of file chonk_batch_verifier.cpp.
|
delete |
|
private |
Definition at line 211 of file chonk_batch_verifier.cpp.
|
private |
Definition at line 238 of file chonk_batch_verifier.cpp.
|
private |
Definition at line 57 of file chonk_batch_verifier.cpp.
|
private |
Definition at line 285 of file chonk_batch_verifier.cpp.
| void bb::ChonkBatchVerifier::enqueue | ( | VerifyRequest | request | ) |
Enqueue a proof for verification.
Definition at line 27 of file chonk_batch_verifier.cpp.
|
inlinestaticprivate |
Definition at line 90 of file chonk_batch_verifier.hpp.
|
inlinestaticprivate |
Definition at line 86 of file chonk_batch_verifier.hpp.
|
delete |
|
private |
Definition at line 148 of file chonk_batch_verifier.cpp.
| void bb::ChonkBatchVerifier::start | ( | std::vector< std::shared_ptr< MegaZKFlavor::VKAndHash > > | vks, |
| uint32_t | num_cores, | ||
| uint32_t | batch_size, | ||
| ResultCallback | on_result | ||
| ) |
Start the coordinator thread.
| vks | Verification keys indexed by VerifyRequest::vk_index |
| num_cores | Number of cores for parallel reduce |
| batch_size | Number of proofs to accumulate before batch-checking |
| on_result | Callback invoked for each completed verification |
Definition at line 12 of file chonk_batch_verifier.cpp.
| void bb::ChonkBatchVerifier::stop | ( | ) |
Stop the processor, flushing remaining proofs.
Definition at line 37 of file chonk_batch_verifier.cpp.
|
private |
Definition at line 97 of file chonk_batch_verifier.hpp.
|
private |
Definition at line 104 of file chonk_batch_verifier.hpp.
|
private |
Definition at line 101 of file chonk_batch_verifier.hpp.
|
private |
Definition at line 100 of file chonk_batch_verifier.hpp.
|
private |
Definition at line 96 of file chonk_batch_verifier.hpp.
|
private |
Definition at line 98 of file chonk_batch_verifier.hpp.
|
private |
Definition at line 102 of file chonk_batch_verifier.hpp.
|
private |
Definition at line 103 of file chonk_batch_verifier.hpp.
|
private |
Definition at line 95 of file chonk_batch_verifier.hpp.