Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Commit 2206810

Browse files
Simplify I/O types. Remove unused/proxy chips and gate. (#74)
* Remove wrapper chips * remove unused chip * remove unused gate * simplify point add io * simplify point mult io * simplify to affine io * simplify to projective io
1 parent 76ccc97 commit 2206810

16 files changed

+118
-962
lines changed

crates/shielder-circuits/src/chips/el_gamal.rs

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,8 @@ use macros::embeddable;
33

44
use super::{points_add::PointsAddChip, scalar_multiply::ScalarMultiplyChip, sum::SumChip};
55
use crate::{
6-
chips::{
7-
points_add::{PointsAddChipInput, PointsAddChipOutput},
8-
scalar_multiply::{ScalarMultiplyChipInput, ScalarMultiplyChipOutput},
9-
},
10-
consts::FIELD_BITS,
11-
curve_arithmetic::GrumpkinPoint,
12-
embed::Embed,
13-
synthesizer::Synthesizer,
14-
AssignedCell,
6+
chips::scalar_multiply::ScalarMultiplyChipInput, consts::FIELD_BITS,
7+
curve_arithmetic::GrumpkinPoint, embed::Embed, synthesizer::Synthesizer, AssignedCell,
158
};
169

1710
#[derive(Clone, Debug)]
@@ -97,33 +90,25 @@ impl ElGamalEncryptionChip {
9790

9891
self.constrain_generator(synthesizer, generator.clone())?;
9992

100-
let ScalarMultiplyChipOutput {
101-
result: shared_secret,
102-
} = self.multiply_chip.scalar_multiply(
93+
let shared_secret = self.multiply_chip.scalar_multiply(
10394
synthesizer,
10495
&ScalarMultiplyChipInput {
10596
input: public_key.clone(),
10697
scalar_bits: salt_le_bits.clone(),
10798
},
10899
)?;
109100

110-
let ScalarMultiplyChipOutput {
111-
result: ciphertext1,
112-
} = self.multiply_chip.scalar_multiply(
101+
let ciphertext1 = self.multiply_chip.scalar_multiply(
113102
synthesizer,
114103
&ScalarMultiplyChipInput {
115104
input: generator,
116105
scalar_bits: salt_le_bits.clone(),
117106
},
118107
)?;
119108

120-
let PointsAddChipOutput { s: ciphertext2 } = self.add_chip.points_add(
121-
synthesizer,
122-
&PointsAddChipInput {
123-
p: message.clone(),
124-
q: shared_secret,
125-
},
126-
)?;
109+
let ciphertext2 = self
110+
.add_chip
111+
.points_add(synthesizer, message, &shared_secret)?;
127112

128113
Ok(ElGamalEncryptionChipOutput {
129114
ciphertext1,

crates/shielder-circuits/src/chips/is_point_on_curve.rs

Lines changed: 0 additions & 130 deletions
This file was deleted.

crates/shielder-circuits/src/chips/is_point_on_curve_affine.rs

Lines changed: 0 additions & 134 deletions
This file was deleted.

crates/shielder-circuits/src/chips/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
pub mod el_gamal;
22
pub mod id_hiding;
3-
pub mod is_point_on_curve;
4-
pub mod is_point_on_curve_affine;
53
pub mod mac;
64
pub mod note;
7-
pub mod point_double;
85
pub mod points_add;
96
pub mod range_check;
107
pub mod scalar_multiply;

0 commit comments

Comments
 (0)