Barretenberg
The ZK-SNARK library at the core of Aztec
|
Custom element class for when using goblin. More...
#include <biggroup_goblin.hpp>
Public Types | |
using | Builder = Builder_ |
using | BaseField = Fq |
using | bool_ct = stdlib::bool_t< Builder > |
using | biggroup_tag = goblin_element |
Public Member Functions | |
goblin_element ()=default | |
goblin_element (const typename NativeGroup::affine_element &input) | |
goblin_element (const Fq &x, const Fq &y) | |
goblin_element (const goblin_element &other)=default | |
goblin_element (goblin_element &&other) noexcept=default | |
goblin_element & | operator= (const goblin_element &other)=default |
goblin_element & | operator= (goblin_element &&other) noexcept=default |
~goblin_element ()=default | |
void | assert_equal (const goblin_element &other) const |
void | convert_constant_to_fixed_witness (Builder *builder) |
Creates fixed witnesses from a constant element. | |
void | fix_witness () |
void | validate_on_curve () const |
goblin_element | checked_unconditional_add (const goblin_element &other) const |
goblin_element | checked_unconditional_subtract (const goblin_element &other) const |
goblin_element | operator+ (const goblin_element &other) const |
goblin_element | operator- (const goblin_element &other) const |
goblin_element | operator- () const |
goblin_element | operator+= (const goblin_element &other) |
goblin_element | operator-= (const goblin_element &other) |
std::array< goblin_element, 2 > | checked_unconditional_add_sub (const goblin_element &other) const |
goblin_element | operator* (const Fr &scalar) const |
goblin_element | conditional_negate (const bool_ct &predicate) const |
goblin_element | normalize () const |
goblin_element | reduce () const |
goblin_element | dbl () const |
NativeGroup::affine_element | get_value () const |
Builder * | get_context () const |
Builder * | get_context (const goblin_element &other) const |
bool_ct | is_point_at_infinity () const |
void | set_point_at_infinity (const bool_ct &is_infinity) |
goblin_element | get_standard_form () const |
Enforce x and y coordinates of a point to be (0,0) in the case of point at infinity. | |
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 element's tags. | |
void | unset_free_witness_tag () |
Unset the free witness flag for the goblin element's tags. | |
uint32_t | set_public () const |
Set the witness indices representing the goblin element to public. | |
Static Public Member Functions | |
static goblin_element | from_witness (Builder *ctx, const typename NativeGroup::affine_element &input) |
static goblin_element | one (Builder *ctx) |
static goblin_element | point_at_infinity (Builder *ctx) |
static goblin_element | batch_mul (const std::vector< goblin_element > &points, const std::vector< Fr > &scalars, const size_t max_num_bits=0, const bool handle_edge_cases=false) |
Goblin style batch multiplication. | |
static goblin_element | reconstruct_from_public (const std::span< const Fr, PUBLIC_INPUTS_SIZE > &limbs) |
Reconstruct a goblin element from its representation as limbs stored in the public inputs. | |
Public Attributes | |
Fq | x |
Fq | y |
Static Public Attributes | |
static constexpr size_t | PUBLIC_INPUTS_SIZE = BIGGROUP_PUBLIC_INPUTS_SIZE |
Private Attributes | |
bool_ct | _is_infinity |
Custom element class for when using goblin.
When using goblin (builder = MEGA and element = bn254), the assumptions and heuristics we apply vary considerably to the "default" case, justifying a separate class (we use a using
declaration to make element
map to goblin_element
if the correct parametrisation is used, see the IsGoblinBigGroup
concept for details) Differences between goblin and regular biggroup elements:
Builder | |
Fq | |
Fr | |
NativeGroup |
Definition at line 38 of file biggroup_goblin.hpp.
using bb::stdlib::element_goblin::goblin_element< Builder_, Fq, Fr, NativeGroup >::BaseField = Fq |
Definition at line 41 of file biggroup_goblin.hpp.
using bb::stdlib::element_goblin::goblin_element< Builder_, Fq, Fr, NativeGroup >::biggroup_tag = goblin_element |
Definition at line 43 of file biggroup_goblin.hpp.
using bb::stdlib::element_goblin::goblin_element< Builder_, Fq, Fr, NativeGroup >::bool_ct = stdlib::bool_t<Builder> |
Definition at line 42 of file biggroup_goblin.hpp.
using bb::stdlib::element_goblin::goblin_element< Builder_, Fq, Fr, NativeGroup >::Builder = Builder_ |
Definition at line 40 of file biggroup_goblin.hpp.
|
default |
|
inline |
Definition at line 49 of file biggroup_goblin.hpp.
|
inline |
Definition at line 54 of file biggroup_goblin.hpp.
|
default |
|
defaultnoexcept |
|
default |
|
inline |
Definition at line 65 of file biggroup_goblin.hpp.
|
static |
Goblin style batch multiplication.
In goblin-style arithmetization, the operands (points/scalars) for each mul-accumulate operation are decomposed into smaller components and written to an operation queue via the builder. The components are also added as witness variables. This function adds constraints demonstrating the fidelity of the point/scalar decompositions given the indices of the components in the variables array. The actual mul-accumulate operations are performed natively (without constraints) under the hood, and the final result is obtained by queueing an equality operation via the builder. The components of the result are returned as indices into the variables array from which the resulting accumulator point is re-constructed.
C | CircuitBuilder |
Fq | Base field |
Fr | Scalar field |
G | Native group |
points | |
scalars | |
max_num_bits |
Definition at line 38 of file biggroup_goblin_impl.hpp.
|
inline |
Definition at line 142 of file biggroup_goblin.hpp.
|
inline |
Definition at line 223 of file biggroup_goblin.hpp.
|
inline |
Definition at line 146 of file biggroup_goblin.hpp.
|
inline |
Definition at line 230 of file biggroup_goblin.hpp.
|
inline |
Creates fixed witnesses from a constant element.
Definition at line 97 of file biggroup_goblin.hpp.
|
inline |
Definition at line 250 of file biggroup_goblin.hpp.
|
inline |
Fix a witness. The value of the witness is constrained with a selector
Definition at line 107 of file biggroup_goblin.hpp.
|
inlinestatic |
Definition at line 74 of file biggroup_goblin.hpp.
|
inline |
Definition at line 274 of file biggroup_goblin.hpp.
|
inline |
Definition at line 285 of file biggroup_goblin.hpp.
|
inline |
Definition at line 321 of file biggroup_goblin.hpp.
|
inline |
Enforce x and y coordinates of a point to be (0,0) in the case of point at infinity.
We need to have a standard witness in Noir and the point at infinity can have non-zero random coefficients when we get it as output from our optimized algorithms. This function returns a (0,0) point, if it is a point at infinity
Definition at line 311 of file biggroup_goblin.hpp.
|
inline |
Definition at line 263 of file biggroup_goblin.hpp.
|
inline |
Definition at line 302 of file biggroup_goblin.hpp.
|
inline |
Definition at line 238 of file biggroup_goblin.hpp.
|
inlinestatic |
Definition at line 122 of file biggroup_goblin.hpp.
|
inline |
Definition at line 228 of file biggroup_goblin.hpp.
|
inline |
Definition at line 151 of file biggroup_goblin.hpp.
|
inline |
Definition at line 213 of file biggroup_goblin.hpp.
|
inline |
Definition at line 211 of file biggroup_goblin.hpp.
|
inline |
Definition at line 156 of file biggroup_goblin.hpp.
|
inline |
Definition at line 218 of file biggroup_goblin.hpp.
|
default |
|
defaultnoexcept |
|
inlinestatic |
Definition at line 131 of file biggroup_goblin.hpp.
|
inlinestatic |
Reconstruct a goblin element from its representation as limbs stored in the public inputs.
For consistency with biggroup, a goblin element is represented in the public inputs using eight field elements (even though it could be represented using only four).
limbs |
Definition at line 377 of file biggroup_goblin.hpp.
|
inline |
Definition at line 244 of file biggroup_goblin.hpp.
|
inline |
Set the free witness flag for the goblin element's tags.
Definition at line 336 of file biggroup_goblin.hpp.
|
inline |
Definition at line 326 of file biggroup_goblin.hpp.
|
inline |
Definition at line 303 of file biggroup_goblin.hpp.
|
inline |
Set the witness indices representing the goblin element to public.
Even though the coordinates of a goblin element are goblin field elements which may be represented using two native field elements, we store them in the public inputs as if they were bigfield elements, each of which is represented by four native field elements. This uniformity is imposed for simplicity but could be reconsidered if desired.
Definition at line 361 of file biggroup_goblin.hpp.
|
inline |
Unset the free witness flag for the goblin element's tags.
Definition at line 346 of file biggroup_goblin.hpp.
|
inline |
Definition at line 117 of file biggroup_goblin.hpp.
|
private |
Definition at line 390 of file biggroup_goblin.hpp.
|
staticconstexpr |
Definition at line 46 of file biggroup_goblin.hpp.
Fq bb::stdlib::element_goblin::goblin_element< Builder_, Fq, Fr, NativeGroup >::x |
Definition at line 386 of file biggroup_goblin.hpp.
Fq bb::stdlib::element_goblin::goblin_element< Builder_, Fq, Fr, NativeGroup >::y |
Definition at line 387 of file biggroup_goblin.hpp.