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
6
7namespace bb::avm2 {
8
9template <typename FF_>
10template <typename ContainerOverSubrelations, typename AllEntities>
11void update_checkImpl<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_CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS = FF(2);
19 const auto constants_UPDATED_CLASS_IDS_SLOT = FF(1);
20 const auto constants_AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_TIMESTAMP_ROW_IDX = FF(4);
21 const auto constants_TIMESTAMP_OF_CHANGE_BIT_SIZE = FF(32);
22 const auto constants_UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN = FF(3);
23 const auto constants_UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE = FF(144);
24 const auto constants_DOM_SEP__PUBLIC_STORAGE_MAP_SLOT = FF(4015149901UL);
25 const auto update_check_HASH_IS_ZERO = (FF(1) - in.get(C::update_check_hash_not_zero));
26 const auto update_check_TWO_POW_32 = FF(4294967296UL);
27
28 {
29 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
30 auto tmp =
31 static_cast<View>(in.get(C::update_check_sel)) * (FF(1) - static_cast<View>(in.get(C::update_check_sel)));
32 std::get<0>(evals) += (tmp * scaling_factor);
33 }
34 {
35 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
36 auto tmp = (static_cast<View>(in.get(C::update_check_timestamp_pi_offset)) -
37 static_cast<View>(in.get(C::update_check_sel)) *
38 CView(constants_AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_TIMESTAMP_ROW_IDX));
39 std::get<1>(evals) += (tmp * scaling_factor);
40 }
41 {
42 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
43 auto tmp = static_cast<View>(in.get(C::update_check_sel)) *
44 (CView(constants_UPDATED_CLASS_IDS_SLOT) -
45 static_cast<View>(in.get(C::update_check_updated_class_ids_slot)));
46 std::get<2>(evals) += (tmp * scaling_factor);
47 }
48 {
49 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
50 auto tmp = static_cast<View>(in.get(C::update_check_sel)) *
51 (CView(constants_DOM_SEP__PUBLIC_STORAGE_MAP_SLOT) -
52 static_cast<View>(in.get(C::update_check_dom_sep_public_storage_map_slot)));
53 std::get<3>(evals) += (tmp * scaling_factor);
54 }
55 {
56 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
57 auto tmp = static_cast<View>(in.get(C::update_check_sel)) *
58 (static_cast<View>(in.get(C::update_check_const_three)) - FF(3));
59 std::get<4>(evals) += (tmp * scaling_factor);
60 }
61 {
62 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
63 auto tmp = static_cast<View>(in.get(C::update_check_sel)) *
64 ((static_cast<View>(in.get(C::update_check_delayed_public_mutable_slot)) +
65 CView(constants_UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN)) -
66 static_cast<View>(in.get(C::update_check_delayed_public_mutable_hash_slot)));
67 std::get<5>(evals) += (tmp * scaling_factor);
68 }
69 {
70 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
71 auto tmp = static_cast<View>(in.get(C::update_check_sel)) *
72 (CView(constants_CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS) -
73 static_cast<View>(in.get(C::update_check_contract_instance_registry_address)));
74 std::get<6>(evals) += (tmp * scaling_factor);
75 }
76 {
77 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
78 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
79 (FF(1) - static_cast<View>(in.get(C::update_check_hash_not_zero)));
80 std::get<7>(evals) += (tmp * scaling_factor);
81 }
82 { // HASH_IS_ZERO_CHECK
83 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
84 auto tmp = ((static_cast<View>(in.get(C::update_check_update_hash)) *
85 (CView(update_check_HASH_IS_ZERO) *
86 (FF(1) - static_cast<View>(in.get(C::update_check_update_hash_inv))) +
87 static_cast<View>(in.get(C::update_check_update_hash_inv))) -
88 FF(1)) +
89 CView(update_check_HASH_IS_ZERO));
90 std::get<8>(evals) += (tmp * scaling_factor);
91 }
92 { // NEVER_UPDATED_CHECK
93 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
94 auto tmp = (FF(1) - static_cast<View>(in.get(C::update_check_hash_not_zero))) *
95 (static_cast<View>(in.get(C::update_check_current_class_id)) -
96 static_cast<View>(in.get(C::update_check_original_class_id)));
97 std::get<9>(evals) += (tmp * scaling_factor);
98 }
99 {
100 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
101 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
102 ((CView(constants_UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE) -
103 CView(constants_TIMESTAMP_OF_CHANGE_BIT_SIZE)) -
104 static_cast<View>(in.get(C::update_check_update_hi_metadata_bit_size)));
105 std::get<10>(evals) += (tmp * scaling_factor);
106 }
107 {
108 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
109 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
110 (CView(constants_TIMESTAMP_OF_CHANGE_BIT_SIZE) -
111 static_cast<View>(in.get(C::update_check_timestamp_of_change_bit_size)));
112 std::get<11>(evals) += (tmp * scaling_factor);
113 }
114 { // UPDATE_METADATA_DECOMPOSITION
115 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
116 auto tmp = ((static_cast<View>(in.get(C::update_check_update_hi_metadata)) * CView(update_check_TWO_POW_32) +
117 static_cast<View>(in.get(C::update_check_timestamp_of_change))) -
118 static_cast<View>(in.get(C::update_check_update_preimage_metadata)));
119 std::get<12>(evals) += (tmp * scaling_factor);
120 }
121 {
122 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
123 auto tmp = static_cast<View>(in.get(C::update_check_update_pre_class_id_is_zero)) *
124 (FF(1) - static_cast<View>(in.get(C::update_check_update_pre_class_id_is_zero)));
125 std::get<13>(evals) += (tmp * scaling_factor);
126 }
127 { // UPDATE_PRE_CLASS_IS_ZERO
128 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
129 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
130 ((static_cast<View>(in.get(C::update_check_update_preimage_pre_class_id)) *
131 (static_cast<View>(in.get(C::update_check_update_pre_class_id_is_zero)) *
132 (FF(1) - static_cast<View>(in.get(C::update_check_update_pre_class_inv))) +
133 static_cast<View>(in.get(C::update_check_update_pre_class_inv))) -
134 FF(1)) +
135 static_cast<View>(in.get(C::update_check_update_pre_class_id_is_zero)));
136 std::get<14>(evals) += (tmp * scaling_factor);
137 }
138 {
139 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
140 auto tmp = static_cast<View>(in.get(C::update_check_update_post_class_id_is_zero)) *
141 (FF(1) - static_cast<View>(in.get(C::update_check_update_post_class_id_is_zero)));
142 std::get<15>(evals) += (tmp * scaling_factor);
143 }
144 { // UPDATE_POST_CLASS_IS_ZERO
145 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
146 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
147 ((static_cast<View>(in.get(C::update_check_update_preimage_post_class_id)) *
148 (static_cast<View>(in.get(C::update_check_update_post_class_id_is_zero)) *
149 (FF(1) - static_cast<View>(in.get(C::update_check_update_post_class_inv))) +
150 static_cast<View>(in.get(C::update_check_update_post_class_inv))) -
151 FF(1)) +
152 static_cast<View>(in.get(C::update_check_update_post_class_id_is_zero)));
153 std::get<16>(evals) += (tmp * scaling_factor);
154 }
155 { // FUTURE_UPDATE_CLASS_ID_ASSIGNMENT
156 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
157 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
158 static_cast<View>(in.get(C::update_check_timestamp_is_lt_timestamp_of_change)) *
159 ((static_cast<View>(in.get(C::update_check_original_class_id)) *
160 static_cast<View>(in.get(C::update_check_update_pre_class_id_is_zero)) +
161 static_cast<View>(in.get(C::update_check_update_preimage_pre_class_id))) -
162 static_cast<View>(in.get(C::update_check_current_class_id)));
163 std::get<17>(evals) += (tmp * scaling_factor);
164 }
165 { // PAST_UPDATE_CLASS_ID_ASSIGNMENT
166 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
167 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
168 (FF(1) - static_cast<View>(in.get(C::update_check_timestamp_is_lt_timestamp_of_change))) *
169 ((static_cast<View>(in.get(C::update_check_original_class_id)) *
170 static_cast<View>(in.get(C::update_check_update_post_class_id_is_zero)) +
171 static_cast<View>(in.get(C::update_check_update_preimage_post_class_id))) -
172 static_cast<View>(in.get(C::update_check_current_class_id)));
173 std::get<18>(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)
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.