Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bc_hashing_impl.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
6
7namespace bb::avm2 {
8
9template <typename FF_>
10template <typename ContainerOverSubrelations, typename AllEntities>
11void bc_hashingImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
12 const AllEntities& in,
13 [[maybe_unused]] const RelationParameters<FF_>&,
14 [[maybe_unused]] const FF_& scaling_factor)
15{
16 using C = ColumnAndShifts;
17
18 const auto constants_DOM_SEP__PUBLIC_BYTECODE = FF(60);
19 const auto bc_hashing_LATCH_CONDITION = in.get(C::bc_hashing_latch) + in.get(C::precomputed_first_row);
20 const auto bc_hashing_PADDING_1 = in.get(C::bc_hashing_sel) * (FF(1) - in.get(C::bc_hashing_sel_not_padding_1));
21 const auto bc_hashing_PADDING_2 = in.get(C::bc_hashing_sel) * (FF(1) - in.get(C::bc_hashing_sel_not_padding_2));
22
23 {
24 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
25 auto tmp =
26 static_cast<View>(in.get(C::bc_hashing_sel)) * (FF(1) - static_cast<View>(in.get(C::bc_hashing_sel)));
27 std::get<0>(evals) += (tmp * scaling_factor);
28 }
29 { // TRACE_CONTINUITY
30 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
31 auto tmp = (FF(1) - static_cast<View>(in.get(C::precomputed_first_row))) *
32 (FF(1) - static_cast<View>(in.get(C::bc_hashing_sel))) *
33 static_cast<View>(in.get(C::bc_hashing_sel_shift));
34 std::get<1>(evals) += (tmp * scaling_factor);
35 }
36 {
37 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
38 auto tmp =
39 static_cast<View>(in.get(C::bc_hashing_latch)) * (FF(1) - static_cast<View>(in.get(C::bc_hashing_latch)));
40 std::get<2>(evals) += (tmp * scaling_factor);
41 }
42 { // SEL_TOGGLED_AT_LATCH
43 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
44 auto tmp =
45 static_cast<View>(in.get(C::bc_hashing_latch)) * (FF(1) - static_cast<View>(in.get(C::bc_hashing_sel)));
46 std::get<3>(evals) += (tmp * scaling_factor);
47 }
48 {
49 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
50 auto tmp =
51 static_cast<View>(in.get(C::bc_hashing_start)) * (FF(1) - static_cast<View>(in.get(C::bc_hashing_start)));
52 std::get<4>(evals) += (tmp * scaling_factor);
53 }
54 {
55 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
56 auto tmp =
57 (static_cast<View>(in.get(C::bc_hashing_sel_not_start)) -
58 static_cast<View>(in.get(C::bc_hashing_sel)) * (FF(1) - static_cast<View>(in.get(C::bc_hashing_start))));
59 std::get<5>(evals) += (tmp * scaling_factor);
60 }
61 { // START_AFTER_LATCH
62 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
63 auto tmp = static_cast<View>(in.get(C::bc_hashing_sel_shift)) *
64 (static_cast<View>(in.get(C::bc_hashing_start_shift)) - CView(bc_hashing_LATCH_CONDITION));
65 std::get<6>(evals) += (tmp * scaling_factor);
66 }
67 { // PC_INCREMENTS
68 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
69 auto tmp = static_cast<View>(in.get(C::bc_hashing_sel_shift)) *
70 (static_cast<View>(in.get(C::bc_hashing_pc_index_shift)) -
71 (FF(1) - CView(bc_hashing_LATCH_CONDITION)) *
72 (FF(62) + static_cast<View>(in.get(C::bc_hashing_pc_index)) +
73 static_cast<View>(in.get(C::bc_hashing_sel_not_start)) * FF(31)));
74 std::get<7>(evals) += (tmp * scaling_factor);
75 }
76 { // PC_INCREMENTS_1
77 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
78 auto tmp =
79 static_cast<View>(in.get(C::bc_hashing_sel)) *
80 ((static_cast<View>(in.get(C::bc_hashing_pc_index_1)) -
81 static_cast<View>(in.get(C::bc_hashing_start)) * static_cast<View>(in.get(C::bc_hashing_pc_index))) -
82 static_cast<View>(in.get(C::bc_hashing_sel_not_start)) *
83 (static_cast<View>(in.get(C::bc_hashing_pc_index)) + FF(31)));
84 std::get<8>(evals) += (tmp * scaling_factor);
85 }
86 { // PC_INCREMENTS_2
87 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
88 auto tmp = static_cast<View>(in.get(C::bc_hashing_sel)) *
89 (static_cast<View>(in.get(C::bc_hashing_pc_index_2)) -
90 (static_cast<View>(in.get(C::bc_hashing_pc_index_1)) + FF(31)));
91 std::get<9>(evals) += (tmp * scaling_factor);
92 }
93 { // ID_PROPAGATION
94 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
95 auto tmp =
96 (FF(1) - CView(bc_hashing_LATCH_CONDITION)) * (static_cast<View>(in.get(C::bc_hashing_bytecode_id_shift)) -
97 static_cast<View>(in.get(C::bc_hashing_bytecode_id)));
98 std::get<10>(evals) += (tmp * scaling_factor);
99 }
100 { // START_IS_SEPARATOR
101 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
102 auto tmp =
103 static_cast<View>(in.get(C::bc_hashing_start)) *
104 (static_cast<View>(in.get(C::bc_hashing_packed_fields_0)) - CView(constants_DOM_SEP__PUBLIC_BYTECODE));
105 std::get<11>(evals) += (tmp * scaling_factor);
106 }
107 {
108 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
109 auto tmp = static_cast<View>(in.get(C::bc_hashing_sel_not_padding_1)) *
110 (FF(1) - static_cast<View>(in.get(C::bc_hashing_sel_not_padding_1)));
111 std::get<12>(evals) += (tmp * scaling_factor);
112 }
113 {
114 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
115 auto tmp = static_cast<View>(in.get(C::bc_hashing_sel_not_padding_2)) *
116 (FF(1) - static_cast<View>(in.get(C::bc_hashing_sel_not_padding_2)));
117 std::get<13>(evals) += (tmp * scaling_factor);
118 }
119 { // SEL_NOT_PADDING_1_REQUIRES_SEL
120 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
121 auto tmp = static_cast<View>(in.get(C::bc_hashing_sel_not_padding_1)) *
122 (FF(1) - static_cast<View>(in.get(C::bc_hashing_sel)));
123 std::get<14>(evals) += (tmp * scaling_factor);
124 }
125 { // SEL_NOT_PADDING_2_REQUIRES_SEL
126 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
127 auto tmp = static_cast<View>(in.get(C::bc_hashing_sel_not_padding_2)) *
128 (FF(1) - static_cast<View>(in.get(C::bc_hashing_sel)));
129 std::get<15>(evals) += (tmp * scaling_factor);
130 }
131 { // PADDING_CONSISTENCY
132 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
133 auto tmp = CView(bc_hashing_PADDING_1) * static_cast<View>(in.get(C::bc_hashing_sel_not_padding_2));
134 std::get<16>(evals) += (tmp * scaling_factor);
135 }
136 { // PADDING_END
137 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
138 auto tmp = CView(bc_hashing_PADDING_2) * (FF(1) - static_cast<View>(in.get(C::bc_hashing_latch)));
139 std::get<17>(evals) += (tmp * scaling_factor);
140 }
141 { // PADDED_BY_ZERO_1
142 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
143 auto tmp = CView(bc_hashing_PADDING_1) * static_cast<View>(in.get(C::bc_hashing_packed_fields_1));
144 std::get<18>(evals) += (tmp * scaling_factor);
145 }
146 { // PADDED_BY_ZERO_2
147 using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
148 auto tmp = CView(bc_hashing_PADDING_2) * static_cast<View>(in.get(C::bc_hashing_packed_fields_2));
149 std::get<19>(evals) += (tmp * scaling_factor);
150 }
151 { // PADDING_CORRECTNESS
152 using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
153 auto tmp = (static_cast<View>(in.get(C::bc_hashing_pc_at_final_field)) -
154 static_cast<View>(in.get(C::bc_hashing_latch)) *
155 (CView(bc_hashing_PADDING_1) * static_cast<View>(in.get(C::bc_hashing_pc_index)) +
156 (CView(bc_hashing_PADDING_2) - CView(bc_hashing_PADDING_1)) *
157 static_cast<View>(in.get(C::bc_hashing_pc_index_1)) +
158 static_cast<View>(in.get(C::bc_hashing_sel_not_padding_2)) *
159 static_cast<View>(in.get(C::bc_hashing_pc_index_2))));
160 std::get<20>(evals) += (tmp * scaling_factor);
161 }
162 { // BYTECODE_LENGTH_FIELDS
163 using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
164 auto tmp = static_cast<View>(in.get(C::bc_hashing_latch)) *
165 (FF(31) * (static_cast<View>(in.get(C::bc_hashing_input_len)) - FF(2)) -
166 static_cast<View>(in.get(C::bc_hashing_pc_at_final_field)));
167 std::get<21>(evals) += (tmp * scaling_factor);
168 }
169 { // ROUNDS_DECREMENT
170 using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View;
171 auto tmp =
172 static_cast<View>(in.get(C::bc_hashing_sel)) *
173 ((FF(1) - CView(bc_hashing_LATCH_CONDITION)) * ((static_cast<View>(in.get(C::bc_hashing_rounds_rem_shift)) -
174 static_cast<View>(in.get(C::bc_hashing_rounds_rem))) +
175 FF(1)) +
176 static_cast<View>(in.get(C::bc_hashing_latch)) *
177 (static_cast<View>(in.get(C::bc_hashing_rounds_rem)) - FF(1)));
178 std::get<22>(evals) += (tmp * scaling_factor);
179 }
180 { // HASH_IS_ID
181 using View = typename std::tuple_element_t<23, ContainerOverSubrelations>::View;
182 auto tmp =
183 static_cast<View>(in.get(C::bc_hashing_sel)) * (static_cast<View>(in.get(C::bc_hashing_bytecode_id)) -
184 static_cast<View>(in.get(C::bc_hashing_output_hash)));
185 std::get<23>(evals) += (tmp * scaling_factor);
186 }
187}
188
189} // namespace bb::avm2
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
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
#define CView(v)
Container for parameters used by the grand product (permutation, lookup) Honk relations.