MCPcopy Create free account
hub / github.com/docknetwork/crypto / new

Method new

bulletproofs_plus_plus/src/weighted_norm_linear_argument.rs:26–188  ·  view source on GitHub ↗

Create new argument

(
        mut l: Vec<G::ScalarField>,
        mut n: Vec<G::ScalarField>,
        mut c: Vec<G::ScalarField>,
        mut rho: G::ScalarField,
        setup_params: SetupParams<G>,
        transcript:

Source from the content-addressed store, hash-verified

24impl<G: AffineRepr> WeightedNormLinearArgument<G> {
25 /// Create new argument
26 pub fn new(
27 mut l: Vec<G::ScalarField>,
28 mut n: Vec<G::ScalarField>,
29 mut c: Vec<G::ScalarField>,
30 mut rho: G::ScalarField,
31 setup_params: SetupParams<G>,
32 transcript: &mut impl Transcript,
33 ) -> Result<Self, BulletproofsPlusPlusError> {
34 let SetupParams {
35 G: g,
36 G_vec: mut g_vec,
37 H_vec: mut h_vec,
38 } = setup_params;
39 if l.len() != c.len() {
40 return Err(BulletproofsPlusPlusError::UnexpectedLengthOfVectors(
41 format!(
42 "length of l={} not equal to length of c={}",
43 l.len(),
44 c.len()
45 ),
46 ));
47 }
48 if c.len() != h_vec.len() {
49 return Err(BulletproofsPlusPlusError::UnexpectedLengthOfVectors(
50 format!(
51 "length of c={} not equal to length of H_vec={}",
52 c.len(),
53 h_vec.len()
54 ),
55 ));
56 }
57 if n.len() != g_vec.len() {
58 return Err(BulletproofsPlusPlusError::UnexpectedLengthOfVectors(
59 format!(
60 "length of n={} not equal to length of G_vec={}",
61 n.len(),
62 g_vec.len()
63 ),
64 ));
65 }
66 if !l.len().is_power_of_two() {
67 return Err(BulletproofsPlusPlusError::UnexpectedLengthOfVectors(
68 format!("length of l={} must be power of 2", l.len()),
69 ));
70 }
71 if !n.len().is_power_of_two() {
72 return Err(BulletproofsPlusPlusError::UnexpectedLengthOfVectors(
73 format!("length of n={} must be power of 2", n.len()),
74 ));
75 }
76
77 let mut mu = rho.square();
78 let mut X = Vec::new();
79 let mut R = Vec::new();
80
81 while l.len() > 1 || n.len() > 1 {
82 let (l_0, l_1) = Self::split_vec(&l);
83 let (n_0, n_1) = Self::split_vec(&n);

Callers

nothing calls this directly

Calls 7

weighted_inner_productFunction · 0.85
weighted_normFunction · 0.85
doubleMethod · 0.80
mapMethod · 0.80
appendMethod · 0.80
inner_productFunction · 0.50
lenMethod · 0.45

Tested by

no test coverage detected