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(260313585);
19 const auto bc_hashing_LATCH_CONDITION = in.get(C::bc_hashing_end) + in.get(C::precomputed_first_row);
20 const auto bc_hashing_FIRST_FIELD =
21 constants_DOM_SEP__PUBLIC_BYTECODE + in.get(C::bc_hashing_size_in_bytes) * FF(4294967296UL);
22 const auto bc_hashing_PADDING_1 = (in.get(C::bc_hashing_sel) - in.get(C::bc_hashing_sel_not_padding_1));
23 const auto bc_hashing_PADDING_2 = (in.get(C::bc_hashing_sel) - in.get(C::bc_hashing_sel_not_padding_2));
24
25 {
26 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
27 auto tmp =
28 static_cast<View>(in.get(C::bc_hashing_sel)) * (FF(1) - static_cast<View>(in.get(C::bc_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 =
34 static_cast<View>(in.get(C::bc_hashing_start)) * (FF(1) - static_cast<View>(in.get(C::bc_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 =
40 static_cast<View>(in.get(C::bc_hashing_end)) * (FF(1) - static_cast<View>(in.get(C::bc_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::bc_hashing_start)) + static_cast<View>(in.get(C::bc_hashing_end))) *
46 (FF(1) - static_cast<View>(in.get(C::bc_hashing_sel)));
47 std::get<3>(evals) += (tmp * scaling_factor);
48 }
49 { // TRACE_CONTINUITY
50 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
51 auto tmp = (FF(1) - CView(bc_hashing_LATCH_CONDITION)) *
52 (static_cast<View>(in.get(C::bc_hashing_sel)) - static_cast<View>(in.get(C::bc_hashing_sel_shift)));
53 std::get<4>(evals) += (tmp * scaling_factor);
54 }
55 { // START_AFTER_LATCH
56 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
57 auto tmp = static_cast<View>(in.get(C::bc_hashing_sel_shift)) *
58 (static_cast<View>(in.get(C::bc_hashing_start_shift)) - CView(bc_hashing_LATCH_CONDITION));
59 std::get<5>(evals) += (tmp * scaling_factor);
60 }
61 {
62 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
63 auto tmp = (static_cast<View>(in.get(C::bc_hashing_sel_not_start)) -
64 (static_cast<View>(in.get(C::bc_hashing_sel)) - static_cast<View>(in.get(C::bc_hashing_start))));
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_pc_index)) -
70 static_cast<View>(in.get(C::bc_hashing_sel_not_start)) *
71 (static_cast<View>(in.get(C::bc_hashing_pc_index_1)) - FF(31)));
72 std::get<7>(evals) += (tmp * scaling_factor);
73 }
74 { // PC_INCREMENTS_1
75 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
76 auto tmp = (static_cast<View>(in.get(C::bc_hashing_pc_index_1_shift)) -
77 static_cast<View>(in.get(C::bc_hashing_sel_not_start_shift)) *
78 (static_cast<View>(in.get(C::bc_hashing_pc_index_1)) + FF(93)));
79 std::get<8>(evals) += (tmp * scaling_factor);
80 }
81 { // PC_INCREMENTS_2
82 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
83 auto tmp = static_cast<View>(in.get(C::bc_hashing_sel)) *
84 (static_cast<View>(in.get(C::bc_hashing_pc_index_2)) -
85 (static_cast<View>(in.get(C::bc_hashing_pc_index_1)) + FF(31)));
86 std::get<9>(evals) += (tmp * scaling_factor);
87 }
88 { // ID_PROPAGATION
89 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
90 auto tmp =
91 (FF(1) - CView(bc_hashing_LATCH_CONDITION)) * (static_cast<View>(in.get(C::bc_hashing_bytecode_id_shift)) -
92 static_cast<View>(in.get(C::bc_hashing_bytecode_id)));
93 std::get<10>(evals) += (tmp * scaling_factor);
94 }
95 { // START_IS_FIRST_FIELD
96 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
97 auto tmp = static_cast<View>(in.get(C::bc_hashing_start)) *
98 (static_cast<View>(in.get(C::bc_hashing_packed_fields_0)) - CView(bc_hashing_FIRST_FIELD));
99 std::get<11>(evals) += (tmp * scaling_factor);
100 }
101 {
102 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
103 auto tmp = static_cast<View>(in.get(C::bc_hashing_sel_not_padding_1)) *
104 (FF(1) - static_cast<View>(in.get(C::bc_hashing_sel_not_padding_1)));
105 std::get<12>(evals) += (tmp * scaling_factor);
106 }
107 {
108 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
109 auto tmp = static_cast<View>(in.get(C::bc_hashing_sel_not_padding_2)) *
110 (FF(1) - static_cast<View>(in.get(C::bc_hashing_sel_not_padding_2)));
111 std::get<13>(evals) += (tmp * scaling_factor);
112 }
113 { // SEL_NOT_PADDING_REQUIRES_SEL
114 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
115 auto tmp = (static_cast<View>(in.get(C::bc_hashing_sel_not_padding_1)) +
116 static_cast<View>(in.get(C::bc_hashing_sel_not_padding_2))) *
117 (FF(1) - static_cast<View>(in.get(C::bc_hashing_sel)));
118 std::get<14>(evals) += (tmp * scaling_factor);
119 }
120 { // PADDING_CONSISTENCY
121 using View = typename std::tuple_element_t<15, 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<15>(evals) += (tmp * scaling_factor);
124 }
125 { // PADDING_END
126 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
127 auto tmp = CView(bc_hashing_PADDING_2) * (FF(1) - static_cast<View>(in.get(C::bc_hashing_end)));
128 std::get<16>(evals) += (tmp * scaling_factor);
129 }
130 { // PADDED_BY_ZERO_1
131 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
132 auto tmp = CView(bc_hashing_PADDING_1) * static_cast<View>(in.get(C::bc_hashing_packed_fields_1));
133 std::get<17>(evals) += (tmp * scaling_factor);
134 }
135 { // PADDED_BY_ZERO_2
136 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
137 auto tmp = CView(bc_hashing_PADDING_2) * static_cast<View>(in.get(C::bc_hashing_packed_fields_2));
138 std::get<18>(evals) += (tmp * scaling_factor);
139 }
140 { // PADDING_COMPUTATION
141 using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
142 auto tmp = static_cast<View>(in.get(C::bc_hashing_end)) *
143 ((static_cast<View>(in.get(C::bc_hashing_padding)) - CView(bc_hashing_PADDING_1)) -
144 CView(bc_hashing_PADDING_2));
145 std::get<19>(evals) += (tmp * scaling_factor);
146 }
147 { // PADDING_PROPAGATION
148 using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
149 auto tmp =
150 (FF(1) - CView(bc_hashing_LATCH_CONDITION)) *
151 (static_cast<View>(in.get(C::bc_hashing_padding_shift)) - static_cast<View>(in.get(C::bc_hashing_padding)));
152 std::get<20>(evals) += (tmp * scaling_factor);
153 }
154 { // BYTECODE_LENGTH_FIELDS
155 using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
156 auto tmp = static_cast<View>(in.get(C::bc_hashing_start)) *
157 ((FF(3) * static_cast<View>(in.get(C::bc_hashing_rounds_rem)) -
158 static_cast<View>(in.get(C::bc_hashing_padding))) -
159 static_cast<View>(in.get(C::bc_hashing_input_len)));
160 std::get<21>(evals) += (tmp * scaling_factor);
161 }
162 { // ROUNDS_DECREMENT
163 using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View;
164 auto tmp = (static_cast<View>(in.get(C::bc_hashing_rounds_rem)) -
165 (static_cast<View>(in.get(C::bc_hashing_end)) +
166 (static_cast<View>(in.get(C::bc_hashing_sel)) - static_cast<View>(in.get(C::bc_hashing_end))) *
167 (static_cast<View>(in.get(C::bc_hashing_rounds_rem_shift)) + FF(1))));
168 std::get<22>(evals) += (tmp * scaling_factor);
169 }
170}
171
172} // 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.