#include <field_conversion.hpp>
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 101 of file field_conversion.hpp.
◆ convert_full_challenge()
template<typename Field >
template<typename T >
Convert a full-width challenge to a target type (fr or fq).
For fq the full challenge is decomposed into the low/high halves expected by the bigfield(low_bits, high_bits) constructor (which range-constrains the limbs), and the decomposition is bound back to the challenge so the resulting cycle scalar equals the squeezed challenge. This is exact and canonical: the challenge value is < r < q, so it is always a valid fq element. Mirrors the native FrCodec::convert_full_challenge, which reinterprets the same value as fq.
Definition at line 70 of file field_conversion.hpp.
◆ convert_goblin_fr_to_bn254_frs()
template<typename Field >
◆ convert_grumpkin_fr_to_bn254_frs()
template<typename Field >
◆ convert_short_challenge()
template<typename Field >
template<typename T >
A stdlib Transcript method needed to convert a short fr challenge limb to a bigfield one.
- Template Parameters
-
- Parameters
-
| challenge | a 127-bit limb of a full challenge |
- Returns
- T
Definition at line 43 of file field_conversion.hpp.
◆ 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 151 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 320 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 252 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 301 of file field_conversion.hpp.
The documentation for this class was generated from the following file: