Skip to content

Commit 4c2f8ed

Browse files
committed
Remove redundant type
Signed-off-by: lovesh <[email protected]>
1 parent 7a47e21 commit 4c2f8ed

File tree

3 files changed

+20
-23
lines changed

3 files changed

+20
-23
lines changed

delg_cred_cdd/src/attribute_token.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,14 +2287,14 @@ mod tests {
22872287
println!("Commitment takes {:?}, response takes {:?}, commitment reconstitution takes {:?}. Total time taken by commitment and response is {:?}",
22882288
com_duration, resp_duration, recon_duration, com_duration + resp_duration);
22892289
println!(
2290-
"Commitment with precomputation on setup paprams takes {:?}",
2290+
"Commitment with precomputation on setup params takes {:?}",
22912291
com_precomp_setup_duration
22922292
);
22932293
println!(
2294-
"Commitment with precomputation on setup paprams and signature takes {:?}",
2294+
"Commitment with precomputation on setup params and signature takes {:?}",
22952295
com_precomp_duration
22962296
);
2297-
println!("Commitment reconstitution with precomputation on setup paprams and root issuer key takes {:?}", recon_precomp_duration);
2297+
println!("Commitment reconstitution with precomputation on setup params and root issuer key takes {:?}", recon_precomp_duration);
22982298
}
22992299
}
23002300

delg_cred_cdd/src/groth_sig.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ use amcl_wrapper::group_elem::{GroupElement, GroupElementVector};
55
use amcl_wrapper::group_elem_g1::{G1LookupTable, G1Vector, G1};
66
use amcl_wrapper::group_elem_g2::{G2Vector, G2};
77

