Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
keccak_memory.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 keccak_memoryImpl {
14 public:
15 using FF = FF_;
16
17 static constexpr std::array<size_t, 46> SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 4, 3, 5, 3, 4, 3,
18 3, 3, 3, 4, 3, 3, 3, 5, 3, 3, 3, 3,
19 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
20 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 };
21
22 template <typename AllEntities> inline static bool skip(const AllEntities& in)
23 {
24 using C = ColumnAndShifts;
25
26 return (in.get(C::keccak_memory_sel)).is_zero();
27 }
28
29 template <typename ContainerOverSubrelations, typename AllEntities>
30 void static accumulate(ContainerOverSubrelations& evals,
31 const AllEntities& in,
32 [[maybe_unused]] const RelationParameters<FF>&,
33 [[maybe_unused]] const FF& scaling_factor);
34};
35
36template <typename FF> class keccak_memory : public Relation<keccak_memoryImpl<FF>> {
37 public:
38 static constexpr const std::string_view NAME = "keccak_memory";
39
40 // Subrelation indices constants, to be used in tests.
41 static constexpr size_t SR_CTR_INIT = 3;
42 static constexpr size_t SR_RW_READ_INIT = 4;
43 static constexpr size_t SR_RW_WRITE_INIT = 5;
44 static constexpr size_t SR_SEL_CTR_NON_ZERO = 6;
45 static constexpr size_t SR_CTR_END = 8;
46 static constexpr size_t SR_LAST = 9;
47 static constexpr size_t SR_CTR_INCREMENT = 10;
48 static constexpr size_t SR_NO_TAG_ERROR_ON_WRITE = 12;
49 static constexpr size_t SR_TAG_ERROR_INIT = 13;
50 static constexpr size_t SR_TAG_ERROR_PROPAGATION = 14;
51 static constexpr size_t SR_MEM_ADDR_INCREMENT = 15;
52 static constexpr size_t SR_SPACEID_PROPAGATION = 16;
53 static constexpr size_t SR_CLK_PROPAGATION = 17;
54 static constexpr size_t SR_RW_PROPAGATION = 18;
55 static constexpr size_t SR_SINGLE_TAG_ERROR = 19;
56 static constexpr size_t SR_SINGLE_TAG_ERROR_BOOLEAN = 20;
57 static constexpr size_t SR_VAL01 = 21;
58 static constexpr size_t SR_VAL02 = 22;
59 static constexpr size_t SR_VAL03 = 23;
60 static constexpr size_t SR_VAL04 = 24;
61 static constexpr size_t SR_VAL10 = 25;
62 static constexpr size_t SR_VAL11 = 26;
63 static constexpr size_t SR_VAL12 = 27;
64 static constexpr size_t SR_VAL13 = 28;
65 static constexpr size_t SR_VAL14 = 29;
66 static constexpr size_t SR_VAL20 = 30;
67 static constexpr size_t SR_VAL21 = 31;
68 static constexpr size_t SR_VAL22 = 32;
69 static constexpr size_t SR_VAL23 = 33;
70 static constexpr size_t SR_VAL24 = 34;
71 static constexpr size_t SR_VAL30 = 35;
72 static constexpr size_t SR_VAL31 = 36;
73 static constexpr size_t SR_VAL32 = 37;
74 static constexpr size_t SR_VAL33 = 38;
75 static constexpr size_t SR_VAL34 = 39;
76 static constexpr size_t SR_VAL40 = 40;
77 static constexpr size_t SR_VAL41 = 41;
78 static constexpr size_t SR_VAL42 = 42;
79 static constexpr size_t SR_VAL43 = 43;
80 static constexpr size_t SR_VAL44 = 44;
81
82 static std::string get_subrelation_label(size_t index)
83 {
84 switch (index) {
85 case SR_CTR_INIT:
86 return "CTR_INIT";
87 case SR_RW_READ_INIT:
88 return "RW_READ_INIT";
90 return "RW_WRITE_INIT";
92 return "SEL_CTR_NON_ZERO";
93 case SR_CTR_END:
94 return "CTR_END";
95 case SR_LAST:
96 return "LAST";
98 return "CTR_INCREMENT";
100 return "NO_TAG_ERROR_ON_WRITE";
102 return "TAG_ERROR_INIT";
104 return "TAG_ERROR_PROPAGATION";
106 return "MEM_ADDR_INCREMENT";
108 return "SPACEID_PROPAGATION";
110 return "CLK_PROPAGATION";
112 return "RW_PROPAGATION";
114 return "SINGLE_TAG_ERROR";
116 return "SINGLE_TAG_ERROR_BOOLEAN";
117 case SR_VAL01:
118 return "VAL01";
119 case SR_VAL02:
120 return "VAL02";
121 case SR_VAL03:
122 return "VAL03";
123 case SR_VAL04:
124 return "VAL04";
125 case SR_VAL10:
126 return "VAL10";
127 case SR_VAL11:
128 return "VAL11";
129 case SR_VAL12:
130 return "VAL12";
131 case SR_VAL13:
132 return "VAL13";
133 case SR_VAL14:
134 return "VAL14";
135 case SR_VAL20:
136 return "VAL20";
137 case SR_VAL21:
138 return "VAL21";
139 case SR_VAL22:
140 return "VAL22";
141 case SR_VAL23:
142 return "VAL23";
143 case SR_VAL24:
144 return "VAL24";
145 case SR_VAL30:
146 return "VAL30";
147 case SR_VAL31:
148 return "VAL31";
149 case SR_VAL32:
150 return "VAL32";
151 case SR_VAL33:
152 return "VAL33";
153 case SR_VAL34:
154 return "VAL34";
155 case SR_VAL40:
156 return "VAL40";
157 case SR_VAL41:
158 return "VAL41";
159 case SR_VAL42:
160 return "VAL42";
161 case SR_VAL43:
162 return "VAL43";
163 case SR_VAL44:
164 return "VAL44";
165 }
166 return std::to_string(index);
167 }
168};
169
170} // 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_VAL12
static constexpr size_t SR_VAL41
static constexpr size_t SR_VAL13
static constexpr size_t SR_VAL43
static constexpr size_t SR_VAL33
static constexpr size_t SR_VAL34
static std::string get_subrelation_label(size_t index)
static constexpr size_t SR_VAL11
static constexpr const std::string_view NAME
static constexpr size_t SR_VAL10
static constexpr size_t SR_VAL20
static constexpr size_t SR_CTR_INIT
static constexpr size_t SR_CLK_PROPAGATION
static constexpr size_t SR_LAST
static constexpr size_t SR_SINGLE_TAG_ERROR
static constexpr size_t SR_VAL30
static constexpr size_t SR_VAL03
static constexpr size_t SR_VAL21
static constexpr size_t SR_VAL24
static constexpr size_t SR_VAL40
static constexpr size_t SR_SINGLE_TAG_ERROR_BOOLEAN
static constexpr size_t SR_VAL14
static constexpr size_t SR_RW_WRITE_INIT
static constexpr size_t SR_VAL44
static constexpr size_t SR_VAL04
static constexpr size_t SR_NO_TAG_ERROR_ON_WRITE
static constexpr size_t SR_TAG_ERROR_PROPAGATION
static constexpr size_t SR_VAL32
static constexpr size_t SR_VAL31
static constexpr size_t SR_RW_READ_INIT
static constexpr size_t SR_SEL_CTR_NON_ZERO
static constexpr size_t SR_VAL42
static constexpr size_t SR_VAL22
static constexpr size_t SR_CTR_INCREMENT
static constexpr size_t SR_CTR_END
static constexpr size_t SR_VAL01
static constexpr size_t SR_SPACEID_PROPAGATION
static constexpr size_t SR_TAG_ERROR_INIT
static constexpr size_t SR_MEM_ADDR_INCREMENT
static constexpr size_t SR_VAL02
static constexpr size_t SR_RW_PROPAGATION
static constexpr size_t SR_VAL23
static bool skip(const AllEntities &in)
static constexpr std::array< size_t, 46 > SUBRELATION_PARTIAL_LENGTHS
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
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.