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: Complete, auditors: [Luke], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
9#include <cstdint>
10
11namespace bb {
12
13// 3-wire addition gate: a*a_scaling + b*b_scaling + c*c_scaling + const_scaling = 0
14template <typename FF> struct add_triple_ {
15 uint32_t a;
16 uint32_t b;
17 uint32_t c;
22};
23
24// 4-wire addition gate: a*a_scaling + b*b_scaling + c*c_scaling + d*d_scaling + const_scaling = 0
25template <typename FF> struct add_quad_ {
26 uint32_t a;
27 uint32_t b;
28 uint32_t c;
29 uint32_t d;
35};
36
37// 4-wire mul-add gate: a*b*mul_scaling + a*a_scaling + b*b_scaling + c*c_scaling + d*d_scaling + const_scaling = 0
38template <typename FF> struct mul_quad_ {
39 uint32_t a;
40 uint32_t b;
41 uint32_t c;
42 uint32_t d;
49};
50
51// Arithmetic gate with standard selector naming: q_m*a*b + q_l*a + q_r*b + q_o*c + q_c = 0
52template <typename FF> struct arithmetic_triple_ {
53 uint32_t a;
54 uint32_t b;
55 uint32_t c;
61
62 friend bool operator==(arithmetic_triple_<FF> const& lhs, arithmetic_triple_<FF> const& rhs) = default;
63};
64
66
67// Goblin ECCVM operation: stores op type, point coordinates (split into limbs), and scalar
69 uint32_t op;
70 uint32_t x_lo;
71 uint32_t x_hi;
72 uint32_t y_lo;
73 uint32_t y_hi;
74 uint32_t z_1;
75 uint32_t z_2;
77};
78
79// Embedded curve point addition: (x1, y1) + sign_coefficient * (x2, y2) = (x3, y3)
80template <typename FF> struct ecc_add_gate_ {
81 uint32_t x1;
82 uint32_t y1;
83 uint32_t x2;
84 uint32_t y2;
85 uint32_t x3;
86 uint32_t y3;
88};
89
90// Embedded curve point doubling: 2 * (x1, y1) = (x3, y3)
91template <typename FF> struct ecc_dbl_gate_ {
92 uint32_t x1;
93 uint32_t y1;
94 uint32_t x3;
95 uint32_t y3;
96};
97
98// Databus lookup gate: reads value at index from calldata/returndata
99template <typename FF> struct databus_lookup_gate_ {
100 uint32_t index;
101 uint32_t value;
102};
103
104// External gate data for poseidon2 external round
105template <typename FF> struct poseidon2_external_gate_ {
106 uint32_t a;
107 uint32_t b;
108 uint32_t c;
109 uint32_t d;
110 size_t round_idx;
111};
112
113// Internal gate data for poseidon2 internal round
114template <typename FF> struct poseidon2_internal_gate_ {
115 uint32_t a;
116 uint32_t b;
117 uint32_t c;
118 uint32_t d;
119 size_t round_idx;
120};
121} // namespace bb
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
friend bool operator==(arithmetic_triple_< FF > const &lhs, arithmetic_triple_< FF > const &rhs)=default