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 = 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)) * (static_cast<View>(in.get(C::bc_hashing_packed_fields_0)) -
104 CView(constants_GENERATOR_INDEX__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 { // PADDING_CONSISTENCY
120 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
121 auto tmp = CView(bc_hashing_PADDING_1) * static_cast<View>(in.get(C::bc_hashing_sel_not_padding_2));
122 std::get<14>(evals) += (tmp * scaling_factor);
123 }
124 { // PADDING_END
125 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
126 auto tmp = CView(bc_hashing_PADDING_2) * (FF(1) - static_cast<View>(in.get(C::bc_hashing_latch)));
127 std::get<15>(evals) += (tmp * scaling_factor);
128 }
129 { // PADDED_BY_ZERO_1
130 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
131 auto tmp = CView(bc_hashing_PADDING_1) * static_cast<View>(in.get(C::bc_hashing_packed_fields_1));
132 std::get<16>(evals) += (tmp * scaling_factor);
133 }
134 { // PADDED_BY_ZERO_2
135 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
136 auto tmp = CView(bc_hashing_PADDING_2) * static_cast<View>(in.get(C::bc_hashing_packed_fields_2));
137 std::get<17>(evals) += (tmp * scaling_factor);
138 }
139 { // PADDING_CORRECTNESS
140 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
141 auto tmp = (static_cast<View>(in.get(C::bc_hashing_pc_at_final_field)) -
142 static_cast<View>(in.get(C::bc_hashing_latch)) *
143 (CView(bc_hashing_PADDING_1) * static_cast<View>(in.get(C::bc_hashing_pc_index)) +
144 (CView(bc_hashing_PADDING_2) - CView(bc_hashing_PADDING_1)) *
145 static_cast<View>(in.get(C::bc_hashing_pc_index_1)) +
146 static_cast<View>(in.get(C::bc_hashing_sel_not_padding_2)) *
147 static_cast<View>(in.get(C::bc_hashing_pc_index_2))));
148 std::get<18>(evals) += (tmp * scaling_factor);
149 }
150 { // BYTECODE_LENGTH_FIELDS
151 using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
152 auto tmp = static_cast<View>(in.get(C::bc_hashing_latch)) *
153 (FF(31) * (static_cast<View>(in.get(C::bc_hashing_input_len)) - FF(2)) -
154 static_cast<View>(in.get(C::bc_hashing_pc_at_final_field)));
155 std::get<19>(evals) += (tmp * scaling_factor);
156 }
157 { // ROUNDS_DECREMENT
158 using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
159 auto tmp =
160 static_cast<View>(in.get(C::bc_hashing_sel)) *
161 ((FF(1) - CView(bc_hashing_LATCH_CONDITION)) * ((static_cast<View>(in.get(C::bc_hashing_rounds_rem_shift)) -
162 static_cast<View>(in.get(C::bc_hashing_rounds_rem))) +
163 FF(1)) +
164 static_cast<View>(in.get(C::bc_hashing_latch)) *
165 (static_cast<View>(in.get(C::bc_hashing_rounds_rem)) - FF(1)));
166 std::get<20>(evals) += (tmp * scaling_factor);
167 }
168 { // HASH_IS_ID
169 using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
170 auto tmp =
171 static_cast<View>(in.get(C::bc_hashing_sel)) * (static_cast<View>(in.get(C::bc_hashing_bytecode_id)) -
172 static_cast<View>(in.get(C::bc_hashing_output_hash)));
173 std::get<21>(evals) += (tmp * scaling_factor);
174 }
175}
176
177} // 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.