Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::bbapi Namespace Reference

Classes

class  BBApiClientIvcTest
 
struct  BBApiRequest
 
class  BBApiUltraHonkTest
 
struct  CircuitComputeVk
 
struct  CircuitInput
 A circuit to be used in either ultrahonk or ClientIVC-honk proving. More...
 
struct  CircuitInputNoVK
 A circuit to be used in either ultrahonk or chonk (ClientIVC+honk) verification key derivation. More...
 
struct  CircuitProve
 Represents a request to generate a proof. Currently, UltraHonk is the only proving system supported by BB (after plonk was deprecated and removed). This is used for one-shot proving, not our "IVC" scheme, ClientIVC-honk. For that, use the ClientIVC* commands. More...
 
struct  CircuitStats
 Consolidated command for retrieving circuit information. Combines gate count, circuit size, and other metadata into a single command. More...
 
struct  CircuitVerify
 Verify a proof against a verification key and public inputs. More...
 
struct  CircuitWriteSolidityVerifier
 Command to generate Solidity verifier contract. More...
 
struct  ClientIvcAccumulate
 Accumulate the previously loaded circuit into the IVC proof. More...
 
struct  ClientIvcCheckPrecomputedVk
 Verify that a precomputed verification key matches the circuit. More...
 
struct  ClientIvcComputeIvcVk
 Compute IVC verification key for the complete proof. More...
 
struct  ClientIvcComputeStandaloneVk
 Compute standalone verification key for a circuit. More...
 
struct  ClientIvcLoad
 Load a circuit into the ClientIVC instance for accumulation. More...
 
struct  ClientIvcProve
 Generate a proof for all accumulated circuits. More...
 
struct  ClientIvcStart
 Initialize a new ClientIVC instance for incremental proof accumulation. More...
 
struct  ClientIvcStats
 Get gate counts for a circuit. More...
 
struct  ClientIvcVerify
 Verify a ClientIVC proof with its verification key. More...
 
struct  ProofSystemSettings
 
struct  VkAsFields
 Convert a verification key to field elements representation. WORKTODO(bbapi): this should become mostly obsolete with having the verification keys always reported as field elements as well, and having a simpler serialization method. More...
 

Typedefs

using Command = NamedUnion< CircuitProve, CircuitComputeVk, CircuitStats, CircuitVerify, ClientIvcComputeStandaloneVk, ClientIvcComputeIvcVk, ClientIvcStart, ClientIvcLoad, ClientIvcAccumulate, ClientIvcProve, ClientIvcVerify, VkAsFields, CircuitWriteSolidityVerifier, ClientIvcCheckPrecomputedVk, ClientIvcStats >
 
using CommandResponse = NamedUnion< CircuitProve::Response, CircuitComputeVk::Response, CircuitStats::Response, CircuitVerify::Response, ClientIvcComputeStandaloneVk::Response, ClientIvcComputeIvcVk::Response, ClientIvcStart::Response, ClientIvcLoad::Response, ClientIvcAccumulate::Response, ClientIvcProve::Response, ClientIvcVerify::Response, VkAsFields::Response, CircuitWriteSolidityVerifier::Response, ClientIvcCheckPrecomputedVk::Response, ClientIvcStats::Response >
 

Enumerations

enum class  OracleHashType { POSEIDON2 , KECCAK , STARKNET }
 Convert oracle hash type string to enum for internal use. More...
 

Functions

 TEST_F (BBApiClientIvcTest, StandaloneVerificationKeySerialization)
 
 TEST_F (BBApiClientIvcTest, ClientIvcVkSerialization)
 
std::string get_msgpack_schema_as_json ()
 
CommandResponse execute (BBApiRequest &request, Command &&command)
 Executes a command by visiting a variant of all possible commands.
 
OracleHashType parse_oracle_hash_type (const std::string &type)
 
template<typename Flavor >
acir_format::ProgramMetadata _create_program_metadata ()
 
template<typename Flavor , typename Circuit = typename Flavor::CircuitBuilder>
Circuit _compute_circuit (std::vector< uint8_t > &&bytecode, std::vector< uint8_t > &&witness)
 
template<typename Flavor >
std::shared_ptr< ProverInstance_< Flavor > > _compute_prover_instance (std::vector< uint8_t > &&bytecode, std::vector< uint8_t > &&witness)
 
template<typename Flavor >
CircuitProve::Response _prove (std::vector< uint8_t > &&bytecode, std::vector< uint8_t > &&witness, std::vector< uint8_t > &&vk_bytes)
 
template<typename Flavor >
bool _verify (const bool ipa_accumulation, const std::vector< uint8_t > &vk_bytes, const std::vector< uint256_t > &public_inputs, const std::vector< uint256_t > &proof)
 
