Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::stdlib::DataBusDepot< Builder > Class Template Reference

Class for managing propagation of databus return data commitments used in consistency checks. More...

#include <databus.hpp>

Public Types

using Curve = stdlib::bn254< Builder >
 
using Commitment = typename Curve::Group
 
using CommitmentNative = typename Curve::AffineElementNative
 
using FrNative = typename Curve::ScalarFieldNative
 

Public Member Functions

void set_kernel_return_data_commitment (const Commitment &commitment)
 
void set_app_return_data_commitment (const Commitment &commitment)
 
Commitment get_kernel_return_data_commitment (Builder &builder)
 Get the previously set kernel return data commitment if it exists, else a default one.
 
Commitment get_app_return_data_commitment (Builder &builder)
 Get the previously set app return data commitment if it exists, else a default one.
 

Static Public Member Functions

static Commitment construct_default_commitment (Builder &builder)
 Construct a default commitment for the databus return data.
 

Public Attributes

Commitment app_return_data_commitment
 
Commitment kernel_return_data_commitment
 
bool app_return_data_commitment_exists = false
 
bool kernel_return_data_commitment_exists = false
 

Detailed Description

template<class Builder>
class bb::stdlib::DataBusDepot< Builder >

Class for managing propagation of databus return data commitments used in consistency checks.

The databus consistency checks establish the transfer of data between two circuits (i-1 and i) in a third circuit (i+1) via commitment equality checks of the form [R_{i-1}] = [C_i], where R and C represent return data and calldata, respectively. In practice, circuit (i+1) is given access to [R_{i-1}] via the public inputs of \pi_i, and it has access to [C_i] directly from \pi_i. The consistency checks in circuit (i+1) are thus of the form \pi_i.public_inputs.[R_{i-1}] = \pi_i.[C_i].

For consistent behavior across kernels, every kernel propagates two return data commitments via its public inputs. If one of either the app or kernel return data does not exist, it is populated with a default value that will satisfy the consistency check on the next cycle. For example, the first kernel has no previous kernel to verify and thus neither receives a previous kernel return data commitment nor a calldata input corresponding to a previous kernel. The "empty" calldata will be populated with a default value, resulting in a default commitment value. We set the same value for the missing return data herein so that the commitments agree and the corresponding consistency check will be satisfied in the kernel in which it's performed.

Template Parameters
Builder

Definition at line 85 of file databus.hpp.

Member Typedef Documentation

◆ Commitment

template<class Builder >
using bb::stdlib::DataBusDepot< Builder >::Commitment = typename Curve::Group

Definition at line 88 of file databus.hpp.

◆ CommitmentNative

template<class Builder >
using bb::stdlib::DataBusDepot< Builder >::CommitmentNative = typename Curve::AffineElementNative

Definition at line 89 of file databus.hpp.

◆ Curve

Definition at line 87 of file databus.hpp.

◆ FrNative

template<class Builder >
using bb::stdlib::DataBusDepot< Builder >::FrNative = typename Curve::ScalarFieldNative

Definition at line 90 of file databus.hpp.

Member Function Documentation

◆ construct_default_commitment()

template<class Builder >
static Commitment bb::stdlib::DataBusDepot< Builder >::construct_default_commitment ( Builder builder)
inlinestatic

Construct a default commitment for the databus return data.

This commitment is used when no genuine return data commitment exists for either the kernel or app

Definition at line 117 of file databus.hpp.

◆ get_app_return_data_commitment()

template<class Builder >
Commitment bb::stdlib::DataBusDepot< Builder >::get_app_return_data_commitment ( Builder builder)
inline

Get the previously set app return data commitment if it exists, else a default one.

Definition at line 142 of file databus.hpp.

◆ get_kernel_return_data_commitment()

template<class Builder >
Commitment bb::stdlib::DataBusDepot< Builder >::get_kernel_return_data_commitment ( Builder builder)
inline

Get the previously set kernel return data commitment if it exists, else a default one.

Definition at line 129 of file databus.hpp.

◆ set_app_return_data_commitment()

template<class Builder >
void bb::stdlib::DataBusDepot< Builder >::set_app_return_data_commitment ( const Commitment commitment)
inline

Definition at line 106 of file databus.hpp.

◆ set_kernel_return_data_commitment()

template<class Builder >
void bb::stdlib::DataBusDepot< Builder >::set_kernel_return_data_commitment ( const Commitment commitment)
inline

Definition at line 100 of file databus.hpp.

Member Data Documentation

◆ app_return_data_commitment

template<class Builder >
Commitment bb::stdlib::DataBusDepot< Builder >::app_return_data_commitment

Definition at line 93 of file databus.hpp.

◆ app_return_data_commitment_exists

template<class Builder >
bool bb::stdlib::DataBusDepot< Builder >::app_return_data_commitment_exists = false

Definition at line 97 of file databus.hpp.

◆ kernel_return_data_commitment

template<class Builder >
Commitment bb::stdlib::DataBusDepot< Builder >::kernel_return_data_commitment

Definition at line 94 of file databus.hpp.

◆ kernel_return_data_commitment_exists

template<class Builder >
bool bb::stdlib::DataBusDepot< Builder >::kernel_return_data_commitment_exists = false

Definition at line 98 of file databus.hpp.


The documentation for this class was generated from the following file: