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)
 
bool app_return_data_slots_are_empty () const
 Whether all app return-data slots are currently empty.
 
void set_app_return_data_commitment (const Commitment &commitment)
 Record an app return-data commitment in the next available slot.
 
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, const size_t idx)
 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

std::array< Commitment, MAX_APPS_PER_KERNEL > app_return_data_commitments
 
Commitment kernel_return_data_commitment
 
std::array< bool, MAX_APPS_PER_KERNEL > app_return_data_commitment_exists
 
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 MAX_APPS_PER_KERNEL + 1 return-data commitments via its public inputs: one for the previous kernel and one per app slot. If any of these does not exist (e.g., the first kernel has no previous kernel; a kernel with fewer than MAX apps leaves the trailing app slots unset), it is populated with a default commitment value that will satisfy the consistency check on the next cycle. The "empty" calldata column on the next kernel side will commit to the same default value, so the commitments agree and the consistency check passes trivially.

Template Parameters
Builder

Definition at line 93 of file databus.hpp.

Member Typedef Documentation

◆ Commitment

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

Definition at line 96 of file databus.hpp.

◆ CommitmentNative

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

Definition at line 97 of file databus.hpp.

◆ Curve

Definition at line 95 of file databus.hpp.

◆ FrNative

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

Definition at line 98 of file databus.hpp.

Member Function Documentation

◆ app_return_data_slots_are_empty()

template<class Builder >
bool bb::stdlib::DataBusDepot< Builder >::app_return_data_slots_are_empty ( ) const
inline

Whether all app return-data slots are currently empty.

Used to assert the kernel-boundary invariant: at the start of each kernel completion, every slot must have been drained by the prior kernel's get-loop so that set_app_return_data_commitment begins filling from slot 0.

Definition at line 124 of file databus.hpp.

◆ 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.

Returns the point at infinity. This matches the commitment to a databus column containing only zero-valued entries (DEFAULT_VALUE = 0), regardless of the polynomial offset used for disabled rows.

Definition at line 158 of file databus.hpp.

◆ get_app_return_data_commitment()

template<class Builder >
Commitment bb::stdlib::DataBusDepot< Builder >::get_app_return_data_commitment ( Builder builder,
const size_t  idx 
)
inline

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

Definition at line 182 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 169 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

Record an app return-data commitment in the next available slot.

Slot assignment is implicit: the depot fills slot 0 first, then slot 1, etc., as apps are processed in the kernel's verification queue. Slots are released by get_app_return_data_commitment; each kernel-completion pass drains every slot via the get-loop in Chonk::complete_kernel_circuit_logic, so the next kernel begins filling from slot 0 again.

Definition at line 141 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 112 of file databus.hpp.

Member Data Documentation

◆ app_return_data_commitment_exists

template<class Builder >
std::array<bool, MAX_APPS_PER_KERNEL> bb::stdlib::DataBusDepot< Builder >::app_return_data_commitment_exists
Initial value:
= []() {
std::array<bool, MAX_APPS_PER_KERNEL> result{};
result.fill(false);
return result;
}()

Definition at line 105 of file databus.hpp.

◆ app_return_data_commitments

template<class Builder >
std::array<Commitment, MAX_APPS_PER_KERNEL> bb::stdlib::DataBusDepot< Builder >::app_return_data_commitments

Definition at line 101 of file databus.hpp.

◆ kernel_return_data_commitment

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

Definition at line 102 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 110 of file databus.hpp.


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