From e378cdd8fa340469b8c9b046ea6d6f0dd4e04414 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 18 Dec 2024 09:36:54 +1100 Subject: [PATCH] kani: Don't bother checking signed to unsigned conversion Now that we use MAX_MONEY a signed amount always fits in an unsigned amount. --- units/src/amount/verification.rs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/units/src/amount/verification.rs b/units/src/amount/verification.rs index 76f26ec0d..ae970e186 100644 --- a/units/src/amount/verification.rs +++ b/units/src/amount/verification.rs @@ -42,15 +42,6 @@ fn u_amount_homomorphic() { let mut amt = Amount::from_sat(max); amt -= Amount::from_sat(min); assert_eq!(amt, Amount::from_sat(max - min)); - - assert_eq!( - Amount::from_sat(n1).to_signed(), - if n1 <= i64::MAX as u64 { - Ok(SignedAmount::from_sat(n1.try_into().unwrap())) - } else { - Err(OutOfRangeError::too_big(true)) - }, - ); } #[kani::unwind(4)] @@ -81,13 +72,4 @@ fn s_amount_homomorphic() { let mut amt = SignedAmount::from_sat(n1); amt -= SignedAmount::from_sat(n2); assert_eq!(amt, SignedAmount::from_sat(n1 - n2)); - - assert_eq!( - SignedAmount::from_sat(n1).to_unsigned(), - if n1 >= 0 { - Ok(Amount::from_sat(n1.try_into().unwrap())) - } else { - Err(OutOfRangeError { is_signed: false, is_greater_than_max: false }) - }, - ); }