Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
calldata_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 calldata_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_CALLDATA = FF(2760353947UL);
19 const auto calldata_hashing_LATCH_CONDITION = in.get(C::calldata_hashing_end) + in.get(C::precomputed_first_row);
20 const auto calldata_hashing_PADDING_1 =
21 (in.get(C::calldata_hashing_sel) - in.get(C::calldata_hashing_sel_not_padding_1));
22 const auto calldata_hashing_PADDING_2 =
23 (in.get(C::calldata_hashing_sel) - in.get(C::calldata_hashing_sel_not_padding_2));
24
25 {
26 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
27 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel)) *
28 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_sel)));
29 std::get<0>(evals) += (tmp * scaling_factor);
30 }
31 {
32 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
33 auto tmp = static_cast<View>(in.get(C::calldata_hashing_start)) *
34 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_start)));
35 std::get<1>(evals) += (tmp * scaling_factor);
36 }
37 {
38 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
39 auto tmp = static_cast<View>(in.get(C::calldata_hashing_end)) *
40 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_end)));
41 std::get<2>(evals) += (tmp * scaling_factor);
42 }
43 { // SEL_ON_START_OR_END
44 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
45 auto tmp = (static_cast<View>(in.get(C::calldata_hashing_start)) +
46 static_cast<View>(in.get(C::calldata_hashing_end))) *
47 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_sel)));
48 std::get<3>(evals) += (tmp * scaling_factor);
49 }
50 { // TRACE_CONTINUITY
51 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
52 auto tmp = (FF(1) - CView(calldata_hashing_LATCH_CONDITION)) *
53 (static_cast<View>(in.get(C::calldata_hashing_sel)) -
54 static_cast<View>(in.get(C::calldata_hashing_sel_shift)));
55 std::get<4>(evals) += (tmp * scaling_factor);
56 }
57 { // START_AFTER_LATCH
58 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
59 auto tmp =
60 static_cast<View>(in.get(C::calldata_hashing_sel_shift)) *
61 (static_cast<View>(in.get(C::calldata_hashing_start_shift)) - CView(calldata_hashing_LATCH_CONDITION));
62 std::get<5>(evals) += (tmp * scaling_factor);
63 }
64 {
65 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
66 auto tmp = (static_cast<View>(in.get(C::calldata_hashing_sel_not_start)) -
67 (static_cast<View>(in.get(C::calldata_hashing_sel)) -
68 static_cast<View>(in.get(C::calldata_hashing_start))));
69 std::get<6>(evals) += (tmp * scaling_factor);
70 }
71 { // ID_CONSISTENCY
72 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
73 auto tmp = (FF(1) - CView(calldata_hashing_LATCH_CONDITION)) *
74 (static_cast<View>(in.get(C::calldata_hashing_context_id_shift)) -
75 static_cast<View>(in.get(C::calldata_hashing_context_id)));
76 std::get<7>(evals) += (tmp * scaling_factor);
77 }
78 { // SIZE_CONSISTENCY
79 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
80 auto tmp = (FF(1) - CView(calldata_hashing_LATCH_CONDITION)) *
81 (static_cast<View>(in.get(C::calldata_hashing_calldata_size_shift)) -
82 static_cast<View>(in.get(C::calldata_hashing_calldata_size)));
83 std::get<8>(evals) += (tmp * scaling_factor);
84 }
85 { // START_INDEX_IS_ZERO
86 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
87 auto tmp = static_cast<View>(in.get(C::calldata_hashing_start)) *
88 static_cast<View>(in.get(C::calldata_hashing_index_0_));
89 std::get<9>(evals) += (tmp * scaling_factor);
90 }
91 { // START_IS_SEPARATOR
92 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
93 auto tmp =
94 static_cast<View>(in.get(C::calldata_hashing_start)) *
95 (static_cast<View>(in.get(C::calldata_hashing_input_0_)) - CView(constants_DOM_SEP__PUBLIC_CALLDATA));
96 std::get<10>(evals) += (tmp * scaling_factor);
97 }
98 { // INDEX_INCREMENTS
99 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
100 auto tmp =
101 (static_cast<View>(in.get(C::calldata_hashing_sel)) - static_cast<View>(in.get(C::calldata_hashing_end))) *
102 (static_cast<View>(in.get(C::calldata_hashing_index_0__shift)) -
103 (static_cast<View>(in.get(C::calldata_hashing_index_0_)) + FF(3)));
104 std::get<11>(evals) += (tmp * scaling_factor);
105 }
106 { // INDEX_INCREMENTS_1
107 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
108 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel)) *
109 (static_cast<View>(in.get(C::calldata_hashing_index_1_)) -
110 (static_cast<View>(in.get(C::calldata_hashing_index_0_)) + FF(1)));
111 std::get<12>(evals) += (tmp * scaling_factor);
112 }
113 { // INDEX_INCREMENTS_2
114 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
115 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel)) *
116 (static_cast<View>(in.get(C::calldata_hashing_index_2_)) -
117 (static_cast<View>(in.get(C::calldata_hashing_index_1_)) + FF(1)));
118 std::get<13>(evals) += (tmp * scaling_factor);
119 }
120 {
121 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
122 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_1)) *
123 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_1)));
124 std::get<14>(evals) += (tmp * scaling_factor);
125 }
126 {
127 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
128 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_2)) *
129 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_2)));
130 std::get<15>(evals) += (tmp * scaling_factor);
131 }
132 { // PADDED_BY_ZERO_1
133 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
134 auto tmp = CView(calldata_hashing_PADDING_1) * static_cast<View>(in.get(C::calldata_hashing_input_1_));
135 std::get<16>(evals) += (tmp * scaling_factor);
136 }
137 { // PADDED_BY_ZERO_2
138 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
139 auto tmp = CView(calldata_hashing_PADDING_2) * static_cast<View>(in.get(C::calldata_hashing_input_2_));
140 std::get<17>(evals) += (tmp * scaling_factor);
141 }
142 { // PADDING_CONSISTENCY
143 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
144 auto tmp = CView(calldata_hashing_PADDING_1) * static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_2));
145 std::get<18>(evals) += (tmp * scaling_factor);
146 }
147 { // PADDING_END
148 using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
149 auto tmp = CView(calldata_hashing_PADDING_2) * (FF(1) - static_cast<View>(in.get(C::calldata_hashing_end)));
150 std::get<19>(evals) += (tmp * scaling_factor);
151 }
152 { // CHECK_FINAL_INDEX
153 using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
154 auto tmp = static_cast<View>(in.get(C::calldata_hashing_end)) *
155 (static_cast<View>(in.get(C::calldata_hashing_calldata_size)) -
156 (CView(calldata_hashing_PADDING_1) * static_cast<View>(in.get(C::calldata_hashing_index_0_)) +
157 (CView(calldata_hashing_PADDING_2) - CView(calldata_hashing_PADDING_1)) *
158 static_cast<View>(in.get(C::calldata_hashing_index_1_)) +
159 static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_2)) *
160 static_cast<View>(in.get(C::calldata_hashing_index_2_))));
161 std::get<20>(evals) += (tmp * scaling_factor);
162 }
163 {
164 using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
165 auto tmp =
166 (static_cast<View>(in.get(C::calldata_hashing_sel_end_not_empty)) -
167 static_cast<View>(in.get(C::calldata_hashing_end)) *
168 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_start)) * CView(calldata_hashing_PADDING_1)));
169 std::get<21>(evals) += (tmp * scaling_factor);
170 }
171 { // HASH_CONSISTENCY
172 using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View;
173 auto tmp = (FF(1) - CView(calldata_hashing_LATCH_CONDITION)) *
174 (static_cast<View>(in.get(C::calldata_hashing_output_hash_shift)) -
175 static_cast<View>(in.get(C::calldata_hashing_output_hash)));
176 std::get<22>(evals) += (tmp * scaling_factor);
177 }
178 { // CALLDATA_HASH_INPUT_LENGTH_FIELDS
179 using View = typename std::tuple_element_t<23, ContainerOverSubrelations>::View;
180 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel)) *
181 (static_cast<View>(in.get(C::calldata_hashing_input_len)) -
182 (static_cast<View>(in.get(C::calldata_hashing_calldata_size)) + FF(1)));
183 std::get<23>(evals) += (tmp * scaling_factor);
184 }
185 { // ROUNDS_DECREMENT
186 using View = typename std::tuple_element_t<24, ContainerOverSubrelations>::View;
187 auto tmp =
188 ((static_cast<View>(in.get(C::calldata_hashing_sel)) - static_cast<View>(in.get(C::calldata_hashing_end))) *
189 ((static_cast<View>(in.get(C::calldata_hashing_rounds_rem_shift)) -
190 static_cast<View>(in.get(C::calldata_hashing_rounds_rem))) +
191 FF(1)) +
192 static_cast<View>(in.get(C::calldata_hashing_end)) *
193 (static_cast<View>(in.get(C::calldata_hashing_rounds_rem)) - FF(1)));
194 std::get<24>(evals) += (tmp * scaling_factor);
195 }
196}
197
198} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
AvmFlavorSettings::FF FF
Definition field.hpp:10
ColumnAndShifts
Definition columns.hpp:34
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.