Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
grumpkin.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Completed, auditors: [Federico], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
8#include "../bigfield/bigfield.hpp"
9#include "../biggroup/biggroup.hpp"
10#include "../field/field.hpp"
13
14namespace bb::stdlib {
15
21template <typename CircuitBuilder> struct grumpkin {
23 static constexpr bool is_stdlib_type = true;
25
26 // Corresponding native types (used exclusively for testing)
30 using ElementNative = GroupNative::element;
31 using AffineElementNative = GroupNative::affine_element;
32
33 // Stdlib types corresponding to those defined in the native description of the curve.
34 // Note: its useful to have these type names match the native analog exactly so that components that digest a
35 // Curve (e.g. the PCS) can be agnostic as to whether they're operating on native or stdlib types.
40 using Element = Group;
41
42 // Additional types with no analog in the native description of the curve
44
45 // Required by SmallSubgroupIPA argument. This constant needs to divide the size of the multiplicative subgroup of
46 // the ScalarField and satisfy SUBGROUP_SIZE > CONST_PROOF_SIZE_LOG_N * 3, since in every round of Sumcheck, the
47 // prover sends 3 elements to the verifier.
48 static constexpr size_t SUBGROUP_SIZE = 87;
49 // The generator below was derived by factoring r - 1 into primes, where r is the modulus of the Grumkin scalar
50 // field. A random field element was sampled and raised to the power (r - 1) / (3 * 29). We verified that the
51 // resulting element does not generate a smaller subgroup by further raising it to the powers of 3 and 29. To
52 // optimize the recursive verifier and avoid costly inversions, we also precompute and store its inverse.
53 static constexpr bb::fq subgroup_generator =
54 bb::fq("0x147c647c09fb639514909e9f0513f31ec1a523bf8a0880bc7c24fbc962a9586b");
56 bb::fq("0x0c68e27477b5e78cfab790bd3b59806fa871771f71ec7452cde5384f6e3a1988");
57 // The length of the polynomials used to mask the Sumcheck Round Univariates. In the ECCVM Sumcheck, the prover only
58 // sends 3 elements in every round - a commitment to the round univariate and its evaluations at 0 and 1. Therefore,
59 // length 3 is sufficient.
60 static constexpr uint32_t LIBRA_UNIVARIATES_LENGTH = 3;
61};
62
63} // namespace bb::stdlib
TranslatorCircuitBuilder creates a circuit that evaluates the correctness of the evaluation of EccOpQ...
typename grumpkin::g1 Group
Definition grumpkin.hpp:63
cycle_group represents a group Element of the proving system's embedded curve, i.e....
field< Bn254FqParams > fq
Definition fq.hpp:153
CurveType
Definition types.hpp:10
@ GRUMPKIN
Definition types.hpp:10
Curve grumpkin in circuit setting.
Definition grumpkin.hpp:21
GroupNative::element ElementNative
Definition grumpkin.hpp:30
static constexpr bool is_stdlib_type
Definition grumpkin.hpp:23
static constexpr bb::fq subgroup_generator
Definition grumpkin.hpp:53
static constexpr bb::fq subgroup_generator_inverse
Definition grumpkin.hpp:55
curve::Grumpkin::Group GroupNative
Definition grumpkin.hpp:29
static constexpr uint32_t LIBRA_UNIVARIATES_LENGTH
Definition grumpkin.hpp:60
static constexpr size_t SUBGROUP_SIZE
Definition grumpkin.hpp:48
GroupNative::affine_element AffineElementNative
Definition grumpkin.hpp:31
TranslatorFlavor::CircuitBuilder CircuitBuilder