16#ifdef BB_HAS_BATCH_VERIFIER_SERVICE
45 void msgpack(
auto&& pack_fn) { pack_fn(); }
71 void msgpack(
auto&& pack_fn) { pack_fn(); }
98 void msgpack(
auto&& pack_fn) { pack_fn(); }
159 std::vector<uint8_t>
vk;
189 std::vector<uint8_t>
vk;
358#ifdef BB_HAS_BATCH_VERIFIER_SERVICE
367class ChonkBatchVerifierService {
369 ChonkBatchVerifierService() =
default;
370 ~ChonkBatchVerifierService();
372 ChonkBatchVerifierService(
const ChonkBatchVerifierService&) =
delete;
373 ChonkBatchVerifierService& operator=(
const ChonkBatchVerifierService&) =
delete;
378 const std::string& fifo_path);
380 void fail_request(uint64_t request_id, std::string error_message);
382 bool is_running()
const {
return running_.load(); }
386 bool ensure_fifo_open();
387 void close_fifo_locked();
388 bool fail_fifo_locked(
const std::string& message);
392 std::mutex fifo_mutex_;
393 std::string fifo_path_;
Shared type definitions for the Barretenberg RPC API.
Asynchronous batch verifier for Chonk IVC proofs.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
A request to verify a single Chonk proof.
Result of verifying a single proof within a batch.
Empty response indicating successful circuit accumulation.
void msgpack(auto &&pack_fn)
bool operator==(const Response &) const =default
static constexpr const char MSGPACK_SCHEMA_NAME[]
Accumulate the previously loaded circuit into the IVC proof.
static constexpr const char MSGPACK_SCHEMA_NAME[]
std::vector< uint8_t > witness
Serialized witness data for the last loaded circuit.
Response execute(BBApiRequest &request) &&
bool operator==(const ChonkAccumulate &) const =default
SERIALIZATION_FIELDS(witness)
bool operator==(const Response &) const =default
static constexpr const char MSGPACK_SCHEMA_NAME[]
void msgpack(auto &&pack_fn)
Enqueue a proof for batch verification.
Response execute(BBApiRequest &request) &&
std::vector< bb::fr > proof_fields
static constexpr const char MSGPACK_SCHEMA_NAME[]
bool operator==(const ChonkBatchVerifierQueue &) const =default
SERIALIZATION_FIELDS(request_id, vk_index, proof_fields)
void msgpack(auto &&pack_fn)
static constexpr const char MSGPACK_SCHEMA_NAME[]
bool operator==(const Response &) const =default
Start the batch verifier service.
SERIALIZATION_FIELDS(vks, num_cores, batch_size, fifo_path)
Response execute(BBApiRequest &request) &&
bool operator==(const ChonkBatchVerifierStart &) const =default
std::vector< std::vector< uint8_t > > vks
static constexpr const char MSGPACK_SCHEMA_NAME[]
bool operator==(const Response &) const =default
void msgpack(auto &&pack_fn)
static constexpr const char MSGPACK_SCHEMA_NAME[]
Stop the batch verifier service.
void msgpack(auto &&pack_fn)
bool operator==(const ChonkBatchVerifierStop &) const =default
static constexpr const char MSGPACK_SCHEMA_NAME[]
Response execute(BBApiRequest &request) &&
bool operator==(const Response &) const =default
SERIALIZATION_FIELDS(valid)
static constexpr const char MSGPACK_SCHEMA_NAME[]
Batch-verify multiple Chonk proofs with batched IPA SRS MSMs.
std::vector< std::vector< uint8_t > > vks
bool operator==(const ChonkBatchVerify &) const =default
SERIALIZATION_FIELDS(proofs, vks)
Response execute(const BBApiRequest &request={}) &&
static constexpr const char MSGPACK_SCHEMA_NAME[]
std::vector< ChonkProof > proofs
Contains the validation result.
std::vector< uint8_t > actual_vk
The actual VK it should be.
SERIALIZATION_FIELDS(valid, actual_vk)
bool valid
True if the precomputed VK matches the circuit.
bool operator==(const Response &) const =default
static constexpr const char MSGPACK_SCHEMA_NAME[]
Verify that a precomputed verification key matches the circuit.
bool operator==(const ChonkCheckPrecomputedVk &) const =default
Response execute(const BBApiRequest &request={}) &&
CircuitKind kind
CircuitKind tag selecting the per-kind flavor (App / Kernel / HidingKernel).
SERIALIZATION_FIELDS(circuit, kind)
CircuitInput circuit
Circuit with its precomputed verification key.
static constexpr const char MSGPACK_SCHEMA_NAME[]
static constexpr const char MSGPACK_SCHEMA_NAME[]
SERIALIZATION_FIELDS(compressed_proof)
std::vector< uint8_t > compressed_proof
bool operator==(const Response &) const =default
Compress a Chonk proof to a compact byte representation.
bool operator==(const ChonkCompressProof &) const =default
static constexpr const char MSGPACK_SCHEMA_NAME[]
Response execute(const BBApiRequest &request={}) &&
SERIALIZATION_FIELDS(proof)
Contains the computed verification key in multiple formats.
static constexpr const char MSGPACK_SCHEMA_NAME[]
SERIALIZATION_FIELDS(bytes, fields)
std::vector< uint8_t > bytes
Serialized Chonk verification key in binary format.
std::vector< bb::fr > fields
Verification key as array of field elements.
bool operator==(const Response &) const =default
Compute MegaHonk verification key for a circuit to be accumulated in Chonk.
static constexpr const char MSGPACK_SCHEMA_NAME[]
Response execute(const BBApiRequest &request={}) &&
SERIALIZATION_FIELDS(circuit, kind)
bool operator==(const ChonkComputeVk &) const =default
bool operator==(const Response &) const =default
static constexpr const char MSGPACK_SCHEMA_NAME[]
SERIALIZATION_FIELDS(proof)
Decompress a compressed Chonk proof back to field elements.
std::vector< uint8_t > compressed_proof
SERIALIZATION_FIELDS(compressed_proof)
bool operator==(const ChonkDecompressProof &) const =default
static constexpr const char MSGPACK_SCHEMA_NAME[]
Response execute(const BBApiRequest &request={}) &&
Empty response indicating successful circuit loading.
void msgpack(auto &&pack_fn)
static constexpr const char MSGPACK_SCHEMA_NAME[]
bool operator==(const Response &) const =default
Load a circuit into the Chonk instance for accumulation.
static constexpr const char MSGPACK_SCHEMA_NAME[]
bool operator==(const ChonkLoad &) const =default
CircuitKind kind
CircuitKind tag selecting the per-kind slim flavor (App / Kernel / HidingKernel).
SERIALIZATION_FIELDS(circuit, kind)
Response execute(BBApiRequest &request) &&
CircuitInput circuit
Circuit to be loaded with its bytecode and verification key.
Contains the generated IVC proof.
bool operator==(const Response &) const =default
static constexpr const char MSGPACK_SCHEMA_NAME[]
ChonkProof proof
Complete IVC proof for all accumulated circuits.
SERIALIZATION_FIELDS(proof)
Generate a proof for all accumulated circuits.
static constexpr const char MSGPACK_SCHEMA_NAME[]
void msgpack(auto &&pack_fn)
bool operator==(const ChonkProve &) const =default
Response execute(BBApiRequest &request) &&
Empty response indicating successful initialization.
bool operator==(const Response &) const =default
void msgpack(auto &&pack_fn)
static constexpr const char MSGPACK_SCHEMA_NAME[]
Initialize a new Chonk instance for incremental proof accumulation.
Response execute(BBApiRequest &request) &&
bool operator==(const ChonkStart &) const =default
SERIALIZATION_FIELDS(kinds)
std::vector< CircuitKind > kinds
static constexpr const char MSGPACK_SCHEMA_NAME[]
Contains gate count information.
SERIALIZATION_FIELDS(acir_opcodes, circuit_size, gates_per_opcode)
uint32_t circuit_size
Circuit size (total number of gates)
static constexpr const char MSGPACK_SCHEMA_NAME[]
uint32_t acir_opcodes
Number of ACIR opcodes.
std::vector< uint32_t > gates_per_opcode
Optional: gate counts per opcode.
bool operator==(const Response &) const =default
Get gate counts for a circuit.
bool include_gates_per_opcode
Whether to include detailed gate counts per opcode.
static constexpr const char MSGPACK_SCHEMA_NAME[]
bool operator==(const ChonkStats &) const =default
CircuitInputNoVK circuit
The circuit to analyze.
SERIALIZATION_FIELDS(circuit, include_gates_per_opcode)
Response execute(BBApiRequest &request) &&
Contains the verification result.
bool valid
True if the proof is valid.
static constexpr const char MSGPACK_SCHEMA_NAME[]
SERIALIZATION_FIELDS(valid)
bool operator==(const Response &) const =default
SERIALIZATION_FIELDS(valid)
static constexpr const char MSGPACK_SCHEMA_NAME[]
bool valid
True if the proof is valid.
bool operator==(const Response &) const =default
Verify a Chonk proof passed as a flat field-element array (with public inputs prepended).
SERIALIZATION_FIELDS(proof, vk)
std::vector< uint8_t > vk
The verification key.
bool operator==(const ChonkVerifyFromFields &) const =default
std::vector< bb::fr > proof
Flat proof field elements with public inputs prepended.
static constexpr const char MSGPACK_SCHEMA_NAME[]
Response execute(const BBApiRequest &request={}) &&
Verify a Chonk proof with its verification key.
static constexpr const char MSGPACK_SCHEMA_NAME[]
std::vector< uint8_t > vk
The verification key.
SERIALIZATION_FIELDS(proof, vk)
Response execute(const BBApiRequest &request={}) &&
bool operator==(const ChonkVerify &) const =default
ChonkProof proof
The Chonk proof to verify.