Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
gate_data.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
7#pragma once
10#include <cstdint>
11
12// TODO(#557): The field-specific aliases for gates should be removed and the type could be explicit when this
13// structures are used to avoid having foo_gate and foo_gate_grumpkin (i.e. use foo_gate<field> instead). Moreover, we
14// need to ensure the read/write functions handle grumpkin gates as well.
15namespace bb {
16template <typename FF> struct add_triple_ {
17 uint32_t a;
18 uint32_t b;
19 uint32_t c;
24};
25
26template <typename FF> struct add_quad_ {
27 uint32_t a;
28 uint32_t b;
29 uint32_t c;
30 uint32_t d;
36};
37template <typename FF> struct mul_quad_ {
38 uint32_t a;
39 uint32_t b;
40 uint32_t c;
41 uint32_t d;
48};
49template <typename FF> struct mul_triple_ {
50 uint32_t a;
51 uint32_t b;
52 uint32_t c;
56};
57template <typename FF> struct poly_triple_ {
58 uint32_t a;
59 uint32_t b;
60 uint32_t c;
66
67 friend bool operator==(poly_triple_<FF> const& lhs, poly_triple_<FF> const& rhs) = default;
68};
71 uint32_t op;
72 uint32_t x_lo;
73 uint32_t x_hi;
74 uint32_t y_lo;
75 uint32_t y_hi;
76 uint32_t z_1;
77 uint32_t z_2;
79};
80
81template <typename B, typename FF> inline void read(B& buf, poly_triple_<FF>& constraint)
82{
83 using serialize::read;
84 read(buf, constraint.a);
85 read(buf, constraint.b);
86 read(buf, constraint.c);
87 read(buf, constraint.q_m);
88 read(buf, constraint.q_l);
89 read(buf, constraint.q_r);
90 read(buf, constraint.q_o);
91 read(buf, constraint.q_c);
92}
93template <typename B, typename FF> inline void write(B& buf, poly_triple_<FF> const& constraint)
94{
95 using serialize::write;
96 write(buf, constraint.a);
97 write(buf, constraint.b);
98 write(buf, constraint.c);
99 write(buf, constraint.q_m);
100 write(buf, constraint.q_l);
101 write(buf, constraint.q_r);
102 write(buf, constraint.q_o);
103 write(buf, constraint.q_c);
104}
105
106template <typename FF> struct fixed_group_add_quad_ {
107 uint32_t a;
108 uint32_t b;
109 uint32_t c;
110 uint32_t d;
115};
116template <typename FF> struct fixed_group_init_quad_ {
121};
122template <typename FF> struct accumulator_triple_ {
123 std::vector<uint32_t> left;
124 std::vector<uint32_t> right;
125 std::vector<uint32_t> out;
126};
127template <typename FF> struct ecc_add_gate_ {
128 uint32_t x1;
129 uint32_t y1;
130 uint32_t x2;
131 uint32_t y2;
132 uint32_t x3;
133 uint32_t y3;
135};
136template <typename FF> struct ecc_dbl_gate_ {
137 uint32_t x1;
138 uint32_t y1;
139 uint32_t x3;
140 uint32_t y3;
141};
142
143template <typename FF> struct databus_lookup_gate_ {
144 uint32_t index;
145 uint32_t value;
146};
147
148/* External gate data for poseidon2 external round*/
149template <typename FF> struct poseidon2_external_gate_ {
150 uint32_t a;
151 uint32_t b;
152 uint32_t c;
153 uint32_t d;
154 size_t round_idx;
155};
156
157/* Internal gate data for poseidon2 internal round*/
158template <typename FF> struct poseidon2_internal_gate_ {
159 uint32_t a;
160 uint32_t b;
161 uint32_t c;
162 uint32_t d;
163 size_t round_idx;
164};
165} // namespace bb
uint8_t const * buf
Definition data_store.hpp:9
Entry point for Barretenberg command-line interface.
void read(B &it, field2< base_field, Params > &value)
typename Flavor::FF FF
void write(B &buf, field2< base_field, Params > const &value)
void read(auto &it, msgpack_concepts::HasMsgPack auto &obj)
Automatically derived read for any object that defines .msgpack() (implicitly defined by MSGPACK_FIEL...
void write(auto &buf, const msgpack_concepts::HasMsgPack auto &obj)
Automatically derived write for any object that defines .msgpack() (implicitly defined by MSGPACK_FIE...
std::vector< uint32_t > right
std::vector< uint32_t > out
std::vector< uint32_t > left
friend bool operator==(poly_triple_< FF > const &lhs, poly_triple_< FF > const &rhs)=default