Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ecc_transcript_relation.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Complete, auditors: [Raju], commit: 2a49eb6 }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
8
12
13namespace bb {
14
35template <typename FF_> class ECCVMTranscriptRelationImpl {
36 public:
37 using FF = FF_;
38
39 // Named subrelation indices — matches SUBRELATION_PARTIAL_LENGTHS ordering.
40 enum SubrelationIndex : size_t {
41 // z1/z2 zero checks: if z_zero flag is set, scalar must be 0
44 // Opcode encoding: op = q_reset + 2*q_eq + 4*q_mul + 8*q_add
46 // Point counter update: pc decrements by number of muls
48 // MSM count zero at transition: witnesses correct msm_count_zero_at_transition
50 // MSM transition: msm_transition = q_mul * (1 - q_mul_shift) * (1 - msm_count_zero_at_transition)
52 // MSM count zero when not at a mul op
54 // MSM count increments correctly across mul rows
56 // Opcode exclusion: q_mul and q_add are mutually exclusive with other opcodes
58 // Equality check x-coordinate
60 // Equality check y-coordinate
62 // Boundary: is_accumulator_empty = 1 at third row
64 // Boundary: msm_count = 0 at third row, pc = 0 at last row
66 // On-curve check for input points
68 // Lambda relation for add/msm group operations
70 // Accumulator x-coordinate update
72 // Accumulator y-coordinate update
74 // Accumulator empty flag update
76 // x-equal flag validation
78 // y-equal flag validation
80 // Hiding op row: q_eq must be 1
82 // Hiding op row: q_reset must be 1
84 // Infinity flag consistency: Px = 0 when base infinity
86 // Infinity flag consistency: Py = 0 when base infinity
88 // Infinity flag consistency: acc_x = 0 when accumulator empty
90 // Infinity flag consistency: acc_y = 0 when accumulator empty
92 // Boundary: accumulator_not_empty must be 0 at lagrange_first row
94 // The following subrelations are gated entirely by `msm_transition` and are grouped contiguously at the end so
95 // the short-monomial flavor can split them into a separately-skippable relation (skip when msm_transition ==
96 // 0).
97 // MSM offset generator subtraction: x-coordinate
99 // MSM offset generator subtraction: y-coordinate
101 // MSM infinity x-diff check
103 // MSM infinity y-sum check
105 // MSM infinity inverse check
108 };
109
110 static constexpr std::array<size_t, 32> SUBRELATION_PARTIAL_LENGTHS{
111 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
112 };
113 static_assert(NUM_SUBRELATIONS == SUBRELATION_PARTIAL_LENGTHS.size());
114
115 template <typename ContainerOverSubrelations, typename AllEntities, typename Parameters>
116 static void accumulate(ContainerOverSubrelations& accumulator,
117 const AllEntities& in,
118 const Parameters& /* unused */,
119 const FF& scaling_factor);
120
121 static constexpr FF get_curve_b()
122 {
123 if constexpr (FF::modulus == bb::fq::modulus) {
124 return bb::g1::curve_b;
125 } else if constexpr (FF::modulus == grumpkin::fq::modulus) {
127 } else {
128 static_assert(!std::is_same_v<FF, FF>, "Unsupported field type for ECC transcript relation");
129 }
130 }
131};
132
134
135} // namespace bb
ECCVMTranscriptRelationImpl evaluates the correctness of the ECCVM transcript columns.
static void accumulate(ContainerOverSubrelations &accumulator, const AllEntities &in, const Parameters &, const FF &scaling_factor)
ECCVMTranscriptRelationImpl evaluates the correctness of the ECCVM transcript columns.
static constexpr std::array< size_t, 32 > SUBRELATION_PARTIAL_LENGTHS
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
static constexpr Fq curve_b
Definition group.hpp:53
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
static constexpr uint256_t modulus