Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
emit_notehash_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 emit_notehashImpl<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_NOTE_HASHES_PER_TX = FF(64);
19 const auto execution_REMAINING_NOTE_HASH_WRITES =
20 (constants_MAX_NOTE_HASHES_PER_TX - in.get(C::execution_prev_num_note_hashes_emitted));
21
22 {
23 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
24 auto tmp = static_cast<View>(in.get(C::execution_sel_reached_max_note_hashes)) *
25 (FF(1) - static_cast<View>(in.get(C::execution_sel_reached_max_note_hashes)));
26 std::get<0>(evals) += (tmp * scaling_factor);
27 }
28 { // MAX_NOTE_HASHES_REACHED
29 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
30 auto tmp = static_cast<View>(in.get(C::execution_sel_execute_emit_notehash)) *
31 ((CView(execution_REMAINING_NOTE_HASH_WRITES) *
32 (static_cast<View>(in.get(C::execution_sel_reached_max_note_hashes)) *
33 (FF(1) - static_cast<View>(in.get(C::execution_remaining_note_hashes_inv))) +
34 static_cast<View>(in.get(C::execution_remaining_note_hashes_inv))) -
35 FF(1)) +
36 static_cast<View>(in.get(C::execution_sel_reached_max_note_hashes)));
37 std::get<1>(evals) += (tmp * scaling_factor);
38 }
39 { // OPCODE_ERROR_IF_MAX_NOTE_HASHES_REACHED_OR_STATIC
40 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
41 auto tmp = static_cast<View>(in.get(C::execution_sel_execute_emit_notehash)) *
42 ((FF(1) - static_cast<View>(in.get(C::execution_sel_reached_max_note_hashes))) *
43 (FF(1) - static_cast<View>(in.get(C::execution_is_static))) -
44 (FF(1) - static_cast<View>(in.get(C::execution_sel_opcode_error))));
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::execution_sel_execute_emit_notehash)) *
50 ((FF(1) - static_cast<View>(in.get(C::execution_sel_opcode_error))) -
51 static_cast<View>(in.get(C::execution_sel_write_note_hash)));
52 std::get<3>(evals) += (tmp * scaling_factor);
53 }
54 { // EMIT_NOTEHASH_TREE_ROOT_NOT_CHANGED
55 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
56 auto tmp = static_cast<View>(in.get(C::execution_sel_execute_emit_notehash)) *
57 static_cast<View>(in.get(C::execution_sel_opcode_error)) *
58 (static_cast<View>(in.get(C::execution_prev_note_hash_tree_root)) -
59 static_cast<View>(in.get(C::execution_note_hash_tree_root)));
60 std::get<4>(evals) += (tmp * scaling_factor);
61 }
62 { // EMIT_NOTEHASH_TREE_SIZE_INCREASE
63 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
64 auto tmp = static_cast<View>(in.get(C::execution_sel_execute_emit_notehash)) *
65 ((static_cast<View>(in.get(C::execution_prev_note_hash_tree_size)) +
66 static_cast<View>(in.get(C::execution_sel_write_note_hash))) -
67 static_cast<View>(in.get(C::execution_note_hash_tree_size)));
68 std::get<5>(evals) += (tmp * scaling_factor);
69 }
70 { // EMIT_NOTEHASH_NUM_NOTE_HASHES_EMITTED_INCREASE
71 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
72 auto tmp = static_cast<View>(in.get(C::execution_sel_execute_emit_notehash)) *
73 ((static_cast<View>(in.get(C::execution_prev_num_note_hashes_emitted)) +
74 static_cast<View>(in.get(C::execution_sel_write_note_hash))) -
75 static_cast<View>(in.get(C::execution_num_note_hashes_emitted)));
76 std::get<6>(evals) += (tmp * scaling_factor);
77 }
78}
79
80} // 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.