From 76db682a2520c3ae4d2efa6792ff8257067a365f Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Sun, 21 Aug 2022 00:46:23 -0400 Subject: [PATCH] Replace static Scalar with a uint conversion in BP+ --- coins/monero/src/ringct/bulletproofs/plus.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/coins/monero/src/ringct/bulletproofs/plus.rs b/coins/monero/src/ringct/bulletproofs/plus.rs index 4082e169..7c5b8b33 100644 --- a/coins/monero/src/ringct/bulletproofs/plus.rs +++ b/coins/monero/src/ringct/bulletproofs/plus.rs @@ -19,13 +19,6 @@ lazy_static! { static ref GENERATORS: Generators = generators_core(b"bulletproof_plus"); static ref TRANSCRIPT: [u8; 32] = EdwardsPoint(raw_hash_to_point(hash(b"bulletproof_plus_transcript"))).compress().to_bytes(); - static ref TWO_SIXTY_FOUR_MINUS_ONE: Scalar = { - let mut temp = Scalar::from(2u8); - for _ in 0 .. LOG_N { - temp *= temp; - } - temp - Scalar::one() - }; } // TRANSCRIPT isn't a Scalar, so we need this alternative for the first hash @@ -253,7 +246,7 @@ impl PlusStruct { proof.push((minus_esq, A)); proof.push((Scalar(self.d1), G)); - let d_sum = zpow.sum() * *TWO_SIXTY_FOUR_MINUS_ONE; + let d_sum = zpow.sum() * Scalar::from(u64::MAX); let y_sum = weighted_powers(y, MN).sum(); proof.push(( Scalar(self.r1 * y.0 * self.s1) + (esq * ((yMNy * z * d_sum) + ((zsq - z) * y_sum))),