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 // MSM offset generator subtraction: x-coordinate
76 // MSM offset generator subtraction: y-coordinate
78 // MSM infinity x-diff check
80 // MSM infinity y-sum check
82 // MSM infinity inverse check
84 // Accumulator empty flag update
86 // x-equal flag validation
88 // y-equal flag validation
90 // Hiding op row: q_eq must be 1
92 // Hiding op row: q_reset must be 1
94 // Infinity flag consistency: Px = 0 when base infinity
96 // Infinity flag consistency: Py = 0 when base infinity
98 // Infinity flag consistency: acc_x = 0 when accumulator empty
100 // Infinity flag consistency: acc_y = 0 when accumulator empty
102 // Boundary: accumulator_not_empty must be 0 at lagrange_first row
105 };
106
107 static constexpr std::array<size_t, 32> SUBRELATION_PARTIAL_LENGTHS{
108 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,
109 };
110 static_assert(NUM_SUBRELATIONS == SUBRELATION_PARTIAL_LENGTHS.size());
111
112 template <typename ContainerOverSubrelations, typename AllEntities, typename Parameters>
113 static void accumulate(ContainerOverSubrelations& accumulator,
114 const AllEntities& in,
115 const Parameters& /* unused */,
116 const FF& scaling_factor);
117
118 static constexpr FF get_curve_b()
119 {
120 if constexpr (FF::modulus == bb::fq::modulus) {
121 return bb::g1::curve_b;
122 } else if constexpr (FF::modulus == grumpkin::fq::modulus) {
124 } else {
125 static_assert(!std::is_same_v<FF, FF>, "Unsupported field type for ECC transcript relation");
126 }
127 }
128};
129
131
132} // 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