Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
update_check_impl.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
5
6namespace bb::avm2 {
7
8template <typename FF_>
9template <typename ContainerOverSubrelations, typename AllEntities>
10void update_checkImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
11 const AllEntities& in,
12 [[maybe_unused]] const RelationParameters<FF_>&,
13 [[maybe_unused]] const FF_& scaling_factor)
14{
15 using C = ColumnAndShifts;
16
17 PROFILE_THIS_NAME("accumulate/update_check");
18
19 const auto constants_CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS = FF(2);
20 const auto constants_UPDATED_CLASS_IDS_SLOT = FF(1);
21 const auto constants_AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_TIMESTAMP_ROW_IDX = FF(4);
22 const auto constants_TIMESTAMP_OF_CHANGE_BIT_SIZE = FF(32);
23 const auto constants_UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN = FF(3);
24 const auto constants_UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE = FF(144);
25 const auto constants_GENERATOR_INDEX__PUBLIC_LEAF_INDEX = FF(23);
26 const auto update_check_HASH_IS_ZERO = (FF(1) - in.get(C::update_check_hash_not_zero));
27 const auto update_check_TWO_POW_32 = FF(4294967296UL);
28 const auto update_check_TIMESTAMP_LT_TIMESTAMP_OF_CHANGE =
29 ((in.get(C::update_check_timestamp_of_change) - FF(1)) - in.get(C::update_check_timestamp));
30 const auto update_check_TIMESTAMP_GTE_TIMESTAMP_OF_CHANGE =
31 (in.get(C::update_check_timestamp) - in.get(C::update_check_timestamp_of_change));
32
33 {
34 using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>;
35 auto tmp = in.get(C::update_check_sel) * (FF(1) - in.get(C::update_check_sel));
36 tmp *= scaling_factor;
37 std::get<0>(evals) += typename Accumulator::View(tmp);
38 }
39 {
40 using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>;
41 auto tmp = (in.get(C::update_check_timestamp_pi_offset) -
42 in.get(C::update_check_sel) * constants_AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_TIMESTAMP_ROW_IDX);
43 tmp *= scaling_factor;
44 std::get<1>(evals) += typename Accumulator::View(tmp);
45 }
46 {
47 using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>;
48 auto tmp = in.get(C::update_check_sel) *
49 (constants_UPDATED_CLASS_IDS_SLOT - in.get(C::update_check_updated_class_ids_slot));
50 tmp *= scaling_factor;
51 std::get<2>(evals) += typename Accumulator::View(tmp);
52 }
53 {
54 using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>;
55 auto tmp = in.get(C::update_check_sel) * ((in.get(C::update_check_delayed_public_mutable_slot) +
56 constants_UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN) -
57 in.get(C::update_check_delayed_public_mutable_hash_slot));
58 tmp *= scaling_factor;
59 std::get<3>(evals) += typename Accumulator::View(tmp);
60 }
61 {
62 using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>;
63 auto tmp = in.get(C::update_check_sel) * (constants_GENERATOR_INDEX__PUBLIC_LEAF_INDEX -
64 in.get(C::update_check_public_leaf_index_domain_separator));
65 tmp *= scaling_factor;
66 std::get<4>(evals) += typename Accumulator::View(tmp);
67 }
68 {
69 using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>;
70 auto tmp = in.get(C::update_check_sel) * (constants_CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS -
71 in.get(C::update_check_deployer_protocol_contract_address));
72 tmp *= scaling_factor;
73 std::get<5>(evals) += typename Accumulator::View(tmp);
74 }
75 {
76 using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>;
77 auto tmp = in.get(C::update_check_hash_not_zero) * (FF(1) - in.get(C::update_check_hash_not_zero));
78 tmp *= scaling_factor;
79 std::get<6>(evals) += typename Accumulator::View(tmp);
80 }
81 { // HASH_IS_ZERO_CHECK
82 using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>;
83 auto tmp = ((in.get(C::update_check_update_hash) *
84 (update_check_HASH_IS_ZERO * (FF(1) - in.get(C::update_check_update_hash_inv)) +
85 in.get(C::update_check_update_hash_inv)) -
86 FF(1)) +
87 update_check_HASH_IS_ZERO);
88 tmp *= scaling_factor;
89 std::get<7>(evals) += typename Accumulator::View(tmp);
90 }
91 { // NEVER_UPDATED_CHECK
92 using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>;
93 auto tmp = (FF(1) - in.get(C::update_check_hash_not_zero)) *
94 (in.get(C::update_check_current_class_id) - in.get(C::update_check_original_class_id));
95 tmp *= scaling_factor;
96 std::get<8>(evals) += typename Accumulator::View(tmp);
97 }
98 {
99 using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>;
100 auto tmp =
101 in.get(C::update_check_hash_not_zero) *
102 ((constants_UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE - constants_TIMESTAMP_OF_CHANGE_BIT_SIZE) -
103 in.get(C::update_check_update_hi_metadata_bit_size));
104 tmp *= scaling_factor;
105 std::get<9>(evals) += typename Accumulator::View(tmp);
106 }
107 {
108 using Accumulator = typename std::tuple_element_t<10, ContainerOverSubrelations>;
109 auto tmp = in.get(C::update_check_hash_not_zero) *
110 (constants_TIMESTAMP_OF_CHANGE_BIT_SIZE - in.get(C::update_check_timestamp_of_change_bit_size));
111 tmp *= scaling_factor;
112 std::get<10>(evals) += typename Accumulator::View(tmp);
113 }
114 { // UPDATE_METADATA_DECOMPOSITION
115 using Accumulator = typename std::tuple_element_t<11, ContainerOverSubrelations>;
116 auto tmp = ((in.get(C::update_check_update_hi_metadata) * update_check_TWO_POW_32 +
117 in.get(C::update_check_timestamp_of_change)) -
118 in.get(C::update_check_update_preimage_metadata));
119 tmp *= scaling_factor;
120 std::get<11>(evals) += typename Accumulator::View(tmp);
121 }
122 {
123 using Accumulator = typename std::tuple_element_t<12, ContainerOverSubrelations>;
124 auto tmp = in.get(C::update_check_timestamp_is_lt_timestamp_of_change) *
125 (FF(1) - in.get(C::update_check_timestamp_is_lt_timestamp_of_change));
126 tmp *= scaling_factor;
127 std::get<12>(evals) += typename Accumulator::View(tmp);
128 }
129 {
130 using Accumulator = typename std::tuple_element_t<13, ContainerOverSubrelations>;
131 auto tmp = (((update_check_TIMESTAMP_LT_TIMESTAMP_OF_CHANGE - update_check_TIMESTAMP_GTE_TIMESTAMP_OF_CHANGE) *
132 in.get(C::update_check_timestamp_is_lt_timestamp_of_change) +
133 update_check_TIMESTAMP_GTE_TIMESTAMP_OF_CHANGE) -
134 in.get(C::update_check_timestamp_of_change_subtraction));
135 tmp *= scaling_factor;
136 std::get<13>(evals) += typename Accumulator::View(tmp);
137 }
138 {
139 using Accumulator = typename std::tuple_element_t<14, ContainerOverSubrelations>;
140 auto tmp = in.get(C::update_check_update_pre_class_id_is_zero) *
141 (FF(1) - in.get(C::update_check_update_pre_class_id_is_zero));
142 tmp *= scaling_factor;
143 std::get<14>(evals) += typename Accumulator::View(tmp);
144 }
145 { // UPDATE_PRE_CLASS_IS_ZERO
146 using Accumulator = typename std::tuple_element_t<15, ContainerOverSubrelations>;
147 auto tmp =
148 in.get(C::update_check_hash_not_zero) * ((in.get(C::update_check_update_preimage_pre_class_id) *
149 (in.get(C::update_check_update_pre_class_id_is_zero) *
150 (FF(1) - in.get(C::update_check_update_pre_class_inv)) +
151 in.get(C::update_check_update_pre_class_inv)) -
152 FF(1)) +
153 in.get(C::update_check_update_pre_class_id_is_zero));
154 tmp *= scaling_factor;
155 std::get<15>(evals) += typename Accumulator::View(tmp);
156 }
157 {
158 using Accumulator = typename std::tuple_element_t<16, ContainerOverSubrelations>;
159 auto tmp = in.get(C::update_check_update_post_class_id_is_zero) *
160 (FF(1) - in.get(C::update_check_update_post_class_id_is_zero));
161 tmp *= scaling_factor;
162 std::get<16>(evals) += typename Accumulator::View(tmp);
163 }
164 { // UPDATE_POST_CLASS_IS_ZERO
165 using Accumulator = typename std::tuple_element_t<17, ContainerOverSubrelations>;
166 auto tmp =
167 in.get(C::update_check_hash_not_zero) * ((in.get(C::update_check_update_preimage_post_class_id) *
168 (in.get(C::update_check_update_post_class_id_is_zero) *
169 (FF(1) - in.get(C::update_check_update_post_class_inv)) +
170 in.get(C::update_check_update_post_class_inv)) -
171 FF(1)) +
172 in.get(C::update_check_update_post_class_id_is_zero));
173 tmp *= scaling_factor;
174 std::get<17>(evals) += typename Accumulator::View(tmp);
175 }
176 { // FUTURE_UPDATE_CLASS_ID_ASSIGNMENT
177 using Accumulator = typename std::tuple_element_t<18, ContainerOverSubrelations>;
178 auto tmp = in.get(C::update_check_hash_not_zero) * in.get(C::update_check_timestamp_is_lt_timestamp_of_change) *
179 ((in.get(C::update_check_original_class_id) * in.get(C::update_check_update_pre_class_id_is_zero) +
180 in.get(C::update_check_update_preimage_pre_class_id)) -
181 in.get(C::update_check_current_class_id));
182 tmp *= scaling_factor;
183 std::get<18>(evals) += typename Accumulator::View(tmp);
184 }
185 { // PAST_UPDATE_CLASS_ID_ASSIGNMENT
186 using Accumulator = typename std::tuple_element_t<19, ContainerOverSubrelations>;
187 auto tmp = in.get(C::update_check_hash_not_zero) *
188 (FF(1) - in.get(C::update_check_timestamp_is_lt_timestamp_of_change)) *
189 ((in.get(C::update_check_original_class_id) * in.get(C::update_check_update_post_class_id_is_zero) +
190 in.get(C::update_check_update_preimage_post_class_id)) -
191 in.get(C::update_check_current_class_id));
192 tmp *= scaling_factor;
193 std::get<19>(evals) += typename Accumulator::View(tmp);
194 }
195}
196
197} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
ColumnAndShifts
Definition columns.hpp:35
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
#define PROFILE_THIS_NAME(name)
Definition op_count.hpp:16
Container for parameters used by the grand product (permutation, lookup) Honk relations.