1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
use super::Point;
use crate::constraint_system::StandardComposer;
use crate::constraint_system::Variable;
use dusk_bls12_381::Scalar;
#[derive(Debug, Clone, Copy)]
pub(crate) struct WnafRound {
pub acc_x: Variable,
pub acc_y: Variable,
pub accumulated_bit: Variable,
pub xy_alpha: Variable,
pub x_beta: Scalar,
pub y_beta: Scalar,
pub xy_beta: Scalar,
}
impl StandardComposer {
pub(crate) fn new_fixed_group_add(&mut self, wnaf_round: WnafRound) {
self.w_l.push(wnaf_round.acc_x);
self.w_r.push(wnaf_round.acc_y);
self.w_o.push(wnaf_round.xy_alpha);
self.w_4.push(wnaf_round.accumulated_bit);
self.q_l.push(wnaf_round.x_beta);
self.q_r.push(wnaf_round.y_beta);
self.q_c.push(wnaf_round.xy_beta);
self.q_o.push(Scalar::zero());
self.q_ecc.push(Scalar::one());
self.q_m.push(Scalar::zero());
self.q_4.push(Scalar::zero());
self.q_arith.push(Scalar::zero());
self.q_range.push(Scalar::zero());
self.q_logic.push(Scalar::zero());
self.public_inputs.push(Scalar::zero());
self.perm.add_variables_to_map(
wnaf_round.acc_x,
wnaf_round.acc_y,
wnaf_round.xy_alpha,
wnaf_round.accumulated_bit,
self.n,
);
self.n += 1;
}
pub fn assert_equal_public_point(
&mut self,
point: Point,
public_point: dusk_jubjub::AffinePoint,
) {
self.constrain_to_constant(point.x, Scalar::zero(), -public_point.get_x());
self.constrain_to_constant(point.y, Scalar::zero(), -public_point.get_y());
}
pub fn assert_equal_point(&mut self, point_a: Point, point_b: Point) {
self.assert_equal(point_a.x, point_b.x);
self.assert_equal(point_a.y, point_b.y);
}
}