Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ecc_set_relation.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
7#pragma once
8#include <array>
9#include <tuple>
10
14
15namespace bb {
16
17template <typename FF_> class ECCVMSetRelationImpl {
18 public:
19 using FF = FF_;
20
21 static constexpr std::array<size_t, 2> SUBRELATION_PARTIAL_LENGTHS{
22 22, // grand product construction sub-relation
23 3 // left-shiftable polynomial sub-relation
24 };
25
26 template <typename AllEntities> inline static bool skip(const AllEntities& in)
27 {
28 // If z_perm == z_perm_shift, this implies that none of the wire values for the present input are involved in
29 // non-trivial copy constraints. The value of `transcript_mul` can be non-zero at the end of an MSM of
30 // points-at-infinity, which will cause `full_msm_count` to be non-zero while `transcript_msm_count` vanishes.
31 // Therefore, we add this as a skip condition.
32 return (in.z_perm - in.z_perm_shift).is_zero() && in.transcript_mul.is_zero() && in.lagrange_last.is_zero();
33 }
34
35 template <typename Accumulator> static Accumulator convert_to_wnaf(const auto& s0, const auto& s1)
36 {
37 auto t = s0 + s0;
38 t += t;
39 t += s1;
40
41 auto naf = t + t - 15;
42 return naf;
43 }
44
45 inline static auto& get_grand_product_polynomial(auto& input) { return input.z_perm; }
46 inline static auto& get_shifted_grand_product_polynomial(auto& input) { return input.z_perm_shift; }
47
48 template <typename Accumulator, typename AllEntities, typename Parameters>
49 static Accumulator compute_grand_product_numerator(const AllEntities& in, const Parameters& params);
50
51 template <typename Accumulator, typename AllEntities, typename Parameters>
52 static Accumulator compute_grand_product_denominator(const AllEntities& in, const Parameters& params);
53
54 template <typename ContainerOverSubrelations, typename AllEntities, typename Parameters>
55 static void accumulate(ContainerOverSubrelations& accumulator,
56 const AllEntities& in,
57 const Parameters& params,
58 const FF& scaling_factor);
59};
60
62
63} // namespace bb
static Accumulator convert_to_wnaf(const auto &s0, const auto &s1)
static auto & get_shifted_grand_product_polynomial(auto &input)
static auto & get_grand_product_polynomial(auto &input)
static bool skip(const AllEntities &in)
static constexpr std::array< size_t, 2 > SUBRELATION_PARTIAL_LENGTHS
static Accumulator compute_grand_product_denominator(const AllEntities &in, const Parameters &params)
static Accumulator compute_grand_product_numerator(const AllEntities &in, const Parameters &params)
Performs list-equivalence checks for the ECCVM.
static void accumulate(ContainerOverSubrelations &accumulator, const AllEntities &in, const Parameters &params, const FF &scaling_factor)
Expression for the standard arithmetic gate. @dbetails The relation is defined as C(in(X)....
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
Entry point for Barretenberg command-line interface.
typename Flavor::FF FF