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_GENERATOR_INDEX__PUBLIC_LEAF_INDEX = FF(23);
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 ((static_cast<View>(in.get(C::update_check_delayed_public_mutable_slot)) +
52 CView(constants_UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN)) -
53 static_cast<View>(in.get(C::update_check_delayed_public_mutable_hash_slot)));
54 std::get<3>(evals) += (tmp * scaling_factor);
55 }
56 {
57 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
58 auto tmp = static_cast<View>(in.get(C::update_check_sel)) *
59 (CView(constants_GENERATOR_INDEX__PUBLIC_LEAF_INDEX) -
60 static_cast<View>(in.get(C::update_check_public_leaf_index_domain_separator)));
61 std::get<4>(evals) += (tmp * scaling_factor);
62 }
63 {
64 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
65 auto tmp = static_cast<View>(in.get(C::update_check_sel)) *
66 (CView(constants_CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS) -
67 static_cast<View>(in.get(C::update_check_deployer_protocol_contract_address)));
68 std::get<5>(evals) += (tmp * scaling_factor);
69 }
70 {
71 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
72 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
73 (FF(1) - static_cast<View>(in.get(C::update_check_hash_not_zero)));
74 std::get<6>(evals) += (tmp * scaling_factor);
75 }
76 { // HASH_IS_ZERO_CHECK
77 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
78 auto tmp = ((static_cast<View>(in.get(C::update_check_update_hash)) *
79 (CView(update_check_HASH_IS_ZERO) *
80 (FF(1) - static_cast<View>(in.get(C::update_check_update_hash_inv))) +
81 static_cast<View>(in.get(C::update_check_update_hash_inv))) -
82 FF(1)) +
83 CView(update_check_HASH_IS_ZERO));
84 std::get<7>(evals) += (tmp * scaling_factor);
85 }
86 { // NEVER_UPDATED_CHECK
87 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
88 auto tmp = (FF(1) - static_cast<View>(in.get(C::update_check_hash_not_zero))) *
89 (static_cast<View>(in.get(C::update_check_current_class_id)) -
90 static_cast<View>(in.get(C::update_check_original_class_id)));
91 std::get<8>(evals) += (tmp * scaling_factor);
92 }
93 {
94 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
95 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
96 ((CView(constants_UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE) -
97 CView(constants_TIMESTAMP_OF_CHANGE_BIT_SIZE)) -
98 static_cast<View>(in.get(C::update_check_update_hi_metadata_bit_size)));
99 std::get<9>(evals) += (tmp * scaling_factor);
100 }
101 {
102 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
103 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
104 (CView(constants_TIMESTAMP_OF_CHANGE_BIT_SIZE) -
105 static_cast<View>(in.get(C::update_check_timestamp_of_change_bit_size)));
106 std::get<10>(evals) += (tmp * scaling_factor);
107 }
108 { // UPDATE_METADATA_DECOMPOSITION
109 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
110 auto tmp = ((static_cast<View>(in.get(C::update_check_update_hi_metadata)) * CView(update_check_TWO_POW_32) +
111 static_cast<View>(in.get(C::update_check_timestamp_of_change))) -
112 static_cast<View>(in.get(C::update_check_update_preimage_metadata)));
113 std::get<11>(evals) += (tmp * scaling_factor);
114 }
115 {
116 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
117 auto tmp = static_cast<View>(in.get(C::update_check_update_pre_class_id_is_zero)) *
118 (FF(1) - static_cast<View>(in.get(C::update_check_update_pre_class_id_is_zero)));
119 std::get<12>(evals) += (tmp * scaling_factor);
120 }
121 { // UPDATE_PRE_CLASS_IS_ZERO
122 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
123 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
124 ((static_cast<View>(in.get(C::update_check_update_preimage_pre_class_id)) *
125 (static_cast<View>(in.get(C::update_check_update_pre_class_id_is_zero)) *
126 (FF(1) - static_cast<View>(in.get(C::update_check_update_pre_class_inv))) +
127 static_cast<View>(in.get(C::update_check_update_pre_class_inv))) -
128 FF(1)) +
129 static_cast<View>(in.get(C::update_check_update_pre_class_id_is_zero)));
130 std::get<13>(evals) += (tmp * scaling_factor);
131 }
132 {
133 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
134 auto tmp = static_cast<View>(in.get(C::update_check_update_post_class_id_is_zero)) *
135 (FF(1) - static_cast<View>(in.get(C::update_check_update_post_class_id_is_zero)));
136 std::get<14>(evals) += (tmp * scaling_factor);
137 }
138 { // UPDATE_POST_CLASS_IS_ZERO
139 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
140 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
141 ((static_cast<View>(in.get(C::update_check_update_preimage_post_class_id)) *
142 (static_cast<View>(in.get(C::update_check_update_post_class_id_is_zero)) *
143 (FF(1) - static_cast<View>(in.get(C::update_check_update_post_class_inv))) +
144 static_cast<View>(in.get(C::update_check_update_post_class_inv))) -
145 FF(1)) +
146 static_cast<View>(in.get(C::update_check_update_post_class_id_is_zero)));
147 std::get<15>(evals) += (tmp * scaling_factor);
148 }
149 { // FUTURE_UPDATE_CLASS_ID_ASSIGNMENT
150 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
151 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
152 static_cast<View>(in.get(C::update_check_timestamp_is_lt_timestamp_of_change)) *
153 ((static_cast<View>(in.get(C::update_check_original_class_id)) *
154 static_cast<View>(in.get(C::update_check_update_pre_class_id_is_zero)) +
155 static_cast<View>(in.get(C::update_check_update_preimage_pre_class_id))) -
156 static_cast<View>(in.get(C::update_check_current_class_id)));
157 std::get<16>(evals) += (tmp * scaling_factor);
158 }
159 { // PAST_UPDATE_CLASS_ID_ASSIGNMENT
160 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
161 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
162 (FF(1) - static_cast<View>(in.get(C::update_check_timestamp_is_lt_timestamp_of_change))) *
163 ((static_cast<View>(in.get(C::update_check_original_class_id)) *
164 static_cast<View>(in.get(C::update_check_update_post_class_id_is_zero)) +
165 static_cast<View>(in.get(C::update_check_update_preimage_post_class_id))) -
166 static_cast<View>(in.get(C::update_check_current_class_id)));
167 std::get<17>(evals) += (tmp * scaling_factor);
168 }
169}
170
171} // 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.