From c68fe772119f4a5525b550319048c8d2a863a599 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 11 May 2021 11:57:36 +1000 Subject: [PATCH] Remove Result return value because we can never fail --- monero-adaptor/src/clsag.rs | 13 ++++++------- monero-adaptor/src/lib.rs | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/monero-adaptor/src/clsag.rs b/monero-adaptor/src/clsag.rs index 3282f2ec..f7c8c51b 100644 --- a/monero-adaptor/src/clsag.rs +++ b/monero-adaptor/src/clsag.rs @@ -20,7 +20,7 @@ pub fn sign( msg: &[u8], signing_key: Scalar, alpha: Scalar, -) -> anyhow::Result { +) -> 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 { 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) diff --git a/monero-adaptor/src/lib.rs b/monero-adaptor/src/lib.rs index 7273952a..641f6abf 100644 --- a/monero-adaptor/src/lib.rs +++ b/monero-adaptor/src/lib.rs @@ -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 {