Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
sstore_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 sstoreImpl<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_MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX = FF(63);
19 const auto constants_AVM_WRITTEN_PUBLIC_DATA_SLOTS_TREE_INITIAL_SIZE = FF(1);
20 const auto execution_REMAINING_DATA_WRITES = ((constants_MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX +
21 constants_AVM_WRITTEN_PUBLIC_DATA_SLOTS_TREE_INITIAL_SIZE) -
22 in.get(C::execution_prev_written_public_data_slots_tree_size));
23
24 {
25 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
26 auto tmp = static_cast<View>(in.get(C::execution_max_data_writes_reached)) *
27 (FF(1) - static_cast<View>(in.get(C::execution_max_data_writes_reached)));
28 std::get<0>(evals) += (tmp * scaling_factor);
29 }
30 { // SSTORE_MAX_DATA_WRITES_REACHED
31 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
32 auto tmp = static_cast<View>(in.get(C::execution_sel_execute_sstore)) *
33 ((CView(execution_REMAINING_DATA_WRITES) *
34 (static_cast<View>(in.get(C::execution_max_data_writes_reached)) *
35 (FF(1) - static_cast<View>(in.get(C::execution_remaining_data_writes_inv))) +
36 static_cast<View>(in.get(C::execution_remaining_data_writes_inv))) -
37 FF(1)) +
38 static_cast<View>(in.get(C::execution_max_data_writes_reached)));
39 std::get<1>(evals) += (tmp * scaling_factor);
40 }
41 { // OPCODE_ERROR_IF_OVERFLOW_OR_STATIC
42 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
43 auto tmp = static_cast<View>(in.get(C::execution_sel_execute_sstore)) *
44 ((FF(1) - static_cast<View>(in.get(C::execution_max_data_writes_reached)) *
45 static_cast<View>(in.get(C::execution_dynamic_da_gas_factor))) *
46 (FF(1) - static_cast<View>(in.get(C::execution_is_static))) -
47 (FF(1) - static_cast<View>(in.get(C::execution_sel_opcode_error))));
48 std::get<2>(evals) += (tmp * scaling_factor);
49 }
50 {
51 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
52 auto tmp = static_cast<View>(in.get(C::execution_sel_execute_sstore)) *
53 ((FF(1) - static_cast<View>(in.get(C::execution_sel_opcode_error))) -
54 static_cast<View>(in.get(C::execution_sel_write_public_data)));
55 std::get<3>(evals) += (tmp * scaling_factor);
56 }
57 { // SSTORE_WRITTEN_SLOTS_ROOT_NOT_CHANGED
58 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
59 auto tmp = static_cast<View>(in.get(C::execution_sel_execute_sstore)) *
60 static_cast<View>(in.get(C::execution_sel_opcode_error)) *
61 (static_cast<View>(in.get(C::execution_prev_written_public_data_slots_tree_root)) -
62 static_cast<View>(in.get(C::execution_written_public_data_slots_tree_root)));
63 std::get<4>(evals) += (tmp * scaling_factor);
64 }
65 { // SSTORE_WRITTEN_SLOTS_SIZE_NOT_CHANGED
66 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
67 auto tmp = static_cast<View>(in.get(C::execution_sel_execute_sstore)) *
68 static_cast<View>(in.get(C::execution_sel_opcode_error)) *
69 (static_cast<View>(in.get(C::execution_prev_written_public_data_slots_tree_size)) -
70 static_cast<View>(in.get(C::execution_written_public_data_slots_tree_size)));
71 std::get<5>(evals) += (tmp * scaling_factor);
72 }
73 { // SSTORE_PUBLIC_DATA_TREE_ROOT_NOT_CHANGED
74 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
75 auto tmp = static_cast<View>(in.get(C::execution_sel_execute_sstore)) *
76 static_cast<View>(in.get(C::execution_sel_opcode_error)) *
77 (static_cast<View>(in.get(C::execution_prev_public_data_tree_root)) -
78 static_cast<View>(in.get(C::execution_public_data_tree_root)));
79 std::get<6>(evals) += (tmp * scaling_factor);
80 }
81 { // SSTORE_PUBLIC_DATA_TREE_SIZE_NOT_CHANGED
82 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
83 auto tmp = static_cast<View>(in.get(C::execution_sel_execute_sstore)) *
84 static_cast<View>(in.get(C::execution_sel_opcode_error)) *
85 (static_cast<View>(in.get(C::execution_prev_public_data_tree_size)) -
86 static_cast<View>(in.get(C::execution_public_data_tree_size)));
87 std::get<7>(evals) += (tmp * scaling_factor);
88 }
89}
90
91} // 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.