#![allow(dead_code)]
use primitives::algebra::{
elliptic_curve::{Curve, Point, Scalar},
BoxedUint,
};
use serde::Deserialize;
use crate::circuit::v1::{
circuit::GateIndex,
ops::{
Batched,
BitShareBinaryOp,
BitShareUnaryOp,
FieldPlaintextBinaryOp,
FieldPlaintextUnaryOp,
FieldShareBinaryOp,
FieldShareUnaryOp,
Input,
PointPlaintextBinaryOp,
PointPlaintextUnaryOp,
PointShareBinaryOp,
PointShareUnaryOp,
},
AlgebraicType,
FieldType,
ShareOrPlaintext,
};
#[derive(Deserialize)]
#[serde(bound(deserialize = "Scalar<C>: Deserialize<'de>, Point<C>: Deserialize<'de>"))]
#[repr(C)]
pub enum Gate<C: Curve> {
Input {
input_type: Input<C>,
},
FieldShareUnaryOp {
x: GateIndex,
op: FieldShareUnaryOp,
field_type: FieldType,
},
FieldShareBinaryOp {
x: GateIndex,
y: GateIndex,
y_form: ShareOrPlaintext,
op: FieldShareBinaryOp,
field_type: FieldType,
},
BatchSummation {
x: GateIndex,
x_form: ShareOrPlaintext,
algebraic_type: AlgebraicType,
},
BitShareUnaryOp {
x: GateIndex,
op: BitShareUnaryOp,
},
BitShareBinaryOp {
x: GateIndex,
y: GateIndex,
y_form: ShareOrPlaintext,
op: BitShareBinaryOp,
},
PointShareUnaryOp {
p: GateIndex,
op: PointShareUnaryOp,
},
PointShareBinaryOp {
p: GateIndex,
y: GateIndex,
p_form: ShareOrPlaintext,
y_form: ShareOrPlaintext,
op: PointShareBinaryOp,
},
FieldPlaintextUnaryOp {
x: GateIndex,
op: FieldPlaintextUnaryOp,
field_type: FieldType,
},
FieldPlaintextBinaryOp {
x: GateIndex,
y: GateIndex,
op: FieldPlaintextBinaryOp,
field_type: FieldType,
},
BitPlaintextUnaryOp {
x: GateIndex,
op: FieldPlaintextUnaryOp,
},
BitPlaintextBinaryOp {
x: GateIndex,
y: GateIndex,
op: FieldPlaintextBinaryOp,
},
PointPlaintextUnaryOp {
p: GateIndex,
op: PointPlaintextUnaryOp,
},
PointPlaintextBinaryOp {
p: GateIndex,
y: GateIndex,
op: PointPlaintextBinaryOp,
},
DaBit {
field_type: FieldType,
batched: Batched,
},
GetDaBitFieldShare {
x: GateIndex,
field_type: FieldType,
},
GetDaBitSharedBit {
x: GateIndex,
field_type: FieldType,
},
BaseFieldPow {
x: GateIndex,
exp: BoxedUint,
},
BitPlaintextToField {
x: GateIndex,
field_type: FieldType,
},
FieldPlaintextToBit {
x: GateIndex,
field_type: FieldType,
},
BatchGetIndex {
x: GateIndex,
x_type: AlgebraicType,
x_form: ShareOrPlaintext,
index: usize,
},
CollectToBatch {
wires: Vec<GateIndex>,
x_type: AlgebraicType,
x_form: ShareOrPlaintext,
},
PointFromPlaintextExtendedEdwards {
wires: Vec<GateIndex>,
},
PlaintextPointToExtendedEdwards {
point: GateIndex,
},
PlaintextKeccakF1600 {
wires: Vec<GateIndex>,
},
CompressPlaintextPoint {
point: GateIndex,
},
KeyRecoveryPlaintextComputeErrors {
d_minus_one: GateIndex,
syndromes: GateIndex,
},
}