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_GENERATOR_INDEX__PUBLIC_CALLDATA = FF(43);
19 const auto calldata_hashing_LATCH_CONDITION = in.get(C::calldata_hashing_latch) + in.get(C::precomputed_first_row);
20 const auto calldata_hashing_PADDING_1 =
21 in.get(C::calldata_hashing_sel) * (FF(1) - in.get(C::calldata_hashing_sel_not_padding_1));
22 const auto calldata_hashing_PADDING_2 =
23 in.get(C::calldata_hashing_sel) * (FF(1) - in.get(C::calldata_hashing_sel_not_padding_2));
24
25 { // TRACE_CONTINUITY
26 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
27 auto tmp = (FF(1) - static_cast<View>(in.get(C::precomputed_first_row))) *
28 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_sel))) *
29 static_cast<View>(in.get(C::calldata_hashing_sel_shift));
30 std::get<0>(evals) += (tmp * scaling_factor);
31 }
32 {
33 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
34 auto tmp = static_cast<View>(in.get(C::calldata_hashing_latch)) *
35 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_latch)));
36 std::get<1>(evals) += (tmp * scaling_factor);
37 }
38 { // SEL_TOGGLED_AT_LATCH
39 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
40 auto tmp = static_cast<View>(in.get(C::calldata_hashing_latch)) *
41 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_sel)));
42 std::get<2>(evals) += (tmp * scaling_factor);
43 }
44 { // ID_CONSISTENCY
45 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
46 auto tmp = (FF(1) - CView(calldata_hashing_LATCH_CONDITION)) *
47 (static_cast<View>(in.get(C::calldata_hashing_context_id_shift)) -
48 static_cast<View>(in.get(C::calldata_hashing_context_id)));
49 std::get<3>(evals) += (tmp * scaling_factor);
50 }
51 { // SIZE_CONSISTENCY
52 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
53 auto tmp = (FF(1) - CView(calldata_hashing_LATCH_CONDITION)) *
54 (static_cast<View>(in.get(C::calldata_hashing_calldata_size_shift)) -
55 static_cast<View>(in.get(C::calldata_hashing_calldata_size)));
56 std::get<4>(evals) += (tmp * scaling_factor);
57 }
58 {
59 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
60 auto tmp = static_cast<View>(in.get(C::calldata_hashing_start)) *
61 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_start)));
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 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_start))));
69 std::get<6>(evals) += (tmp * scaling_factor);
70 }
71 { // START_AFTER_LATCH
72 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
73 auto tmp =
74 static_cast<View>(in.get(C::calldata_hashing_sel_shift)) *
75 (static_cast<View>(in.get(C::calldata_hashing_start_shift)) - CView(calldata_hashing_LATCH_CONDITION));
76 std::get<7>(evals) += (tmp * scaling_factor);
77 }
78 { // START_INDEX_IS_ZERO
79 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
80 auto tmp = static_cast<View>(in.get(C::calldata_hashing_start)) *
81 static_cast<View>(in.get(C::calldata_hashing_index_0_));
82 std::get<8>(evals) += (tmp * scaling_factor);
83 }
84 { // START_IS_SEPARATOR
85 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
86 auto tmp = static_cast<View>(in.get(C::calldata_hashing_start)) *
87 (static_cast<View>(in.get(C::calldata_hashing_input_0_)) -
88 CView(constants_GENERATOR_INDEX__PUBLIC_CALLDATA));
89 std::get<9>(evals) += (tmp * scaling_factor);
90 }
91 { // INDEX_INCREMENTS
92 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
93 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel)) *
94 (FF(1) - CView(calldata_hashing_LATCH_CONDITION)) *
95 (static_cast<View>(in.get(C::calldata_hashing_index_0__shift)) -
96 (static_cast<View>(in.get(C::calldata_hashing_index_0_)) + FF(3)));
97 std::get<10>(evals) += (tmp * scaling_factor);
98 }
99 { // INDEX_INCREMENTS_1
100 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
101 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel)) *
102 (static_cast<View>(in.get(C::calldata_hashing_index_1_)) -
103 (static_cast<View>(in.get(C::calldata_hashing_index_0_)) + FF(1)));
104 std::get<11>(evals) += (tmp * scaling_factor);
105 }
106 { // INDEX_INCREMENTS_2
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_2_)) -
110 (static_cast<View>(in.get(C::calldata_hashing_index_1_)) + FF(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::calldata_hashing_sel_not_padding_1)) *
116 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_1)));
117 std::get<13>(evals) += (tmp * scaling_factor);
118 }
119 {
120 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
121 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_2)) *
122 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_2)));
123 std::get<14>(evals) += (tmp * scaling_factor);
124 }
125 { // PADDED_BY_ZERO_1
126 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
127 auto tmp = CView(calldata_hashing_PADDING_1) * static_cast<View>(in.get(C::calldata_hashing_input_1_));
128 std::get<15>(evals) += (tmp * scaling_factor);
129 }
130 { // PADDED_BY_ZERO_2
131 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
132 auto tmp = CView(calldata_hashing_PADDING_2) * static_cast<View>(in.get(C::calldata_hashing_input_2_));
133 std::get<16>(evals) += (tmp * scaling_factor);
134 }
135 { // PADDING_CONSISTENCY
136 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
137 auto tmp = CView(calldata_hashing_PADDING_1) * static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_2));
138 std::get<17>(evals) += (tmp * scaling_factor);
139 }
140 { // PADDING_END
141 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
142 auto tmp = CView(calldata_hashing_PADDING_2) * (FF(1) - static_cast<View>(in.get(C::calldata_hashing_latch)));
143 std::get<18>(evals) += (tmp * scaling_factor);
144 }
145 { // CHECK_FINAL_INDEX
146 using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
147 auto tmp = static_cast<View>(in.get(C::calldata_hashing_latch)) *
148 (static_cast<View>(in.get(C::calldata_hashing_calldata_size)) -
149 (CView(calldata_hashing_PADDING_1) * static_cast<View>(in.get(C::calldata_hashing_index_0_)) +
150 (CView(calldata_hashing_PADDING_2) - CView(calldata_hashing_PADDING_1)) *
151 static_cast<View>(in.get(C::calldata_hashing_index_1_)) +
152 static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_2)) *
153 static_cast<View>(in.get(C::calldata_hashing_index_2_))));
154 std::get<19>(evals) += (tmp * scaling_factor);
155 }
156 { // HASH_CONSISTENCY
157 using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
158 auto tmp = (FF(1) - CView(calldata_hashing_LATCH_CONDITION)) *
159 (static_cast<View>(in.get(C::calldata_hashing_output_hash_shift)) -
160 static_cast<View>(in.get(C::calldata_hashing_output_hash)));
161 std::get<20>(evals) += (tmp * scaling_factor);
162 }
163 { // CALLDATA_HASH_INPUT_LENGTH_FIELDS
164 using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
165 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel)) *
166 (static_cast<View>(in.get(C::calldata_hashing_input_len)) -
167 (static_cast<View>(in.get(C::calldata_hashing_calldata_size)) + FF(1)));
168 std::get<21>(evals) += (tmp * scaling_factor);
169 }
170 { // ROUNDS_DECREMENT
171 using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View;
172 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel)) *
173 ((FF(1) - CView(calldata_hashing_LATCH_CONDITION)) *
174 ((static_cast<View>(in.get(C::calldata_hashing_rounds_rem_shift)) -
175 static_cast<View>(in.get(C::calldata_hashing_rounds_rem))) +
176 FF(1)) +
177 static_cast<View>(in.get(C::calldata_hashing_latch)) *
178 (static_cast<View>(in.get(C::calldata_hashing_rounds_rem)) - FF(1)));
179 std::get<22>(evals) += (tmp * scaling_factor);
180 }
181}
182
183} // 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.