8+
#[derive(Clone, Debug, Serialize, Deserialize)]
9+
pub struct GrothSigkey(pub FieldElement);
10+
811
macro_rules! impl_GrothS {
9-
( $GrothSetupParams:ident, $GrothSigkey:ident, $GrothVerkey:ident, $GrothSig:ident, $GrothS:ident, $vk_group:ident, $msg_group:ident, $GVector:ident ) => {
12+
( $GrothSetupParams:ident, $GrothVerkey:ident, $GrothSig:ident, $GrothS:ident, $vk_group:ident, $msg_group:ident, $GVector:ident ) => {
1013
#[derive(Clone, Debug, Serialize, Deserialize)]
1114
pub struct $GrothSetupParams {
1215
pub g1: G1,
1316
pub g2: G2,
1417
pub y: $GVector,
1518
}
1619

17-
#[derive(Clone, Debug, Serialize, Deserialize)]
18-
pub struct $GrothSigkey(pub FieldElement);
19-
2020
#[derive(Clone, Debug, Serialize, Deserialize)]
2121
pub struct $GrothVerkey(pub $vk_group);
2222

@@ -88,7 +88,6 @@ macro_rules! impl_GrothSig_randomize {
8888

8989
impl_GrothS!(
9090
Groth1SetupParams,
91-
Groth1Sigkey,
9291
Groth1Verkey,
9392
Groth1Sig,
9493
GrothS1,
@@ -99,7 +98,6 @@ impl_GrothS!(
9998

10099
impl_GrothS!(
101100
Groth2SetupParams,
102-
Groth2Sigkey,
103101
Groth2Verkey,
104102
Groth2Sig,
105103
GrothS2,
@@ -124,17 +122,17 @@ macro_rules! var_time_mul_scl_mul_with_same_field_element {
124122
impl GrothS1 {
125123
impl_GrothS_setup!(Groth1SetupParams, G1, G1Vector);
126124

127-
pub fn keygen(setup_params: &Groth1SetupParams) -> (Groth1Sigkey, Groth1Verkey) {
125+
pub fn keygen(setup_params: &Groth1SetupParams) -> (GrothSigkey, Groth1Verkey) {
128126
let sk = FieldElement::random();
129127
let vk = &setup_params.g2 * &sk;
130-
(Groth1Sigkey(sk), Groth1Verkey(vk))
128+
(GrothSigkey(sk), Groth1Verkey(vk))
131129
}
132130
}
133131

134132
impl Groth1Sig {
135133
pub fn new(
136134
messages: &[G1],
137-
sk: &Groth1Sigkey,
135+
sk: &GrothSigkey,
138136
setup_params: &Groth1SetupParams,
139137
) -> DelgResult<Self> {
140138
impl_GrothSig_new!(
@@ -252,17 +250,17 @@ impl Groth1Sig {
252250
impl GrothS2 {
253251
impl_GrothS_setup!(Groth2SetupParams, G2, G2Vector);
254252

255-
pub fn keygen(setup_params: &Groth2SetupParams) -> (Groth2Sigkey, Groth2Verkey) {
253+
pub fn keygen(setup_params: &Groth2SetupParams) -> (GrothSigkey, Groth2Verkey) {
256254
let sk = FieldElement::random();
257255
let vk = &setup_params.g1 * &sk;
258-
(Groth2Sigkey(sk), Groth2Verkey(vk))
256+
(GrothSigkey(sk), Groth2Verkey(vk))
259257
}
260258
}
261259

262260
impl Groth2Sig {
263261
pub fn new(
264262
messages: &[G2],
265-
sk: &Groth2Sigkey,
263+
sk: &GrothSigkey,
266264
setup_params: &Groth2SetupParams,
267265
) -> DelgResult<Self> {
268266
impl_GrothSig_new!(

delg_cred_cdd/src/issuer.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
use crate::errors::{DelgError, DelgResult};
22
use crate::groth_sig::{
3-
Groth1SetupParams, Groth1Sig, Groth1Sigkey, Groth1Verkey, Groth2SetupParams, Groth2Sig,
4-
Groth2Sigkey, Groth2Verkey, GrothS1, GrothS2,
3+
Groth1SetupParams, Groth1Sig, Groth1Verkey, Groth2SetupParams, Groth2Sig, Groth2Verkey,
4+
GrothS1, GrothS2, GrothSigkey,
55
};
66
use amcl_wrapper::group_elem::{GroupElement, GroupElementVector};
77
use amcl_wrapper::group_elem_g1::{G1LookupTable, G1Vector, G1};
88
use amcl_wrapper::group_elem_g2::{G2Vector, G2};
99

10-
pub type EvenLevelSigkey = Groth1Sigkey;
10+
pub type Sigkey = GrothSigkey;
1111
pub type EvenLevelVerkey = Groth1Verkey;
12-
pub type OddLevelSigkey = Groth2Sigkey;
1312
pub type OddLevelVerkey = Groth2Verkey;
1413

1514
// (attributes, signature). The signature is over the attributes and the public key combined by appending public key to the attribute vector.
@@ -314,15 +313,15 @@ impl EvenLevelIssuer {
314313
Ok(Self { level })
315314
}
316315

317-
pub fn keygen(setup_params: &Groth1SetupParams) -> (EvenLevelSigkey, EvenLevelVerkey) {
316+
pub fn keygen(setup_params: &Groth1SetupParams) -> (Sigkey, EvenLevelVerkey) {
318317
GrothS1::keygen(setup_params)
319318
}
320319

321320
pub fn delegate(
322321
&self,
323322
mut delegatee_attributes: G1Vector,
324323
delegatee_vk: OddLevelVerkey,
325-
sk: &EvenLevelSigkey,
324+
sk: &Sigkey,
326325
setup_params: &Groth1SetupParams,
327326
) -> DelgResult<CredLinkOdd> {
328327
if delegatee_attributes.len() >= setup_params.y.len() {
@@ -349,15 +348,15 @@ impl OddLevelIssuer {
349348
Ok(Self { level })
350349
}
351350

352-
pub fn keygen(setup_params: &Groth2SetupParams) -> (OddLevelSigkey, OddLevelVerkey) {
351+
pub fn keygen(setup_params: &Groth2SetupParams) -> (Sigkey, OddLevelVerkey) {
353352
GrothS2::keygen(setup_params)
354353
}
355354

356355
pub fn delegate(
357356
&self,
358357
mut delegatee_attributes: G2Vector,
359358
delegatee_vk: EvenLevelVerkey,
360-
sk: &OddLevelSigkey,
359+
sk: &Sigkey,
361360
setup_params: &Groth2SetupParams,
362361
) -> DelgResult<CredLinkEven> {
363362
if delegatee_attributes.len() >= setup_params.y.len() {

0 commit comments

Comments
 (0)