Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
Acir::Helpers Struct Reference

#include <acir.hpp>

Static Public Member Functions

static std::map< std::string, msgpack::object const * > make_kvmap (msgpack::object const &o, std::string const &name)
 
template<typename T >
static void conv_fld_from_kvmap (std::map< std::string, msgpack::object const * > const &kvmap, std::string const &struct_name, std::string const &field_name, T &field, bool is_optional)
 
template<typename T >
static void conv_fld_from_array (msgpack::object_array const &array, std::string const &struct_name, std::string const &field_name, T &field, uint32_t index)
 
template<typename T >
static void convert_or_throw (msgpack::object const &val, std::string const &struct_name, std::string const &field_name, T &field)
 
static bool is_int_keyed_map (msgpack::object const &o)
 
template<typename Dispatch >
static void int_map_dispatch (msgpack::object const &o, std::string const &name, Dispatch &&dispatch)
 
static void check_size (uint32_t actual, std::string const &name, uint32_t active, uint32_t reserved)
 

Detailed Description

Definition at line 14 of file acir.hpp.

Member Function Documentation

◆ check_size()

static void Acir::Helpers::check_size ( uint32_t  actual,
std::string const &  name,
uint32_t  active,
uint32_t  reserved 
)
inlinestatic

Cap a MAP or ARRAY entry count against active + reserved. Under-length wires are caught downstream (conv_fld_from_array errors out of bounds; conv_fld_from_kvmap errors on missing required keys), so we only need the upper bound here.

  • Up to reserved extra trailing entries are tolerated as retired fields (#[tagged(reserved(...))] on the Rust side).
  • Anything beyond that is forward-compat drift that the producer only emits when newer fields were added. The Rust-side cue is #[tagged(allow_unknown_tags)]; the message points at it so a reviewer can see the opt-in.

Definition at line 138 of file acir.hpp.

◆ conv_fld_from_array()

template<typename T >
static void Acir::Helpers::conv_fld_from_array ( msgpack::object_array const &  array,
std::string const &  struct_name,
std::string const &  field_name,
T &  field,
uint32_t  index 
)
inlinestatic

Definition at line 57 of file acir.hpp.

◆ conv_fld_from_kvmap()

template<typename T >
static void Acir::Helpers::conv_fld_from_kvmap ( std::map< std::string, msgpack::object const * > const &  kvmap,
std::string const &  struct_name,
std::string const &  field_name,
T &  field,
bool  is_optional 
)
inlinestatic

Definition at line 34 of file acir.hpp.

◆ convert_or_throw()

template<typename T >
static void Acir::Helpers::convert_or_throw ( msgpack::object const &  val,
std::string const &  struct_name,
std::string const &  field_name,
T &  field 
)
inlinestatic

Convert val into field, or throw a focused error mentioning the struct + field name. Used by the int-keyed dispatch path where each switch case populates one field directly.

Definition at line 82 of file acir.hpp.

◆ int_map_dispatch()

template<typename Dispatch >
static void Acir::Helpers::int_map_dispatch ( msgpack::object const &  o,
std::string const &  name,
Dispatch &&  dispatch 
)
inlinestatic

Iterate an int-keyed MAP and invoke dispatch(tag, val) for each (u8, msgpack::object) entry. The per-tag switch inside the caller's lambda decides which field (or variant) to populate; unknown tags fall through to default and are silently skipped, matching the MsgpackTagged decoder's forward-compat policy (allow_unknown_tags / retired tags drained).

Definition at line 113 of file acir.hpp.

◆ is_int_keyed_map()

static bool Acir::Helpers::is_int_keyed_map ( msgpack::object const &  o)
inlinestatic

Whether o is a non-empty MAP whose first key is an integer. This is the signature of Format::MsgpackTagged: int keys for struct field tags and enum variant tags. Legacy Format::Msgpack keys are always strings, so a positive-integer first key is a reliable shape discriminator between the two.

Definition at line 100 of file acir.hpp.

◆ make_kvmap()

static std::map< std::string, msgpack::object const * > Acir::Helpers::make_kvmap ( msgpack::object const &  o,
std::string const &  name 
)
inlinestatic

Definition at line 15 of file acir.hpp.


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