Remove Result return value because we can never fail

This commit is contained in:
Thomas Eizinger 2021-05-11 11:57:36 +10:00
parent a9e60515a1
commit c68fe77211
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96
2 changed files with 8 additions and 9 deletions

View File

@ -20,7 +20,7 @@ pub fn sign(
msg: &[u8],
signing_key: Scalar,
alpha: Scalar,
) -> anyhow::Result<Signature> {
) -> Signature {
let D = z * H_p_pk;
let D_inv_8 = D * Scalar::from(8u8).invert();
@ -61,12 +61,11 @@ pub fn sign(
I,
&mus,
)
.unwrap()
});
let s_last = alpha - h_last * ((mus.mu_P * signing_key) + (mus.mu_C * z));
Ok(Signature {
Signature {
responses: [
fake_responses[0],
fake_responses[1],
@ -83,7 +82,7 @@ pub fn sign(
h_0,
I,
D,
})
}
}
pub struct Signature {
@ -135,7 +134,7 @@ fn challenge(
h_prev: Scalar,
I: EdwardsPoint,
mus: &AggregationHashes,
) -> anyhow::Result<Scalar> {
) -> Scalar {
let L_i = compute_L(h_prev, mus, s_i, pk_i, adjusted_commitment_i);
let R_i = compute_R(h_prev, mus, pk_i, s_i, I, D);
@ -147,7 +146,7 @@ fn challenge(
let mut output = [0u8; 32];
hasher.finalize(&mut output);
Ok(Scalar::from_bytes_mod_order(output))
Scalar::from_bytes_mod_order(output)
}
// L_i = s_i * G + c_p * pk_i + c_c * (commitment_i - pseudoutcommitment)
@ -270,7 +269,7 @@ impl Signature {
h,
self.I,
todo!(),
)?;
);
}
Ok(h == self.h_0)

View File

@ -178,7 +178,7 @@ impl Alice0 {
&self.msg,
self.s_prime_a,
self.alpha_a,
)?;
);
let sig = HalfAdaptorSignature {
s_0_half: sig.responses[10],
@ -354,7 +354,7 @@ impl Bob1 {
&self.msg,
self.s_b,
self.alpha_b,
)?;
);
let s_0_b = sig.responses[10];
let sig = HalfAdaptorSignature {