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 update_check_HASH_IS_ZERO = (FF(1) - in.get(C::update_check_hash_not_zero));
25 const auto update_check_TWO_POW_32 = FF(4294967296UL);
26
27 {
28 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
29 auto tmp =
30 static_cast<View>(in.get(C::update_check_sel)) * (FF(1) - static_cast<View>(in.get(C::update_check_sel)));
31 std::get<0>(evals) += (tmp * scaling_factor);
32 }
33 {
34 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
35 auto tmp = (static_cast<View>(in.get(C::update_check_timestamp_pi_offset)) -
36 static_cast<View>(in.get(C::update_check_sel)) *
37 CView(constants_AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_TIMESTAMP_ROW_IDX));
38 std::get<1>(evals) += (tmp * scaling_factor);
39 }
40 {
41 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
42 auto tmp = static_cast<View>(in.get(C::update_check_sel)) *
43 (CView(constants_UPDATED_CLASS_IDS_SLOT) -
44 static_cast<View>(in.get(C::update_check_updated_class_ids_slot)));
45 std::get<2>(evals) += (tmp * scaling_factor);
46 }
47 {
48 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
49 auto tmp = static_cast<View>(in.get(C::update_check_sel)) *
50 ((static_cast<View>(in.get(C::update_check_delayed_public_mutable_slot)) +
51 CView(constants_UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN)) -
52 static_cast<View>(in.get(C::update_check_delayed_public_mutable_hash_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 (CView(constants_CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS) -
59 static_cast<View>(in.get(C::update_check_deployer_protocol_contract_address)));
60 std::get<4>(evals) += (tmp * scaling_factor);
61 }
62 {
63 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
64 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
65 (FF(1) - static_cast<View>(in.get(C::update_check_hash_not_zero)));
66 std::get<5>(evals) += (tmp * scaling_factor);
67 }
68 { // HASH_IS_ZERO_CHECK
69 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
70 auto tmp = ((static_cast<View>(in.get(C::update_check_update_hash)) *
71 (CView(update_check_HASH_IS_ZERO) *
72 (FF(1) - static_cast<View>(in.get(C::update_check_update_hash_inv))) +
73 static_cast<View>(in.get(C::update_check_update_hash_inv))) -
74 FF(1)) +
75 CView(update_check_HASH_IS_ZERO));
76 std::get<6>(evals) += (tmp * scaling_factor);
77 }
78 { // NEVER_UPDATED_CHECK
79 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
80 auto tmp = (FF(1) - static_cast<View>(in.get(C::update_check_hash_not_zero))) *
81 (static_cast<View>(in.get(C::update_check_current_class_id)) -
82 static_cast<View>(in.get(C::update_check_original_class_id)));
83 std::get<7>(evals) += (tmp * scaling_factor);
84 }
85 {
86 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
87 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
88 ((CView(constants_UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE) -
89 CView(constants_TIMESTAMP_OF_CHANGE_BIT_SIZE)) -
90 static_cast<View>(in.get(C::update_check_update_hi_metadata_bit_size)));
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_TIMESTAMP_OF_CHANGE_BIT_SIZE) -
97 static_cast<View>(in.get(C::update_check_timestamp_of_change_bit_size)));
98 std::get<9>(evals) += (tmp * scaling_factor);
99 }
100 { // UPDATE_METADATA_DECOMPOSITION
101 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
102 auto tmp = ((static_cast<View>(in.get(C::update_check_update_hi_metadata)) * CView(update_check_TWO_POW_32) +
103 static_cast<View>(in.get(C::update_check_timestamp_of_change))) -
104 static_cast<View>(in.get(C::update_check_update_preimage_metadata)));
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_update_pre_class_id_is_zero)) *
110 (FF(1) - static_cast<View>(in.get(C::update_check_update_pre_class_id_is_zero)));
111 std::get<11>(evals) += (tmp * scaling_factor);
112 }
113 { // UPDATE_PRE_CLASS_IS_ZERO
114 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
115 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
116 ((static_cast<View>(in.get(C::update_check_update_preimage_pre_class_id)) *
117 (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_inv))) +
119 static_cast<View>(in.get(C::update_check_update_pre_class_inv))) -
120 FF(1)) +
121 static_cast<View>(in.get(C::update_check_update_pre_class_id_is_zero)));
122 std::get<12>(evals) += (tmp * scaling_factor);
123 }
124 {
125 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
126 auto tmp = static_cast<View>(in.get(C::update_check_update_post_class_id_is_zero)) *
127 (FF(1) - static_cast<View>(in.get(C::update_check_update_post_class_id_is_zero)));
128 std::get<13>(evals) += (tmp * scaling_factor);
129 }
130 { // UPDATE_POST_CLASS_IS_ZERO
131 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
132 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
133 ((static_cast<View>(in.get(C::update_check_update_preimage_post_class_id)) *
134 (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_inv))) +
136 static_cast<View>(in.get(C::update_check_update_post_class_inv))) -
137 FF(1)) +
138 static_cast<View>(in.get(C::update_check_update_post_class_id_is_zero)));
139 std::get<14>(evals) += (tmp * scaling_factor);
140 }
141 { // FUTURE_UPDATE_CLASS_ID_ASSIGNMENT
142 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
143 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
144 static_cast<View>(in.get(C::update_check_timestamp_is_lt_timestamp_of_change)) *
145 ((static_cast<View>(in.get(C::update_check_original_class_id)) *
146 static_cast<View>(in.get(C::update_check_update_pre_class_id_is_zero)) +
147 static_cast<View>(in.get(C::update_check_update_preimage_pre_class_id))) -
148 static_cast<View>(in.get(C::update_check_current_class_id)));
149 std::get<15>(evals) += (tmp * scaling_factor);
150 }
151 { // PAST_UPDATE_CLASS_ID_ASSIGNMENT
152 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
153 auto tmp = static_cast<View>(in.get(C::update_check_hash_not_zero)) *
154 (FF(1) - static_cast<View>(in.get(C::update_check_timestamp_is_lt_timestamp_of_change))) *
155 ((static_cast<View>(in.get(C::update_check_original_class_id)) *
156 static_cast<View>(in.get(C::update_check_update_post_class_id_is_zero)) +
157 static_cast<View>(in.get(C::update_check_update_preimage_post_class_id))) -
158 static_cast<View>(in.get(C::update_check_current_class_id)));
159 std::get<16>(evals) += (tmp * scaling_factor);
160 }
161}
162
163} // 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.