8#include "../circuit_builders/circuit_builders_fwd.hpp"
9#include "../field/field.hpp"
16template <
typename Builder>
class databus {
68 for (uint8_t idx = 0; idx < MAX_APPS_PER_KERNEL; ++idx) {
106 std::array<bool, MAX_APPS_PER_KERNEL> result{};
126 for (
size_t idx = 0; idx < MAX_APPS_PER_KERNEL; ++idx) {
143 for (
size_t idx = 0; idx < MAX_APPS_PER_KERNEL; ++idx) {
150 BB_ASSERT(
false,
"DataBusDepot has no free app return-data slot");
160 auto default_commitment =
Commitment(CommitmentNative::infinity());
161 default_commitment.convert_constant_to_fixed_witness(&
builder);
162 return default_commitment;
184 BB_ASSERT_LT(idx, MAX_APPS_PER_KERNEL,
"DataBusDepot app return-data index out of bounds");
#define BB_ASSERT(expression,...)
#define BB_ASSERT_LT(left, right,...)
Class for managing propagation of databus return data commitments used in consistency checks.
std::array< bool, MAX_APPS_PER_KERNEL > app_return_data_commitment_exists
std::array< Commitment, MAX_APPS_PER_KERNEL > app_return_data_commitments
Commitment get_kernel_return_data_commitment(Builder &builder)
Get the previously set kernel return data commitment if it exists, else a default one.
typename Curve::ScalarFieldNative FrNative
bool kernel_return_data_commitment_exists
typename Curve::AffineElementNative CommitmentNative
static Commitment construct_default_commitment(Builder &builder)
Construct a default commitment for the databus return data.
Commitment kernel_return_data_commitment
bool app_return_data_slots_are_empty() const
Whether all app return-data slots are currently empty.
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.
typename Curve::Group Commitment
void set_app_return_data_commitment(const Commitment &commitment)
Record an app return-data commitment in the next available slot.
void set_kernel_return_data_commitment(const Commitment &commitment)
field_pt operator[](const field_pt &index) const
Read from the bus vector with a witness index value. Creates a read gate.
std::vector< OriginTag > _tags
bus_vector(const BusId bus_idx)
void set_values(const std::vector< field_pt > &entries_in)
Set the entries of the bus vector from possibly unnormalized or constant inputs.
std::vector< field_pt > entries
Builder * get_context() const
void set_context(Builder *builder_context)
std::array< bus_vector, MAX_APPS_PER_KERNEL > app_calldata
bus_vector kernel_calldata
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
GroupNative::affine_element AffineElementNative
curve::BN254::ScalarField ScalarFieldNative
element< CircuitBuilder, bigfield< CircuitBuilder, bb::Bn254FqParams >, ScalarField, GroupNative > Group