Barretenberg
The ZK-SNARK library at the core of Aztec
|
goblin_field wraps x/y coordinates of bn254 group elements when using goblin More...
#include <goblin_field.hpp>
Public Types | |
using | field_ct = stdlib::field_t< Builder > |
using | bool_ct = stdlib::bool_t< Builder > |
Public Member Functions | |
goblin_field () | |
goblin_field (Builder *parent_context, const uint256_t &value) | |
goblin_field (bb::fq input) | |
goblin_field (field_ct lo, field_ct hi) | |
void | assert_equal (const goblin_field &other) const |
void | convert_constant_to_fixed_witness (Builder *builder) |
void | fix_witness () |
uint512_t | get_value () const |
uint512_t | get_maximum_value () const |
Builder * | get_context () const |
void | assert_is_in_field () |
OriginTag | get_origin_tag () const |
void | set_origin_tag (const OriginTag &tag) const |
void | set_free_witness_tag () |
Set the free witness flag for the goblin field's tags. | |
void | unset_free_witness_tag () |
Unset the free witness flag for the goblin field's tags. | |
uint32_t | set_public () const |
Set the witness indices for the limbs of the goblin field to public. | |
Static Public Member Functions | |
static goblin_field | construct_from_limbs (field_ct lolo, field_ct lohi, field_ct hilo, field_ct hihi, bool can_overflow=false) |
static goblin_field | zero () |
static goblin_field | from_witness (Builder *ctx, bb::fq input) |
static goblin_field | conditional_assign (const bool_ct &predicate, const goblin_field &lhs, goblin_field &rhs) |
static goblin_field | reconstruct_from_public (const std::span< const field_ct, PUBLIC_INPUTS_SIZE > &limbs) |
Reconstruct goblin field from its representation as limbs as stored in the public inputs. | |
Public Attributes | |
std::array< field_ct, 2 > | limbs |
Static Public Attributes | |
static const uint1024_t | DEFAULT_MAXIMUM_REMAINDER |
static constexpr size_t | NUM_LIMBS = bigfield<Builder, bb::Bn254FqParams>::NUM_LIMBS |
static constexpr size_t | NUM_LIMB_BITS = bigfield<Builder, bb::Bn254FqParams>::NUM_LIMB_BITS |
static constexpr size_t | NUM_LAST_LIMB_BITS |
static constexpr size_t | PUBLIC_INPUTS_SIZE = 4 |
goblin_field wraps x/y coordinates of bn254 group elements when using goblin
this class exists because we do not want to parametrise goblin bn254 coordinates with bigfield. bigfield generates a large number of constraints to apply checks that are not needed for goblin coordinates This is because, in the goblin context we can apply the following heuristics:
assert_is_in_field
goblin_field
allows us to harvest these optimisations without a proliferation of edge cases and bloated logic in other classes Builder |
Definition at line 28 of file goblin_field.hpp.
using bb::stdlib::goblin_field< Builder >::bool_ct = stdlib::bool_t<Builder> |
Definition at line 38 of file goblin_field.hpp.
using bb::stdlib::goblin_field< Builder >::field_ct = stdlib::field_t<Builder> |
Definition at line 37 of file goblin_field.hpp.
|
inline |
Definition at line 46 of file goblin_field.hpp.
|
inline |
Definition at line 49 of file goblin_field.hpp.
|
inline |
Definition at line 55 of file goblin_field.hpp.
|
inline |
Definition at line 62 of file goblin_field.hpp.
|
inline |
Definition at line 76 of file goblin_field.hpp.
|
inline |
Definition at line 149 of file goblin_field.hpp.
|
inlinestatic |
Definition at line 118 of file goblin_field.hpp.
|
inlinestatic |
Definition at line 68 of file goblin_field.hpp.
|
inline |
Create a witness from a constant. This way the value of the witness is fixed and public.
Definition at line 98 of file goblin_field.hpp.
|
inline |
Fix a witness. The value of the witness is constrained with a selector
Definition at line 109 of file goblin_field.hpp.
|
inlinestatic |
Definition at line 83 of file goblin_field.hpp.
|
inline |
Definition at line 140 of file goblin_field.hpp.
|
inline |
Definition at line 138 of file goblin_field.hpp.
|
inline |
Definition at line 151 of file goblin_field.hpp.
|
inline |
Definition at line 129 of file goblin_field.hpp.
|
inlinestatic |
Reconstruct goblin field from its representation as limbs as stored in the public inputs.
For consistency with bigfield, a goblin field is represented in the public inputs using four limbs.
Definition at line 199 of file goblin_field.hpp.
|
inline |
Set the free witness flag for the goblin field's tags.
Definition at line 162 of file goblin_field.hpp.
|
inline |
Definition at line 153 of file goblin_field.hpp.
|
inline |
Set the witness indices for the limbs of the goblin field to public.
For consistency with bigfield, a goblin field is represented in the public inputs using four limbs.
Definition at line 184 of file goblin_field.hpp.
|
inline |
Unset the free witness flag for the goblin field's tags.
Definition at line 172 of file goblin_field.hpp.
|
inlinestatic |
Definition at line 81 of file goblin_field.hpp.
|
inlinestatic |
Definition at line 30 of file goblin_field.hpp.
std::array<field_ct, 2> bb::stdlib::goblin_field< Builder >::limbs |
Definition at line 39 of file goblin_field.hpp.
|
staticconstexpr |
Definition at line 34 of file goblin_field.hpp.
|
staticconstexpr |
Definition at line 33 of file goblin_field.hpp.
|
staticconstexpr |
Definition at line 32 of file goblin_field.hpp.
|
staticconstexpr |
Definition at line 43 of file goblin_field.hpp.