Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bc_hashing.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
4#include <string_view>
5
10
11namespace bb::avm2 {
12
13template <typename FF_> class bc_hashingImpl {
14 public:
15 using FF = FF_;
16
17 static constexpr std::array<size_t, 22> SUBRELATION_PARTIAL_LENGTHS = { 3, 4, 3, 3, 3, 3, 3, 4, 4, 3, 3,
18 3, 3, 3, 4, 4, 4, 4, 5, 3, 4, 3 };
19
20 template <typename AllEntities> inline static bool skip(const AllEntities& in)
21 {
22 using C = ColumnAndShifts;
23
24 return (in.get(C::bc_hashing_sel)).is_zero();
25 }
26
27 template <typename ContainerOverSubrelations, typename AllEntities>
28 void static accumulate(ContainerOverSubrelations& evals,
29 const AllEntities& in,
30 [[maybe_unused]] const RelationParameters<FF>&,
31 [[maybe_unused]] const FF& scaling_factor);
32};
33
34template <typename FF> class bc_hashing : public Relation<bc_hashingImpl<FF>> {
35 public:
36 static constexpr const std::string_view NAME = "bc_hashing";
37
38 // Subrelation indices constants, to be used in tests.
39 static constexpr size_t SR_TRACE_CONTINUITY = 1;
40 static constexpr size_t SR_SEL_TOGGLED_AT_LATCH = 3;
41 static constexpr size_t SR_START_AFTER_LATCH = 6;
42 static constexpr size_t SR_PC_INCREMENTS = 7;
43 static constexpr size_t SR_PC_INCREMENTS_1 = 8;
44 static constexpr size_t SR_PC_INCREMENTS_2 = 9;
45 static constexpr size_t SR_ID_PROPAGATION = 10;
46 static constexpr size_t SR_START_IS_SEPARATOR = 11;
47 static constexpr size_t SR_PADDING_CONSISTENCY = 14;
48 static constexpr size_t SR_PADDING_END = 15;
49 static constexpr size_t SR_PADDED_BY_ZERO_1 = 16;
50 static constexpr size_t SR_PADDED_BY_ZERO_2 = 17;
51 static constexpr size_t SR_PADDING_CORRECTNESS = 18;
52 static constexpr size_t SR_BYTECODE_LENGTH_FIELDS = 19;
53 static constexpr size_t SR_ROUNDS_DECREMENT = 20;
54 static constexpr size_t SR_HASH_IS_ID = 21;
55
56 static std::string get_subrelation_label(size_t index)
57 {
58 switch (index) {
60 return "TRACE_CONTINUITY";
62 return "SEL_TOGGLED_AT_LATCH";
64 return "START_AFTER_LATCH";
66 return "PC_INCREMENTS";
68 return "PC_INCREMENTS_1";
70 return "PC_INCREMENTS_2";
72 return "ID_PROPAGATION";
74 return "START_IS_SEPARATOR";
76 return "PADDING_CONSISTENCY";
77 case SR_PADDING_END:
78 return "PADDING_END";
80 return "PADDED_BY_ZERO_1";
82 return "PADDED_BY_ZERO_2";
84 return "PADDING_CORRECTNESS";
86 return "BYTECODE_LENGTH_FIELDS";
88 return "ROUNDS_DECREMENT";
89 case SR_HASH_IS_ID:
90 return "HASH_IS_ID";
91 }
92 return std::to_string(index);
93 }
94};
95
96} // namespace bb::avm2
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
static constexpr size_t SR_SEL_TOGGLED_AT_LATCH
static constexpr size_t SR_PADDING_CONSISTENCY
static constexpr size_t SR_ROUNDS_DECREMENT
static constexpr size_t SR_PADDING_END
static constexpr size_t SR_PC_INCREMENTS_2
static constexpr size_t SR_TRACE_CONTINUITY
static constexpr const std::string_view NAME
static constexpr size_t SR_START_AFTER_LATCH
static constexpr size_t SR_PADDED_BY_ZERO_2
static constexpr size_t SR_PADDING_CORRECTNESS
static constexpr size_t SR_HASH_IS_ID
static constexpr size_t SR_START_IS_SEPARATOR
static constexpr size_t SR_ID_PROPAGATION
static constexpr size_t SR_PADDED_BY_ZERO_1
static std::string get_subrelation_label(size_t index)
static constexpr size_t SR_PC_INCREMENTS
static constexpr size_t SR_BYTECODE_LENGTH_FIELDS
static constexpr size_t SR_PC_INCREMENTS_1
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
static constexpr std::array< size_t, 22 > SUBRELATION_PARTIAL_LENGTHS
static bool skip(const AllEntities &in)
ColumnAndShifts
Definition columns.hpp:34
AvmFlavorSettings::FF FF
Definition field.hpp:10
std::string to_string(bb::avm2::ValueTag tag)
Container for parameters used by the grand product (permutation, lookup) Honk relations.