template<typename Flavor , typename Circuit = typename Flavor::CircuitBuilder>
CircuitStats::Response _stats (std::vector< uint8_t > &&bytecode, bool include_gates_per_opcode)
 
 TEST_F (BBApiUltraHonkTest, CircuitProve)
 
 TEST_F (BBApiUltraHonkTest, ParallelComputeVk)
 
CommandResponse bbapi (Command &&command)
 Main API function that processes commands and returns responses.
 

Variables

bool USE_SUMCHECK_IVC = false
 Global flag to control whether to use SumcheckClientIVC instead of ClientIVC.
 

Typedef Documentation

◆ Command

◆ CommandResponse

Enumeration Type Documentation

◆ OracleHashType

enum class bb::bbapi::OracleHashType
strong

Convert oracle hash type string to enum for internal use.

Enumerator
POSEIDON2 
KECCAK 
STARKNET 

Definition at line 111 of file bbapi_shared.hpp.

Function Documentation

◆ _compute_circuit()

template<typename Flavor , typename Circuit = typename Flavor::CircuitBuilder>
Circuit bb::bbapi::_compute_circuit ( std::vector< uint8_t > &&  bytecode,
std::vector< uint8_t > &&  witness 
)

Definition at line 54 of file bbapi_ultra_honk.cpp.

◆ _compute_prover_instance()

template<typename Flavor >
std::shared_ptr< ProverInstance_< Flavor > > bb::bbapi::_compute_prover_instance ( std::vector< uint8_t > &&  bytecode,
std::vector< uint8_t > &&  witness 
)

Definition at line 66 of file bbapi_ultra_honk.cpp.

◆ _create_program_metadata()

template<typename Flavor >
acir_format::ProgramMetadata bb::bbapi::_create_program_metadata ( )

Definition at line 35 of file bbapi_ultra_honk.cpp.

◆ _prove()

template<typename Flavor >
CircuitProve::Response bb::bbapi::_prove ( std::vector< uint8_t > &&  bytecode,
std::vector< uint8_t > &&  witness,
std::vector< uint8_t > &&  vk_bytes 
)

Definition at line 79 of file bbapi_ultra_honk.cpp.

◆ _stats()

template<typename Flavor , typename Circuit = typename Flavor::CircuitBuilder>
CircuitStats::Response bb::bbapi::_stats ( std::vector< uint8_t > &&  bytecode,
bool  include_gates_per_opcode 
)

Definition at line 282 of file bbapi_ultra_honk.cpp.

◆ _verify()

template<typename Flavor >
bool bb::bbapi::_verify ( const bool  ipa_accumulation,
const std::vector< uint8_t > &  vk_bytes,
const std::vector< uint256_t > &  public_inputs,
const std::vector< uint256_t > &  proof 
)

Definition at line 141 of file bbapi_ultra_honk.cpp.

◆ bbapi()

CommandResponse bb::bbapi::bbapi ( Command &&  command)

Main API function that processes commands and returns responses.

Parameters
commandThe command to execute
Returns
CommandResponse The response from executing the command

Definition at line 24 of file c_bind.cpp.

◆ execute()

CommandResponse bb::bbapi::execute ( BBApiRequest request,
Command &&  command 
)
inline

Executes a command by visiting a variant of all possible commands.

Parameters
commandThe command to execute, consumed by this function.
requestThe circuit registry (acting as the request context).
Returns
A variant of all possible command responses.

Definition at line 50 of file bbapi_execute.hpp.

◆ get_msgpack_schema_as_json()

std::string bb::bbapi::get_msgpack_schema_as_json ( )

Definition at line 11 of file bbapi_execute.cpp.

◆ parse_oracle_hash_type()

OracleHashType bb::bbapi::parse_oracle_hash_type ( const std::string &  type)
inline

Definition at line 113 of file bbapi_shared.hpp.

◆ TEST_F() [1/4]

bb::bbapi::TEST_F ( BBApiClientIvcTest  ,
ClientIvcVkSerialization   
)

Definition at line 36 of file bbapi_client_ivc.test.cpp.

◆ TEST_F() [2/4]

bb::bbapi::TEST_F ( BBApiClientIvcTest  ,
StandaloneVerificationKeySerialization   
)

Definition at line 17 of file bbapi_client_ivc.test.cpp.

◆ TEST_F() [3/4]

bb::bbapi::TEST_F ( BBApiUltraHonkTest  ,
CircuitProve   
)

Definition at line 31 of file bbapi_ultra_honk.test.cpp.

◆ TEST_F() [4/4]

bb::bbapi::TEST_F ( BBApiUltraHonkTest  ,
ParallelComputeVk   
)

Definition at line 73 of file bbapi_ultra_honk.test.cpp.

Variable Documentation

◆ USE_SUMCHECK_IVC

bool bb::bbapi::USE_SUMCHECK_IVC = false
inline

Global flag to control whether to use SumcheckClientIVC instead of ClientIVC.

Definition at line 22 of file bbapi_shared.hpp.