#include <field_conversion.hpp>
|
| template<typename T > |
| static T | convert_challenge (const fr &challenge) |
| | A stdlib Transcript method needed to convert an fr challenge to a bigfield one. Assumes that challenge is "short".
|
| |
| static std::vector< fr > | convert_goblin_fr_to_bn254_frs (const goblin_field< Builder > &input) |
| |
| static std::vector< fr > | convert_grumpkin_fr_to_bn254_frs (const fq &input) |
| |
| template<typename T > |
| static constexpr size_t | calc_num_fields () |
| | Calculates the size of a type (in its native form) in terms of frs.
|
| |
| template<typename T > |
| static T | deserialize_from_fields (std::span< const fr > fr_vec) |
| | Core stdlib Transcript deserialization method.
|
| |
| template<typename T > |
| static std::vector< fr > | serialize_to_fields (const T &val) |
| | Core stdlib Transcript serialization method.
|
| |
| static std::array< fr, 2 > | split_challenge (const fr &challenge) |
| | Split a challenge field element into two equal-width challenges.
|
| |
| template<typename TargetType > |
| static TargetType | deserialize_from_frs (std::span< fr > elements, size_t &num_frs_read) |
| | A stdlib VerificationKey-specific method.
|
| |
template<typename Field>
class bb::stdlib::StdlibCodec< Field >
Definition at line 27 of file field_conversion.hpp.
◆ bn254_commitment
template<typename Field >
◆ Builder
template<typename Field >
◆ DataType
template<typename Field >
◆ fq
template<typename Field >
◆ fr
template<typename Field >
◆ grumpkin_commitment
template<typename Field >
◆ calc_num_fields()
template<typename Field >
template<typename T >
Calculates the size of a type (in its native form) in terms of frs.
Definition at line 80 of file field_conversion.hpp.
◆ convert_challenge()
template<typename Field >
template<typename T >
A stdlib Transcript method needed to convert an fr challenge to a bigfield one. Assumes that challenge is "short".
- Template Parameters
-
- Parameters
-
| challenge | a 127-bit limb of a full challenge |
- Returns
- T
Definition at line 44 of file field_conversion.hpp.
◆ convert_goblin_fr_to_bn254_frs()
template<typename Field >
◆ convert_grumpkin_fr_to_bn254_frs()
template<typename Field >
◆ deserialize_from_fields()
template<typename Field >
template<typename T >
Core stdlib Transcript deserialization method.
Deserializes a vector of in-circuit frs, i.e. field_t elements, into
- Template Parameters
-
| Builder | UltraCircuitBuilder or MegaCircuitBuilder |
| T | Target object type |
- Parameters
-
Definition at line 130 of file field_conversion.hpp.
◆ deserialize_from_frs()
template<typename Field >
template<typename TargetType >
A stdlib VerificationKey-specific method.
Deserialize an object of specified type from a buffer of field elements; update provided read count in place
- Template Parameters
-
| TargetType | Type to reconstruct from buffer of field elements |
- Parameters
-
| elements | Buffer of field_t elements |
| num_frs_read | Index at which to read into buffer |
Definition at line 299 of file field_conversion.hpp.
◆ serialize_to_fields()
template<typename Field >
template<typename T >
Core stdlib Transcript serialization method.
Serializes an object into a flat vector of in-circuit fr, i.e. field_t elements. This is the inverse of deserialize_from_fields (up to the conventional point-at-infinity representation; see TODO below).
Serializes the following types:
- field_t — no conversion needed; output a single
fr.
- bigfield (bb::stdlib::bigfield< Builder, T >) — output 2
fr limbs obtained from the bigfield’s binary-basis limbs recombined according to NUM_LIMB_BITS. Specific to UltraCircuitBuilder.
- goblin field element (bb::stdlib::goblin_field< Builder >) — emit 2
fr limbs by exposing the goblin field’s internal limbs (low, high) as-is. Range constraints are enforced in Translator (see Translator Range Constraint relation). Specific to MegaCircuitBuilder.
- bn254 goblin point (bb::stdlib::element_goblin::goblin_element< Builder_, Fq, Fr, NativeGroup >) — serialize the pair of coordinates
(x, y) by concatenating the encodings of each coordinate in the base field (goblin/bigfield form). Point-at-infinity is represented as (0, 0); ECCVM validates this. Specific to MegaCircuitBuilder.
- bn254 point (bb::stdlib::element_default::element< Builder_, Fq, Fr, NativeGroup >) — serialize
(x, y) by concatenating the encodings of the two bigfield coordinates. Specific to UltraCircuitBuilder.
- Grumpkin point — serialize
(x, y) in the base field fr by concatenating their encodings. The point-at-infinity flag is re-derived from coordinates during deserialization. Specific to UltraCircuitBuilder.
bb::Univariate<FF, N> or std::array<FF, N> of any of the above — serialize element-wise and concatenate.
Round-trip note:
- For supported types,
serialize_to_fields(val) followed by deserialize_from_fields<T>(...) reconstructs an equivalent in-circuit object, assuming the same arithmetization and that range/ECC checks are enforced where applicable during reconstruction (see ECCVM Transcript relation).
TODO(https://github.com/AztecProtocol/barretenberg/issues/1527): make the point-at-infinity representation fully uniform across (de)serialization paths.
- Template Parameters
-
| Builder | UltraCircuitBuilder or MegaCircuitBuilder |
| T | Target object type |
- Parameters
-
- Returns
- Flat vector of
fr<Builder> elements
Definition at line 231 of file field_conversion.hpp.
◆ split_challenge()
template<typename Field >
Split a challenge field element into two equal-width challenges.
Both lo and hi are 127 bits each (254/2) which provides significantly more than our security parameter bound: 100 bits. The decomposition is constrained to be unique.
- Parameters
-
- Returns
- std::array<DataType, 2>
Definition at line 280 of file field_conversion.hpp.
The documentation for this class was generated from the following file: