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_GENERATOR_INDEX__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 =
70 (static_cast<View>(in.get(C::bc_hashing_sel)) + static_cast<View>(in.get(C::precomputed_first_row))) *
71 (static_cast<View>(in.get(C::bc_hashing_pc_index_shift)) -
72 (FF(1) - CView(bc_hashing_LATCH_CONDITION)) *
73 (FF(62) + static_cast<View>(in.get(C::bc_hashing_pc_index)) +
74 static_cast<View>(in.get(C::bc_hashing_sel_not_start)) * FF(31)));
75 std::get<7>(evals) += (tmp * scaling_factor);
76 }
77 { // PC_INCREMENTS_1
78 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
79 auto tmp =
80 static_cast<View>(in.get(C::bc_hashing_sel)) *
81 ((static_cast<View>(in.get(C::bc_hashing_pc_index_1)) -
82 static_cast<View>(in.get(C::bc_hashing_start)) * static_cast<View>(in.get(C::bc_hashing_pc_index))) -
83 static_cast<View>(in.get(C::bc_hashing_sel_not_start)) *
84 (static_cast<View>(in.get(C::bc_hashing_pc_index)) + FF(31)));
85 std::get<8>(evals) += (tmp * scaling_factor);
86 }
87 { // PC_INCREMENTS_2
88 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
89 auto tmp = static_cast<View>(in.get(C::bc_hashing_sel)) *
90 (static_cast<View>(in.get(C::bc_hashing_pc_index_2)) -
91 (static_cast<View>(in.get(C::bc_hashing_pc_index_1)) + FF(31)));
92 std::get<9>(evals) += (tmp * scaling_factor);
93 }
94 { // ID_PROPAGATION
95 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
96 auto tmp =
97 (FF(1) - CView(bc_hashing_LATCH_CONDITION)) * (static_cast<View>(in.get(C::bc_hashing_bytecode_id_shift)) -
98 static_cast<View>(in.get(C::bc_hashing_bytecode_id)));
99 std::get<10>(evals) += (tmp * scaling_factor);
100 }
101 { // START_IS_SEPARATOR
102 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
103 auto tmp =
104 static_cast<View>(in.get(C::bc_hashing_start)) * (static_cast<View>(in.get(C::bc_hashing_packed_fields_0)) -
105 CView(constants_GENERATOR_INDEX__PUBLIC_BYTECODE));
106 std::get<11>(evals) += (tmp * scaling_factor);
107 }
108 {
109 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
110 auto tmp = static_cast<View>(in.get(C::bc_hashing_sel_not_padding_1)) *
111 (FF(1) - static_cast<View>(in.get(C::bc_hashing_sel_not_padding_1)));
112 std::get<12>(evals) += (tmp * scaling_factor);
113 }
114 {
115 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
116 auto tmp = static_cast<View>(in.get(C::bc_hashing_sel_not_padding_2)) *
117 (FF(1) - static_cast<View>(in.get(C::bc_hashing_sel_not_padding_2)));
118 std::get<13>(evals) += (tmp * scaling_factor);
119 }
120 { // PADDING_CONSISTENCY
121 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
122 auto tmp = CView(bc_hashing_PADDING_1) * static_cast<View>(in.get(C::bc_hashing_sel_not_padding_2));
123 std::get<14>(evals) += (tmp * scaling_factor);
124 }
125 { // PADDING_END
126 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
127 auto tmp = CView(bc_hashing_PADDING_2) * (FF(1) - static_cast<View>(in.get(C::bc_hashing_latch)));
128 std::get<15>(evals) += (tmp * scaling_factor);
129 }
130 { // PADDED_BY_ZERO_1
131 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
132 auto tmp = CView(bc_hashing_PADDING_1) * static_cast<View>(in.get(C::bc_hashing_packed_fields_1));
133 std::get<16>(evals) += (tmp * scaling_factor);
134 }
135 { // PADDED_BY_ZERO_2
136 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
137 auto tmp = CView(bc_hashing_PADDING_2) * static_cast<View>(in.get(C::bc_hashing_packed_fields_2));
138 std::get<17>(evals) += (tmp * scaling_factor);
139 }
140 { // PADDING_CORRECTNESS
141 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
142 auto tmp = (static_cast<View>(in.get(C::bc_hashing_pc_at_final_field)) -
143 static_cast<View>(in.get(C::bc_hashing_latch)) *
144 (CView(bc_hashing_PADDING_1) * static_cast<View>(in.get(C::bc_hashing_pc_index)) +
145 (CView(bc_hashing_PADDING_2) - CView(bc_hashing_PADDING_1)) *
146 static_cast<View>(in.get(C::bc_hashing_pc_index_1)) +
147 static_cast<View>(in.get(C::bc_hashing_sel_not_padding_2)) *
148 static_cast<View>(in.get(C::bc_hashing_pc_index_2))));
149 std::get<18>(evals) += (tmp * scaling_factor);
150 }
151 { // BYTECODE_LENGTH_FIELDS
152 using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
153 auto tmp = static_cast<View>(in.get(C::bc_hashing_latch)) *
154 (FF(31) * (static_cast<View>(in.get(C::bc_hashing_input_len)) - FF(2)) -
155 static_cast<View>(in.get(C::bc_hashing_pc_at_final_field)));
156 std::get<19>(evals) += (tmp * scaling_factor);
157 }
158 { // ROUNDS_DECREMENT
159 using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
160 auto tmp =
161 static_cast<View>(in.get(C::bc_hashing_sel)) *
162 ((FF(1) - CView(bc_hashing_LATCH_CONDITION)) * ((static_cast<View>(in.get(C::bc_hashing_rounds_rem_shift)) -
163 static_cast<View>(in.get(C::bc_hashing_rounds_rem))) +
164 FF(1)) +
165 static_cast<View>(in.get(C::bc_hashing_latch)) *
166 (static_cast<View>(in.get(C::bc_hashing_rounds_rem)) - FF(1)));
167 std::get<20>(evals) += (tmp * scaling_factor);
168 }
169 { // HASH_IS_ID
170 using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
171 auto tmp =
172 static_cast<View>(in.get(C::bc_hashing_sel)) * (static_cast<View>(in.get(C::bc_hashing_bytecode_id)) -
173 static_cast<View>(in.get(C::bc_hashing_output_hash)));
174 std::get<21>(evals) += (tmp * scaling_factor);
175 }
176}
177
178} // 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.